File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes xml doc to xml string using jaxp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml doc to xml string using jaxp" Watch "xml doc to xml string using jaxp" New topic

xml doc to xml string using jaxp

slagy maggie
Ranch Hand

Joined: Feb 20, 2001
Posts: 35
I have an xml document,using do i convert
this document back into an XML string,.....i know i can do this with using TXDocument(IBM PARSER),but that is not what my company is using....SO I NEED TO DO THIS USING JAXP........
please help!!!
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
How are you parsing the document? If you're using an InputSource( ie., org.xml.sax.InputSource), you could use InputSource.getByteStream() to get an instance of You can also use InputSource.getCharacterStream() to get an instance of corresponding to the XML source(file).
Once you have a handle to a i/o stream you can simply read the characters in the XML document into a string.

Hope that helps,
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
In Oreilly's Book Java Examples in a Nutshell which is listed in our Bunkhouse They have a example called it's in chapter 19 which is on-line It strictly used the org.w3c.dom package so it will work with any parser derived from it.
Licensing information for commercial use is Here
Hope This Helps
Carl Trusiak

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
slagy maggie
Ranch Hand

Joined: Feb 20, 2001
Posts: 35
thanks ajith
actually i achieved it by using XMLDocument found in crimson.jar
I agree. Here's the link:
subject: xml doc to xml string using jaxp
It's not a secret anymore!