function exampleDom = getExampleDom(metadataNumber, examplesXml)
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    dbf = DocumentBuilderFactory.newInstance();
    db = dbf.newDocumentBuilder();
    exampleDom = db.newDocument();

    dom = xmlread(examplesXml);
    factory = javax.xml.xpath.XPathFactory.newInstance;
    xpath = factory.newXPath;
    bySource = '/demos/demoitem[metadata/text()=''%s'']/metadata/text()';
    expression = xpath.compile(sprintf(bySource,metadataNumber));
    
    NODESET = javax.xml.xpath.XPathConstants.NODESET;
    nodeList = expression.evaluate(dom,NODESET);
    if nodeList.getLength == 1
        parentNode = nodeList.item(0).getParentNode().getParentNode();
        copy = exampleDom.importNode(parentNode, true);
        exampleDom.appendChild(copy);
    else 
        error(em('ExampleNotFound',metadataNumber,examplesXml))
    end
end