xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
[XOM-interest] [Patch] DOMConverter DocumentFragment conversion
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] [Patch] DOMConverter DocumentFragment conversion
- Date: Fri, 13 Feb 2004 11:21:19 -0800
DOMConverter currently cannot deal with a DOM DocumentFragment.
Unfortunately I get handed such a DocumentFragment from the apache xmlbeans framework's XMLTokenSource.newDomNode(). So need to deal with it one way or another. Please consider the patch below that implements one way of handling it.
One might also think of making convert(Node) and convert(NodeList) public but that's a separate issue.
public static Nodes convert(org.w3c.dom.DocumentFragment domDocumentFragment) {
return convert(domDocumentFragment.getChildNodes());
}
private static Nodes convert(org.w3c.dom.NodeList nodeList) {
Nodes nodes = new Nodes();
int length = nodeList.getLength();
for (int i=0; i < length; i++) {
nodes.append(convert(nodeList.item(i)));
}
return nodes;
}
- [XOM-interest] [Patch] DOMConverter DocumentFragment conversion, Wolfgang Hoschek, 02/13/2004
Archive powered by MHonArc 2.6.24.