Package nu.xom

Examples of nu.xom.Element.toXML()


                    }
                  }
                  if(failedParameterMatch) // At least one parameter did not match
                    continue;
                  if(usedAttributes.size() < childElem.getAttributeCount()) {
                    logger.log(TreeLogger.TRACE, "Not all attributes used from "+childElem.toXML()+" to call "+method+":", null);
                    for (int k = 0; k < childElem.getAttributeCount(); k++) {
                      if(!usedAttributes.contains(childElem.getAttribute(k).getLocalName())) {
                        logger.log(TreeLogger.TRACE, "   Attribute "+childElem.getAttribute(k).getLocalName()+" was not used.", null);
                      }
                    }
View Full Code Here


                        }
                      }
                      if(foundSetter && !missingSetter.isEmpty()) {
                        int i=0;
                        for(Element childElem : missingSetter) {
                          logger.log(TreeLogger.WARN, "Ignored "+childElem.toXML()+"; couldn't find any matching setter.", null);
                          for(JMethod candidate : missingSetterCandidates.get(i++)) {
                            logger.log(TreeLogger.WARN, "Candidate setter method: "+candidate);
                          }
                        }
                      }
View Full Code Here

       
        String name = "sakjdhjhd";
        String uri = "http://www.something.com/";
        Element e = new Element(name, uri);
       
        String s = e.toXML();
        assertTrue(s.endsWith("/>"));
        assertTrue(s.startsWith("<" + name));
        assertTrue(s.indexOf(uri) != -1);
        assertTrue(s.indexOf("xmlns=") != -1);   
       
View Full Code Here

        Builder builder = new Builder();
        File f = new File("data");
        f = new File(f, "soapresponse.xml");  
        Document doc = builder.build(f);
        Element root = doc.getRootElement();
        String  form = root.toXML();
        Document doc2
          = builder.build(form, f.toURI().toString());
        Element root2 = doc2.getRootElement();
        assertEquals(root, root2);
        
View Full Code Here

    }
   
   
    public void testPhilip() {
        Element element = new Element("x", "x:&");
        assertEquals("<x xmlns=\"x:&amp;\" />", element.toXML());
    }
   
   
    public void testToXMLWithXMLLangAttribute() {
        Element e = new Element("e");
View Full Code Here

   
    public void testToXMLWithXMLLangAttribute() {
        Element e = new Element("e");
        e.addAttribute(new Attribute("xml:lang",
          "http://www.w3.org/XML/1998/namespace", "en"));
        assertEquals("<e xml:lang=\"en\" />", e.toXML());
    }   

   
    public void testAllowNullNamespace() {
        String name = "sakjdhjhd";
View Full Code Here

          new Attribute("xml:space",
            "http://www.w3.org/XML/1998/namespace",
            "preserve"));
        e.addAttribute(
          new Attribute("zzz:zzz", "http://www.example.org", "preserve"));
        String result = e.toXML();
        assertEquals("<test xmlns:zzz=\"http://www.example.org\" xml:space=\"preserve\" zzz:zzz=\"preserve\" />", result);
    }

   
    public void testGetNamespacePrefixInt() {
View Full Code Here

   
    // a very weird case but legal
    public void testXMLPrefixOnElement() {
        Element e = new Element("xml:test", "http://www.w3.org/XML/1998/namespace");
        assertEquals(0, e.getNamespaceDeclarationCount());
        assertEquals("<xml:test />", e.toXML());
        try {
            e.getNamespacePrefix(0);
            fail("Got prefix beyond bounds");
        }
        catch (IndexOutOfBoundsException success) {
View Full Code Here

  public static void removeIfNoText(Nodes nodes) {
    for (int i = 0; i < nodes.size(); i++) {
      Element elem = (Element)nodes.get(i);
      String value = elem.getValue().replaceAll("\\u00a0"," ").trim();                 
      if(value.length()<1) {
        System.out.println("removing: " + elem.toXML());
        elem.getParent().removeChild(elem);
      }else {
               
      }
    }
View Full Code Here

  }

  public static void toComments(Nodes elements) {
    for (int i = 0; i < elements.size(); i++) {
      Element e = (Element) elements.get(i);
      Comment c = new Comment(e.toXML());
      e.getParent().replaceChild(e, c);
    }   
  }

  public static Element addEpubTypeAttr(String value, Element dest) {
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.