XSD: XML Schema Definition
or
How to check that my mission file is valid
Introduction:
One of the nice things about XML, is that it has an option to test it validity in few levels.
The first an basic one, is the well formed structure of the content, meaning that every element should have a closing tag and in the correct hierarchy.
The second is to define an XML Schema Definition, that allow us to test any XML file against it.
Although this feature is a nice to have, it is not mandatory and it has its limitations.
The main limitations I found, which are direct descendent of how I constructed the mission file for mission-x, can be seen as the author fault, but they are few and mainly summed to:
For Mission-X v2.01 I have constructed a simple XSD file that might help a mission designer to test its mission file validity. I must also state that this is 95% accurate while you always need to consult the designer guide if you find conflicts. The worst case scenario is that you will have to send me an e-mail for help or cross check the issue.
Another limitation, so far, is that I tested the XSD only on windows using XML-Pad free application. When I tested it on linux (using xmllint) it seems that it did not like my XSD implementation, probably a setup issue in the file, but if you know how to fix it, please let me know.
Obtaining and using the Mission XSD file:
Here are the steps to get the xsd file and how to use it ( you can also download this document at the end of this page) :
step 1: Grab XML-Pad application.
Step 2: Download mission.xsd file - find it at the bottom of this page (visit this site frequently to check if there are new updates to it).
Step 3: [optional] Run XML-Pad and load mission.xsd.
Step 4: Load your mission file into XML-Pad.
Step 5: Using the "XML" menu, pick the "Assign Schema/DTD" sub-menu.
Pick the "W3C Schema" in the opened window and browse to where you saved "mission.xsd" file.
Press [OK]
This will add to your "root" element the attributes: “xsi:noNamespaceSchemaLocation” and “xmlns:xsi”.
"
Step 6: Press "F7" to validate your XML file against the XSD.
You will see the results at the lower window.
Remember:
You can ignore element "structure" warnings. You do not need to have the exact same order of elements/sub elements, as in the XSD file, the plugin ignore this, and so should you.
Resources:
One of the nice things about XML, is that it has an option to test it validity in few levels.
The first an basic one, is the well formed structure of the content, meaning that every element should have a closing tag and in the correct hierarchy.
The second is to define an XML Schema Definition, that allow us to test any XML file against it.
Although this feature is a nice to have, it is not mandatory and it has its limitations.
The main limitations I found, which are direct descendent of how I constructed the mission file for mission-x, can be seen as the author fault, but they are few and mainly summed to:
- Invalid structure definition of an element (in most case this is XSD limitation).
- Choice between attributes is not allowed, so I had to mark them as optional (mainly in "if" logical element).
For Mission-X v2.01 I have constructed a simple XSD file that might help a mission designer to test its mission file validity. I must also state that this is 95% accurate while you always need to consult the designer guide if you find conflicts. The worst case scenario is that you will have to send me an e-mail for help or cross check the issue.
Another limitation, so far, is that I tested the XSD only on windows using XML-Pad free application. When I tested it on linux (using xmllint) it seems that it did not like my XSD implementation, probably a setup issue in the file, but if you know how to fix it, please let me know.
Obtaining and using the Mission XSD file:
Here are the steps to get the xsd file and how to use it ( you can also download this document at the end of this page) :
step 1: Grab XML-Pad application.
Step 2: Download mission.xsd file - find it at the bottom of this page (visit this site frequently to check if there are new updates to it).
Step 3: [optional] Run XML-Pad and load mission.xsd.
Step 4: Load your mission file into XML-Pad.
Step 5: Using the "XML" menu, pick the "Assign Schema/DTD" sub-menu.
Pick the "W3C Schema" in the opened window and browse to where you saved "mission.xsd" file.
Press [OK]
This will add to your "root" element the attributes: “xsi:noNamespaceSchemaLocation” and “xmlns:xsi”.
"
Step 6: Press "F7" to validate your XML file against the XSD.
You will see the results at the lower window.
Remember:
You can ignore element "structure" warnings. You do not need to have the exact same order of elements/sub elements, as in the XSD file, the plugin ignore this, and so should you.
Resources:
how to use xml schema file.pdf | |
File Size: | 611 kb |
File Type: |
mission.xsd | |
File Size: | 32 kb |
File Type: | xsd |
Please re-visit this page in order to check for latest XSD or document file.