Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2004, 08:53 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transformer.transform throws DOM006 error

I have been working on this for at least 4 days now. Time to ask for help

I am working within an opensource application called open adaptor.
I receive an object which holds my xml. I convert this to a string, and then Parse the string using DOMParser, extract the document, and then call Transformer.transform(DOMSource(document),DOMResul t), where i get a DOM006 error.

NOw this works, the sax transformer.

Here is a partial representation of the xml file
<<?xml version="1.0" encoding="ISO-8859-1"?>
<Trades>
<Trade>
<H_AccruedAmount>35350.19</H_AccruedAmount>
<H_RecAmortisingFlag>NOT_AMORTIZED</H_RecAmortisingFlag>
<H_Buy>B</H_Buy>
<H_Company>BOSTS_LDN</H_Company>
<H_Counterparty>MIDL_L</H_Counterparty
.
.
</Trade>
<Trade>
<H_AccruedAmount>12165.1</H_AccruedAmount>
<H_RecAmortisingFlag>NOT_AMORTIZED</H_RecAmortisingFlag>
.
.
</Trade>
</Trades>

and here is the code that attempts to transform it

 try
     {
          DOMResult domresult = new DOMResult();
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = factory.newDocumentBuilder();
        Document document = docBuilder.newDocument();
         DOMParser domParser = new DOMParser();
        GenericXMLWriter stringwriter = new GenericXMLWriter();
 stringwriter.setAttributeValue("WriteAsXMLFragment s", "true");
stringwriter.setAttributeValue("ElideSingletonRoot ObjectTag", "true");
     String s1 = stringwriter.toString(adataobject);
     StringReader stringReader = new StringReader(s1);
     InputSource inputSource = new InputSource(stringReader);
     domParser.parse(inputSource);
 transformer.transform(new DOMSource(domParser.getDocument()), domresult);

         Document document1 = (Document)domresult.getNode();
         DOMDataObject domdataobject1 = new DOMDataObject(document1);
         DataObject adataobject1[] = new DataObject[1];
         adataobject1[0] = domdataobject1;
         return adataobject1;
     }
     catch(Exception exception)
     {
         throw new PipelineException(exception.getMessage(), 0);
     }






Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista: Getfiles throws security error sigilaea Visual Basic 2008 Professionals 2 February 9th, 2009 06:00 PM
XML/XSLT Transform Error in ASP kwilliams Classic ASP XML 2 October 9th, 2007 02:26 AM
column name starts with a number. c# throws error. jaikanth_n ADO.NET 0 March 18th, 2006 01:44 PM
UPDATE query throws error in selective MSI tables eelisMX General .NET 0 July 14th, 2005 06:29 AM
Exception in generating a new transformer neta XSLT 5 September 23rd, 2004 04:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.