Package org.w3c.dom

Examples of org.w3c.dom.Element.normalize()


            Element literalRoot = ((OAssign.Literal) from).xmlLiteral
                    .getDocumentElement();
            assert literalRoot.getLocalName().equals("literal");
            // We'd like a single text node...

            literalRoot.normalize();
            retVal = literalRoot.getFirstChild();

            // Adjust for whitespace before an element.
            if (retVal != null && retVal.getNodeType() == Node.TEXT_NODE
                    && retVal.getTextContent().trim().length() == 0
View Full Code Here


        collectionElement.setAttribute(ATTRIBUTE_TYPE, getType());
       
        collectionElement.setAttribute(ATTRIBUTE_HREF, getHref());

        collectionElement.normalize();

        NodeList emptyTextNodes = XPathAPI.selectNodeList(collectionElement, "text()");
        for (int i = 0; i < emptyTextNodes.getLength(); i++) {
            Node node = emptyTextNodes.item(i);
            node = collectionElement.removeChild(node);
View Full Code Here

    public License[] getLicenses() {
        Element licenses = getFirstChildElement(projectElement, LICENSES);
        if (licenses == null) {
            return new License[0];
        }
        licenses.normalize();
        List/*<License>*/ lics = new ArrayList();
        for (Iterator it = getAllChilds(licenses).iterator(); it.hasNext();) {
            Element license = (Element) it.next();
            if (LICENSE.equals(license.getNodeName())) {
                String name = getFirstChildText(license, LICENSE_NAME);
View Full Code Here

     */
    public Map/* <String,String> */getPomProperties() {
        Map pomProperties = new HashMap();
        Element propsEl = getFirstChildElement(projectElement, PROPERTIES);
        if (propsEl != null) {
            propsEl.normalize();
        }
        for (Iterator it = getAllChilds(propsEl).iterator(); it.hasNext();) {
            Element prop = (Element) it.next();
            pomProperties.put(prop.getNodeName(), getTextContent(prop));
        }
View Full Code Here

           
            QName nn = new QName("http://gizmos.com/orders/", "order");
            Iterator<Element> it = CastUtils.cast(detail.getChildElements(nn));
            assertTrue(it.hasNext());
            Element el = it.next();
            el.normalize();
            assertEquals("Quantity element does not have a value", el.getFirstChild().getNodeValue());
            el = it.next();
            el.normalize();
            assertEquals("Incomplete address: no zip code", el.getFirstChild().getNodeValue());
        }       
View Full Code Here

            assertTrue(it.hasNext());
            Element el = it.next();
            el.normalize();
            assertEquals("Quantity element does not have a value", el.getFirstChild().getNodeValue());
            el = it.next();
            el.normalize();
            assertEquals("Incomplete address: no zip code", el.getFirstChild().getNodeValue());
        }       
    }
   
    /*-------------------------------------------------------
 
View Full Code Here

           
            QName nn = new QName("http://gizmos.com/orders/", "order");
            Iterator<Element> it = CastUtils.cast(detail.getChildElements(nn));
            assertTrue(it.hasNext());
            Element el = it.next();
            el.normalize();
            assertEquals("Quantity element does not have a value", el.getFirstChild().getNodeValue());
            el = it.next();
            el.normalize();
            assertEquals("Incomplete address: no zip code", el.getFirstChild().getNodeValue());
        }       
View Full Code Here

            assertTrue(it.hasNext());
            Element el = it.next();
            el.normalize();
            assertEquals("Quantity element does not have a value", el.getFirstChild().getNodeValue());
            el = it.next();
            el.normalize();
            assertEquals("Incomplete address: no zip code", el.getFirstChild().getNodeValue());
        }       
    }
   
    /*-------------------------------------------------------
 
View Full Code Here

        NodeList sects = processor.selectNodeList(doc, elementXPath);
        getLogger().debug("## .. got "+sects.getLength()+" sections");
        for (int i=0; i<sects.getLength(); i++) {
            Element sect = (Element)sects.item(i);
            if (!sect.hasAttribute(this.idAttr)) {
                sect.normalize();
                getLogger().debug("## Using id XPath "+idXPath);
                String id = null;
                try {
                  id = processor.evaluateAsString(sect, idXPath).trim();
                } catch (Exception e) {
View Full Code Here

        getLogger().debug("## Using element XPath "+elementXPath);
        NodeList sects = processor.selectNodeList(doc, elementXPath);
        getLogger().debug("## .. got "+sects.getLength()+" sections");
        for (int i=0; i<sects.getLength(); i++) {
            Element sect = (Element)sects.item(i);
            sect.normalize();
            getLogger().debug("## Using id XPath "+idXPath);
            String id = null;
            try {
              id = processor.evaluateAsString(sect, idXPath);
              id.trim();
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.