use of org.w3c.dom.DocumentFragment in project cxf by apache.
the class EncoderDecoder10AImpl method encodeSequenceAcknowledgement.
public Element encodeSequenceAcknowledgement(SequenceAcknowledgement ack) throws JAXBException {
DocumentFragment doc = DOMUtils.getEmptyDocument().createDocumentFragment();
Marshaller marshaller = getContext().createMarshaller();
marshaller.marshal(VersionTransformer.convert200502wsa15(ack), doc);
return (Element) doc.getFirstChild();
}
use of org.w3c.dom.DocumentFragment in project cxf by apache.
the class EncoderDecoder10AImpl method encodeIdentifier.
public Element encodeIdentifier(Identifier id) throws JAXBException {
DocumentFragment doc = DOMUtils.getEmptyDocument().createDocumentFragment();
Marshaller marshaller = getContext().createMarshaller();
marshaller.marshal(VersionTransformer.convert200502wsa15(id), doc);
return (Element) doc.getFirstChild();
}
use of org.w3c.dom.DocumentFragment in project cxf by apache.
the class EncoderDecoder11Impl method encodeIdentifier.
public Element encodeIdentifier(Identifier id) throws JAXBException {
DocumentFragment doc = DOMUtils.getEmptyDocument().createDocumentFragment();
Marshaller marshaller = getContext().createMarshaller();
marshaller.marshal(id, doc);
return (Element) doc.getFirstChild();
}
use of org.w3c.dom.DocumentFragment in project nutch by apache.
the class HtmlParser method parseNeko.
private DocumentFragment parseNeko(InputSource input) throws Exception {
DOMFragmentParser parser = new DOMFragmentParser();
try {
parser.setFeature("http://cyberneko.org/html/features/scanner/allow-selfclosing-iframe", true);
parser.setFeature("http://cyberneko.org/html/features/augmentations", true);
parser.setProperty("http://cyberneko.org/html/properties/default-encoding", defaultCharEncoding);
parser.setFeature("http://cyberneko.org/html/features/scanner/ignore-specified-charset", true);
parser.setFeature("http://cyberneko.org/html/features/balance-tags/ignore-outside-content", false);
parser.setFeature("http://cyberneko.org/html/features/balance-tags/document-fragment", true);
parser.setFeature("http://cyberneko.org/html/features/report-errors", LOG.isTraceEnabled());
} catch (SAXException e) {
}
// convert Document to DocumentFragment
HTMLDocumentImpl doc = new HTMLDocumentImpl();
doc.setErrorChecking(false);
DocumentFragment res = doc.createDocumentFragment();
DocumentFragment frag = doc.createDocumentFragment();
parser.parse(input, frag);
res.appendChild(frag);
try {
while (true) {
frag = doc.createDocumentFragment();
parser.parse(input, frag);
if (!frag.hasChildNodes())
break;
if (LOG.isInfoEnabled()) {
LOG.info(" - new frag, " + frag.getChildNodes().getLength() + " nodes.");
}
res.appendChild(frag);
}
} catch (Exception e) {
LOG.error("Error: ", e);
}
;
return res;
}
use of org.w3c.dom.DocumentFragment in project nutch by apache.
the class HtmlParser method parseTagSoup.
private DocumentFragment parseTagSoup(InputSource input) throws Exception {
HTMLDocumentImpl doc = new HTMLDocumentImpl();
DocumentFragment frag = doc.createDocumentFragment();
DOMBuilder builder = new DOMBuilder(doc, frag);
org.ccil.cowan.tagsoup.Parser reader = new org.ccil.cowan.tagsoup.Parser();
reader.setContentHandler(builder);
reader.setFeature(org.ccil.cowan.tagsoup.Parser.ignoreBogonsFeature, true);
reader.setFeature(org.ccil.cowan.tagsoup.Parser.bogonsEmptyFeature, false);
reader.setProperty("http://xml.org/sax/properties/lexical-handler", builder);
reader.parse(input);
return frag;
}
Aggregations