xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Geuer-Pollmann <maill...@nue.et-inf.uni-siegen.de>
Subject Re: XPath to generate XML
Date Tue, 01 Oct 2002 14:56:56 GMT


--On Monday, September 30, 2002 9:01 PM -0400 Shekhar Jha 
<shekhar-jha@usa.net> wrote:

> I am thinking along the lines of generating a skeleton DOM
> using the path i.e. along the line of
> instead of writing a code like
> ...
> Element element = document.createElement("Order"));
> document.appendChild(element);
> Node node = XPathAPI.selectSingleNode("/Order");
> node.appendChild( document.createElement("Customer" ) );
> Node node = XPathAPI.selectSingleNode("/Order/Customer[1]");
> node.appendChild( document.createElement("Name" ) );
> Node node = XPathAPI.selectSingleNode("/Order/Customer[1]/Name");
> node.appendChild(document.createText("John Doe") );
> ....
>
> I would like to just do
> ...
> Node node = XPathAPI.selectSingleNode("/Order/Customer[1]/Name");
> node.appendChild(document.createText("John Doe") );

Or even

documentCreator.appendData(doc, "/Order/Customer[1]/Name/text()='John 
Doe'");

Christian

Mime
View raw message