Search in sources :

Example 21 with CharacterData

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

the class NamespaceHandler method getTextValue.

private static String getTextValue(Element element) {
    StringBuilder value = new StringBuilder();
    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

CharacterData (org.w3c.dom.CharacterData)21 Node (org.w3c.dom.Node)15 NodeList (org.w3c.dom.NodeList)15 Comment (org.w3c.dom.Comment)10 EntityReference (org.w3c.dom.EntityReference)10 Element (org.w3c.dom.Element)8 Document (org.w3c.dom.Document)5 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 org.apache.aries.blueprint (org.apache.aries.blueprint)1 SVGStylableElement (org.apache.batik.anim.dom.SVGStylableElement)1 GenericCDATASection (org.apache.batik.dom.GenericCDATASection)1 GenericText (org.apache.batik.dom.GenericText)1 Attr (org.w3c.dom.Attr)1