Package nu.xom.canonical

Examples of nu.xom.canonical.Canonicalizer


        Element element = new Element("pre:foo", "http://www.example.org");
        root.appendChild(element);
        element.appendChild("  value \n value");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out, Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION);
            serializer.write(element);
        }
        finally {
            out.close();
        }          
        byte[] actual = out.toByteArray();
View Full Code Here


    public void testCanonicalizeDocumentTypeDeclaration() throws IOException {
    
        DocType doctype = new DocType("root", "http://www.example.org");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(doctype);
        }
        finally {
            out.close();
        }          
        byte[] actual = out.toByteArray();
View Full Code Here

    public void testCanonicalizeProcessingInstruction() throws IOException {
    
        ProcessingInstruction pi = new ProcessingInstruction("target", "value \n value");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(pi);
        }
        finally {
            out.close();
        }          
        byte[] actual = out.toByteArray();
View Full Code Here

    public void testCanonicalizeText() throws IOException {
    
        Text c = new Text("  pre:foo \n  ");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(c);
        }
        finally {
            out.close();
        }          
        byte[] actual = out.toByteArray()
View Full Code Here

    public void testCanonicalizeComment() throws IOException {
    
        Comment c = new Comment("pre:foo");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(c);
        }
        finally {
            out.close();
        }          
        byte[] actual = out.toByteArray();
View Full Code Here

   
    public void testUnsupportedAlgorithm() throws IOException {
    
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            new Canonicalizer(out, "http://www.example.org/canonical");
            fail("Allowed unrecognized algorithm");
        }
        catch (CanonicalizationException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

    public void testCanonicalizeDetachedNodes() throws IOException {
    
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        Element e = new Element("test");
        Nodes nodes = new Nodes(e);
        Canonicalizer serializer = new Canonicalizer(out);
        try {
            serializer.write(nodes);
            fail("Canonicalized detached node");
        }
        catch (CanonicalizationException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

        new Document(e1);
        Element e2 = new Element("test");
        new Document(e2);
        Nodes nodes = new Nodes(e1);
        nodes.append(e2);
        Canonicalizer serializer = new Canonicalizer(out);
        try {
            serializer.write(nodes);
            fail("Canonicalized multiple document nodes");
        }
        catch (CanonicalizationException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

   
   
    public void testDetachElementWhenExceptionIsThrown() {
       
        Element e = new Element("a");
        Canonicalizer canonicalizer = new Canonicalizer(new UnwriteableOutputStream());
        try {
            canonicalizer.write(e);
        }
        catch (IOException ex) {
        }
        assertNull(e.getParent());
       
View Full Code Here

   
    public void testCanonicalizeWithNullAlgorithm()
      throws IOException {
       
        try {
            new Canonicalizer(out, null);
            fail("Allowed null algorithm");
        }
        catch (NullPointerException success) {
            assertNotNull(success.getMessage());
        }
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.