You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Thorsten Scherler <th...@apache.org> on 2008/02/05 00:52:01 UTC

How can I create a w3c nodeset for xsl without DOM?

Hi all,

recent threads have shown the dispatcher needs to reduce memory usage.

One impact is the usage of <forrest:property> in contracts:

https://svn.apache.org/repos/asf/forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/helper/ContractHelperStAX.java
// It seems that the only way to pass a xml file to a xsl as param
// is as DOM
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
for (Iterator iter = param.keySet().iterator(); iter.hasNext();) {
  String key = (String) iter.next();
  File value = (File) param.get(key);
  transformer.setParameter(key, builder.parse(value));
}

Meaning, having many properties has a negative effect on memory consumption.

Is there a more memory less approach to pass properties to the xsl?

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: How can I create a w3c nodeset for xsl without DOM?

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2008-02-04 at 20:39 -0500, Tim Williams wrote:
> On Feb 4, 2008 6:52 PM, Thorsten Scherler <th...@apache.org> wrote:
> > Hi all,
> >
> > recent threads have shown the dispatcher needs to reduce memory usage.
> >
> > One impact is the usage of <forrest:property> in contracts:
> >
> > https://svn.apache.org/repos/asf/forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/helper/ContractHelperStAX.java
> > // It seems that the only way to pass a xml file to a xsl as param
> > // is as DOM
> > DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
> > for (Iterator iter = param.keySet().iterator(); iter.hasNext();) {
> >   String key = (String) iter.next();
> >   File value = (File) param.get(key);
> >   transformer.setParameter(key, builder.parse(value));
> > }
> >
> > Meaning, having many properties has a negative effect on memory consumption.
> >
> > Is there a more memory less approach to pass properties to the xsl?
> 
> Can you just use XSL's document() function combined with
> xalan:nodeset() to do it in pure xsl or does it need to be passed in
> code?

document() has a similar negative effect AFAIK and we need to pass the
properties configuration from the structurer to the contract.  Meaning
we need to pass it from the java code.

Thanks for your thoughts.

salu2

> --tim
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: How can I create a w3c nodeset for xsl without DOM?

Posted by Tim Williams <wi...@gmail.com>.
On Feb 4, 2008 6:52 PM, Thorsten Scherler <th...@apache.org> wrote:
> Hi all,
>
> recent threads have shown the dispatcher needs to reduce memory usage.
>
> One impact is the usage of <forrest:property> in contracts:
>
> https://svn.apache.org/repos/asf/forrest/trunk/whiteboard/dispatcher/java/org/apache/forrest/dispatcher/helper/ContractHelperStAX.java
> // It seems that the only way to pass a xml file to a xsl as param
> // is as DOM
> DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
> for (Iterator iter = param.keySet().iterator(); iter.hasNext();) {
>   String key = (String) iter.next();
>   File value = (File) param.get(key);
>   transformer.setParameter(key, builder.parse(value));
> }
>
> Meaning, having many properties has a negative effect on memory consumption.
>
> Is there a more memory less approach to pass properties to the xsl?

Can you just use XSL's document() function combined with
xalan:nodeset() to do it in pure xsl or does it need to be passed in
code?
--tim