use of org.w3c.dom.bootstrap.DOMImplementationRegistry in project wildfly by wildfly.
the class DOMImplementationRegistryTestCase method testDOMImplementationRegistry.
@Test
@Ignore("[WFLY-4416] Cannot obtain DOMImplementationRegistry instance")
public void testDOMImplementationRegistry() throws Exception {
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
Assert.assertNotNull("DOMImplementation not null", domImpl);
}
use of org.w3c.dom.bootstrap.DOMImplementationRegistry in project ACS by ACS-Community.
the class HibernateWDALImpl method initializeParser.
private void initializeParser() throws RuntimeException {
try {
System.setProperty(DOMImplementationRegistry.PROPERTY, "org.apache.xerces.dom.DOMImplementationSourceImpl");
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
domImplementationLS = (DOMImplementationLS) registry.getDOMImplementation("LS");
parser = domImplementationLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
//parser.getDomConfig().setParameter("http://apache.org/xml/features/xinclude", Boolean.TRUE);
schemaResourceResolverLoader = new SchemaResourceResolverLoader(null, domImplementationLS, m_logger);
parser.getDomConfig().setParameter("resource-resolver", schemaResourceResolverLoader);
parser.getDomConfig().setParameter("http://apache.org/xml/features/validation/schema", Boolean.TRUE);
parser.getDomConfig().setParameter("error-handler", new DOMErrorHandler() {
public boolean handleError(DOMError error) {
//((Exception) error.getRelatedException()).printStackTrace();
throw new LSException(LSException.PARSE_ERR, error.getMessage());
}
});
input = domImplementationLS.createLSInput();
output = domImplementationLS.createLSOutput();
// SAX parser (non-validating)
SAXParserFactory factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
} catch (Throwable th) {
throw new RuntimeException("Failed to initialize parser.", th);
}
}
use of org.w3c.dom.bootstrap.DOMImplementationRegistry in project jdk8u_jdk by JetBrains.
the class MergeStdCommentTest method main.
public static void main(String[] args) throws Exception {
String format = "javax_imageio_1.0";
BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB);
ImageWriter iw = ImageIO.getImageWritersByMIMEType("image/png").next();
IIOMetadata meta = iw.getDefaultImageMetadata(new ImageTypeSpecifier(img), null);
DOMImplementationRegistry registry;
registry = DOMImplementationRegistry.newInstance();
DOMImplementation impl = registry.getDOMImplementation("XML 3.0");
Document doc = impl.createDocument(null, format, null);
Element root, text, entry;
root = doc.getDocumentElement();
root.appendChild(text = doc.createElement("Text"));
text.appendChild(entry = doc.createElement("TextEntry"));
// keyword isn't #REQUIRED by the standard metadata format.
// However, it is required by the PNG format, so we include it here.
entry.setAttribute("keyword", "Comment");
entry.setAttribute("value", "Some demo comment");
meta.mergeTree(format, root);
}
Aggregations