get Character Data From Element : Xml « Development « Android






get Character Data From Element

     
import org.w3c.dom.CharacterData;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

class Main {

  public static String getCharacterDataFromElement(Element e) {
    Node child = e.getFirstChild();
    if (child instanceof CharacterData) {
      CharacterData cd = (CharacterData) child;
      return cd.getData();
    }
    return "?";
  }
}

   
    
    
    
    
  








Related examples in the same category

1.Using xml resource
2.XML Resource Demo
3.Load style from styles.xml
4.Define PreferenceScreen in xml file
5.Using XML Parser
6.XML-defined adapters can be used to easily create adapters in your own application or to pass adapters to other processes.
7.Xml Parse
8.Xml Serializer Uri
9.Get Text Content from Xml Node
10.Escape un escape Xml
11.Get Xml node value with substring
12.Get value from Element
13.Get attribute value
14.Get field from NamedNodeMap
15.get Node Value With Attribute
16.update Xml