Search in sources :

Example 96 with Node

use of org.w3c.dom.Node in project Signal-Android by WhisperSystems.

the class SmilDocumentImpl method getLayout.

public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;
    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }
    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
Also used : Node(org.w3c.dom.Node) SMILLayoutElement(org.w3c.dom.smil.SMILLayoutElement)

Example 97 with Node

use of org.w3c.dom.Node in project Signal-Android by WhisperSystems.

the class SmilDocumentImpl method getHead.

/*
     * SMILElement Interface
     */
public SMILElement getHead() {
    Node rootElement = getDocumentElement();
    Node headElement = rootElement.getFirstChild();
    if (headElement == null || !(headElement instanceof SMILElement)) {
        // The head doesn't exist. Create a new one.
        headElement = createElement("head");
        rootElement.appendChild(headElement);
    }
    return (SMILElement) headElement;
}
Also used : Node(org.w3c.dom.Node) SMILElement(org.w3c.dom.smil.SMILElement)

Example 98 with Node

use of org.w3c.dom.Node in project Signal-Android by WhisperSystems.

the class SmilDocumentImpl method getDocumentElement.

@Override
public SMILElement getDocumentElement() {
    Node rootElement = getFirstChild();
    if (rootElement == null || !(rootElement instanceof SMILElement)) {
        // The root doesn't exist. Create a new one.
        rootElement = createElement("smil");
        appendChild(rootElement);
    }
    return (SMILElement) rootElement;
}
Also used : Node(org.w3c.dom.Node) SMILElement(org.w3c.dom.smil.SMILElement)

Example 99 with Node

use of org.w3c.dom.Node in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.

the class GoogleDirection method getStartAddress.

public String getStartAddress(Document doc) {
    NodeList nl1 = doc.getElementsByTagName("start_address");
    Node node1 = nl1.item(0);
    if (isLogging)
        Log.i("GoogleDirection", "StartAddress : " + node1.getTextContent());
    return node1.getTextContent();
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node)

Example 100 with Node

use of org.w3c.dom.Node in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.

the class GoogleDirection method getTotalDistanceText.

public String getTotalDistanceText(Document doc) {
    NodeList nl1 = doc.getElementsByTagName("distance");
    Node node1 = nl1.item(nl1.getLength() - 1);
    NodeList nl2 = node1.getChildNodes();
    Node node2 = nl2.item(getNodeIndex(nl2, "text"));
    if (isLogging)
        Log.i("GoogleDirection", "TotalDuration : " + node2.getTextContent());
    return node2.getTextContent();
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node)

Aggregations

Node (org.w3c.dom.Node)2347 NodeList (org.w3c.dom.NodeList)1062 Element (org.w3c.dom.Element)720 Document (org.w3c.dom.Document)545 NamedNodeMap (org.w3c.dom.NamedNodeMap)333 ArrayList (java.util.ArrayList)318 DocumentBuilder (javax.xml.parsers.DocumentBuilder)202 IOException (java.io.IOException)176 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)147 Test (org.junit.Test)132 HashMap (java.util.HashMap)127 Attr (org.w3c.dom.Attr)126 SAXException (org.xml.sax.SAXException)107 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)98 HashSet (java.util.HashSet)86 InputSource (org.xml.sax.InputSource)75 XPath (javax.xml.xpath.XPath)70 List (java.util.List)67 File (java.io.File)62 ByteArrayInputStream (java.io.ByteArrayInputStream)57