TS 71 XML

XML, DTD and XSD Tools Test Specification for NetBeans 7.1

Contact: Michal Strnad
Version: 1.0
Last update: Jan 6, 2012
Introduction:
Comments: Requires "XML and Schema" plugin installed

Contents


Agregace techto specifikaci:
http://wiki.netbeans.org/TS_70_XML
http://netbeans.org/projects/qa/sources/web-content/show/trunk/modules/editor/promo-g/xsd?rev=53
http://netbeans.org/projects/qa/sources/web-content/show/trunk/modules/editor/promo-g/xml?rev=53
http://netbeans.org/projects/qa/sources/web-content/show/trunk/modules/editor/promo-g/dtd?rev=53

XML

Test suite: Syntax highlighting

Purpose: This test suite checks that syntax highlighting in XML editor is correct.
Setup: No preparation is necessary for this test suite.

  1. New XML document
    1. Use File | New Project... to create new Web Application project located in your home directory.
    2. Use File | New File..., select XML category and XML Document as file type. Push Next
    3. Type diary into File Name, change Folder field to src\java and press Next.
    4. Let Well-formed Document option selected and press Finish.
    5. Verify that new diary.xml file is opened in editor containing only <root> and </root> elements. The file is created under Source Packages | src.java node.


  1. Syntax highlighting
    1. Copy whole content of diary into clipboard.
    2. Press CTRL+A in the editor and then click Edit | Paste from main
    3. Editor should replace its content with text from clipboard.
    4. Check that proper colors should be used for tags blue, attributes green, values brown, comments grey and plain text black. Invalid data section is highlighted in red color.


Test suite: Validation

Purpose: This test suite checks that it is possible to check structure and contents of XML file.
Setup: No preparation is necessary for this test suite except having a web project open with diary.xml file.

  1. Check structure
    1. Right click editor area and choose Check XML from popup menu.
    2. One error at line 48 must be reported in Output - XML check window.
    3. Click Comment must start with "<!---". [48] link. It should highlight the line 48 in editor and move cursor there.
    4. Delete line 48 and repeat step 1.
    5. XML checking must finish successfully without any error.


  1. Create DTD
    1. Right click editor area and choose Generate DTD... from popup menu.
    2. Push OK in follow-up dialog.
    3. New diary.dtd file should be opened in editor containing definitions for week and day elements.


  1. Validate contents
    1. Switch to diary.xml editor tab, right click editor area and choose Validate XML from popup menu.
    2. One error at line 45 must be reported in Output - XML check window.
    3. Click cvc-elt.1: Cannot find the declaration of element 'week'. [45] link. It should highlight the line 45 in editor and move cursor there.
    4. Type <!DOCTYPE week SYSTEM "diary.dtd"> at line 2 and repeat step 1.
    5. Verigy that mo error shows up in Output - XML check window and XML file validates successfully.


Test suite: Code completion

Purpose: This test suite checks that code completion in XML editor is working correctly.
Setup: No preparation is necessary for this test suite except having a web project open with diary.xml and diary.dtd files.

  1. Tags completion
    1. Switch to diary.dtd editor tab and replace CDATA by (2004|2005) in definition of year attribute at line 25.
    2. Type >!ENTITY boolean "true|false"> at last line and Save the diary.dtd file.
    3. Switch to diary.xml editor tab. Add new line at end of the file and type <.
    4. Press CTRL+Space. Two suggestions day and week show up.
    5. Type w which should leave only week in the list of suggestions.
    6. Press Enter.
    7. Now you should have <week written at last line.


  1. Attributes completion
    1. Press Space and invoke code completion by CTRL+Space again.
    2. Two attributes must show up id and year.
    3. Use Arrow Down to select year and press Enter.
    4. Now you should have <week year="" written at last line.


  1. Values completion
    1. While having cursor between the quotation marks press CTRL+Space to invoke code completion.
    2. Press Enter, then End and type > to complete the tag.
    3. Editor should add value. Now you should have <week year="2004"> and new code completion window with end tag should be shown. Press Enter.
    4. <week year="2004"></week> should be written at last line.


  1. Contex awareness
    1. Delete </week> and press Enter. Type < and press CTRL+Space to invoke code completion.
    2. Only two items should show up day and /week.
    3. Type / character.
    4. Closing tag must be automatically completed so that you have </week> now. Verify that new node showed up in Navigator.


  1. Entities completion
    1. Type & and wait for code completion.
    2. 6 items will be suggested including boolean entity.
    3. Type a which should reduce the list to only amp and apos items. Press Enter.
    4. amp; should be automatically completed so that you have </week>&amp; at last line 10 now.


