Code example for Element

Methods: getLocalName, getNamespaceURI, getNodeName

0
                lname = lname.substring(idx+1);
            } 
        } 
 
 
        String docElemNS = docElem.getNamespaceURI();
        if ((docElemNS != nsURI) &&
            ((docElemNS == null) || (!docElemNS.equals(nsURI))))
            throw new IOException
                ("Root element namespace does not match that requested:\n" + 
                 "Requested: " + nsURI + "\n" +
                 "Found: " + docElemNS);
 
        if (docElemNS != null) {
            if (!docElem.getLocalName().equals(lname))
                throw new IOException
                    ("Root element does not match that requested:\n" + 
                     "Requested: " + lname + "\n" +
                     "Found: " + docElem.getLocalName());
        } else { 
            if (!docElem.getNodeName().equals(lname))
                throw new IOException
                    ("Root element does not match that requested:\n" + 
                     "Requested: " + lname + "\n" +
                     "Found: " + docElem.getNodeName());
        } 
 
        return ret;
    }