Code example for Document

Methods: getDocumentElement, getElementsByTagName

0
        dataDirectory.addPropertiesType(name, properties, extra);
    } 
 
    public void testAliasFifteen() throws Exception { 
        Document doc = getAsDOM("wfs?request=GetFeature&typename=cdf:ft15&version=1.0.0&service=wfs");
        assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());
 
        assertTrue(doc.getElementsByTagName("gml:featureMember").getLength() > 0);
        assertTrue(doc.getElementsByTagName("cdf:ft15").getLength() > 0);
    } 
     
    public void testGetByFeatureId() throws Exception { 
        Document doc = getAsDOM("wfs?request=GetFeature&typename=cdf:ft15&version=1.0.0&featureId=ft15.1");
        assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());
 
        assertEquals(1, doc.getElementsByTagName("gml:featureMember").getLength());
        final NodeList features = doc.getElementsByTagName("cdf:ft15");
        assertEquals(1, features.getLength());
        Node feature = features.item(0);
        final Node fidNode = feature.getAttributes().getNamedItem("fid");
        assertEquals("ft15.1", fidNode.getTextContent());