ex1


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
  <!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"GREETING"},
 {{rule,"GREETING"},pcdata}]

Parse tree

{"GREETING",[],{pcdata,"Hello, world!"}}

ex2


<?XML version="1.0" ?>
<!DOCTYPE greeting [
  <!ENTITY % pc "#PCDATA">
  <!ELEMENT greeting (%pc;)>
]>
<greeting>Hello, world!</greeting>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"GREETING"},
 {{pent,"pc"},"#PCDATA"},
 {{rule,"GREETING"},pcdata}]

Parse tree

{"GREETING",[],{pcdata,"Hello, world!"}}

ex3


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (title,text)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT text (#PCDATA)>
]>
<greeting>
<title>Section 1</title>
<text>Hello, world!</text>
</greeting>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"GREETING"},
 {{rule,"GREETING"},{seq,{rule,"TITLE"},{seq,{rule,"TEXT"},nil}}},
 {{rule,"TITLE"},pcdata},
 {{rule,"TEXT"},pcdata}]

Parse tree

{"GREETING",
 [],
 [{"TITLE",[],{pcdata,"Section 1"}},{"TEXT",[],{pcdata,"Hello, world!"}}]}

ex4


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (paras)>
<!ELEMENT paras (p+)>
<!ELEMENT p (#PCDATA)>
]>
<greeting>
<paras>
<p>para1</p>
<p>para2</p>
</paras>
</greeting>

    

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"GREETING"},
 {{rule,"GREETING"},{rule,"PARAS"}},
 {{rule,"PARAS"},{plus,{rule,"P"}}},
 {{rule,"P"},pcdata}]

Parse tree

{"GREETING",
 [],
 {"PARAS",[],[{"P",[],{pcdata,"para1"}},{"P",[],{pcdata,"para2"}}]}}

ex5


<?XML version="1.0"?>
<!DOCTYPE play SYSTEM "play.dtd">

<PLAY>
<TITLE>The Tragedy of Hamlet, Prince of Denmark</TITLE>

<fm>
<p>Text placed in the public domain by Moby Lexical Tools, 1992.</p>
<p>SGML markup by Jon Bosak, 1992-1994.</p>
<p>XML version by Jon Bosak, 1996-1997.</p>
<p>This work may be freely copied and distributed worldwide.</p>
</fm>


<PERSONAE>
<TITLE>Dramatis Personae</TITLE>

<PERSONA>CLAUDIUS, king of Denmark. </PERSONA>
<PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>
<PGROUP>
<PERSONA>GUILDENSTERN</PERSONA>
<PERSONA>OSRIC</PERSONA>
<GRPDESCR>courtiers.</GRPDESCR>
</PGROUP>

</PERSONAE>

<SCNDESCR>SCENE  Denmark.</SCNDESCR>

<PLAYSUBT>HAMLET</PLAYSUBT>

<ACT><TITLE>ACT I</TITLE>

<SCENE><TITLE>SCENE I.  Elsinore. A platform before the castle.</TITLE>
<STAGEDIR>FRANCISCO at his post. Enter to him BERNARDO</STAGEDIR>

<SPEECH>
<SPEAKER>BERNARDO</SPEAKER>
<LINE>Who's there?</LINE>
</SPEECH>

<SPEECH>
<SPEAKER>PRINCE FORTINBRAS</SPEAKER>
<LINE>Let four captains</LINE>
<LINE>Bear Hamlet, like a soldier, to the stage;</LINE>
<LINE>For he was likely, had he been put on,</LINE>
<LINE>To have proved most royally: and, for his passage,</LINE>
<LINE>The soldiers' music and the rites of war</LINE>
<LINE>Speak loudly for him.</LINE>
<LINE>Take up the bodies: such a sight as this</LINE>
<LINE>Becomes the field, but here shows much amiss.</LINE>
<LINE>Go, bid the soldiers shoot.</LINE>
</SPEECH>


