Search in sources :

Example 21 with Comment

use of org.w3c.dom.Comment in project aries by apache.

the class Parser method getTextValue.

private static String getTextValue(Element element) {
    StringBuffer value = new StringBuffer();
    NodeList nl = element.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
        Node item = nl.item(i);
        if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
            value.append(item.getNodeValue());
        }
    }
    return value.toString();
}
Also used : Comment(org.w3c.dom.Comment) CharacterData(org.w3c.dom.CharacterData) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) EntityReference(org.w3c.dom.EntityReference)

Example 22 with Comment

use of org.w3c.dom.Comment in project karaf by apache.

the class NamespaceHandler method getTextValue.

private static String getTextValue(Element element) {
    StringBuffer value = new StringBuffer();
    NodeList nl = element.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
        Node item = nl.item(i);
        if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
            value.append(item.getNodeValue());
        }
    }
    return value.toString();
}
Also used : Comment(org.w3c.dom.Comment) CharacterData(org.w3c.dom.CharacterData) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) EntityReference(org.w3c.dom.EntityReference)

Aggregations

Comment (org.w3c.dom.Comment)22 Node (org.w3c.dom.Node)14 NodeList (org.w3c.dom.NodeList)13 Element (org.w3c.dom.Element)9 EntityReference (org.w3c.dom.EntityReference)8 CharacterData (org.w3c.dom.CharacterData)7 Document (org.w3c.dom.Document)7 DocumentType (org.w3c.dom.DocumentType)2 ProcessingInstruction (org.w3c.dom.ProcessingInstruction)2 Text (org.w3c.dom.Text)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 StringReader (java.io.StringReader)1 Enumeration (java.util.Enumeration)1 InvalidPropertiesFormatException (java.util.InvalidPropertiesFormatException)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1