Package nu.xom.canonical

Examples of nu.xom.canonical.Canonicalizer


      throws IOException {
    
        Element pdu = new Element("doc");
  
        String expected = "<doc></doc>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        canonicalizer.write(doc)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here


        Element pdu = new Element("doc");
        pdu.addAttribute(new Attribute("a1", "v1"));
        pdu.addAttribute(new Attribute("a2", "v2"));
       
        String expected = "<doc a1=\"v1\" a2=\"v2\"></doc>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        canonicalizer.write(doc)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

  
      Element pdu = new Element("n0:tuck", "http://a.example");
      pdu.addNamespaceDeclaration("pre", "http://www.example.org/");
      String expected = "<n0:tuck xmlns:n0=\"http://a.example\"></n0:tuck>";
      Canonicalizer canonicalizer = new Canonicalizer(out,
        Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
     
      Document doc = new Document(pdu);
      canonicalizer.write(doc)
     
      out.close();
      String s = new String(out.toByteArray(), "UTF8");
      assertEquals(expected, s);
     
View Full Code Here

        Element grandchild = new Element("n2:C", "http://b.example.com");
        child.appendChild(grandchild);
        grandchild.addAttribute(new Attribute("Attribute", "something"));
       
        String expected = "<n2:C xmlns:n2=\"http://b.example.com\" Attribute=\"something\"></n2:C>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        new Document(root);
        canonicalizer.write(grandchild)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

        Element grandchild = new Element("n2:C", "http://b.example.com");
        child.appendChild(grandchild);
        grandchild.addAttribute(new Attribute("Attribute", "something"));
       
        String expected = "<n2:C xmlns:n2=\"http://b.example.com\" Attribute=\"something\"></n2:C>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        new Document(root);
        canonicalizer.write(grandchild)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

    public void testWriteDefaultNamespace() throws IOException {

        Element pdu = new Element("tuck", "http://www.example.org/");
       
        String expected = " xmlns=\"http://www.example.org/\"";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        Nodes subset = doc.query("//namespace::node()");
        canonicalizer.write(subset)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

        Element child = new Element("child");
        child.addAttribute(new Attribute("xml:lang", Namespace.XML_NAMESPACE, "en"));
        middle.appendChild(child);
       
        String expected = "<tuck xml:lang=\"fr\"><child xml:lang=\"en\"></child></tuck>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        Nodes subset = doc.query("/* | //child | //@*");
        canonicalizer.write(subset)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

        pdu.addAttribute(new Attribute("pre:foo", "http://www.example.org/", "value"));
        Element child = new Element("pre:test", "http://www.example.org/");
        pdu.appendChild(child);
       
        String expected = "<tuck xmlns:pre=\"http://www.example.org/\" pre:foo=\"value\"><pre:test></pre:test></tuck>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        canonicalizer.write(doc)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

        Element child = new Element("pre:test", "http://www.example.org/");
        pdu.appendChild(child);
       
        String expected = "<tuck xmlns:pre=\"http://www.example.com/\" "
          + "pre:foo=\"value\"><pre:test xmlns:pre=\"http://www.example.org/\"></pre:test></tuck>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        canonicalizer.write(doc)
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

    
        Element pdu = new Element("n0:tuck", "http://a.example");
        pdu.addAttribute(new Attribute("pre:foo", "http://www.example.org/", "test"));
  
        String expected = "<n0:tuck xmlns:n0=\"http://a.example\"></n0:tuck>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        Document doc = new Document(pdu);
        canonicalizer.write(doc.query("//* | //namespace::node()"))
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
       
View Full Code Here

TOP

Related Classes of nu.xom.canonical.Canonicalizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.