|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Filtering XML to improve performance
> <root>
> <items>
> <onlyImportantItem>THIS</onlyImportantItem>
> <junkItem>foo</junkItem>
> <moreJunk>foo</moreJunk>
> <stillMoreJunk>foo</stillMoreJunk>
> </items>
> <items>
> <onlyImportantItem>THAT</onlyImportantItem>
> <junkItem>foo</junkItem>
> <moreJunk>foo</moreJunk>
> <stillMoreJunk>foo</stillMoreJunk>
> </items>
> ...
> ...
> ...
> </root>
>
>
> If I only mainly want to work with <onlyImportantItems>, is
> there a way that I can filter out all the other data I don't
> need when I do the transform?
>
> So for instance, I don't want the XML parser searching
> through all the garbage, I want it cut down to just the data
> I need. Can I do something like this at the beginning of all
> my xsl sheets?
One way is to use a SAXFilter in java to only 'pass through' the
elements you want. That way the xslt processor will only receive a
document that looks like:
<root>
<items>
<onlyImportantItem>THIS</onlyImportantItem>
</items>
<items>
<onlyImportantItem>THAT</onlyImportantItem>
</items>
...
This filtering pretty much costs nothing and you will end up with a much
smaller input document, which reduces memory use and increases speed.
cheers
andrew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








