Solved

How To View The Contents Of A Node

Posted on 2001-06-26
2
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

696 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