Ok,
You have a bug in your code. You are using a parser non namespaceaware,
you have this:
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newInstance().
newDocumentBuilder();
Take a look of the last line you are obtaining a new factory that by
default is not name space aware, please write this and everything
should work:
DocumentBuilder builder = factory.newDocumentBuilder();
Regards,
On Mar 31, 2005 11:45 PM, Skip Walker <[EMAIL PROTECTED]> wrote:
> Outputting the dom via the serializer before running the canonicalizer, and
> comparing it with the output after the canonicalizer, it appears that the
> canonicalizer is having no effect. See below.
>
> I'm attaching my test class and test files. Would someone please check if
> they have similar results, or check to see if I'm making some stupid
> mistake.
>
> The class needs glue 5.0.2 to run the glue test, or at least the ElectricXML
> bundled with it, but one can comment that section out easily, and just run
> the JAXP test.
>
> _______
>
> Serializing Doc before Canonicalization:
>
> <?xml version="1.0"?>
> <soap:Envelope
> soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soap:Body>
> <n:getRate xmlns:n="urn:xmethods-CurrencyExchange">
> <country1 xsi:type="xsd:string">usa</country1>
> <country2 xsi:type="xsd:string">japan</country2>
> </n:getRate>
> </soap:Body>
>
> <!-- test comment -->
> <testElement a="1" b="2" c="3">
> test crapola
> </testElement>
> </soap:Envelope>
>
> Canonicalized XML written to file: c14n-jaxp.xml
>
> <soap:Envelope
> soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soap:Body>
> <n:getRate xmlns:n="urn:xmethods-CurrencyExchange">
> <country1 xsi:type="xsd:string">usa</country1>
> <country2 xsi:type="xsd:string">japan</country2>
> </n:getRate>
> </soap:Body>
>
> <!-- test comment -->
> <testElement a="1" b="2" c="3">
> test crapola
> </testElement>
> </soap:Envelope>
>
> ________
>
> Skip Walker
> [EMAIL PROTECTED]
> Gossamer Group
> Bldg #2, Suite 410
> 4807 Spicewood Springs Rd.
> Austin, TX 78759
> (512) 342-2600 Fax (512) 342-2612
>
> -----Original Message-----
> From: Raul Benito [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 31, 2005 2:04 PM
> To: [email protected]
> Subject: Re: Java XML C14n interop with .Net
>
> I'll think you are still having problems with your dom, but it is
> really weird as if your program is really what you have shown it
> should work, correctly. Anyway can you tell me what's the output of
> the following lines in your example:
> XMLSerializer ser=new XMLSerializer();
> ser.setOutputByteStream(System.out);
> ser.serialize(doc);
> Regards,
>
> Raul
>
> On Thu, 31 Mar 2005 14:45:32 -0500, Scott Cantor <[EMAIL PROTECTED]> wrote:
> > > For some reason, in my little test case, the canonicalizer renders a
> > > different result with the DOM from the JAXP api then from the Glue api.
> > > Apparently, the result from the JAXP DOM, produces something wrong, as
> far
> > > as the soap:encodingStyle attribute goes.
> >
> > I guess a first sanity check would be to compare the DOMs in a piecemeal
> > fashion. Literally spit out a property-based display for every single node
> > in the tree with the node type, name, NS, and hex value.
> >
> > If those match, well, hmm. If not, at least that explains something.
> >
> > But the thing I don't get is that your JAXP DOM c14n output just doesn't
> > seem to be canonical, at least not unless the DOMs are really different.
> >
> > -- Scott
> >
> >
>
> --
> http://r-bg.com
>
>
>
--
http://r-bg.com