org.deegree.commons.xml.XPath类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.deegree.commons.xml.XPath类的一些代码示例,展示了XPath类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPath类的具体详情如下:
包路径:org.deegree.commons.xml.XPath
类名称:XPath

XPath介绍

[英]TODO add documentation here
[中]TODO在此处添加文档

代码示例

代码示例来源:origin: deegree/deegree3

private XPath getXPath( String attribute ) {
  return new XPath( "//" + CSW_202_PREFIX + ":TransactionResponse/" + CSW_202_PREFIX + ":TransactionSummary/"
           + CSW_202_PREFIX + ":" + attribute, nsContext );
}

代码示例来源:origin: deegree/deegree3

private AXIOMXPath getAXIOMXPath( XPath xpath )
            throws JaxenException {
  AXIOMXPath compiledXPath = new AXIOMXPath( xpath.getXPath() );
  compiledXPath.setNamespaceContext( xpath.getNamespaceContext() );
  return compiledXPath;
}

代码示例来源:origin: deegree/deegree3

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;
}

代码示例来源:origin: deegree/deegree3

private XPath getEOPath( String type ) {
  return new XPath( "./rim:RegistryObjectList/rim:ExtrinsicObject[@objectType='" + type + "']", ns );
}

代码示例来源:origin: deegree/deegree3

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;
}

代码示例来源:origin: deegree/deegree3

/**
   * @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;
  }
}

代码示例来源:origin: deegree/deegree3

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;
}

代码示例来源:origin: deegree/deegree3

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;
}

代码示例来源:origin: deegree/deegree3

private String parseOutputCRS( String defaultCRS ) {
  return getNodeAsString( rootElement, new XPath( "/" + WCS_PREFIX + ":GetCoverage/" + WCS_PREFIX + ":output/"
                          + WCS_PREFIX + ":crs", wcsNSContext ), defaultCRS );
}

代码示例来源:origin: deegree/deegree3

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 );
}

代码示例来源:origin: deegree/deegree3

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 );
}

代码示例来源:origin: deegree/deegree3

private String parseSRSName( OMElement envelope, String defaultSRS ) {
  return getNodeAsString( envelope, new XPath( "@srsName", wcsNSContext ), defaultSRS );
}

代码示例来源:origin: deegree/deegree3

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 );
}

代码示例来源:origin: deegree/deegree3

/**
 * 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" );
}

代码示例来源:origin: deegree/deegree3

@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;
}

代码示例来源:origin: deegree/deegree3

@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;
}

代码示例来源:origin: deegree/deegree3

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 );
}

代码示例来源:origin: deegree/deegree3

@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;
}

代码示例来源:origin: deegree/deegree3

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;
}

代码示例来源:origin: deegree/deegree3

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;
  }
}

相关文章