<STAGEDIR>A dead march. Exeunt, bearing off the dead
bodies; after which a peal of ordnance is shot off</STAGEDIR>
</SCENE>
</ACT>
</PLAY>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"PLAY"},
 {{gent,"amp"},"&"},
 {{rule,"PLAY"},
  {seq,{rule,"TITLE"},
       {seq,{rule,"FM"},
            {seq,{rule,"PERSONAE"},
                 {seq,{rule,"SCNDESCR"},
                      {seq,{rule,"PLAYSUBT"},
                           {seq,{question,{rule,"INDUCT"}},
                                {seq,{question,{rule,"PROLOGUE"}},
                                     {seq,
                                         {plus,{rule,"ACT"}},
                                         {seq,
                                             {question,{rule,"EPILOGUE"}},
                                             nil}}}}}}}}}},
 {{rule,"TITLE"},pcdata},
 {{rule,"FM"},{plus,{rule,"P"}}},
 {{rule,"P"},pcdata},
 {{rule,"PERSONAE"},
  {seq,{rule,"TITLE"},
       {seq,{plus,{alt,{rule,"PERSONA"},{alt,{rule,"PGROUP"},fail}}},nil}}},
 {{rule,"PGROUP"},{seq,{plus,{rule,"PERSONA"}},{seq,{rule,"GRPDESCR"},nil}}},
 {{rule,"PERSONA"},pcdata},
 {{rule,"GRPDESCR"},pcdata},
 {{rule,"SCNDESCR"},pcdata},
 {{rule,"PLAYSUBT"},pcdata},
 {{rule,"INDUCT"},
  {seq,{rule,"TITLE"},
       {seq,{star,{rule,"SUBTITLE"}},
            {seq,{alt,{plus,{rule,"SCENE"}},
                      {alt,{plus,{alt,{rule,"SPEECH"},
                                      {alt,
                                          {rule,"STAGEDIR"},
                                          {alt,{rule,"SUBHEAD"},fail}}}},
                           fail}},
                 nil}}}},
 {{rule,"ACT"},
  {seq,{rule,"TITLE"},
       {seq,{star,{rule,"SUBTITLE"}},
            {seq,{question,{rule,"PROLOGUE"}},
                 {seq,{plus,{rule,"SCENE"}},
                      {seq,{question,{rule,"EPILOGUE"}},nil}}}}}},
 {{rule,"SCENE"},
  {seq,{rule,"TITLE"},
       {seq,{star,{rule,"SUBTITLE"}},
            {seq,{plus,{alt,{rule,"SPEECH"},
                            {alt,{rule,"STAGEDIR"},
                                 {alt,{rule,"SUBHEAD"},fail}}}},
                 nil}}}},
 {{rule,"PROLOGUE"},
  {seq,{rule,"TITLE"},
       {seq,{star,{rule,"SUBTITLE"}},
            {seq,{plus,{alt,{rule,"STAGEDIR"},{alt,{rule,"SPEECH"},fail}}},
                 nil}}}},
 {{rule,"EPILOGUE"},
  {seq,{rule,"TITLE"},
       {seq,{star,{rule,"SUBTITLE"}},
            {seq,{plus,{alt,{rule,"STAGEDIR"},{alt,{rule,"SPEECH"},fail}}},
                 nil}}}},
 {{rule,"SPEECH"},
  {seq,{plus,{rule,"SPEAKER"}},
       {seq,{plus,{alt,{rule,"LINE"},
                       {alt,{rule,"STAGEDIR"},{alt,{rule,"SUBHEAD"},fail}}}},
            nil}}},
 {{rule,"SPEAKER"},pcdata},
 {{rule,"LINE"},{plus,{alt,{rule,"STAGEDIR"},{alt,pcdata,fail}}}},
 {{rule,"STAGEDIR"},pcdata},
 {{rule,"SUBTITLE"},pcdata},
 {{rule,"SUBHEAD"},pcdata}]

Parse tree

{"PLAY",
 [],
 [{"TITLE",[],{pcdata,"The Tragedy of Hamlet, Prince of Denmark"}},
  {"FM",
   [],
   [{"P",
     [],
     {pcdata,"Text placed in the public domain by Moby Lexical Tools, 1992."}},
    {"P",[],{pcdata,"SGML markup by Jon Bosak, 1992-1994."}},
    {"P",[],{pcdata,"XML version by Jon Bosak, 1996-1997."}},
    {"P",
     [],
     {pcdata,"This work may be freely copied and distributed worldwide."}}]},
  {"PERSONAE",
   [],
   [{"TITLE",[],{pcdata,"Dramatis Personae"}},
    [{"PERSONA",[],{pcdata,"CLAUDIUS, king of Denmark. "}},
     {"PERSONA",
      [],
      {pcdata,"HAMLET, son to the late, and nephew to the present king."}},
     {"PGROUP",
      [],
      [[{"PERSONA",[],{pcdata,"GUILDENSTERN"}},
        {"PERSONA",[],{pcdata,"OSRIC"}}],
       {"GRPDESCR",[],{pcdata,"courtiers."}}]}]]},
  {"SCNDESCR",[],{pcdata,"SCENE  Denmark."}},
  {"PLAYSUBT",[],{pcdata,"HAMLET"}},
  [],
  [],
  [{"ACT",
    [],
    [{"TITLE",[],{pcdata,"ACT I"}},
     [],
     [],
     [{"SCENE",
       [],
       [{"TITLE",
         [],
         {pcdata,"SCENE I.  Elsinore. A platform before the castle."}},
        [],
        [{"STAGEDIR",
          [],
          {pcdata,"FRANCISCO at his post. Enter to him BERNARDO"}},
         {"SPEECH",
          [],
          [[{"SPEAKER",[],{pcdata,"BERNARDO"}}],
           [{"LINE",[],[{pcdata,"Who's there?"}]}]]},
         {"SPEECH",
          [],
          [[{"SPEAKER",[],{pcdata,"PRINCE FORTINBRAS"}}],
           [{"LINE",[],[{pcdata,"Let four captains"}]},
            {"LINE",
             [],
             [{pcdata,"Bear Hamlet, like a soldier, to the stage;"}]},
            {"LINE",[],[{pcdata,"For he was likely, had he been put on,"}]},
            {"LINE",
             [],
             [{pcdata,"To have proved most royally: and, for his passage,"}]},
            {"LINE",[],[{pcdata,"The soldiers' music and the rites of war"}]},
            {"LINE",[],[{pcdata,"Speak loudly for him."}]},
            {"LINE",[],[{pcdata,"Take up the bodies: such a sight as this"}]},
            {"LINE",
             [],
             [{pcdata,"Becomes the field, but here shows much amiss."}]},
            {"LINE",[],[{pcdata,"Go, bid the soldiers shoot."}]}]]},
         {"STAGEDIR",
          [],
          {pcdata,"A dead march. Exeunt, bearing off the dead\nbodies; after which a peal of ordnance is shot off"}}]]}],
     []]}],
  []]}

ex6


