Java 类org.jdom2.input.sax.XMLReaderSAX2Factory 实例源码

项目:cia    文件:XmlAgentImpl.java   
/**
 * Sets the name space on xml stream.
 *
 * @param in
 *            the in
 * @param nameSpace
 *            the name space
 * @return the source
 * @throws Exception
 *             the exception
 */
private static Source setNameSpaceOnXmlStream(final InputStream in, final String nameSpace)
        throws Exception {
    final SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false));
    final Document doc = sb.build(in);
    doc.getRootElement().setNamespace(Namespace.getNamespace(nameSpace));
    return new JDOMSource(doc);
}