[jdom-interest] SAXBuilder again [better formatting]
Todd O'Bryan
toddobryan at mac.com
Thu Aug 9 07:48:12 PDT 2001
My guess is that using SAX is going to be more efficient. JDOM holds the
document model in memory, and while a JDOM model is considerably less
memory intensive than a DOM model, it's still going to take a lot of
space. In addition, since you have to use a SAX parser anyway to create
the JDOM object, why not just skip the extra step.
As I said, that's my guess. If someone more in-the-know can correct any
misconceptions on my part, I'd appreciate it.
Todd
On Wednesday, August 8, 2001, at 11:23 PM, Mujahid Ali wrote:
> Hi.
>
> I have an xml document that contains sql queries in form of processing
> instructions.
> I want to read in the document, run the queries contained by the PIs and
> replace the PI
> with data returned by the queries.
>
>
>
> So if we have this:
>
> <interface>
> <filter_criteria>
> <field name="test">
> <?query sql="SELECT * from x"?>
> </field>
> <field name="test2">
> <?query sql="SELECT * FROM y"?>
> </field>
> </filter_criteria>
> </interface>
>
>
>
> after processing the above document we would have
>
>
>
> <interface>
> <filter_criteria>
> <field name="test">
> <values>
> <value>1</value>
> <value>2</value>
> </values>
> </field>
> <field name="test2">
> <values>
> <value>1</value>
> <value>2</value>
> </values>
> </field>
> </filter_criteria>
> </interface>
>
>
>
> I can accomplish this by building my own Content Handler and capturing
> the callbacks using SAX. So as I
> start to read the file using SAX, I can write another one out. So this
> way the new file will contain the
> original xml structure + the new data fetched by the sql queries.
>
>
>
> Alternatively, I can use the SAXBuilder to build a JDOM document,
> traverse through each element looking
> for PIs and handling them appropriately.
>
>
>
> My question is if the xml file is really big, like let’s say 1 MB, which
> way would be more efficient? I don’t really understand what a JDOM
> Document is so hoping that maybe some one can help me out.
>
> Regards,
>
> Mujahid Ali
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-
> interest/youraddr at yourhost.com
More information about the jdom-interest
mailing list