You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Bruce Kern x22345 <br...@kodak.com> on 2002/07/01 19:48:43 UTC

How to get custom DOM from jaxp DocumentBuilder API?

The jaxp interface for document building goes like
this:

    #import org.xml.parsers.DocumentBuilderFactory;
    #import org.xml.parsers.DocumentBuilder;
    #import org.w3c.dom.Document;

    DocumentBuilderFactory df = DocumentBuilderFactory..newInstance();
    DocumentBuilder db = df.newDocumentBuilder();
    Document doc = db.newDocument();

At which point I have a nicely built DOM.  What if I want to supply
my own DOM implementation?  How do I get the embedded parser to accept
a custom ContentHandler (or whatever the correct mechanism is)?

-- 
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Bruce A. Kern					(716) 722-2345
Eastman Kodak Company				kern@image.kodak.com
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: How to get custom DOM from jaxp DocumentBuilder API?

Posted by Elena Litani <el...@ca.ibm.com>.
Hi Bruce, 


Bruce Kern x22345 wrote:
> What if I want to supply
> my own DOM implementation?  How do I get the embedded parser to accept
> a custom ContentHandler (or whatever the correct mechanism is)?

You can set Xerces
"http://apache.org/xml/properties/dom/document-class-name" property [1]
(using JAXP DocumentBuilderFactory setAttribute()) to register your own
DOM implementation. 

Also, the latest Xerces release provides partial implementation for the
DOM Level 3. You can use it to register your own DOM implementation by
specifying implementation for DOMImplementationSource [2]. 
Note: DOM level 3 implementation is experimental and the API might be
changed.


[1]
http://xml.apache.org/xerces2-j/properties.html#dom.document-class-name
[2] http://xml.apache.org/xerces2-j/samples-dom.html#DOM3

-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org