www.alphaworks.ibm.comwww.ibm.com/developerwww.ibm.com

Home

XML4J Readme
Xerces Readme
Installation

API Docs
Samples
Schema

Properties
Features
FAQs

Releases
Caveats
Feedback

Y2K Compliance

Setting Features
 

To set a property on either org.apache.xerces.parsers.SAXParser or org.apache.xerces.parsers.DOMParser, you should use the SAX2 method setProperty(String,Object). To query a property, use the SAX2 method getProperty(String).

For example, to set the document factory by name:

DOMParser p=new DOMParser();
try {        
  p.setProperty("http://apache.org/xml/properties/dom/document-class-name",
                "org.apache.xerces.dom.DocumentImpl");
} catch (SAXException e) {
  System.out.println("error in setting up parser property");             
}

General Properties
 

http://xml.org/sax/properties/xml-string

Type:  java.lang.String 
Access:  read-only 
Desc:  Get the string of characters associated with the current event. If the parser recognizes and supports this property but is not currently parsing text, it should return null. 
Note:  This property is currently not supported because the contents of the XML string returned by this property is not well defined. 

DOM Parser Properties
 

http://apache.org/xml/properties/dom/current-element-node

Type:  org.w3c.dom.Node 
Access:  read-only 
Desc:  The current DOM element node while parsing. 
Note:  This property is useful for determining the location with a DOM document when an error occurs. 
See:  http://xml.org/sax/properties/dom-node 

http://apache.org/xml/properties/dom/document-class-name

Type:  java.lang.String 
Access:  read-write 
Desc:  The fully qualified class name of the DOM implementation. The implementation used must have a zero argument constructor. 
Default:  "org.apache.xerces.dom.DocumentImpl" 
Note:  When the document class name is set to a value other than the name of the default document factory, the deferred node expansion feature does not work.  
See:  http://apache.org/xml/features/dom/defer-node-expansion 

SAX Parser Properties
 

http://xml.org/sax/properties/declaration-handler

Type:  org.xml.sax.ext.DeclHandler 
Access:  read-write 
Desc:  Set the handler for DTD declarations. 

http://xml.org/sax/properties/lexical-handler

Type:  org.xml.sax.ext.LexicalHandler 
Access:  read-write 
Desc:  Set the handler for lexical parsing events. 

http://xml.org/sax/properties/dom-node

Type:  org.w3c.dom.Node 
Access:  (parsing) read-only; (not parsing) read/write 
Desc:  The DOM node currently being visited, if SAX is being used as a DOM iterator. If the parser recognizes and supports this property but is not currently visiting a DOM node, it should return null.