Subject: Re: JDK 5 XSLTC handling of namespace prefixes
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 19 Dec 2005 15:40:32 +0000
|
> drkm wrote:
> > Julian Reschke wrote:
> >
> >> Because the whole point of the stylesheet is to get rid of prefixes,
> >> because their output is used to compare test results (where prefixes
> >> are
> >> irrelevant).
> >
> > If I understand, you want to compare two XML documents
> > (with diff(1) or similar), so you want to strip out the
> > prefixes. IMHO, there are a lot of XML caracteristics that
> > make it unusable with diff(1) (withespaces, namespaces,
> > character entities, etc.).
>
> That's why I am running them through a normalization step (sigh).
You have no chance unless you implement your own serializer because of
many reasons, one being that attribute order isn't significant - the
order in which they get written out is allowed to be different each
time (others include the namespace prefix problem you've come across,
entites and character references eg ' versus ', & #160; versus '
' etc).
XML canonicalization is a big topic and has its very own w3c rec:
http://www.w3.org/TR/xml-c14n
Could you not compare in memory structures and do the work in whatever
tool is comparing the XML? That way serialization issues aren't
involved.
cheers
andrew
|