Michael Glavassevich schrieb am 08.04.2009 um 15:03:58 (-0400):
> Michael Ludwig <[email protected]> wrote on 04/08/2009 02:52:22 PM:
> > And I was wondering if Xerces had a DOM parser option to not enlist
> > namespace declaration attributes among the ordinary attributes as
> > in:
> >
> > NamedNodeMap nodeMap = elm.getAttributes();
> >
> > If so, I haven't found it. Just asking because coming from LibXML2
> > (which I'm not saying is the Specification Incarnate), I'm not used
> > to finding namespace declaration attributes together with straight
> > attributes when using the DOM parser. So maybe there is some switch
> > controlling that behaviour in Xerces?
>
> There is one but you need to be using the DOM Level 3 LSParser [1].
> Setting the "namespace-declarations" parameter to false on its
> DOMConfiguration [2] should do the trick.
Thanks! It works!
String xmlFileName = "c:/dev/XML/urmel.xml";
DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance();
DOMImplementationLS impl =
(DOMImplementationLS) registry.getDOMImplementation("LS");
LSParser parser =
impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
DOMConfiguration domConf = parser.getDomConfig();
domConf.setParameter("namespace-declarations", false);
Document doc = parser.parseURI(xmlFileName);
Michael Ludwig
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]