<?XML version="1.0"?>
<!DOCTYPE foobar [
 <!ENTITY % abc "aaa">
 <!ENTITY lme "LM Ericsson">
 <!ENTITY % ISOLat2 SYSTEM "ISOlat1.xml" >
 <!ELEMENT foobar (#PCDATA)>
 %ISOLat2;
 ]>
<foobar>
I work at &lme; &cent; hoho
</foobar>

Parse succeeded

Warnings

["line 15 ","old style comment dropped  cent sign "]
["line 14 ","old style comment dropped inverted exclamation mark "]
["line 13 ","old style comment dropped no-break space "]

Dictionary

[{errors,[]},
 {warnings,[["line 15 ","old style comment dropped  cent sign "],
            ["line 14 ",
             "old style comment dropped  inverted exclamation mark "],
            ["line 13 ","old style comment dropped  no-break space "]]},
 {ids,[]},
 {idrefs,[]},
 {top,"FOOBAR"},
 {{pent,"abc"},"aaa"},
 {{gent,"lme"},"LM Ericsson"},
 {{pent,"ISOLat2"},
  "<!-- (C) International Organization for Standardization 1986\n     Permission to copy in any form is granted for use with\n     conforming SGML systems and applications as defined in\n     ISO 8879, provided this notice is included in all copies.\n     This has been extended for use with HTML to cover the full\n     set of codes in the range 160-255 decimal.\n-->\n<!-- Character entity set. Typical invocation:\n     <!ENTITY % ISOlat1 PUBLIC\n       \"ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML\">\n     %ISOlat1;\n-->\n    <!ENTITY nbsp   CDATA \"&#160;\" -- no-break space -->\n    <!ENTITY iexcl  CDATA \"&#161;\" -- inverted exclamation mark -->\n    <!ENTITY cent   CDATA \"&#162;\" -- cent sign -->\n\n<!-- lots of lines omitted -->\n"},
 {{rule,"FOOBAR"},pcdata},
 {{gent,"nbsp"},"&#160;"},
 {{gent,"iexcl"},"&#161;"},
 {{gent,"cent"},"&#162;"}]

Parse tree

{"FOOBAR",[],{pcdata,"\nI work at LM Ericsson \242 hoho\n"}}

ex7


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (termdef,list,form)>
<!ELEMENT termdef (#PCDATA)>
<!ELEMENT list (#PCDATA)>
<!ELEMENT form (#PCDATA)>
<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          pqr     IDREF   #REQUIRED
          method  CDATA   #FIXED "POST">

<!ELEMENT b (#PCDATA)>
]>
<greeting>
<termdef id="foo" name="Hejho">para1</termdef>
<list type="ordered">para2</list>
<form method="POST" pqr="foo">para3</form>
</greeting>

    

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,["foo"]},
 {idrefs,["foo"]},
 {top,"GREETING"},
 {{rule,"GREETING"},
  {seq,{rule,"TERMDEF"},{seq,{rule,"LIST"},{seq,{rule,"FORM"},nil}}}},
 {{rule,"TERMDEF"},pcdata},
 {{rule,"LIST"},pcdata},
 {{rule,"FORM"},pcdata},
 {{attr,"TERMDEF"},[{"id",{id,required}},{"name",{cdata,implied}}]},
 {{attr,"LIST"},
  [{"type",{enum,["bullets","ordered","glossary"],{default,"ordered"}}}]},
 {{attr,"FORM"},[{"pqr",{idref,required}},{"method",{cdata,{fixed,"POST"}}}]},
 {{rule,"B"},pcdata}]

Parse tree

{"GREETING",
 [],
 [{"TERMDEF",[{"id","foo"},{"name","Hejho"}],{pcdata,"para1"}},
  {"LIST",[{"type","ordered"}],{pcdata,"para2"}},
  {"FORM",[{"pqr","foo"},{"method","POST"}],{pcdata,"para3"}}]}

ex8


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (termdef,list,form)>
<!ELEMENT termdef (#PCDATA)>
<!ELEMENT list (#PCDATA)>
<!ELEMENT form (#PCDATA)>
<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
	  p       IDREF   #REQUIRED
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          method  CDATA   #FIXED "POST">

<!ELEMENT b (#PCDATA)>
]>
<greeting>
<termdef id="foo" name="Hejho">para1</termdef>
<list type="ordered" p="foo">para2</list>
<form method="POST">para3</form>
</greeting>

    

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,["foo"]},
 {idrefs,["foo"]},
 {top,"GREETING"},
 {{rule,"GREETING"},
  {seq,{rule,"TERMDEF"},{seq,{rule,"LIST"},{seq,{rule,"FORM"},nil}}}},
 {{rule,"TERMDEF"},pcdata},
 {{rule,"LIST"},pcdata},
 {{rule,"FORM"},pcdata},
 {{attr,"TERMDEF"},[{"id",{id,required}},{"name",{cdata,implied}}]},
 {{attr,"LIST"},
  [{"p",{idref,required}},
   {"type",{enum,["bullets","ordered","glossary"],{default,"ordered"}}}]},
 {{attr,"FORM"},[{"method",{cdata,{fixed,"POST"}}}]},
 {{rule,"B"},pcdata}]

Parse tree

{"GREETING",
 [],
 [{"TERMDEF",[{"id","foo"},{"name","Hejho"}],{pcdata,"para1"}},
  {"LIST",[{"p","foo"},{"type","ordered"}],{pcdata,"para2"}},
  {"FORM",[{"method","POST"}],{pcdata,"para3"}}]}

ex9


<?XML version="1.0" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (IMG|br)+>
<!ELEMENT br EMPTY>
<!ELEMENT IMG EMPTY>
<!ATTLIST IMG
          align  CDATA  #IMPLIED
          src    CDATA  #IMPLIED>

]>
<greeting>
<IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" />
<br/>
<br></br>
</greeting>

    

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"GREETING"},
 {{rule,"GREETING"},{plus,{alt,{rule,"IMG"},{alt,{rule,"BR"},fail}}}},
 {{rule,"BR"},empty},
 {{rule,"IMG"},empty},
 {{attr,"IMG"},[{"align",{cdata,implied}},{"src",{cdata,implied}}]}]

