Package org.jdom2.xpath

Examples of org.jdom2.xpath.XPathFactory


    }

    @Override
    public HierarchicalStreamReader createReader(final Reader reader) {
        try {
            final SAXBuilder builder = new SAXBuilder();
            final Document document = builder.build(reader);
            return new JDom2Reader(document, getNameCoder());
        } catch (final IOException e) {
            throw new StreamException(e);
        } catch (final JDOMException e) {
            throw new StreamException(e);
View Full Code Here


    }

    @Override
    public HierarchicalStreamReader createReader(final InputStream in) {
        try {
            final SAXBuilder builder = new SAXBuilder();
            final Document document = builder.build(in);
            return new JDom2Reader(document, getNameCoder());
        } catch (final IOException e) {
            throw new StreamException(e);
        } catch (final JDOMException e) {
            throw new StreamException(e);
View Full Code Here

    }

    @Override
    public HierarchicalStreamReader createReader(final URL in) {
        try {
            final SAXBuilder builder = new SAXBuilder();
            final Document document = builder.build(in);
            return new JDom2Reader(document, getNameCoder());
        } catch (final IOException e) {
            throw new StreamException(e);
        } catch (final JDOMException e) {
            throw new StreamException(e);
View Full Code Here

    }

    @Override
    public HierarchicalStreamReader createReader(final File in) {
        try {
            final SAXBuilder builder = new SAXBuilder();
            final Document document = builder.build(in);
            return new JDom2Reader(document, getNameCoder());
        } catch (final IOException e) {
            throw new StreamException(e);
        } catch (final JDOMException e) {
            throw new StreamException(e);
View Full Code Here

    protected List<String> trans = null;

    public KeyboardLayout(InputStream is) throws Exception
    {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(is);
        loadData(document.getRootElement());
    }
View Full Code Here

    this.annotatorNames = annotatorNames;
  }

  public Collection<KnowtatorAnnotation> parse(URI knowtatorXML) throws JDOMException, IOException {

    Element annotationsElem = new SAXBuilder().build(knowtatorXML.toURL()).getRootElement();

    // parse <annotation> elements
    Set<String> ignoredAnnotators = new HashSet<String>();
    Map<String, KnowtatorAnnotation> annotations = new HashMap<String, KnowtatorAnnotation>();
    for (Element annotationElem : annotationsElem.getChildren("annotation")) {
View Full Code Here

   * @param url Target URL.
   * @return The HTML document.
   * @throws Exception
   */
  Document loadURL(URL url) throws Exception{
    SAXBuilder builder=new SAXBuilder();
    Document xml=null;
    HttpURLConnection con=(HttpURLConnection) url.openConnection();
    con.setInstanceFollowRedirects(true);
   
    InputStream in;
    try
    {
       in = con.getInputStream();
    }
    catch(Exception e)
    {
      in=con.getErrorStream();
    }
    String encoding = con.getContentEncoding();
    encoding = encoding == null ? "UTF-8" : encoding;
    if(encoding.equals("gzip"))
    {
      in=new GZIPInputStream(con.getInputStream());
      encoding="UTF-8";
    }
   
    String body = IOUtils.toString(in, encoding).replace(" & ", "&amp;");
    for(int i=0;i<this.attempts;i++)
    {
      try
      {
        xml=(Document) builder.build(new StringReader(body));
        i+=this.attempts+1;
      }
      catch(JDOMParseException ex)
      {
        int line=ex.getLineNumber();
View Full Code Here

  /**
   *
   */
  private void openSQList()
  {
    SAXBuilder sxb = new SAXBuilder();
    try {
      this.root = sxb.build(new File(SQCalculator.xmlPath)).getRootElement();
    } catch (JDOMException | IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

   * @param lang A formated tag language (<b>Ex : </b>Fr-FR, En-EN). Use locale.toLanguageTag() method to be sure of your parameter.
   * </b>
   */
  private void openLangFile()
  {
    SAXBuilder sxb = new SAXBuilder();
    try {
      this.root = sxb.build(new File(Language.xmlPath)).getRootElement();
      this.openLocaleLang();
    } catch (JDOMException | IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      {
        System.out.println("-----------Checking file: "+file.getName()+ " "+String.valueOf(x)+"/"+String.valueOf(files.size())+"--------------");
        x++;
        try
        {
          SAXBuilder builder=new SAXBuilder();
          Document xml=(Document)builder.build(file);
          ArrayList<Element> words=new ArrayList<Element>();
          for(Element word:xml.getDescendants(new ElementFilter("wf")))
            words.add(word);
          for(int w=0;w<words.size();w++)
          {
View Full Code Here

TOP

Related Classes of org.jdom2.xpath.XPathFactory

Copyright © 2018 www.massapicom. 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.