Documents and Infosets
RELAX NG is an XML-based technology. RELAX NG schemas are commonly stored in XML documents (called schema documents ) and used to validate other XML documents (called instance documents ). While RELAX NG works with and uses XML documents, RELAX NG processors operate at a slightly higher level of abstraction, called an infoset , rather than processing the actual text of the XML document, which is called lexical processing .
An infoset is a logical view of the XML
document, rather than the document as stored in a text file. Most XML
processors read (or generate) XML syntax but work internally on a
representation that omits a lot of details. To take a brief example,
from a lexical perspective, which looks at the actual contents of an
XML document, <book
id='b0836217462'
available="true"/> is an empty tag containing
two attributes named id and
available. The value of id is
delimited with single quotes, while the value of
available is delimited with double quotes. Yet,
from an infoset perspective, this isn’t an empty tag
with particular syntax; the kind of quotation marks
don’t matter. It’s a
book element with an attribute named
id and a value of b0836217462,
as well as an attribute named available with a
value of true. Elements, attributes, and text are
often referred to as
nodes
in this perspective, like nodes in an object tree.
There are a variety of different models for XML documents—specifications such as the Simple API for XML (SAX), the Document Object ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access