Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:12:43+00:00 2026-05-30T13:12:43+00:00

I am trying to parse some xml with saxon to make some xpath querying

  • 0

I am trying to parse some xml with saxon to make some xpath querying on it but got 2 problems : the first one is that saxon is very long to build a very short document in xhtml.
code is this :

Processor processorInstance = new Processor(false);
    processorInstance.setConfigurationProperty(FeatureKeys.DTD_VALIDATION, false);


    XPathCompiler XPathCompilerInstance = processorInstance.newXPathCompiler();
    XPathCompilerInstance.setBackwardsCompatible(false);

    String expressionTitre = "//div[@class='score_global']/preceding-sibling::img[1]";

    XPathExecutable XPathExecutableInstance = XPathCompilerInstance.compile(expressionTitre);
    XPathSelector selector = XPathExecutableInstance.load();
    logger.info("Xpath compiled.");

    // Phase 2, load xml document.
    DocumentBuilder documentBuilderInstance = processorInstance.newDocumentBuilder();
    documentBuilderInstance.setSchemaValidator(null);
    documentBuilderInstance.setLineNumbering(false);
    documentBuilderInstance.setRetainPSVI(false);


    XdmNode context = documentBuilderInstance.build(new File("sample/sample.xml")); // This line takes ages to return.

What I don’t understand is that if I do it with SAX, it loads at normal speed :(.
What did I forget to provide in saxon ?

Java 1.6
Saxon 9.1.0.8

Second problem is that he is unable to process accented characters while my xml was like this:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

So I removed xml:lang en lang= attributes but got no better luck 🙁

Do you have any ideas ?
Thank you !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:12:44+00:00Added an answer on May 30, 2026 at 1:12 pm

    Well After much reading, it was simply necessary to define a CatalogResolver and downloading locally the Xhtml dtds. I dropped saxon and used simple JaxP/SaxReader instead.

    This page http://xml.apache.org/commons/components/resolver/resolver-article.html proved very interesting.

    Hope this considerations will prove themselves useful to someone 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse one XML file that contains some unicode characters.I tried
Trying to parse some XML but apparently this is too much for a lazy
I've been trying to parse some huge XML files that LXML won't grok, so
I am trying to parse some XML that looks similar to this: <document> <headings>
I'm trying to parse some xml and i'm getting a NullPointerException but i can't
I'm trying to parse some of my first XML documents in SAX by simply
I have the following XML code that I'm trying to parse, but I'm sure
I am trying to use XDocument.Parse(string s) to parse some XML that is being
I'm trying to use BeautifulSoup to parse some XML that looks like <a> <b>
I am trying to parse some text from a xml. But text contains enter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.