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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:48:53+00:00 2026-05-25T17:48:53+00:00

I have an XML file that I am trying to parse with Sax (this

  • 0

I have an XML file that I am trying to parse with Sax (this is my first time doing this). I’ve researched how to implement the parser, and that all makes sense, but I’m unsure of the best way to tackle this problem.

I have scattered pieces of related data (two Facts are associated by a FactKey). In the example below, Foo has a value of 5.34.

Sax calls StartElement() on every new element, so that is one call for Facts and one call for Value….so my questions are: Do I have to store FactKey from the Facts element so I can associate it with the Value element on the next pass, or is there a way for Sax to do that automatically?

And is there any facility built in for associating two different Facts with the same FactKey, perhaps if I used DOM instead of Sax? Or is that just wishful thinking, and I actually just need to maintain a multimap or something.

 ...
    <Facts FactKey="2832154551" FieldId="73250">
    <Value xsi:type="xs:double">5.3499999</Value>
    </Facts>
    ...
    <Facts FactKey="2832154551" FieldId="410288">
    <Value xsi:type="xs:string">Foo</Value>
    </Facts>
  • 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-25T17:48:53+00:00Added an answer on May 25, 2026 at 5:48 pm

    For your first question: yes, you have to maintain any context that is used by the parser (ie, you have to keep track of the fact that you are in/not-in a Facts element).

    As for associating different Fact elements by key, yes, with caveats. You can load the file into DOM (assuming that you have enough memory), then use XPath to extract all elements with a specific FactKey.

    //Facts[@FactKey="2832154551"]
    

    However, if you want to read the file and accumulate Facts with the same key, then a multimap is your best bet. A DOM parser may still be useful, as you could have a multimap that associates the string keys to Element values.

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

Sidebar

Related Questions

I have an XML file that I'm trying to parse with Linq-to-XML. One of
I am trying to parse a xml file that i have (using javascript DOM).
I have this XML file that I parse into its elements and create a
I have a weird XML file that I'm trying to parse. <Data> <Row> <Field
I am trying to parse an XML file so that I get all of
I'm trying to parse an xml file that contains accents, but I get this
I have an XML file that I'm trying to serialize into an object. Some
So I have an XML file that I am trying to loop through in
I have a really simple XML file that I'm trying to read, but I
i have a coode that are trying to get the id of xml file

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.