private XPath getXPath( String attribute ) { return new XPath( "//" + CSW_202_PREFIX + ":TransactionResponse/" + CSW_202_PREFIX + ":TransactionSummary/" + CSW_202_PREFIX + ":" + attribute, nsContext ); }
private AXIOMXPath getAXIOMXPath( XPath xpath ) throws JaxenException { AXIOMXPath compiledXPath = new AXIOMXPath( xpath.getXPath() ); compiledXPath.setNamespaceContext( xpath.getNamespaceContext() ); return compiledXPath; }
private AXIOMXPath getAsXPath( ValueReference propName ) throws JaxenException { AXIOMXPath path; XPath xPathFromCQP = ISOCQPMapping.getXPathFromCQP( propName.getAsQName(), getType() ); if ( xPathFromCQP != null ) path = new AXIOMXPath( xPathFromCQP.getXPath() ); else path = new AXIOMXPath( propName.getAsText() ); path.setNamespaceContext( ns ); return path; }
private XPath getEOPath( String type ) { return new XPath( "./rim:RegistryObjectList/rim:ExtrinsicObject[@objectType='" + type + "']", ns ); }
public static List<QName> extractQNames( XPath xpath ) { List<QName> list = new ArrayList<QName>(); try { Expr expr = new BaseXPath( xpath.getXPath(), null ).getRootExpr(); if ( expr instanceof LocationPath ) { LocationPath lp = (LocationPath) expr; for ( Object o : lp.getSteps() ) { findQName( list, (Step) o, xpath.getNamespaceContext() ); } } } catch ( JaxenException e ) { // not a proper xpath } return list; }
/** * @return */ private List<String> parseSections() { String section = getNodeAsString( rootElement, new XPath( "/" + WCS_PREFIX + "GetCapabilities/" + WCS_PREFIX + ":section", nsContext ), "/" ); List<String> result = new ArrayList<String>( 1 ); result.add( section ); return result; } }
private List<String> parse200Languages() { List<OMElement> languageElements = getElements( rootElement, new XPath( "ows200:AcceptLanguages/ows200:Language", nsContext ) ); List<String> languages = new ArrayList<String>(); for ( OMElement languageElement : languageElements ) { String language = languageElement.getText(); languages.add( language ); } return languages; }
private List<String> parse200Formats() { List<OMElement> formatElements = getElements( rootElement, new XPath( "ows200:AcceptFormats/ows200:OutputFormat", nsContext ) ); List<String> formats = new ArrayList<String>( formatElements.size() ); for ( OMElement formatElement : formatElements ) { formats.add( formatElement.getText() ); } return formats; }
private String parseOutputCRS( String defaultCRS ) { return getNodeAsString( rootElement, new XPath( "/" + WCS_PREFIX + ":GetCoverage/" + WCS_PREFIX + ":output/" + WCS_PREFIX + ":crs", wcsNSContext ), defaultCRS ); }
private BBoxOutputType parseBBoxOutput( OMElement bboxData, CodeType id, LanguageString outputTitle, LanguageString outputAbstract ) { XPath xpath = new XPath( "Default/CRS", nsContext ); String defaultCrs = omResponse.getElement( bboxData, xpath ).getText(); xpath = new XPath( "Supported/CRS", nsContext ); List<OMElement> omSupported = omResponse.getElements( bboxData, xpath ); String[] supportedCrs = new String[omSupported.size()]; for ( int i = 0; i < omSupported.size(); i++ ) { supportedCrs[i] = omSupported.get( i ).getText(); } return new BBoxOutputType( id, outputTitle, outputAbstract, defaultCrs, supportedCrs ); }
private BBoxInputType parseBBoxData( OMElement input, CodeType id, LanguageString inputTitle, LanguageString inputAbstract, String minOccurs, String maxOccurs ) { XPath xpath = new XPath( "Default/CRS", nsContext ); String defaultCRS = omResponse.getElement( input, xpath ).getText(); xpath = new XPath( "Supported/CRS", nsContext ); List<OMElement> omSupported = omResponse.getElements( input, xpath ); String[] supportedCRSs = new String[omSupported.size()]; for ( int i = 0; i < omSupported.size(); i++ ) { supportedCRSs[i] = omSupported.get( i ).getText(); } return new BBoxInputType( id, inputTitle, inputAbstract, minOccurs, maxOccurs, defaultCRS, supportedCRSs ); }
private String parseSRSName( OMElement envelope, String defaultSRS ) { return getNodeAsString( envelope, new XPath( "@srsName", wcsNSContext ), defaultSRS ); }
public ResolveParams parseStandardResolveParameters110( OMElement requestEl ) { String traverseXlinkDepth = getNodeAsString( rootElement, new XPath( "@traverseXlinkDepth", nsContext ), null ); String traverseXlinkExpiryStr = getNodeAsString( rootElement, new XPath( "@traverseXlinkExpiry", nsContext ), null ); BigInteger resolveTimeout = null; if ( traverseXlinkExpiryStr != null ) { resolveTimeout = new BigInteger( traverseXlinkExpiryStr ).multiply( BigInteger.valueOf( 60 ) ); } return new ResolveParams( null, traverseXlinkDepth, resolveTimeout ); }
/** * Returns whether the record is a service metadata record. * <ul> * <li>Data Metadata: /gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue='dataset' (or missing) or 'series' or * 'application'</li> * <li>Service Metadata: /gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue='service'</li> * </ul> * * @return <code>true</code>, if the record is a service metadata record, <code>false</code> otherwise (implies data * metadata record) */ public boolean isServiceRecord() { XPath xpath = new XPath( "gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue", ns ); String scopeCode = getStringFromXPath( xpath ); // TODO should this check be more fail safe? return scopeCode != null && scopeCode.equals( "service" ); }
@Override public List<WFSFeatureType> parseFeatureTypeList() { List<OMElement> ftEls = getElements( rootElement, new XPath( "wfs:FeatureTypeList/wfs:FeatureType", nsContext ) ); List<WFSFeatureType> fts = new ArrayList<WFSFeatureType>( ftEls.size() ); for ( OMElement ftEl : ftEls ) { fts.add( parseFeatureType( ftEl ) ); } return fts; }
@Override public List<WFSFeatureType> parseFeatureTypeList() { List<OMElement> ftEls = getElements( rootElement, new XPath( "wfs:FeatureTypeList/wfs:FeatureType", nsContext ) ); List<WFSFeatureType> fts = new ArrayList<WFSFeatureType>( ftEls.size() ); for ( OMElement ftEl : ftEls ) { fts.add( parseFeatureType( ftEl ) ); } return fts; }
private StoredQuery parseStoredQuery200( OMElement queryEl ) { // <xsd:attribute name="handle" type="xsd:string"/> String handle = getNodeAsString( queryEl, new XPath( "@handle", nsContext ), null ); // <xsd:attribute name="id" type="xsd:anyURI" use="required"/> String id = getRequiredNodeAsString( queryEl, new XPath( "@id", nsContext ) ); // <xsd:element name="Parameter" type="wfs:ParameterType" minOccurs="0" maxOccurs="unbounded"/> Map<String, OMElement> paramToValue = new HashMap<String, OMElement>(); List<OMElement> paramEls = getElements( queryEl, new XPath( "wfs200:Parameter", nsContext ) ); for ( OMElement paramEl : paramEls ) { String paramName = getRequiredNodeAsString( paramEl, new XPath( "@name", nsContext ) ); paramToValue.put( paramName.toUpperCase(), paramEl ); } return new StoredQuery( handle, id, paramToValue ); }
@Override public List<String> parseLanguages() { OMElement languagesEl = getElement( getRootElement(), new XPath( "ows:Languages", nsContext ) ); if ( languagesEl == null ) { return null; } String[] langs = getNodesAsStrings( languagesEl, new XPath( "ows:Language", nsContext ) ); List<String> languages = new ArrayList<String>(); for ( String language : langs ) { languages.add( language ); } return languages; }
private List<Pair<String, String>> parseIdentifiers( OMElement lay ) { List<Pair<String, String>> identifiers = new ArrayList<Pair<String, String>>(); List<OMElement> identiferElements = getElements( lay, new XPath( getPrefix() + "Identifier", nsContext ) ); for ( OMElement identifierElement : identiferElements ) { String id = identifierElement.getText(); if ( id != null && id.length() > 0 ) { String authority = getNodeAsString( identifierElement, new XPath( "@authority" ), null ); identifiers.add( new Pair<String, String>( id, authority ) ); } } return identifiers; }
private List<QName> parseFeatureTypes( OMElement el ) { String returnFtsStr = getRequiredNodeAsString( el, new XPath( "@returnFeatureTypes", nsContext ) ).trim(); if ( "".equals( returnFtsStr ) ) return new ArrayList<QName>(); String[] tokens = StringUtils.split( returnFtsStr, " " ); if ( tokens.length == 1 && "${deegreewfs:ServedFeatureTypes}".equals( tokens[0] ) ) return new ArrayList<QName>(); List<QName> returnFtNames = new ArrayList<QName>( tokens.length ); for ( String token : tokens ) { returnFtNames.add( parseQName( token, el ) ); } return returnFtNames; } }