From ok@atlas.otago.ac.nz Tue Mar 13 00:47:01 2001
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f2CNkxZ15806
	for <prolog@swi.psy.uva.nl>; Tue, 13 Mar 2001 00:47:00 +0100 (MET)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id MAA08977;
	Tue, 13 Mar 2001 12:45:24 +1300 (NZDT)
Date: Tue, 13 Mar 2001 12:45:24 +1300 (NZDT)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200103122345.MAA08977@atlas.otago.ac.nz>
To: aruiz@isys.dia.fi.upm.es, prolog@swi.psy.uva.nl
Subject: Re:  [SWIPL] XML Parser

Alberto Ruiz Cristina <aruiz@isys.dia.fi.upm.es> 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?

