Seems to me that a databinding framwork such as JAXB2 [1] or JiBX [2] would work
nicely for this, assuming you have a schema for the document.


[1] http://jaxb.java.net/
[2] http://jibx.sourceforge.net/

Jake

On 12/15/2011 11:56 AM, kesh...@us.ibm.com wrote:
> There are a number of good tutorials on XML programming in Java at
> http://www.ibm.com/xml, along with a lot of articles on more specific
> techniques. For basic "how do I get started" questions, I'd recommend
> reading some of those.
> 
> XML itself is a strict tree structure, with the only "links" being the
> parent/child/attribute/previous/next relationships. The ID/IDREF
> relationship may also exist, IF the kind of document you're working with
> uses it. It's also possible that some kinds of documents define their
> own relationships. You need to understand how the specific XML-based
> language(s) you'll be working with behave if you want to extract these,
> and/or use XML Schema datatypes to help interpret them.
> 
> If you want an XML-specific in-memory datastructure, the DOM is an
> obvious one to work with since it's already implemented; you might need
> some additional datastructures to support the applicaiton-specific
> relationships. Or you can code your own, for your specific application,
> and write a SAX handler (see the tutorials) to build it ... but that's a
> straight Java data structure and UI problem, and I'd consider that
> mostly offtopic for this list.
> 
> 
> 
> ______________________________________
> "You build world of steel and stone
> I build worlds of words alone
> Skilled tradespeople, long years taught:
> You shape matter; I shape thought."
> (http://www.songworm.com/lyrics/songworm-parody/ShapesofShadow.html)
> 
> 
> From:         "alessandra.brind...@virgilio.it" 
> <alessandra.brind...@virgilio.it>
> To:   j-users@xerces.apache.org,
> Date:         12/14/2011 11:08 PM
> Subject:      Data graph from xml document
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 
>  Hello, I have to implement the Data Graph in Java from an XML document.
> For example, having the following document:
> 
> <movie>
> <title> Hello </ title>
> <actors>
> <actor> Brad Pitt </ actor>
> <actor> George Clooney </ actor>
> </actors>
> </movie>
> 
> we must build an internal representation of the document in the form of
> a graph, where elements are represented as nodes and links between
> elements such as arches. Then I have to navigate through the graph to
> process the data. I wanted to understand what are the most efficient
> structures for the representation of a graph, ie Hashtable, matrices,
> etc. ...
> In addition, you have to give me some suggestions on how I can use the
> sax parser to construct the structure graph?

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to