Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Re: Last call

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Re: Last call
  • Date: Fri, 12 Mar 2004 14:06:59 -0800

Since you asked, here is one of my previous patches that has not been incorporated or commented on:
Note that i can't do this external to DOMConverter because DOMConverter.convert(Node) is not public.

[Patch] DOMConverter DocumentFragment conversion

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;
}






Archive powered by MHonArc 2.6.24.

Top of Page