Test suite: Big files

Purpose: This test suite checks that code completion in XML editor is working correctly.
Setup: No preparation is necessary for this test suite except having a web project open.

  1. Open big file
    1. Download this file and unzip it into your WebApplication/web directory.
    2. Deploy WebApplication/Web Pages in Projects view.
    3. New file mondial.xml should be displayed. Double click it.
    4. Question dialog should warn the user that mondial.xml is a big file. Press Yes to agree with opening the file.
    5. mondial.xml should be opened in editor.


  1. XML structure
    1. Right click into editor view and select Check XML from popup menu.
    2. An error message .../mondial.dtd (The system cannot find the file specified) [2] should be writen in Output window.
    3. Right click editor view again, but this time choose Generate DTD... from popup menu.
    4. Don't change the name of DTD file, just press OK button.
    5. New file mondial.dtd should be generated and open in editor.
    6. Right click into editor view and select Check DTD . DTD checking sould finish without any warnings.
    7. Change the view back to mondial.xml and repeat step 1.
    8. Right click into editor view and select Validate XML from popup menu.
    9. Document should by valid and not any problem should be shown during check and validation.


  1. Navigation
    1. Press Ctrl+7 to show Navigator window.
    2. Expand mondial node and double-click on some country.
    3. The country that you selected in Navigator window and displayed in editor view.


DTD

Test suite: Syntax highlighting

Purpose: This test suite checks that syntax highlighting in DTD editor is correct.
Setup: No preparation is necessary for this test suite.

  1. New DTD document
    1. Use File | New Project... to create new Web Application project located in your home directory.
    2. Use File | New File..., select XML category and DTD Entity as file type. Push Next.
    3. Type diary into File Name, change Folder field to src\java (on Windows platform is \ and on Un*x is / as separator) and press Finish.
    4. Verify that new diary.dtd file is opened in editor containing only definition of root element. The file is created under Source Packages | src.java node.


  1. Syntax highlighting
    1. Copy whole content of diary into clipboard.
    2. Press CTRL + A in the editor and then click Edit | Paste from main.
    3. Editor should replace its content with text from clipboard.
    4. Check that proper colors should be used for keywords bold dark blue, symbols bold black, processing instruction targets dark red, values orange, comments dark green, plain text black and references blue. Invalid data section is highlighted in red color.

Test suite: Validation

Purpose: This test suite checks that it is possible to check structure and contents of XML file.
Setup: No preparation is necessary for this test suite except having a web project open with diary.xml file.

  1. Check DTD
    1. The diary.dtd file contains 4 errors in total.
    2. Right click editor area and choose Check DTD from popup menu.
    3. The first error about unquoted string shows up in the output .
    4. Click the The value following "encoding" in the text declaration must be a quoted string. [1] link which takes the cursor to line 1.
    5. Correct the error and repeat step 2.
    6. Go after each error and fix it according to hints mentioned in the comment below the error line.
    7. The last step is remove line with %days;
    8. Save the changes.

