GetCapabilitiesXMLParser extends OWSCommonXMLAdapter { public GetCapabilities parse200() throws XMLParsingException { String updateSequence = rootElement.getAttributeValue( new QName( "updateSequence" ) ); String[] versions = getNodesAsStrings( rootElement, new XPath( "ows200:AcceptVersions/ows200:Version/text()", nsContext ) ); List<String> sections = parseSections( OWS200_PREFIX ); List<String> formats = parse200Formats(); List<String> languages = parse200Languages(); return new GetCapabilities( null, Arrays.asList( versions ), sections, formats, updateSequence, languages ); } GetCapabilitiesXMLParser();  GetCapabilitiesXMLParser( OMElement rootElement ); GetCapabilities parse100(); GetCapabilities parse110(); GetCapabilities parse200();  }
@Test public void testParsing200() { URL docURL = GetCapabilitiesXMLParserTest.class.getResource( "../capabilities/GetCapabilitiesOWS200.xml" ); GetCapabilitiesXMLParser parser = new GetCapabilitiesXMLParser(); parser.load( docURL ); GetCapabilities request = parser.parse200(); List<String> acceptVersions = request.getAcceptVersions(); assertThat( acceptVersions.size(), is( 3 ) ); assertThat( acceptVersions, hasItems( "1.0.0", "2.0.0", "1.1.0" ) ); Set<String> sections = request.getSections(); assertThat( sections.size(), is( 3 ) ); assertThat( sections, hasItems( "ServiceIdentification", "ServiceProvider", "OperationsMetadata" ) ); Set<String> acceptFormats = request.getAcceptFormats(); assertThat( acceptFormats.size(), is( 1 ) ); assertThat( acceptFormats, hasItems( "text/xml" ) ); List<String> acceptLanguages = request.getAcceptLanguages(); assertThat( acceptLanguages.size(), is( 2 ) ); assertThat( acceptLanguages, hasItems( "en", "de" ) ); assertThat( request.getUpdateSequence(), is( "2" ) ); }