Re: [xml] "Proper" way to use XML (not library specific)



Hi Will,

"Will Sappington" <wsappington ndma us> writes:

In response to my troubles, my manager is saying that the problem is with
how I'm trying to use XML, not with the library.  He says XPath is not
appropriate for this, that I should "marshal" the entire XML file into a
different form, toss the DOM, and operate on the transformed data.

This is usually a good approach for the following reasons:

1. The same information takes less memory. DOM stores everything
   as text. In your data structure you can store things as int's,
   etc.

2. In DOM everything is stored in lists. In your data structure
   you can use maps and sets which will speed up lookups
   significantly. This seems especially true for your case.

3. Custom data structure will be "domain-specific" and thus easier
   to use compared to DOM.


What this is called is marshaling the data. If you want, you could
download an evaluation copy of an XML tool and it would generate the
code to do all that for you.

Or you can grab an open-source one (a little plug ;-)):

http://codesynthesis.com/products/xsd/


hth,
-boris


-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]