Code example for Node

Methods: getChildNodes

0
     */ 
    public static ObligationExpressions getInstance(Node root, PolicyMetaData metaData) throws ParsingException {
 
        Set<ObligationExpression> obligationExpressions = new HashSet<ObligationExpression>();
 
        NodeList children = root.getChildNodes();
 
        for(int i = 0; i < children.getLength(); i ++){
            Node child = children.item(i);
            if("ObligationExpression".equals(DOMHelper.getLocalName(child))){
                obligationExpressions.add(ObligationExpression.getInstance(child, metaData));    
            } 
        } 
 
        if(obligationExpressions.isEmpty()){
            throw new ParsingException("ObligationExpressions must contain at least one " + 
                    "ObligationExpression");             
        } 
 
        return new ObligationExpressions(obligationExpressions);
    }