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 7669195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:32:27+00:00 2026-05-31T15:32:27+00:00

Suppose that… I have a complex XML schema, one that imports/includes other schema files,

  • 0

Suppose that…

  • I have a complex XML schema, one that imports/includes other schema files, which in turn import/include even more schema files.
  • I want to find all the elements in this XML schema that have a value (i.e., text node) that is declared to be of type QName.
  • I want the location (path) of these elements to be expressed as XPath statements (e.g., /foo/bar).

If I’m writing a Java application, what’s the right technology for this job? Is it a schema object model like XSOM? Is it the Java XPath API? Something else?

Edit: For those who want a jumpstart on accessing the SCM in Saxon (per Michael Kay’s recommendation below), here’s some Java code (sans exception handling):

// Load the XSD into Saxon
Processor processor = new Processor(true);
SchemaManager schemaManager = processor.getSchemaManager(); 
DocumentBuilder documentBuilder = processor.newDocumentBuilder();
SAXSource saxSource = new SAXSource(new InputSource("path/to/yourSchema.xsd"));
XdmNode schema = documentBuilder.build(saxSource);
schemaManager.load(saxSource);
// Export the SCM
XdmDestination destination = new XdmDestination();
schemaManager.exportComponents(destination);
XdmNode xdmNode = destination.getXdmNode();
System.out.println(xdmNode.toString());
  • 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-31T15:32:28+00:00Added an answer on May 31, 2026 at 3:32 pm

    Querying schema documents is a difficult thing to get right, because in XSD there are so many ways of saying the same thing: for example named model groups and attribute groups complicate your task considerably.

    If you’re looking for types derived from QName as well as QName itself, then it really gets quite difficult.

    Doing it on a “compiled” schema of some kind is therefore much easier than doing it on raw schema documents.

    Using XSOM is one approach, though it doesn’t have a query capability IIRC. Another approach is to use Saxon’s SCM output: this is a representation of the compiled “schema component model” in XML form; being the compiled schema you don’t have to worry about all the complexities of xs:include, xs:redefine, etc, while being XML means you can use XQuery on it. (I would recommend XQuery rather than XPath because there will be a lot of joins involved, including recursive joins for which you need user-defined functions.)

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

Sidebar

Related Questions

Suppose that you have two huge files (several GB) that you want to concatenate
suppose that you have two activities A(which is the main activity) and B when
Suppose that I have a multimap (which maps multiple values to a single key),
Suppose that i have 2 objects, where each one has a particular slot numbered
Suppose that I have a priority queue which removes elements in increasing order, and
Suppose that we have a System.Decimal number. For illustration, let's take one whose ToString()
Suppose that your domain is domain.com and you have the following directories and files
Suppose that I have a table with the following schema: tableId field1 field2 .....
Suppose that two tables exist: users and groups . How does one provide simple
Suppose that I have a Java program within an IDE (Eclipse in this case).

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.