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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Asfand Yar Qazi

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

    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[color=blue]
    >[/color]

    <!-- 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|Mu p)[color=blue]
    >[/color]

    <!ATTLIST Drawable
    name CDATA #REQUIRED[color=blue]
    >[/color]

    <!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_ClassicTra ckT43A.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_ClassicTra ckT43A.png</Image>
    </Drawable>
    <Drawable name="t43a"/>
    <Drawable name="mup1"/>
    </Mup>
    </Drawable>

    </root>


    Wha??

    Thanks,
    Asfand Yar



    --




  • Patrick TJ McPhee

    #2
    Re: What am I doing wrong? (&quot;Debug&qu ot; XML code help please.)

    In article <bkhr6s$1l1$1@n ewsg4.svr.pol.c o.uk>,
    Asfand Yar Qazi <im_not_giving_ it_here@i_hate_ spam.com> wrote:

    % <!-- 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|Mu p)
    % >


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

    <!ELEMENT Drawable (Image|Mup)?[color=blue]
    >[/color]

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

    Patrick TJ McPhee
    East York Canada
    ptjm@interlog.c om

    Comment

    • Asfand Yar Qazi

      #3
      Re: What am I doing wrong? (&quot;Debug&qu ot; XML code help please.)

      Patrick TJ McPhee wrote:[color=blue]
      > In article <bkhr6s$1l1$1@n ewsg4.svr.pol.c o.uk>,
      > Asfand Yar Qazi <im_not_giving_ it_here@i_hate_ spam.com> wrote:
      >
      > % <!-- 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|Mu p)
      > % >
      >
      >
      > This says that Drawable takes one of three elements as content:
      > EMPTY, Image, or Mup. What you want is
      >
      > <!ELEMENT Drawable (Image|Mup)?[color=green]
      > >[/color]
      >
      > This says that the content is zero or one of either Image or Mup.[/color]

      (Sorry for the late reply...)

      Ohh... now I see...

      Thanks.

      --




      Comment

      Working...