Test suite: Generated

  1. CSS stylesheet
    1. Right click editor area of diary.dtd file and select Generate CSS... action.
    2. Change default filename from diaryStylesheet to diary and press OK button.
    3. New diary.css stylesheet file gets generated and opened in editor.
  1. HTML documentation
    1. Use this file to create new time.dtd file.
    2. Right click editor area of time.dtd file and invoke Generate Documentation... from popup menu.
    3. Change default timeDocumentation file name to time and press OK button.
    4. New time.html page file gets generated and opened in system default browser. It contains element index and details sections with description taken from comments above each element and links for faster navigation. The result should look like this page.


  1. DOM scanner
    1. Right click editor area of time.dtd file and invoke Generate DOM Tree Scanner... from popup menu.
    2. Change default TimeScanner file name to MyTimeScanner and press OK button.
    3. New MyTimeScanner.java class file gets generated and opened in editor.
    4. Invoke Run | Build Main Project from main menu.
    5. Check that it is possible to generate DOM tree scanner class that is immediatelly compilable.


  1. SAX handler
    1. Right click editor area of time.dtd file and invoke SAX Document Handler Wizard... from popup menu.
    2. Check Propagate SAX Events to Generated Handler option and push Next
    3. For month element select Ignore handler type and change handler method to monthMethod. Then push Next twice.
    4. Change handler interface to MyTimeHandler, handler implementation to MyTimeHandlerImpl and generated parser to MyTimeParser. Finally push Finish.
    5. 1 XML and 4 Java class files get generated. MyTimeHandlerImpl.java gets opened in editor.
    6. Verify that TimeSAXBindings.xml file contains <bind element='month' method='month' type='IGNORE' ></bind>.
    7. Open MyTimeParser.java and verify that all methods are not empty and contain at least one method call.
    8. Finally invoke Run | Build Main Project from main menu.
    9. Verify that it is possible to generate DOM tree scanner class that is immediatelly compilable. This is unfortunately not working due to issue #58967.


Test suite: Big files

  1. Open big DTD
    1. Save this document into Web Application/web directory.
    2. Deploy WebApplication/Web Pages in Projects view.
    3. New file xhtml1-strict.dtd should be displayed. Double click it.
    4. Check that Xhtml1-strict.dtd is open in editor.


  1. CSS stylesheet in big file
    1. Right click editor area of xhtml1-strict.dtd file and select Generate CSS... action.
    2. Press OK button.
    3. New xhtml1-strictStylesheet.css stylesheet file gets generated and opened in editor.
    4. Right click xhtml1-strictStylesheet.css in Projects view and select Check CSS from popup menu.
    5. CSS check should finish without any problem and CSS checking finished message should be displayed on status bar.


  1. HTML documentation of DTD
    1. Right click editor area of xhtml1-strict.dtd file and invoke Generate Documentation... from popup menu.
    2. Press OK button.
    3. New xhtml1-strictDocumentation.html page file should be generated and opened in system default browser.


XSD

This part contains procedures for testing XML schema editor. The xml module provides syntax highlighting, bracket matching, code folding, navigator and validation/transformation actions in the editor.


Test suite: Syntax highlighting

Purpose: This test suite checks that syntax highlighting in XSD editor is correct.
Setup: No preparation is necessary for this test suite.

  1. New XSD document
    1. Use File | New Project... to create new Web Application project located in your home directory.
    2. Invoke File | New File... from main menu.
    3. Select XML category and XML Schema (empty) as file type. Push Next.
    4. Type addressbook into File Name, change Folder field to src\java\schema (on Windows platform is \ and on Un*x is / as separator) and press Finish.
    5. New addressbook.xsd file should be opened in editor containing default definition and commented out example. The file is created under Source Packages | schema node.


  1. Syntax highlighting
    1. Copy whole content of this document into clipboard.
    2. Press CTRL + A in the editor and then click Edit | Paste from main menu.
    3. Editor should replace its content with text from clipboard. Proper colors should be used for XSD elements blue, attributes green, values orange, comments green and metadata dark blue.


Test suite: Validation

