Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] DOMConverter getDOMImplementation

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] DOMConverter getDOMImplementation
  • Date: Mon, 5 Apr 2004 17:28:26 -0700

I'm working a lot with converting from/to DOM and XOM, for example via
DOMConverter.convert(org.w3c.dom.Document, org.w3c.dom.DOMImplementation impl).
Dealing with JAXP and all its factory layers may be flexible but is also quite cumbersome to get a default DOMImplementation.
XOM users probably would like to avoid digging into JAXP as much as possible.
So here is a proposal to add a method getDOMImplementation() or perhaps better named getDefaultDOMImplementation() to DOMConverter:


private static org.w3c.dom.DOMImplementation domImpl = null;

public static synchronized org.w3c.dom.DOMImplementation getDOMImplementation() {
if (domImpl == null) {
javax.xml.parsers.DocumentBuilderFactory factory =

javax.xml.parsers.DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
domImpl =
factory.newDocumentBuilder().getDOMImplementation();
} catch
(javax.xml.parsers.ParserConfigurationException e) {
// do nothing special; just return null
domImpl
}
}

return domImpl;
}





Archive powered by MHonArc 2.6.24.

Top of Page