Android XML Document to String Convert numResults(Document doc)

Here you can find the source of numResults(Document doc)

Description

num Results

Declaration

public static int numResults(Document doc) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    public static int numResults(Document doc) {
        Node results = doc.getDocumentElement();
        int res = -1;

        try {//from  ww  w.ja  v  a  2  s  . c  om
            res = Integer.valueOf(results.getAttributes()
                    .getNamedItem("count").getNodeValue());
        } catch (Exception e) {
            res = -1;
        }

        return res;
    }
}

Related

  1. toXML(Document document)
  2. getXml(Document doc)
  3. documentToString(Node n)
  4. getErrorText(Document xml)
  5. xmlDocumentToString(Document document)
  6. xmlToString(Document doc)