next up previous contents
Next: Editing Up: Processing SGML Previous: Processing SGML

SGML validating parser

The basic question for a developer:

The best choice:

James Clark's SP

SP is a "object-oriented toolkit for SGML parsing and entity management."

Validating with nsgmls:

The document mixed.sgml:

<!doctype listitem [
   <!ELEMENT listitem  - - (#PCDATA, para+)>
   <!ELEMENT para      - - (#PCDATA)>
]>
<listitem>
Oranges
<para>Oranges are a lovely fruit.</para>
<para>They grow in warm climates.</para>
</listitem>

nsgmls as validator:

nsgmls -s mixed.sgml
nsgmls:mixed.sgml:7:40:E: character data is not allowed here
nsgmls:mixed.sgml:8:40:E: character data is not allowed here

SGML validation exited abnormally with code 1

Parsing with nsgmls

Fixed document:

<!doctype listitem [
   <!ELEMENT listitem  - - (#PCDATA, para+)>
   <!ELEMENT para      - - (#PCDATA)>
]>
<listitem>
Oranges
<para>
Oranges are a lovely fruit.
</para><para>
They grow in warm climates.
</para></listitem>

nsgmls ESIS output:

nsgmls mixed.sgml
(LISTITEM
-Oranges\n
(PARA
-Oranges are a lovely fruit.
)PARA
(PARA
-They grow in warm climates.
)PARA
)LISTITEM
C

SGML validation finished at Fri Jul 11 13:26:51



Tomaz Erjavec
1/9/2000