Package org.apache.xerces.dom

Examples of org.apache.xerces.dom.DocumentImpl.createTextNode()


            Document doc = builder.parseURI("tests/dom/dom3/wholeText.xml");

            Element root = doc.getDocumentElement();
            Element test = (Element)doc.getElementsByTagName("elem").item(0);
           
            test.appendChild(doc.createTextNode("Address: "));
            test.appendChild(doc.createEntityReference("ent2"));
            test.appendChild(doc.createTextNode("City: "));
           
            test.appendChild(doc.createEntityReference("ent1"));
            DocumentType doctype = doc.getDoctype();
View Full Code Here


            Element root = doc.getDocumentElement();
            Element test = (Element)doc.getElementsByTagName("elem").item(0);
           
            test.appendChild(doc.createTextNode("Address: "));
            test.appendChild(doc.createEntityReference("ent2"));
            test.appendChild(doc.createTextNode("City: "));
           
            test.appendChild(doc.createEntityReference("ent1"));
            DocumentType doctype = doc.getDoctype();
            Node entity = doctype.getEntities().getNamedItem("ent3");
View Full Code Here

            Assertion.verify(ls.getLength() == 1, "Length == 1");
            Assertion.verify(ls.item(0).getNodeValue().equals("Replace with this text"), "Replacement works");
            Assertion.verify(newNode != original, "New node created");

            // replace text for node which is not yet attached to the tree
            Text text = doc.createTextNode("readonly");
            ((NodeImpl)text).setReadOnly(true, true);
            text = text.replaceWholeText("Data");
            Assertion.verify(text.getNodeValue().equals("Data"), "New value 'Data'");

            // test with second child that does not have any content
View Full Code Here

        //  creation of implementation objects that are set up on first use.
        //  Don't watch for leaks in this block (no  / )
        Document doc = new DocumentImpl();
        Element     el = doc.createElement("Doc02Element");
        DocumentFragment frag = doc.createDocumentFragment ();
        Text  text = doc.createTextNode("Doc02TextNode");
        Comment comment = doc.createComment("Doc02Comment");
        CDATASection  cdataSec = doc.createCDATASection("Doc02CDataSection");
        DocumentType  docType = doc.getImplementation().createDocumentType("Doc02DocumentType", null, null);
        Notation notation = ((DocumentImpl) doc).createNotation("Doc02Notation");
        ProcessingInstruction pi = doc.createProcessingInstruction("Doc02PITarget",
View Full Code Here

   

   
    {
        Document doc = new DocumentImpl();
        Text  text = doc.createTextNode("Doc02TextNode");
    }
   

   
    {
View Full Code Here

    {
        Document    doc = new DocumentImpl();
        Element     rootEl = doc.createElement("Doc03RootElement");
        doc.appendChild(rootEl);

        Text        textNode = doc.createTextNode("Doc03 text stuff");
        Assertion.verify(rootEl.getFirstChild() == null);
        Assertion.verify(rootEl.getLastChild() == null);
        rootEl.appendChild(textNode);
        Assertion.verify(rootEl.getFirstChild() == textNode);
        Assertion.verify(rootEl.getLastChild() == textNode);
View Full Code Here

        Assertion.verify(rootEl.getFirstChild() == textNode);
        Assertion.verify(rootEl.getLastChild() == textNode);

        Assertion.verify(textNode.getNextSibling() == null);
        Assertion.verify(textNode.getPreviousSibling() == null);
        Text        textNode2 = doc.createTextNode("Doc03 text stuff");
        rootEl.appendChild(textNode2);
        Assertion.verify(textNode.getNextSibling() == textNode2);
        Assertion.verify(textNode2.getNextSibling() == null);
        Assertion.verify(textNode.getPreviousSibling() == null);
        Assertion.verify(textNode2.getPreviousSibling() == textNode);
View Full Code Here

        Document    doc = new DocumentImpl();
        Element     rootEl  = doc.createElement("RootElement");
        doc.appendChild(rootEl);


        Text        txt1 = doc.createTextNode("Hello Goodbye");
        rootEl.appendChild(txt1);

        txt1.splitText(6);
        rootEl.normalize();
View Full Code Here

    //                  that the problem stays fixed.
    //
   
    {
        Document     doc = new DocumentImpl();
        Text          tx = doc.createTextNode("Hello");
        Element       el = doc.createElement("abc");
        el.appendChild(tx);

        int     textLength = tx.getLength();
        Assertion.verify(textLength == 5);
View Full Code Here

        Element lastNameTag = doc.createElement(pTag.getLastNameTag());
        Element firstNameTag = doc.createElement(pTag.getFirstNameTag());
        Element genderTag = doc.createElement(pTag.getGenderTag());
        Element birthdayTag = doc.createElement(pTag.getDateOfBirthTag());

        if (p.getPersonId() != null) idTag.appendChild(doc.createTextNode(p.getPersonId()));
        if (p.getGroup() != null) groupTag.appendChild(doc.createTextNode(p.getGroup()));
        if (p.getLastName() != null) lastNameTag.appendChild(doc.createTextNode(p.getLastName()));
        if (p.getFirstName() != null) firstNameTag.appendChild(doc.createTextNode(p.getFirstName()));
        if (p.getGender() != null) genderTag.appendChild(doc.createTextNode(p.getGender()));
        if (p.getBirth() != null) birthdayTag.appendChild(doc.createTextNode(p.getBirth()));
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.