Package nu.xom

Examples of nu.xom.XPathContext$JaxenNamespaceContext


            + "      </e2>\n"
            + "   </e1>\n"
            + "</doc>";
       
        Document doc = builder.build(input, null);
        XPathContext context = new XPathContext("ietf", "http://www.ietf.org");
        String xpath = "(/* | /*/namespace::*)\n";
       
        String expected = "<doc xmlns=\"http://www.ietf.org\" xmlns:w3c=\"http://www.w3.org\"></doc>";

        try {
View Full Code Here


            + "      </e2>\n"
            + "   </e1>\n"
            + "</doc>";
       
        Document doc = builder.build(input, null);
        XPathContext context = new XPathContext("ietf", "http://www.ietf.org");
        String xpath = "(/*/* | /*/*/namespace::*)\n";
       
        String expected = "<e1 xmlns=\"http://www.ietf.org\" xmlns:w3c=\"http://www.w3.org\"></e1>";

        try {
View Full Code Here

       
        String expected = "<n1:elem1 xmlns:n1=\"http://b.example\">content</n1:elem1>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        XPathContext context = new XPathContext("n1", "http://b.example");
        Document doc = new Document(pdu);
        canonicalizer.write(doc.query("(//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1]", context))
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
View Full Code Here

        Element e1 = new Element("a:a", "urn:a");
        Element e2 = new Element("a:b", "urn:a");
        e1.appendChild(e2);
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
        XPathContext context = new XPathContext("a", "urn:a");
        Document doc = new Document(e1);
        canonicalizer.write(doc.query("(//. | //@* | //namespace::*)[ancestor-or-self::a:b]", context))

        String s = out.toString("UTF8");
        assertEquals("<a:b xmlns:a=\"urn:a\"></a:b>", s);
View Full Code Here

        String expected = "<n1:elem1 xmlns:n1=\"http://b.example\" "
          + "xmlns:pre=\"http://www.example.org/\" pre:foo=\"value\">content</n1:elem1>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        XPathContext context = new XPathContext("n1", "http://b.example");
        Document doc = new Document(pdu);
        canonicalizer.write(doc.query("(//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1]", context))
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
View Full Code Here

        String expected = "<n1:elem1 xmlns:n0=\"http://a.example\""
          + " xmlns:n1=\"http://b.example\">content</n1:elem1>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        XPathContext context = new XPathContext("n1", "http://b.example");
        Document doc = new Document(pdu);
        canonicalizer.setInclusiveNamespacePrefixList("n0");
        Nodes subset = doc.query(
          "(//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1]",
          context);
View Full Code Here

        String expected = "<n1:elem1"
          + " xmlns:n1=\"http://b.example\">content</n1:elem1>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        XPathContext context = new XPathContext("n1", "http://b.example");
        Document doc = new Document(pdu);
        canonicalizer.setInclusiveNamespacePrefixList("n0");
        canonicalizer.setInclusiveNamespacePrefixList(null);
        Nodes subset = doc.query(
          "(//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1]",
 
View Full Code Here

        String expected = "<n1:elem2 xmlns:n1=\"http://example.net\" xml:lang=\"en\">" +
                "<n3:stuff xmlns:n3=\"ftp://example.org\"></n3:stuff></n1:elem2>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        XPathContext context = new XPathContext("n1", "http://example.net");
        canonicalizer.write(doc.query(
          " (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem2]",
          context))
       
        out.close();
View Full Code Here

        String expected = "<n1:elem2 xmlns:n1=\"http://example.net\" xml:lang=\"en\">"
            + "<n3:stuff xmlns:n3=\"ftp://example.org\"></n3:stuff></n1:elem2>";
        Canonicalizer canonicalizer = new Canonicalizer(out,
          Canonicalizer.EXCLUSIVE_XML_CANONICALIZATION_WITH_COMMENTS);
       
        XPathContext context = new XPathContext("n1", "http://example.net");
        canonicalizer.write(doc.query(" (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem2]", context))
       
        out.close();
        String s = new String(out.toByteArray(), "UTF8");
        assertEquals(expected, s);
View Full Code Here

    }
   
   
    public void testCantRebindXMLPrefix() {
       
        XPathContext context = new XPathContext();
        try {
            context.addNamespace("xml", "http://www.example.org");
            fail("Rebound xml prefix");
        }
        catch (NamespaceConflictException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

TOP

Related Classes of nu.xom.XPathContext$JaxenNamespaceContext

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.