![]() |
Previous Top Next |
Validating and entering data
|
1. | Select the menu option XML | Check well-formedness or hit the F7 key.
|
A message appears at the bottom of the main window declaring that the document is well formed. Click OK to confirm and close the message.
|
![]() |
Being well-formed, means that the XML document syntax is correct (i.e. there is a root element, each start tag has a corresponding end tag, all elements are nested correctly etc.).
|
This check does not check against a schema file (or any other external file). Element sequence or element content are not checked either.
|
1. | Select the menu option XML | Validate or hit the F8 key.
|
An error message appears: "This file is not valid: Mandatory elements expected after 'City' (Zip, State).
|
The error message describes in detail what is currently wrong with our XML document.
|
![]() |
![]() |
1. | Double click the !Zip element in the Element entry helper.
|
This inserts the Zip element under the City element (Append tab is active by default).
|
2. | Hit the Tab key, enter the Zip Code of the State (04812), and confirm with Enter.
|
The Element entry helper now contains the !State entry, which is also a mandatory element and must also appear with the Zip element.
|
![]() |
3. | Double click the !State element, hit the Tab key and enter the name of the state (e.g. Texas), confirm with Enter.
|
The Element entry helper now contains only grayed-out elements. This shows that all the required Address sub-elements have been inserted.
|
![]() |
1. | Click the empty element content field (right of element name) of the element First, enter the persons first name (e.g. Fred), and hit the Enter key.
|
![]() |
2. | Hit the Down arrow key, and fill in the next field, Last (e.g. Smith)
|
3. | Use the same method to enter PhoneExt (e.g. 22) and the persons e-mail address (e.g. smith@work.com). You XML document should look like this:
|
![]() |
4. | Click the Revalidate button to check if the document is valid.
|
The "This file is valid" message appears. The XML document is now valid against its schema. Click OK to confirm and close the message.
|
![]() |
Being valid, means that the XML document adheres to the assigned schema i.e. the elements and the sequence they appear in is correct, as well as the element "contents" and their attributes.
|
5. | Select the menu option File | Save As... and name the XML document (e.g. CompanyFirst.xml)
|
This XML document is available as 'CompanyFirst.xml' in the Tutorial folder.
|
Please note:
|
An XML document does not have to be valid in order to save it. Saving an invalid document causes a prompt to appear which then allows you to select "Save anyway", the document is then saved in its current state.
|
|