Package javax.xml.xpath

Examples of javax.xml.xpath.XPath.evaluate()


      @Override
      protected TokenFilterFactory register(String name, TokenFilterFactory plugin) throws Exception {
        return null; // used for map registration
      }
    };
    filterLoader.load( loader, (NodeList)xpath.evaluate("./filter", node, XPathConstants.NODESET) );

    return new TokenizerChain(charFilters.toArray(new CharFilterFactory[charFilters.size()]),
        tokenizers.get(0), filters.toArray(new TokenFilterFactory[filters.size()]));
  };
View Full Code Here


    }
  }
 
  private Properties readProperties(Config cfg, Node node) throws XPathExpressionException {
      XPath xpath = cfg.getXPath();
      NodeList props = (NodeList) xpath.evaluate("property", node, XPathConstants.NODESET);
      Properties properties = new Properties();
      for (int i=0; i<props.getLength(); i++) {
        Node prop = props.item(i);
        properties.setProperty(DOMUtil.getAttr(prop, "name"), DOMUtil.getAttr(prop, "value"));
      }
View Full Code Here

    XPath xpath = xpathFactory.newXPath();
    try {
      String xstr=normalize(path);

      // TODO: instead of prepending /prefix/, we could do the search rooted at /prefix...
      Object o = xpath.evaluate(xstr, doc, type);
      return o;

    } catch (XPathExpressionException e) {
      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + path +" for " + name,e,false);
    }
View Full Code Here

   XPath xpath = xpathFactory.newXPath();
   Node nd = null;
   String xstr = normalize(path);

    try {
      nd = (Node)xpath.evaluate(xstr, doc, XPathConstants.NODE);

      if (nd==null) {
        if (errIfMissing) {
          throw new RuntimeException(name + " missing "+path);
        } else {
View Full Code Here

    final String analyzerName = DOMUtil.getAttr(attrs, "class");

    // check for all of these up front, so we can error if used in
    // conjunction with an explicit analyzer class.
    final XPath xpath = XPathFactory.newInstance().newXPath();
    final NodeList charFilterNodes = (NodeList) xpath.evaluate
      ("./charFilter",  node, XPathConstants.NODESET);
    final NodeList tokenizerNodes = (NodeList) xpath.evaluate
      ("./tokenizer", node, XPathConstants.NODESET);
    final NodeList tokenFilterNodes = (NodeList) xpath.evaluate
      ("./filter", node, XPathConstants.NODESET);
View Full Code Here

    // check for all of these up front, so we can error if used in
    // conjunction with an explicit analyzer class.
    final XPath xpath = XPathFactory.newInstance().newXPath();
    final NodeList charFilterNodes = (NodeList) xpath.evaluate
      ("./charFilter",  node, XPathConstants.NODESET);
    final NodeList tokenizerNodes = (NodeList) xpath.evaluate
      ("./tokenizer", node, XPathConstants.NODESET);
    final NodeList tokenFilterNodes = (NodeList) xpath.evaluate
      ("./filter", node, XPathConstants.NODESET);

    if (analyzerName != null) {
View Full Code Here

    final XPath xpath = XPathFactory.newInstance().newXPath();
    final NodeList charFilterNodes = (NodeList) xpath.evaluate
      ("./charFilter",  node, XPathConstants.NODESET);
    final NodeList tokenizerNodes = (NodeList) xpath.evaluate
      ("./tokenizer", node, XPathConstants.NODESET);
    final NodeList tokenFilterNodes = (NodeList) xpath.evaluate
      ("./filter", node, XPathConstants.NODESET);

    if (analyzerName != null) {

      // explicitly check for child analysis factories instead of
View Full Code Here

      // pass the config resource loader to avoid building an empty one for no reason:
      // in the current case though, the stream is valid so we wont load the resource by name
      final Config schemaConf = new Config(loader, "datatypeConfig", is, "/datatypeConfig/");
      final Document document = schemaConf.getDocument();
      final XPath xpath = schemaConf.getXPath();
      final Node nd = (Node) xpath.evaluate("/datatypeConfig/@name", document, XPathConstants.NODE);
      if (nd == null) {
        log.warn("datatypeConfig has no name!");
      }
      else {
        name = nd.getNodeValue();
View Full Code Here

          final Datatype dt = loader.newInstance(className, Datatype.class);
          dt.setDatatypeName(name);

          // An analyzer with type="index"
          String expression = "./analyzer[@type='index']";
          Node anode = (Node) xpath.evaluate(expression, node, XPathConstants.NODE);
          final Analyzer analyzer = AnalyzerConfigReader.readAnalyzer(anode,
            loader, luceneMatchVersion);
          if (analyzer != null) dt.setAnalyzer(analyzer);

          expression = "./analyzer[@type='query']";
View Full Code Here

          final Analyzer analyzer = AnalyzerConfigReader.readAnalyzer(anode,
            loader, luceneMatchVersion);
          if (analyzer != null) dt.setAnalyzer(analyzer);

          expression = "./analyzer[@type='query']";
          anode = (Node) xpath.evaluate(expression, node, XPathConstants.NODE);
          final Analyzer queryAnalyzer = AnalyzerConfigReader.readAnalyzer(anode,
            loader, luceneMatchVersion);
          if (queryAnalyzer != null) dt.setQueryAnalyzer(queryAnalyzer);

          return dt;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.