
Anonymous
Not applicable
2011-09-30
12:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert routines.system.Document to String
I have a Document coming out of a tXMLMap that I need to convert to a String. I wrote some Java code to do this, assuming the Document in question was a org.w3c.dom.Document but, it turns out it is a routines.system.Document. How can I convert THAT to a String or a org.w3c.dom.Document? Pasted my broken code below so you get the idea. Thanks.
org.w3c.dom.Document xml_doc = input_row.xmldata;
String xml_string = "";
try {
javax.xml.transform.Transformer transformer = javax.xml.transform.TransformerFactory.newInstance().newTransformer();
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(new java.io.StringWriter());
javax.xml.transform.dom.DOMSource source = new javax.xml.transform.dom.DOMSource(xml_doc);
transformer.transform(source, result);
xml_string = result.getWriter().toString();
}
catch(Exception e) {
System.out.println("XML exception: " + e.toString());
}
output_row.xmldata = xml_string;
org.w3c.dom.Document xml_doc = input_row.xmldata;
String xml_string = "";
try {
javax.xml.transform.Transformer transformer = javax.xml.transform.TransformerFactory.newInstance().newTransformer();
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(new java.io.StringWriter());
javax.xml.transform.dom.DOMSource source = new javax.xml.transform.dom.DOMSource(xml_doc);
transformer.transform(source, result);
xml_string = result.getWriter().toString();
}
catch(Exception e) {
System.out.println("XML exception: " + e.toString());
}
output_row.xmldata = xml_string;
411 Views
4 Replies

Anonymous
Not applicable
2011-09-30
05:24 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anybody?
411 Views

Anonymous
Not applicable
2011-10-07
12:25 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
u wrote this code in tjavaRow? if so what do you have in your schema mapping for input_row.xmldata; (xmldata)
try to cast that to Document object.
try to cast that to Document object.
411 Views

Anonymous
Not applicable
2012-05-21
07:28 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Chris,
The routines.system.Document is a org.dom4j.Document. So you need to make that conversion before you can do anything else.
The routines.system.Document is a org.dom4j.Document. So you need to make that conversion before you can do anything else.
411 Views

Specialist III
2012-09-17
10:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use can directly use the following code in tjavaRow to convert Document type to string.
routines.system.Document xml_doc = input_row.xmldata;
sml_doc.toString();
routines.system.Document xml_doc = input_row.xmldata;
sml_doc.toString();
