Solved

How To View The Contents Of A Node

Posted on 2001-06-26
2
201 Views
Last Modified: 2008-02-01
I have retrieved a node using Oracle Business Components for Java's writeXML method, and I'd like to view its contents.

I have tried to append it to a document (so that I can use xmlOutput.output(document, System.out) to view the node) using appendChild(node), but I get this error:

org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR: That node doesn't belong in this document.

I have also tried to import the node using importNode(node, boolean) but I get this error:

java.lang.IllegalArgumentException: Node is not a rg.apache.crimson.tree implementation.

Lastly, I have tried this:

javax.xml.transform.dom.DOMSource domSource = new javax.xml.transform.dom.DOMSource(xmlNode);
javax.xml.transform.TransformerFactory txnfac = javax.xml.transform.TransformerFactory.newInstance();
File xslfile = new File("C:\\xml\\testoutput.xsl");
StreamSource xslsource = new StreamSource(xslfile);
javax.xml.transform.Transformer txn = txnfac.newTransformer(xslsource);
txn.transform(domSource, new StreamResult(new FileOutputStream("C:\\xml\\result.xml")));

but then I get this error:

java.lang.AbstractMethodError
void org.apache.xalan.transformer.TransformerImpl.transform(javax.xml.transform.Source, javax.xml.transform.Result)

Any help would be greatly appreciated.
0
Comment
Question by:janey88
2 Comments
 
LVL 10

Accepted Solution

by:
Yury_Delendik earned 75 total points
ID: 6227358
You can't use neither appendChild nor importNode.

Try
  javax.xml.transform.TransformerFactory txnfac = javax.xml.transform.TransformerFactory.newInstance();
  javax.xml.transform.Transformer txn = txnfac.newTransformer();
  txn.transform(new javax.xml.transform.dom.DOMSource(yourSourceNode), new javax.xml.transform.dom.DOMResult(yourParentNode));

{ and same }
javax.xml.transform.TransformerFactory.newInstance().newInstance().transform(new javax.xml.transform.dom.DOMSource(yourSourceNode), new javax.xml.transform.dom.DOMResult(yourParentNode));
0
 

Author Comment

by:janey88
ID: 6233751
I tried the code you posted, but there's still an Abstract Method Error.  Anyway, I found a new API that has a method that converts a node directly into a String.  But thanks for your response!  =)



0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now