What am I doing wrong? ("Debug" XML code help please.)

A

Asfand Yar Qazi

Hi,

xmllint --valid gives error output on some code (included below:)

file "Shotgun_Robot.dtd" (don't ask)

<!ELEMENT Image (#PCDATA) > <!-- #PCDATA == image path -->

<!-- x/y values default to 0, w/h values default to image w/h-->
<!ATTLIST Image
srcrect_x CDATA #IMPLIED
srcrect_y CDATA #IMPLIED
srcrect_w CDATA #IMPLIED
srcrect_h CDATA #IMPLIED
<!-- If element content is empty, the Drawable name points to an
already created Drawable. If it is not empty, it defines a
Drawable of the name and type given. -->
<!ELEMENT Drawable (EMPTY|Image|Mup)
<!ATTLIST Drawable
name CDATA #REQUIRED
<!ELEMENT Mup (Drawable)* >


file "image_test.xml"

<?xml version="1.0"?>

<!DOCTYPE root SYSTEM "Shotgun_Robot.dtd" [
<!ELEMENT root ANY>
]>

<root>

<Drawable name="mup1">
<Mup>
<Drawable name="t43a">
<Image>images/sprites/tank_ClassicTrackT43A.png</Image>
</Drawable>
<Drawable name="t43a" />
<Drawable name="mup1" />
</Mup>
</Drawable>

</root>


error output:

image_test.xml:14: validity error: Element Drawable content does not
follow the DTD
Expecting (EMPTY | Image | Mup), got
<Drawable name="t43a" />
^
image_test.xml:15: validity error: Element Drawable content does not
follow the DTD
Expecting (EMPTY | Image | Mup), got
<Drawable name="mup1" />
^
<?xml version="1.0"?>
<!DOCTYPE root SYSTEM "Shotgun_Robot.dtd" [
<!ELEMENT root ANY>
]>
<root>

<Drawable name="mup1">
<Mup>
<Drawable name="t43a">
<Image>images/sprites/tank_ClassicTrackT43A.png</Image>
</Drawable>
<Drawable name="t43a"/>
<Drawable name="mup1"/>
</Mup>
</Drawable>

</root>


Wha??

Thanks,
Asfand Yar
 
P

Patrick TJ McPhee

% <!-- If element content is empty, the Drawable name points to an
% already created Drawable. If it is not empty, it defines a
% Drawable of the name and type given. -->
% <!ELEMENT Drawable (EMPTY|Image|Mup)
% >


This says that Drawable takes one of three elements as content:
EMPTY, Image, or Mup. What you want is

<!ELEMENT Drawable (Image|Mup)?
This says that the content is zero or one of either Image or Mup.
 
A

Asfand Yar Qazi

Patrick said:
% <!-- If element content is empty, the Drawable name points to an
% already created Drawable. If it is not empty, it defines a
% Drawable of the name and type given. -->
% <!ELEMENT Drawable (EMPTY|Image|Mup)
% >


This says that Drawable takes one of three elements as content:
EMPTY, Image, or Mup. What you want is

<!ELEMENT Drawable (Image|Mup)?

This says that the content is zero or one of either Image or Mup.

(Sorry for the late reply...)

Ohh... now I see...

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top