List of usage examples for javax.xml.parsers DocumentBuilder isNamespaceAware
public abstract boolean isNamespaceAware();
From source file:Main.java
/** * @param string Creates a {@link Document} from a string. * @return A {@link Document} representation of the string. * @throws ParserConfigurationException if a DocumentBuilder cannot be * created which satisfies the configuration requested * @throws SAXException if any parse errors occur * @throws IOException if any IO errors occur. * *//*w w w. j ava2 s .co m*/ public static Document stringToXml(String string) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); InputSource is = new InputSource(new StringReader(string)); if (builder.isNamespaceAware()) { System.out.println("#######################3Is aware"); } else { System.out.println("#######################Not aware"); } return builder.parse(is); }
From source file:cz.muni.fi.mir.mathmlunificator.utils.DOMBuilderTest.java
@Test public void testGetDocumentBuilder() throws ParserConfigurationException { DocumentBuilder docBuilder = DOMBuilder.getDocumentBuilder(); assertNotNull(docBuilder);//from w ww .j a v a 2 s. c om assertTrue(docBuilder.isNamespaceAware()); }