You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Vlad Arkhipov <ar...@dc.baikal.ru> on 2011/02/08 11:28:19 UTC

Supplying a custom DOM implementation

I wonder why http://apache.org/xml/properties/dom/document-class-name 
property refers to a class name but not to a class factory? It's common 
when you need some external information while parsing the document. For 
example, when you are building a DOM for HTML page it's necessary to 
have a reference to a window of this document. You may also need 
factories for creating elements of your Document. Now you can't set 
Document's properties before parsing is not done.


Re: Supplying a custom DOM implementation

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
An instance of a class that implements org.w3c.dom.Document is the factory
for creating other nodes. If there's some reason that you need to / want to
examine and do further processing on the nodes as they're constructed you
can always register an LSParserFilter [1] with the parser.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParserFilter.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Vlad Arkhipov <ar...@dc.baikal.ru> wrote on 02/08/2011 05:28:19 AM:

> I wonder why http://apache.org/xml/properties/dom/document-class-name
> property refers to a class name but not to a class factory? It's
> common when you need some external information while parsing the
> document. For example, when you are building a DOM for HTML page
> it's necessary to have a reference to a window of this document. You
> may also need factories for creating elements of your Document. Now
> you can't set Document's properties before parsing is not done.

Re: Supplying a custom DOM implementation

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
An instance of a class that implements org.w3c.dom.Document is the factory
for creating other nodes. If there's some reason that you need to / want to
examine and do further processing on the nodes as they're constructed you
can always register an LSParserFilter [1] with the parser.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParserFilter.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Vlad Arkhipov <ar...@dc.baikal.ru> wrote on 02/08/2011 05:28:19 AM:

> I wonder why http://apache.org/xml/properties/dom/document-class-name
> property refers to a class name but not to a class factory? It's
> common when you need some external information while parsing the
> document. For example, when you are building a DOM for HTML page
> it's necessary to have a reference to a window of this document. You
> may also need factories for creating elements of your Document. Now
> you can't set Document's properties before parsing is not done.