• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parsing Strategies, Some advice if you'd be so kind

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm developing a system a part of which parses inputs from an XML file.

I've had a working XML SAX parser supplied by the latest version of the Xerxes Library, but it was scrappy and not particularly flexible.

I need to change the parser because I've changed part of the data structure in my program.

My problem is that because I have some tags in my XML document that have duplicate ID handles the original SAX parser isn't able to distinguish between them.

What I need is a strategy for implementing a SAX parser that "knows" what available actions it can perform in the context of the parent node, even if there are multiple tags with the same ID handle.

I thought about pushing the parent objects onto a stack and selecting the available actions based on a test using the 'instanceof' and then when the objects close setting them in their correct context but, between my loose understanding of the parsers data flow and getting the idea jumbled up in my head, I don't know if that would be an appropriate solution.

Would that be an appropriate solution, or is there a better one available to me? Or am I simply a gibbering moron?

I've considered a DOM parser, but I'm concerned about memory usage as other parts, and eventually threads, of the program will be hugely memory intensive when they're finally developed.

Cheers,

MLJ
 
reply
    Bookmark Topic Watch Topic
  • New Topic