xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Elliotte Harold <elharo AT metalab.unc.edu>
- To: "Aust, Stefan" <stefan.aust AT coremedia.com>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Canonicalization question 2
- Date: Fri, 21 Oct 2005 07:01:57 -0400
Aust, Stefan wrote:
Hi Elliotte,
Thanks for addressing my first C14N problem so fast. Here's another
problem I stumbled across.
public static void main(String[] args) throws Exception {
Element e1 = new Element("a:a", "urn:a");
//e1.addAttribute(new Attribute("a", "a"));
Element e2 = new Element("b");
e1.appendChild(e2);
System.out.println(c(e1));
}
This prints:
<a:a xmlns:a="urn:a"><b xmlns=""></b></a:a> But I think, it should print:
<a:a xmlns:a="urn:a"><b></b></a:a>
Because if you uncomment the attribute definition it will print
<a:a xmlns:a="urn:a" a="a"><b></b></a:a>
I can't reproduce this one. I see both these test cases passing:
public static void testAustB() throws IOException {
Element e1 = new Element("a:a", "urn:a");
Element e2 = new Element("b");
e1.appendChild(e2);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Canonicalizer c = new Canonicalizer(out,
Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION);
c.write(e1);
String s = out.toString("UTF8");
assertEquals("<a:a xmlns:a=\"urn:a\"><b></b></a:a>", s);
}
public static void testAustB2() throws IOException {
Element e1 = new Element("a:a", "urn:a");
Element e2 = new Element("b");
e1.appendChild(e2);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Canonicalizer c = new Canonicalizer(out);
c.write(e1);
String s = out.toString("UTF8");
assertEquals("<a:a xmlns:a=\"urn:a\"><b></b></a:a>", s);
}
What am I missing? Do you have a complete test case?
--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
-
[XOM-interest] Canonicalization question 2,
Aust, Stefan, 10/21/2005
- Re: [XOM-interest] Canonicalization question 2, Elliotte Harold, 10/21/2005
- Re: [XOM-interest] Canonicalization question 2, Elliotte Harold, 10/21/2005
Archive powered by MHonArc 2.6.24.