org.jdom2.input.sax.XMLReaderSAX2Factory Java Examples
The following examples show how to use
org.jdom2.input.sax.XMLReaderSAX2Factory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NameSpaceUtil.java From cia with Apache License 2.0 | 5 votes |
/** * Sets the name space on xml stream. * * @param in the in * @param nameSpace the name space * @return the source * @throws JDOMException the JDOM exception * @throws IOException Signals that an I/O exception has occurred. */ public static Source setNameSpaceOnXmlStream(final InputStream in, final String nameSpace) throws JDOMException, IOException { final SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false)); sb.setExpandEntities(false); sb.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); final Document doc = sb.build(in); doc.getRootElement().setNamespace(Namespace.getNamespace(nameSpace)); return new JDOMSource(doc); }