Solved

How To View The Contents Of A Node

Posted on 2001-06-26
2
209 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

Industry Leaders: 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 Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

628 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