Purpose: This test suite checks that it is possible to check structure and contents of XSD file.
Setup: No preparation is necessary for this test suite except having a web project open with addressbook XSD file.


  1. Check structure
    1. Notes: The addressbook.xsd file contains 3 structure errors in total.
    2. Right click editor area and choose Check XML from popup menu.
    3. Click The value following "encoding" ... [1] link. It highlights the first line in editor and moves cursor there.
    4. Correct the error and repeat step 2.
    5. Go after each error and fix it according to hints mentioned in the comment below the error line.
    6. In the end XML checking finished must show up in the status bar of IDE.


  1. Validate contents
    1. Notes: The addressbook.xsd file contains 4 content errors in total.
    2. Right click editor area and choose Validate XML from popup menu.
    3. Several errors must be reported in Output - XML check window [Bug 206823].
    4. Click Invalid content was found starting with element 'xsd:elephant'... [15] link. It highlights line 15 in editor and moves cursor there.
    5. Correct the error and repeat step 2.
    6. Go after each error and fix it according to hints mentioned in the comment below the error line.
    7. In the end XML validation finished must show up in the status bar of IDE.


  1. XSD constrained XML
    1. Invoke File | New File... from main menu.
    2. Select XML category and XML Document as file type. Push Next.
    3. Type addressbook into File Name, change Folder to src\java\schema (on Windows platform is \ and on Un*x is / as separator) and press Next.
    4. Select XML Schema-Constrained Document option and push Next.
    5. Push Browse and pick up addressbook.xsd. Also check Import during selecting addressbook.xsd
    6. Verify that column Schema is set to the proper path, Root is set to addressbook and Prefix is set to ns1. If everything is alright check Primary
    7. Push Next and than Finish.
    8. Copy the following text and paste it into addressbook element: <friend nickname="michal.strnad" birthday="1987-03-29"> <email>michal.strnad*oracle.com</email> </friend>
    9. Right click Source Packages | schema | addressbook.xml node and invoke Validate XML [Bug 206828].
    10. The value 'michal.strnad*oracle.com' of element 'email' is not valid, error shows up.
    11. Correct the e-mail address by replacing * char by @ char and repeat step 9.
    12. The addressbook.xml file validates successfully and XML validation finished message shows up in Output - XML check window.
  1. Transformation
    1. Save [addressbook.xsl] stylesheet next to addressbook.xsd schema.
    2. Right click Source Packages | schema | addressbook.xsd node and invoke XSL Transformation....
    3. Type addressbook.xsl into XSLT Script and addressbook.html into Output.
    4. Select Open in Browser as Process Output and push OK.
    5. Transformation finished is printed into Output - XSLT Processor window and browser gets opened displaying newly generated [addressbook.html] file.
  1. Code folding
    1. Switch to addressbook.xsd file and invoke View|Code Folds|Collapse All from main menu.
    2. Move mouse over the root fold <xsd:schema> which shows content of this element in popup window.
    3. Click + icons next to line numbers to expand code folds.
    4. Set cursor at the line 6 i.e. <xsd:simpleType> and press CTRL+ +.
    5. Verify that code fold <xsd:simpleType name="EmailType"> is created.
  1. Navigator
    1. Make sure that Navigator view contains tree structure of addressbook.xsd schema displaying two levels by default.
    2. Double click the last node xsd:element name="addressbook".
    3. Double click expands/collapses selected node. In this case xsd:complexType node shows up. Besides particular line gets highlighted in editor and cursor moves there.
  1. Completion of tags
    1. Create a new line right after tag <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">.
    2. Type <xsd: and press Ctrl+Space.
    3. Code completion should offer one possibility. Choose xsd:element [1..1] and press Enter.
    4. Code completion should complete the tag <xsd:element name="">.
  1. Completion of attributes
    1. Move cursor after quotation marks in recently created <xsd:element name="">.
    2. Press Space and Ctrl+Space.
    3. Attributes should be offered. Select minOccurs and press Enter.
    4. Attribute should be completed so you have <xsd:element name="" minOccurs="">.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo