Package org.w3c.dom

Examples of org.w3c.dom.Document.normalizeDocument()


        document.appendChild(element);
        DOMConfiguration domConfig = document.getDomConfig();
        domConfig.setParameter("split-cdata-sections", Boolean.FALSE);
        domConfig.setParameter("well-formed", Boolean.FALSE);
        domConfig.setParameter("namespaces", Boolean.TRUE);
        document.normalizeDocument();
        NamedNodeMap attributes = element.getAttributes();
        assertEquals(1, attributes.getLength());
        Attr attr = (Attr)attributes.item(0);
        assertNull(attr.getPrefix());
        assertEquals(XMLConstants.XMLNS_ATTRIBUTE, attr.getLocalName());
View Full Code Here


        dbf.setIgnoringElementContentWhitespace(true);
        dbf.setIgnoringComments(true);
        DocumentBuilder db = dbf.newDocumentBuilder();

        Document doc1 = db.parse(new ByteArrayInputStream(element1.getBytes("UTF-8")));
        doc1.normalizeDocument();

        Document doc2 = db.parse(new ByteArrayInputStream(element1.getBytes("UTF-8")));
        doc2.normalizeDocument();

        return doc1.isEqualNode(doc2);
View Full Code Here

        Document doc1 = db.parse(new ByteArrayInputStream(element1.getBytes("UTF-8")));
        doc1.normalizeDocument();

        Document doc2 = db.parse(new ByteArrayInputStream(element1.getBytes("UTF-8")));
        doc2.normalizeDocument();

        return doc1.isEqualNode(doc2);
    }

}
View Full Code Here

                // the message are required.
                DOMConfiguration domConfig = document.getDomConfig();
                domConfig.setParameter("split-cdata-sections", Boolean.FALSE);
                domConfig.setParameter("well-formed", Boolean.FALSE);
                domConfig.setParameter("namespaces", Boolean.TRUE);
                document.normalizeDocument();
                return document;
            }
           
            if (useDoom) {
                env.build();
View Full Code Here

            dbf.setCoalescing(true);
            dbf.setIgnoringElementContentWhitespace(true);
            dbf.setIgnoringComments(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document document = db.parse(new ByteArrayInputStream(xmlContent.getBytes()));
            document.normalizeDocument();
            processNode(document);
            return XmlUtils.serializePretty(document);
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        } catch (SAXException e) {
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Configuration addChild(Configuration child) {
        Document this_doc = _element.getOwnerDocument();
        this_doc.normalizeDocument();
        DOMConfiguration child_config = new DOMConfiguration(child);
        Document child_doc = child_config._element.getOwnerDocument();
        if (child_doc != this_doc) {
            child_doc.normalizeDocument();
            this_doc.adoptNode(child_config._element);
View Full Code Here

        Document this_doc = _element.getOwnerDocument();
        this_doc.normalizeDocument();
        DOMConfiguration child_config = new DOMConfiguration(child);
        Document child_doc = child_config._element.getOwnerDocument();
        if (child_doc != this_doc) {
            child_doc.normalizeDocument();
            this_doc.adoptNode(child_config._element);
        }
        _element.appendChild(child_config._element);
        String child_xmlns = Strings.trimToNull(child_config._element.getNamespaceURI());
        if (child_xmlns == null) {
View Full Code Here

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document expected = db.parse(out);

    expected.normalizeDocument();
    o.normalizeDocument();
   
    String xpath = "/results/resource[@uri='http://example.org/test1#Joerg']/title";
    assertXpathValuesEqual(xpath, expected, xpath, o);
    xpath = "/results/resource[@uri='http://example.org/test1#Joerg']/property/@uri";
View Full Code Here

           
            // remove comments from the document
            config.setParameter("comments", Boolean.FALSE);

            System.out.println("Normalizing document... ");
            doc.normalizeDocument();


            // create DOMWriter
            LSSerializer domWriter = impl.createLSSerializer();
           
View Full Code Here

                DocumentBuilderFactory.newInstance();
        final DocumentBuilder docBuilder =
                docBuilderFactory.newDocumentBuilder();
        final Document doc = docBuilder.parse(new File(secDescPath));

        doc.normalizeDocument();

        final Node node = this.getNodeByNameOnly(paramName, doc);

        if (node == null) {
            throw new Exception("Can not find '" + paramName + "' element");
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.