Package nu.xom

Examples of nu.xom.Element.addNamespaceDeclaration()


        String xmlNamespace = "http://www.w3.org/XML/1998/namespace";
       
        assertEquals(xmlNamespace, e.getNamespaceURI("xml"));
       
        try {
            e.addNamespaceDeclaration("xml", "http://www.yahoo.com/");
            fail("remapped xml prefix!");
        }
        catch (NamespaceConflictException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here


            assertNotNull(success.getMessage());
        }
        assertEquals(e.getNamespaceURI("xml"), xmlNamespace);
       
        // This should succeed
        e.addNamespaceDeclaration("xml", xmlNamespace);
        assertEquals(xmlNamespace, e.getNamespaceURI("xml"));

       
    }
View Full Code Here

        Element child2 = new Element("name", "http://www.default.com");
        parent.appendChild(child2);
       
        // should not be able to undeclare default namespace on child2
        try {
            child2.addNamespaceDeclaration("", "");
            fail("Illegally undeclared default namespace");
        }
        catch (NamespaceConflictException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

   
    public void testConflictingDefaultNamespace() {
       
        Element e = new Element("foo", "http://www.foo.com/");
        try {
            e.addNamespaceDeclaration("", "http://www.bar.com/");
            fail("Added conflicting default namespace");
        }
        catch (NamespaceConflictException success) {
            String message = success.getMessage();
            assertTrue(message.indexOf("default namespace") > 0);
View Full Code Here

    public void testNamespaceMappings() {
       
        String name = "red:sakjdhjhd";
        String uri = "http://www.red.com/";
        Element e = new Element(name, uri);
        e.addNamespaceDeclaration("blue", "http://www.blue.com/");
        e.addNamespaceDeclaration("green", "http://www.green.com/");
        Attribute a1 = new Attribute("test", "test");
        Attribute a2 = new Attribute(
          "pre1:green", "http://www.green.com/", "data");
        Attribute a3 = new Attribute(
View Full Code Here

       
        String name = "red:sakjdhjhd";
        String uri = "http://www.red.com/";
        Element e = new Element(name, uri);
        e.addNamespaceDeclaration("blue", "http://www.blue.com/");
        e.addNamespaceDeclaration("green", "http://www.green.com/");
        Attribute a1 = new Attribute("test", "test");
        Attribute a2 = new Attribute(
          "pre1:green", "http://www.green.com/", "data");
        Attribute a3 = new Attribute(
          "yellow:sfsdadf", "http://www.yellow.com/", "data");
View Full Code Here

        String name = "red:sakjdhjhd";
        String uri = "http://www.red.com/";
        String baseURI = "http://www.example.com/";
        Element e = new Element(name, uri);

        e.addNamespaceDeclaration("blue", "http://www.blue.com");
        e.addNamespaceDeclaration("green", "http://www.green.com");
        Attribute a1 = new Attribute("test", "test");
        Attribute a2 = new Attribute("pre1:green",
          "http://www.green.com/", "data");
        Attribute a3 = new Attribute("yellow:sfsdadf",
View Full Code Here

        String uri = "http://www.red.com/";
        String baseURI = "http://www.example.com/";
        Element e = new Element(name, uri);

        e.addNamespaceDeclaration("blue", "http://www.blue.com");
        e.addNamespaceDeclaration("green", "http://www.green.com");
        Attribute a1 = new Attribute("test", "test");
        Attribute a2 = new Attribute("pre1:green",
          "http://www.green.com/", "data");
        Attribute a3 = new Attribute("yellow:sfsdadf",
          "http://www.yellow.com/", "data");
View Full Code Here

    public void testSerializeXMLNamespaceDeclaration()
      throws ParsingException, IOException {
       
        Serializer serializer = new Serializer(out);
        Element root = new Element("root");
        root.addNamespaceDeclaration("xml", Namespace.XML_NAMESPACE);
        Document doc = new Document(root);
        serializer.write(doc);
        String result = out.toString("UTF-8");
        assertTrue(result.endsWith("<root/>\r\n"))
       
View Full Code Here

  public static Element getFixtureElement() {
    try {
      DDMSVersion version = DDMSVersion.getCurrentVersion();

      Element element = Util.buildDDMSElement(NoticeList.getName(version), null);
      element.addNamespaceDeclaration(PropertyReader.getPrefix("ddms"), version.getNamespace());
      SecurityAttributesTest.getFixture().addTo(element);
      element.appendChild(NoticeTest.getFixtureElement());
      return (element);
    }
    catch (InvalidDDMSException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.