You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Sellers, Christopher" <ch...@wilcom.com> on 2000/12/29 15:33:54 UTC

RE: Parsing a document and writing out a specfic node to a new fi le

Here's kind of a brute force approach.  I've also attached a sample included
with Xerces that shows the more eloquent solution proposed by Paul Brown.

Christopher Sellers
(918) 573-5186
Williams Communications



-----Original Message-----
From: Michael Goldberg [mailto:MGoldberg@yet2.com]
Sent: Thursday, December 28, 2000 6:06 PM
To: 'xerces-j-dev@xml.apache.org'
Subject: Parsing a document and writing out a specfic node to a new file


All,

I am in desperate need of some sample code that writes a node to a file.
More specifically, I am provided with an XHTML file as input.  I need to
scan/parse the document for a specific node.  Once found, I need to create a
second XHTML file which contains just this node (and all of its child
nodes).

I think I have the first part down.  I parse the input file as a Document
and use various methods like getDocumentElement(), getLastChild(), and
getChildNodes() to get to the specific node I am looking for.  However, now
that I have a node, I don't know how to create a file and output all of the
node's contents into the file.

Can please someone suggest some classes and methods to look into?  Even
better would be some sample code!

Sincerely,
Michael S. Goldberg
mgoldberg@yet2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org