http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Charter
Release Info

Installation
Download

FAQs
Samples
API Docs

Features
Properties

XML Schema
Caveats
Feedback
Y2K Compliance

Source Repository
User Mail Archive
Dev Mail Archive

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. 

http://apache.org/xml/properties/schema/external-schemaLocation

Type:  java.lang.String 
Access:  read-write 
Desc:  The XML Schema Recommendation explicitly states that the inclusion of schemaLocation/ noNamespaceSchemaLocation attributes is only a hint; it does not mandate that these attributes must be used to locate schemas. This property allows the user to specify a list of schemas to use. If the targetNamespace of a schema (specified using this property) matches the targetNamespace of a schema occuring in the instance document in schemaLocation attribute, the schema specified by the user using this property will be used (i.e., the instance document's schemaLocation attribute will be effectively ignored).  
Note:  The syntax is the same as for schemaLocation attributes in instance documents: e.g, "http://www.example.com file_name.xsd". The user can specify more than one XML Schema in the list.  

http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation

Type:  java.lang.String 
Access:  read-write 
Desc:  This property allows the user to specify an XML Schema with no namespace.  
Note:  The syntax is a same as for the noNamespaceSchemaLocation attribute that may occur in an instance document: e.g."file_name.xsd". The user may specify only one XML Schema. For more information see the documentation for the http://apache.org/xml/properties/schema/external-schemaLocation property 

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. 


Copyright © 1999-2005 The Apache Software Foundation. All Rights Reserved.