Subject: Re: [SWIPL] XML Parser

From: "Richard A. O'Keefe" <[email-masked]>
Date: Tue, 13 Mar 2001 12:45:24 +1300 (NZDT)

Alberto Ruiz Cristina <[email-masked]> wrote:
    <br>Will I be able to validate XML files with that DTD?

SWI Prolog's SGML/XML parser does not perform all the checks that
a validating parser should do, but it delivers the same Infoset that
a validating parser would.

	<br>I am thinking about developing a simple XML parser that,
	given the name of a general element from the DTD, returned that
	particular element in an XML document.  How could I solve the
	identification problem?  (there can be different elements with
	the same name in a document structure)

I cannot understand this.  What on earth can "THAT PARTICULAR ELEMENT" mean?
The world is full of simple XML parsers (you can write a non-validating XML
parser in under a day in less than a thousand lines of C, including blank
lines and comments; I've done it).

If you want to pick some element out of a document, you must somehow
describe it well enough to locate it.  The element type (also known as GI)
of a node is sufficient to locate it only if the grammar ensures that there
is at most one element of that type.

If the element has an ID attribute, then the value of that attribute is
sufficient to locate the element.

Do you know about XPath?