Package org.dom4j

Examples of org.dom4j.Document.asXML()


        // Add node: branch or leaf
        parent_element.addElement(childtype)
                      .addAttribute("relURI", creator.generateTreeId(childid, childType))
                      .addAttribute("doctype", doctype).addAttribute("menuName",
            creator.getChildName(childname));
        getLogger().debug("Tree has been modified: " + doc.asXML());

        // Write new tree
        java.io.FileWriter fileWriter = new java.io.FileWriter(treefilename);
        doc.write(fileWriter);
        fileWriter.close();
View Full Code Here


    public void testBug799656() throws Exception {
        Document document = DocumentFactory.getInstance().createDocument();
        Element el = document.addElement("root");
        el.setText("text with an \u00FC in it"); // u00FC is umlaut

        System.out.println(document.asXML());

        DocumentHelper.parseText(document.asXML());
    }

    public void testAsXMLWithEncoding() throws Exception {
View Full Code Here

        Element el = document.addElement("root");
        el.setText("text with an \u00FC in it"); // u00FC is umlaut

        System.out.println(document.asXML());

        DocumentHelper.parseText(document.asXML());
    }

    public void testAsXMLWithEncoding() throws Exception {
        DefaultDocument document = new DefaultDocument();
        document.addElement("root");
View Full Code Here

        Document doc = DocumentHelper.parseText("<?xml version='1.0' "
                + "encoding='ISO-8859-1'?><root/>");

        String xml1 = document.asXML();
        String xml2 = doc.asXML();

        assertTrue(xml1.indexOf("ISO-8859-1") != -1);
        assertTrue(xml2.indexOf("ISO-8859-1") != -1);
    }
View Full Code Here

        Document document = DocumentFactory.getInstance().createDocument(
                "koi8-r");
        Element el = document.addElement("root");
        el.setText("text with an \u00FC in it"); // u00FC is umlaut

        System.out.println(document.asXML());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputFormat of = OutputFormat.createPrettyPrint();
        of.setEncoding("koi8-r");
View Full Code Here

        if( prettyPrint )
        {
            document = ParserUtils.styleDocument( document );
        }
       
        return document.asXML();
    }
}
View Full Code Here

      if ( document != null ) {
        // next try with orm 1.0 xsd validation
        try {
          setValidationFor( saxReader, "orm_1_0.xsd" );
          document = saxReader.readnew StringReader( document.asXML() ) );
          if ( errorHandler.getError() != null ) {
            throw errorHandler.getError();
          }
          return new XmlDocumentImpl( document, origin.getType(), origin.getName() );
        }
View Full Code Here

        /*
         * Done!
         */
        wsdlDOM = wsdlDoc;
        wsdl = wsdlDoc.asXML();
    }
}
View Full Code Here

        // Add node: branch or leaf
        parent_element.addElement(childtype)
                      .addAttribute("relURI", creator.generateTreeId(childid, childType))
                      .addAttribute("doctype", doctype).addAttribute("menuName",
            creator.getChildName(childname));
        getLogger().debug("Tree has been modified: " + doc.asXML());

        // Write new tree
        java.io.FileWriter fileWriter = new java.io.FileWriter(treefilename);
        doc.write(fileWriter);
        fileWriter.close();
View Full Code Here

        // Add node: branch or leaf
        parent_element.addElement(childtype)
                      .addAttribute("relURI", creator.generateTreeId(childid, childType))
                      .addAttribute("doctype", doctype).addAttribute("menuName",
            creator.getChildName(childname));
        getLogger().debug("Tree has been modified: " + doc.asXML());

        // Write new tree
        java.io.FileWriter fileWriter = new java.io.FileWriter(treefilename);
        doc.write(fileWriter);
        fileWriter.close();
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.