use of org.jdom2.input.sax.XMLReaderSAX2Factory in project jspwiki by apache.
the class HtmlStringToWikiTranslator method htmlStringToElement.
/**
* Use NekoHtml to parse HTML like well formed XHTML
*
* @param html
* @return xhtml jdom root element (node "HTML")
* @throws JDOMException
* @throws IOException
*/
private Element htmlStringToElement(String html) throws JDOMException, IOException {
SAXBuilder builder = new SAXBuilder(new XMLReaderSAX2Factory(true, CYBERNEKO_PARSER), null, null);
Document doc = builder.build(new StringReader(html));
Element element = doc.getRootElement();
return element;
}
use of org.jdom2.input.sax.XMLReaderSAX2Factory in project cia by Hack23.
the class XmlAgentImpl method setNameSpaceOnXmlStream.
/**
* 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.
*/
private static Source setNameSpaceOnXmlStream(final InputStream in, final String nameSpace) throws JDOMException, IOException {
final SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false));
final Document doc = sb.build(in);
doc.getRootElement().setNamespace(Namespace.getNamespace(nameSpace));
return new JDOMSource(doc);
}
Aggregations