I started off using an XML file and a parser as a convenient way to store my data
I want to use DTD to check the structure of the xml files when they arrive.
Here is my DTD file
< ?xml version="1.0" encoding="UTF-8"?>
< !ELEMENT document (level*)>
< !ELEMENT level (file,filelName?,fileNumber?)>
< !ELEMENT file (#PCDATA)>
< !ELEMENT filelName (#PCDATA)>
< !ELEMENT fileNumber (#PCDATA)>
(note that fileName and fileNumber are actually purely optional)
and
<document>
<level>
<file>group1file01</file>
</level>
<level>
<file>group1file02</file>
<fileName>file 2</fileName>
<fileNumber>0</fileNumber>
</level>
...
as such all this works fine. (I use eclipse "validate" option to test it for now)
however while testing I got what I think is a wierd error
if I do
<level>
<levelName>Level 2</levelName>
<levelNumber>0</levelNumber>
<file>group1level02</file>
</level>
changing the order of the lines, Eclipse refuses to validate it ...
I was wondering if this was a problem with Eclipse or if the order is actually important.
If the order is important how can I change the DTD to make it work no matter the ordering of he elements?
I can't really change the XML because I already have all the XML files and the parser written (I know I did it the wrong way round lol).