Parse tree

{"GREETING",
 [],
 [{"IMG",[{"align","left"},{"src","http://www.w3.org/Icons/WWW/w3c_home"}],[]},
  {"BR",[],[]},
  {"BR",[],[]}]}

ex10


<?XML version='1.0'?>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA) >
<!ENTITY % xx '&#37;zz;'>
<!ENTITY % zz '&#60;!ENTITY tricky "error-prone" >' >
%xx;
]>
<test>This sample shows a &tricky; method.</test>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"TEST"},
 {{rule,"TEST"},pcdata},
 {{pent,"xx"},"&#37;zz;"},
 {{pent,"zz"},"&#60;!ENTITY tricky \"error-prone\" >"},
 {{gent,"tricky"},"error-prone"}]

Parse tree

{"TEST",[],{pcdata,"This sample shows a error-prone method."}}

ex11


<?XML version="1.0"?>
<!DOCTYPE foobar [
 <!ENTITY lme "LM Ericsson">
 <!ENTITY % include SYSTEM "inc2.xml" >
 <!ELEMENT foobar (#PCDATA)>
 %include;
 ]>
<foobar>
I work at &lme; &nbsp; hoho
</foobar>

Parse succeeded

Warnings

["line 6 ","old style comment dropped  no-break space "]

Dictionary

[{errors,[]},
 {warnings,[["line 6 ","old style comment dropped  no-break space "]]},
 {ids,[]},
 {idrefs,[]},
 {top,"FOOBAR"},
 {{gent,"lme"},"LM Ericsson"},
 {{pent,"include"},
  "<!-- Character entity set. Typical invocation:\n     <!ENTITY % silly PUBLIC\n       \"ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML\">\n     %silly;\n-->\n    <!ENTITY nbsp   CDATA \"&#160;\" -- no-break space -->\n"},
 {{rule,"FOOBAR"},pcdata},
 {{gent,"nbsp"},"&#160;"}]

Parse tree

{"FOOBAR",[],{pcdata,"\nI work at LM Ericsson \240 hoho\n"}}

ex12


<?XML version="1.0"?>
<!DOCTYPE foobar [
 <!ENTITY lme "LM Ericsson">
 <!ENTITY % abc SYSTEM "inc1.xml" >
 <!ELEMENT foobar (#PCDATA)>
 %abc;
 ]>
<foobar>
I work at &lme; &nbsp; hoho
</foobar>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"FOOBAR"},
 {{gent,"lme"},"LM Ericsson"},
 {{pent,"abc"},
  "<!ENTITY nbsp   CDATA \"&#160;\" >\n<!ENTITY iexcl  CDATA \"&#161;\" >\n<!ENTITY cent   CDATA \"&#162;\" >\n"},
 {{rule,"FOOBAR"},pcdata},
 {{gent,"nbsp"},"&#160;"},
 {{gent,"iexcl"},"&#161;"},
 {{gent,"cent"},"&#162;"}]

Parse tree

{"FOOBAR",[],{pcdata,"\nI work at LM Ericsson \240 hoho\n"}}

ex13


<?XML version="1.0"?>
<!DOCTYPE web "SYSTEM" "web.xml">
<web>
<name>web</name>
<vsn major="2" minor="1" />
<summary>A program for submitting a program to the Erlang web</summary>
<author>Joe Armstrong</author>
<email>joe@cslab.ericsson.se</email>
<visibility readers="world" />
<keywords>
<key>publishing</key>
<key>html</key>
<key>www</key>
<key>web</key>
</keywords>
<files>
<file>web.erl</file>
<file>web.html</file>
</files>
<publish>
<entry>
<section>Web utilities</section>
<ref>web.html</ref>
<text>This is a program for adding entries to the 
WWW. Using web provides location transparency etc."
</text>
</entry>
</publish>
</web>

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"WEB"},
 {{rule,"WEB"},
  {seq,{rule,"NAME"},
       {seq,{rule,"VSN"},
            {seq,{rule,"SUMMARY"},
                 {seq,{rule,"AUTHOR"},
                      {seq,{rule,"EMAIL"},
                           {seq,{rule,"VISIBILITY"},
                                {seq,{rule,"KEYWORDS"},
                                     {seq,
                                         {rule,"FILES"},
                                         {seq,{rule,"PUBLISH"},nil}}}}}}}}}},
 {{rule,"NAME"},pcdata},
 {{rule,"VSN"},empty},
 {{attr,"VSN"},[{"major",{cdata,required}},{"minor",{cdata,required}}]},
 {{rule,"SUMMARY"},pcdata},
 {{rule,"AUTHOR"},pcdata},
 {{rule,"EMAIL"},pcdata},
 {{rule,"VISIBILITY"},empty},
 {{attr,"VISIBILITY"},[{"readers",{cdata,required}}]},
 {{rule,"KEYWORDS"},{plus,{rule,"KEY"}}},
 {{rule,"KEY"},pcdata},
 {{rule,"FILES"},{plus,{rule,"FILE"}}},
 {{rule,"FILE"},pcdata},
 {{rule,"PUBLISH"},{plus,{rule,"ENTRY"}}},
 {{rule,"ENTRY"},
  {seq,{rule,"SECTION"},{seq,{rule,"REF"},{seq,{rule,"TEXT"},nil}}}},
 {{rule,"SECTION"},pcdata},
 {{rule,"REF"},pcdata},
 {{rule,"TEXT"},pcdata}]

