Book HomeSAX2

B.6. Processing Instruction Information Items

Processing instructions (PIs) are used within XML documents to capture information that doesn't necessarily fit into the nested structure found elsewhere. Such data doesn't need to relate to processing tasks, although that's one historical use for such constructs.

   

Property

Callbacks

Explanation

[target]

  ContentHandler.processingInstruction(), target parameter

[content]

ContentHandler.processingInstruction(), target parameter

[base URI]

computed using xml:base

In the absence of xml:base attributes, this property is normally the value that Locator.getSystemId() exposes during the processingInstruction() callback.

[notation]

See the section on Notation Information Items. Tracking notations is the responsibility of applications.

[parent]

When startElement() is invoked with no matching endElement(), the parent is the current element. Between calls to LexicalHandler.startDTD() and LexicalHandler.endDTD(), the parent is the Document Type Declaration. Otherwise, the document itself is the parent.

Some applications use a convention that PI target names are matched against notation declarations, and the notations' public (or system) IDs are used to deduce the meaning behind a given PI. For example, such an ID might indicate a particular tool to use on receipt of a document (preferably redirecting through a table to facilitate useful security constraints). This is purely a convention, but it's recognized by the XML specification. It is not an XML error if such notations are undeclared. Moreover, PIs can precede notation declarations in the DTD.

If the SAX2 implementation doesn't support the LexicalHandler, then there is no way to determing whether processing instructions are part of the DTD or a part of another section of the document prologue.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.