Code example for Element

Methods: getLocalName

0
     * @throws ParsingException 
     */ 
    private AbstractPolicy handleDocument(Document doc) throws ParsingException {
        // handle the policy, if it's a known type 
        Element root = doc.getDocumentElement();
        String name = root.getLocalName();
        // see what type of policy this is 
        if (name.equals("Policy")) {
            return Policy.getInstance(root);
        } else if (name.equals("PolicySet")) {
            return PolicySet.getInstance(root, policyFinder);
        } else { 
            // this isn't a root type that we know how to handle 
            throw new ParsingException("Unknown root document type: " + name);
        } 
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    public void warning(SAXParseException exception) throws SAXException {