Parse tree

{"WEB",
 [],
 [{"NAME",[],{pcdata,"web"}},
  {"VSN",[{"major","2"},{"minor","1"}],[]},
  {"SUMMARY",
   [],
   {pcdata,"A program for submitting a program to the Erlang web"}},
  {"AUTHOR",[],{pcdata,"Joe Armstrong"}},
  {"EMAIL",[],{pcdata,"joe@cslab.ericsson.se"}},
  {"VISIBILITY",[{"readers","world"}],[]},
  {"KEYWORDS",
   [],
   [{"KEY",[],{pcdata,"publishing"}},
    {"KEY",[],{pcdata,"html"}},
    {"KEY",[],{pcdata,"www"}},
    {"KEY",[],{pcdata,"web"}}]},
  {"FILES",
   [],
   [{"FILE",[],{pcdata,"web.erl"}},{"FILE",[],{pcdata,"web.html"}}]},
  {"PUBLISH",
   [],
   [{"ENTRY",
     [],
     [{"SECTION",[],{pcdata,"Web utilities"}},
      {"REF",[],{pcdata,"web.html"}},
      {"TEXT",
       [],
       {pcdata,"This is a program for adding entries to the \nWWW. Using web provides location transparency etc.\"\n"}}]}]}]}

bug1


<?XML version="1.0" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (IMG|br)+>
<!ELEMENT br EMPTY>
<!ELEMENT IMG EMPTY>
<!ATTLIST IMG
          align  CDATA  #IMPLIED
          src    CDATA  #IMPLIED>

]>
<greeting>
<!-- <IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" /> 

<br/>
</greeting>

    

Parse failed

Errors

["line 17 ","*** Unexpected EOF in ","Comment"]

bug2


<?XML version="1.0" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (IMG|br)+>
<!ELEMENT br EMPTY>
<!ELEMENT IMG EMPTY>
<!ATTLIST IMG
          align  CDATA  #IMPLIED
          src    CDATA  #IMPLIED>

]>
<greeting>
<br/>

<br/>
</greeting>

    

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,[]},
 {idrefs,[]},
 {top,"GREETING"},
 {{rule,"GREETING"},{plus,{alt,{rule,"IMG"},{alt,{rule,"BR"},fail}}}},
 {{rule,"BR"},empty},
 {{rule,"IMG"},empty},
 {{attr,"IMG"},[{"align",{cdata,implied}},{"src",{cdata,implied}}]}]

Parse tree

{"GREETING",[],[{"BR",[],[]},{"BR",[],[]}]}

bug3


<?XML version="1.0" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (IMG|br)+>
<!ELEMENT br EMPTY>
<!ELEMENT IMG EMPTY>
<!ATTLIST IMG
          align  CDATA  #IMPLIED
          src    CDATA  #IMPLIED>

]>
<greeting>
<IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" />
<br/>
<br></br>


    

Parse failed

Errors

["Parse error",
 {found,{[{"IMG",
           [{"align","left"},{"src","http://www.w3.org/Icons/WWW/w3c_home"}],
           []},
          {"BR",[],[]},
          {"BR",[],[]}],
         []},
        "no end tag for ",
        "GREETING",
        " start tag was in line ",
        11}]

bug4


<?XML version="1.0" RMD='INTERNAL'?>
<!-- declarations for <head> & <body> -->
<!DOCTYPE fooybar [
 <!ELEMENT br EMPTY>
 <!ELEMENT %name.para; %content.para; >
 <!ELEMENT container ANY>

 <!ELEMENT spec (front, body, back?)>
 <!ELEMENT div1 (head, (p | list | note)*, div2*)>
 <!ELEMENT head (%head.content; | %head.misc;)*>

 <!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
 <!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
 <!ELEMENT b (#PCDATA)>

 <!ATTLIST termdef
           id      ID      #REQUIRED
           name    CDATA   #IMPLIED>
 <!ATTLIST list
           type    (bullets|ordered|glossary)  "ordered">
 <!ATTLIST form
           method  CDATA   #FIXED "POST">


 <!ENTITY % draft 'INCLUDE' >
 <!ENTITY % final 'IGNORE' >

 <![%draft;[
 <!ELEMENT book (comments*, title, body, supplements?)>
 ]]>
 <![%final;[
 <!ELEMENT book (title, body, supplements?)>
 ]]>
 <!ENTITY % ISOLat2
          SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
 %ISOLat2;
 <!ENTITY Pub-Status "This is a pre-release of the
  specification.">

 <!ENTITY open-hatch
          SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
 <!ENTITY open-hatch
          PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
          "http://www.textuality.com/boilerplate/OpenHatch.xml">
 <!ENTITY hatch-pic
          SYSTEM "../grafix/OpenHatch.gif"
          NDATA gif >

 <?XML ENCODING='UTF-8'?>
 <?XML ENCODING='EUC-JP'?>

 <!ENTITY lt     "&#60;">
 <!ENTITY gt     "&#62;">
 <!ENTITY amp    "&#38;">
 <!ENTITY apos   "'">
 <!ENTITY quot   '"'>
]>

 <![CDATA[<greeting>Hello, world!</greeting>]]>
 <termdef id="dt-dog" term="dog">
	foo
 </termdef>
 <IMG align="left"
  src="http://www.w3.org/Icons/WWW/w3c_home" />
 <br></br>
 <br/>

Parse failed

Errors

["line 50 ",
 "unrecognised dtd element",
 ['?',"XML","ENCODING",'=',{lit,50,"EUC-JP"},'?']]
["line 49 ", "unrecognised dtd element", ['?',"XML","ENCODING",'=',{lit,49,"UTF-8"},'?']]
["line 45 ", "unrecognised dtd element", ['!', "ENTITY", "hatch-pic", "SYSTEM", {lit,46,"../grafix/OpenHatch.gif"}, "NDATA", "gif"]]
["line 42 ", "unrecognised dtd element", ['!', "ENTITY", "open-hatch", "PUBLIC", {lit,43,"-//Textuality//TEXT Standard open-hatch boilerplate//EN"}, {lit,44,"http://www.textuality.com/boilerplate/OpenHatch.xml"}]]
["line 40 ", "unrecognised dtd element", ['!', "ENTITY", "open-hatch", "SYSTEM", {lit,41,"http://www.textuality.com/boilerplate/OpenHatch.xml"}]]
["line 34 ", "cannot read entity ", "SYSTEM", "http://www.xml.com/iso/isolat2-xml.entities"]
["line 31 ", "unrecognised dtd element", ['!', '[', "IGNORE", '[', {tag,32,"!ELEMENT book (title, body, supplements?)"}, ']', ']']]
["line 28 ", "unrecognised dtd element", ['!', '[', "INCLUDE", '[', {tag,29,"!ELEMENT book (comments*, title, body, supplements?)"}, ']', ']']]
["line 13 ", "Error in Model expecting:", "'(' or a string", " found ", ['|','|','|',')','*']]
["line 13 ","undefined PE ","form"]
["line 13 ","undefined PE ","special"]
["line 13 ","undefined PE ","phrase"]
["line 13 ","undefined PE ","font"]
["line 10 ", "Error in Model expecting:", "'(' or a string", " found ", ['|',')','*']]
["line 10 ","undefined PE ","head.misc"]
["line 10 ","undefined PE ","head.content"]
["line 6 ","Error in Model expecting:","( or EMPTY"," found ",["ANY"]]
["line 5 ","unrecognised dtd element",['!',"ELEMENT"]]
["line 5 ","undefined PE ","content.para"]
["line 5 ","undefined PE ","name.para"]

bug5


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (termdef,list,form)>
<!ELEMENT termdef (#PCDATA)>
<!ELEMENT list (#PCDATA)>
<!ELEMENT form (#PCDATA)>
<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
	  p       IDREF   #REQUIRED
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          method  CDATA   #FIXED "POST">

<!ELEMENT b (#PCDATA)>
]>
<greeting>
<termdef id="foo" name="Hejho">para1</termdef>
<list type="ordered" p="foo">para2</list>
<form method="POST">para3</form>
</greeting>

    

Parse succeeded

Dictionary

[{errors,[]},
 {warnings,[]},
 {ids,["foo"]},
 {idrefs,["foo"]},
 {top,"GREETING"},
 {{rule,"GREETING"},
  {seq,{rule,"TERMDEF"},{seq,{rule,"LIST"},{seq,{rule,"FORM"},nil}}}},
 {{rule,"TERMDEF"},pcdata},
 {{rule,"LIST"},pcdata},
 {{rule,"FORM"},pcdata},
 {{attr,"TERMDEF"},[{"id",{id,required}},{"name",{cdata,implied}}]},
 {{attr,"LIST"},
  [{"p",{idref,required}},
   {"type",{enum,["bullets","ordered","glossary"],{default,"ordered"}}}]},
 {{attr,"FORM"},[{"method",{cdata,{fixed,"POST"}}}]},
 {{rule,"B"},pcdata}]

Parse tree

{"GREETING",
 [],
 [{"TERMDEF",[{"id","foo"},{"name","Hejho"}],{pcdata,"para1"}},
  {"LIST",[{"p","foo"},{"type","ordered"}],{pcdata,"para2"}},
  {"FORM",[{"method","POST"}],{pcdata,"para3"}}]}

bug6


<?XML version="1.0" RMD='INTERNAL'?>
<!-- declarations for <head> & <body> -->
<!DOCTYPE fooybar [
 <!ELEMENT br EMPTY>
 <!ELEMENT %name.para; %content.para; >
 <!ELEMENT container ANY>

 <!ELEMENT spec (front, body, back?)>
 <!ELEMENT div1 (head, (p | list | note)*, div2*)>
 <!ELEMENT head (%head.content; | %head.misc;)*>

 <!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
 <!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
 <!ELEMENT b (#PCDATA)>

 <!ATTLIST termdef
           id      ID      #REQUIRED
           name    CDATA   #IMPLIED>
 <!ATTLIST list
           type    (bullets|ordered|glossary)  "ordered">
 <!ATTLIST form
           method  CDATA   #FIXED "POST">


 <!ENTITY % draft 'INCLUDE' >
 <!ENTITY % final 'IGNORE' >


 <!ENTITY % ISOLat2
          SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
 %ISOLat2;
 <!ENTITY Pub-Status "This is a pre-release of the
  specification.">

 <!ENTITY open-hatch
          SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
 <!ENTITY open-hatch
          PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
          "http://www.textuality.com/boilerplate/OpenHatch.xml">
 <!ENTITY hatch-pic
          SYSTEM "../grafix/OpenHatch.gif"
          NDATA gif >

 <?XML ENCODING='UTF-8'?>
 <?XML ENCODING='EUC-JP'?>

 <!ENTITY lt     "&#60;">
 <!ENTITY gt     "&#62;">
 <!ENTITY amp    "&#38;">
 <!ENTITY apos   "'">
 <!ENTITY quot   '"'>
]>

 <![CDATA[<greeting>Hello, world!</greeting>]]>
 <termdef id="dt-dog" term="dog">
	foo
 </termdef>
 <IMG align="left"
  src="http://www.w3.org/Icons/WWW/w3c_home" />
 <br></br>
 <br/>

Parse failed

Errors

["line 45 ",
 "unrecognised dtd element",
 ['?',"XML","ENCODING",'=',{lit,45,"EUC-JP"},'?']]
["line 44 ", "unrecognised dtd element", ['?',"XML","ENCODING",'=',{lit,44,"UTF-8"},'?']]
["line 40 ", "unrecognised dtd element", ['!', "ENTITY", "hatch-pic", "SYSTEM", {lit,41,"../grafix/OpenHatch.gif"}, "NDATA", "gif"]]
["line 37 ", "unrecognised dtd element", ['!', "ENTITY", "open-hatch", "PUBLIC", {lit,38,"-//Textuality//TEXT Standard open-hatch boilerplate//EN"}, {lit,39,"http://www.textuality.com/boilerplate/OpenHatch.xml"}]]
["line 35 ", "unrecognised dtd element", ['!', "ENTITY", "open-hatch", "SYSTEM", {lit,36,"http://www.textuality.com/boilerplate/OpenHatch.xml"}]]
["line 29 ", "cannot read entity ", "SYSTEM", "http://www.xml.com/iso/isolat2-xml.entities"]
["line 13 ", "Error in Model expecting:", "'(' or a string", " found ", ['|','|','|',')','*']]
["line 13 ","undefined PE ","form"]
["line 13 ","undefined PE ","special"]
["line 13 ","undefined PE ","phrase"]
["line 13 ","undefined PE ","font"]
["line 10 ", "Error in Model expecting:", "'(' or a string", " found ", ['|',')','*']]
["line 10 ","undefined PE ","head.misc"]
["line 10 ","undefined PE ","head.content"]
["line 6 ","Error in Model expecting:","( or EMPTY"," found ",["ANY"]]
["line 5 ","unrecognised dtd element",['!',"ELEMENT"]]
["line 5 ","undefined PE ","content.para"]
["line 5 ","undefined PE ","name.para"]

bug7


<?XML version="1.0"?>
<!DOCTYPE web [
<!ELEMENT web (name,vsn,summary,author,email,visibility,keywords,files,
	publish)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT vsn EMPTY>
<!ATTLIST vsn
	  maj CDATA #REQUIRED
	  min CDATA #REQUIRED>


<!ELEMENT summary (#PCDATA)>
<web>
<name>web</name>
<vsn maj="2" minor="1" />
<summary>A program for submitting a program to the Erlang web</summary>
<author>Joe Armstrong</author>
<email>joe@cslab.ericsson.se</email>
<visibility readers=world />
<keywords>
<key>publishing</key>
<key>html</key>
<key>www</key>
<key>web</key>
<keywords>
<files>
<file>web.erl</file>
<file>web.html</file>
</files>
<publish>
<in>utilities</in>
<entry>
<section>Web utilities</section>
<ref>web.html</ref>
<text>This is a program for adding entries to the 
WWW. Using <b>web</b> provides location transparency etc."
</text>
</entry>
</publish>
<abstract>This is a program for submitting entries to ..." </abstract>
</web>

Parse failed

Errors

["line 42 ","*** Unexpected EOF in ","in a tag"]

bug8


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (paras)>
<!ELEMENT paras (p+)>
<!ELEMENT p (#PCDATA)>
<!ATTLIST (p|x)               -- header or data cell --
  %attrs;                          -- %coreattrs, %i18n, %events --
  abbr        CDATA      #IMPLIED  -- abbreviation for header cell --
  axis        CDATA      #IMPLIED  -- names groups of related headers--
  axes        IDREFS     #IMPLIED  -- list of id's for header cells --
  rowspan     NUMBER     1         -- number of rows spanned by cell --
  colspan     NUMBER     1         -- number of cols spanned by cell --
  %cellhalign;                     -- horizontal alignment in cells --
  %cellvalign;                     -- vertical alignment in cells --
  width       %Pixels;   #IMPLIED  -- suggested width for cell --
  height      %Pixels;   #IMPLIED  -- suggested height for cell --
  >

]>
<greeting>
<paras>
<p>para1</p>
<p>para2</p>
</paras>
</greeting>

    

Parse failed

Errors

["line 6 ",
 " bad attribute",
 ["Cannot parse ATTLIST elements",
  ["p",
   '|',
   "x",
   ')',
   "abbr",
   "CDATA",
   '#',
   "IMPLIED",
   "axis",
   "CDATA",
   '#',
   "IMPLIED",
   "axes",
   "IDREFS",
   '#',
   "IMPLIED",
   "rowspan",
   "NUMBER",
   '1',
   "colspan",
   "NUMBER",
   '1',
   "width",
   '#',
   "IMPLIED",
   "height",
   '#',
   "IMPLIED"]]]
["line 6 ","undefined PE ","Pixels"]
["line 6 ","undefined PE ","Pixels"]
["line 6 ","undefined PE ","cellvalign"]
["line 6 ","undefined PE ","cellhalign"]
["line 6 ","undefined PE ","attrs"]

Warnings

["line 16 ","old style comment dropped  suggested height for cell "]
["line 15 ","old style comment dropped suggested width for cell "]
["line 14 ","old style comment dropped vertical alignment in cells "]
["line 13 ","old style comment dropped horizontal alignment in cells "]
["line 12 ","old style comment dropped number of cols spanned by cell "]
["line 11 ","old style comment dropped number of rows spanned by cell "]
["line 10 ","old style comment dropped list of id's for header cells "]
["line 9 ","old style comment dropped names groups of related headers"]
["line 8 ","old style comment dropped abbreviation for header cell "]
["line 7 ","old style comment dropped %coreattrs, %i18n, %events "]
["line 6 ","old style comment dropped header or data cell "]

bug9


<?XML version="1.0">
<!DOCTYPE greeting [
<!ATTLIST a
  axes         list of is'd
  >
]>


    

Parse failed

Errors

["line 9 ","*** Unexpected EOF in ","in a tag"]
["line 9 ","*** Unexpected EOF in ","Literal which started in line 4"]

bug10


<?XML version="1.0">


    

Parse failed

Errors

["line 1 ","expecting a terminating ? found ",[]]

bug11


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (paras)>
<!ELEMENT paras (p+)>
<!ELEMENT p (#PCDATA)>
<!ATTLIST (p|x)               -- header or data cell --
  %attrs;                          -- %coreattrs, %i18n, %events --
  abbr        CDATA      #IMPLIED  -- abbreviation for header cell --
  axis        CDATA      #IMPLIED  -- names groups of related headers--
  axes        IDREFS     #IMPLIED  -- list of id's for header cells --
  rowspan     NUMBER     1         -- number of rows spanned by cell --
  colspan     NUMBER     1         -- number of cols spanned by cell --
  %cellhalign;                     -- horizontal alignment in cells --
  %cellvalign;                     -- vertical alignment in cells --
  width       %Pixels;   #IMPLIED  -- suggested width for cell --
  height      %Pixels;   #IMPLIED  -- suggested height for cell --
  >

]>
<greeting>
<paras>
<p>para1</p>
<p>para2</p>
</paras>
</greeting>

    

Parse failed

Errors

["line 6 ",
 " bad attribute",
 ["Cannot parse ATTLIST elements",
  ["p",
   '|',
   "x",
   ')',
   "abbr",
   "CDATA",
   '#',
   "IMPLIED",
   "axis",
   "CDATA",
   '#',
   "IMPLIED",
   "axes",
   "IDREFS",
   '#',
   "IMPLIED",
   "rowspan",
   "NUMBER",
   '1',
   "colspan",
   "NUMBER",
   '1',
   "width",
   '#',
   "IMPLIED",
   "height",
   '#',
   "IMPLIED"]]]
["line 6 ","undefined PE ","Pixels"]
["line 6 ","undefined PE ","Pixels"]
["line 6 ","undefined PE ","cellvalign"]
["line 6 ","undefined PE ","cellhalign"]
["line 6 ","undefined PE ","attrs"]

Warnings

["line 16 ","old style comment dropped  suggested height for cell "]
["line 15 ","old style comment dropped suggested width for cell "]
["line 14 ","old style comment dropped vertical alignment in cells "]
["line 13 ","old style comment dropped horizontal alignment in cells "]
["line 12 ","old style comment dropped number of cols spanned by cell "]
["line 11 ","old style comment dropped number of rows spanned by cell "]
["line 10 ","old style comment dropped list of id's for header cells "]
["line 9 ","old style comment dropped names groups of related headers"]
["line 8 ","old style comment dropped abbreviation for header cell "]
["line 7 ","old style comment dropped %coreattrs, %i18n, %events "]
["line 6 ","old style comment dropped header or data cell "]

fail1


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (termdef,list,form)>
<!ELEMENT termdef (#PCDATA)>
<!ELEMENT list (#PCDATA)>
<!ELEMENT form (#PCDATA)>
<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
	  p       IDREF   #REQUIRED
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          method  CDATA   #FIXED "POST">

<!ELEMENT b (#PCDATA)>
]>
<greeting>
<termdef id="foo" name="Hejho">para1</termdef>
<list type="ordered">para2</list>
<form method="POST">para3</form>
</greeting>

    

Parse failed

Errors

["there are some ID conflicts, the following IDs were defined but have no corresponding IDREFs",
 ["foo"]]
["line 20 ","bad attribute",idref,"is required but no value supplied"]

fail2


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (termdef,list,form)>
<!ELEMENT termdef (#PCDATA)>
<!ELEMENT list (#PCDATA)>
<!ELEMENT form (#PCDATA)>
<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
	  p       IDREF   #REQUIRED
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          method  CDATA   #FIXED "POST">

<!ELEMENT b (#PCDATA)>
]>
<greeting>
<termdef id="foo" name="Hejho">para1</termdef>
<list type="ordered" p="foo1">para2</list>
<form method="POST">para3</form>
</greeting>

    

Parse failed

Errors

["there are some ID conflicts, the following IDs were defined but have no corresponding IDREFs",
 ["foo"]]

fail3


<?XML version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (termdef,list,form)>
<!ELEMENT termdef (#PCDATA)>
<!ELEMENT list (#PCDATA)>
<!ELEMENT form (#PCDATA)>
<!ATTLIST termdef
          id      ID      #REQUIRED
          name    CDATA   #IMPLIED>
<!ATTLIST list
          type    (bullets|ordered|glossary)  "ordered">
<!ATTLIST form
          method  CDATA   #FIXED "POST">

<!ELEMENT b (#PCDATA)>
]>
<greeting>
<termdef id="foo" name="Hejho">para1</termdef>
<list type="ordered">para2</list>
<form method="aa">para3</form>
</greeting>

    

Parse failed

Errors

["there are some ID conflicts, the following IDs were defined but have no corresponding IDREFs",
 ["foo"]]
["line 20 ", "bad attribute", "expecting the #FIXED string ", "POST", " found ", "aa"]