You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Köberl <ta...@gmail.com> on 2009/04/17 12:07:45 UTC

Woodstox dependency needed?

While analyzing the Google App Engine problem with Stax I tried to eliminate the dependency to Woodstox (because i thought it was the problem). I found it quite easy to remove the dependency and use "plain" Stax. So I thought: why is this dependency necessary? In my opinion frameworks (like Tapestry) should minimize dependencies. So why is Woodstox used instead of Stax? Is this a performance reason or simply just the feature of parsing the DTD header?

Here are the steps to replace Woodstox with Stax (see also http://derkoe.wordpress.com/2009/04/16/tapestry-51-woodstox/)
 * use XMLInputFactory instead of XMLInputFactory2 in TemplateParserImpl
 * remove inputFactory.configureForSpeed(); in TemplateParserImpl
 * use XMLStreamReader instead of XMLStreamReader2 in StaxTemplateParser
 * change the dtd() method StaxTemplateParser to (this could be nicer):
      private void dtd() throws XMLStreamException
      {
          String dtd = reader.getText();
          String[] dtdElements = dtd.split(" ");
          if(dtdElements.length > 3)
          {
              String rootName = dtdElements[1];
              String publicId = null;
              String systemId = null;
              if("PUBLIC".equals(dtdElements[2]))
              {
                  publicId = dtdElements[3];
                  if(dtdElements.length > 4)
                      systemId = dtdElements[4];
              }
              else if("SYSTEM".equals(dtdElements[2]))
              {
                  systemId = dtdElements[3];
              }
              tokenAccumulator.add(new DTDToken(rootName, publicId, systemId, getLocation()));
          }
      }

-- 
Chris
-- 
View this message in context: http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2645025.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Robert Zeigler <ro...@scazdl.org>.
Heh.  Forgot about those. :)

Robert

On Apr 20, 2009, at 4/2012:42 PM , Howard Lewis Ship wrote:

> There's a whole bunch of new template-related features in 5.1:
> t:remove, t:content, parameter elements (i.e., "<p:empty> not
> <t:parameter name="empty">), template extension points, library
> namespaces.
>
> On Mon, Apr 20, 2009 at 10:28 AM, Robert Zeigler  
> <ro...@scazdl.org> wrote:
>> So that's the switch from STaX to Woodstox.  What features  
>> necessitated the
>> change from SAX to STaX (aside from the fact that the resulting  
>> code is
>> probably cleaner; I haven't checked :)? eg: we already had doctype  
>> handling
>> in 5.0, using SAX...
>>
>> Robert
>>
>> On Apr 20, 2009, at 4/2010:50 AM , Howard Lewis Ship wrote:
>>
>>> I agree, but without certain features of Woodstox, T5.1 would have
>>> lost necessary features. The STaX APIs don't cover a few critical
>>> cases ...  I had to switch to the Woodstox APIs to handle a couple  
>>> of
>>> things like decoding doctypes and handling external entities (if
>>> memory serves).
>>>
>>> On Mon, Apr 20, 2009 at 5:12 AM, Christian Köberl
>>> <ta...@gmail.com> wrote:
>>>>
>>>>
>>>> Ben Gidley wrote:
>>>>>
>>>>> I don't think using Stax will help. It is not woodstox that  
>>>>> breaks app
>>>>> engine but the stax api itself.
>>>>>
>>>> I know - that's what I tried to say in my blog entry.
>>>>
>>>> But my concern was to use plain Stax instead of Woodstox just for  
>>>> the
>>>> sake
>>>> of minimizing dependencies and using Java standards. I prefer to  
>>>> rely on
>>>> standards (if they're there).
>>>>
>>>> --
>>>> Chris
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2663210.html
>>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator of Apache Tapestry
>>> Director of Open Source Technology at Formos
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> -- 
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Howard Lewis Ship <hl...@gmail.com>.
There's a whole bunch of new template-related features in 5.1:
t:remove, t:content, parameter elements (i.e., "<p:empty> not
<t:parameter name="empty">), template extension points, library
namespaces.

On Mon, Apr 20, 2009 at 10:28 AM, Robert Zeigler <ro...@scazdl.org> wrote:
> So that's the switch from STaX to Woodstox.  What features necessitated the
> change from SAX to STaX (aside from the fact that the resulting code is
> probably cleaner; I haven't checked :)? eg: we already had doctype handling
> in 5.0, using SAX...
>
> Robert
>
> On Apr 20, 2009, at 4/2010:50 AM , Howard Lewis Ship wrote:
>
>> I agree, but without certain features of Woodstox, T5.1 would have
>> lost necessary features. The STaX APIs don't cover a few critical
>> cases ...  I had to switch to the Woodstox APIs to handle a couple of
>> things like decoding doctypes and handling external entities (if
>> memory serves).
>>
>> On Mon, Apr 20, 2009 at 5:12 AM, Christian Köberl
>> <ta...@gmail.com> wrote:
>>>
>>>
>>> Ben Gidley wrote:
>>>>
>>>> I don't think using Stax will help. It is not woodstox that breaks app
>>>> engine but the stax api itself.
>>>>
>>> I know - that's what I tried to say in my blog entry.
>>>
>>> But my concern was to use plain Stax instead of Woodstox just for the
>>> sake
>>> of minimizing dependencies and using Java standards. I prefer to rely on
>>> standards (if they're there).
>>>
>>> --
>>> Chris
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2663210.html
>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>> Director of Open Source Technology at Formos
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Robert Zeigler <ro...@scazdl.org>.
So that's the switch from STaX to Woodstox.  What features  
necessitated the change from SAX to STaX (aside from the fact that the  
resulting code is probably cleaner; I haven't checked :)? eg: we  
already had doctype handling in 5.0, using SAX...

Robert

On Apr 20, 2009, at 4/2010:50 AM , Howard Lewis Ship wrote:

> I agree, but without certain features of Woodstox, T5.1 would have
> lost necessary features. The STaX APIs don't cover a few critical
> cases ...  I had to switch to the Woodstox APIs to handle a couple of
> things like decoding doctypes and handling external entities (if
> memory serves).
>
> On Mon, Apr 20, 2009 at 5:12 AM, Christian Köberl
> <ta...@gmail.com> wrote:
>>
>>
>> Ben Gidley wrote:
>>>
>>> I don't think using Stax will help. It is not woodstox that breaks  
>>> app
>>> engine but the stax api itself.
>>>
>> I know - that's what I tried to say in my blog entry.
>>
>> But my concern was to use plain Stax instead of Woodstox just for  
>> the sake
>> of minimizing dependencies and using Java standards. I prefer to  
>> rely on
>> standards (if they're there).
>>
>> --
>> Chris
>> --
>> View this message in context: http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2663210.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> -- 
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Howard Lewis Ship <hl...@gmail.com>.
But another option would be to revert to a SAX parser and do two
passes: one to read stuff into a token stream, a second to convert the
XML tokens to Tapestry tokens.

On Mon, Apr 20, 2009 at 8:50 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
> I agree, but without certain features of Woodstox, T5.1 would have
> lost necessary features. The STaX APIs don't cover a few critical
> cases ...  I had to switch to the Woodstox APIs to handle a couple of
> things like decoding doctypes and handling external entities (if
> memory serves).
>
> On Mon, Apr 20, 2009 at 5:12 AM, Christian Köberl
> <ta...@gmail.com> wrote:
>>
>>
>> Ben Gidley wrote:
>>>
>>> I don't think using Stax will help. It is not woodstox that breaks app
>>> engine but the stax api itself.
>>>
>> I know - that's what I tried to say in my blog entry.
>>
>> But my concern was to use plain Stax instead of Woodstox just for the sake
>> of minimizing dependencies and using Java standards. I prefer to rely on
>> standards (if they're there).
>>
>> --
>> Chris
>> --
>> View this message in context: http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2663210.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Howard Lewis Ship <hl...@gmail.com>.
I agree, but without certain features of Woodstox, T5.1 would have
lost necessary features. The STaX APIs don't cover a few critical
cases ...  I had to switch to the Woodstox APIs to handle a couple of
things like decoding doctypes and handling external entities (if
memory serves).

On Mon, Apr 20, 2009 at 5:12 AM, Christian Köberl
<ta...@gmail.com> wrote:
>
>
> Ben Gidley wrote:
>>
>> I don't think using Stax will help. It is not woodstox that breaks app
>> engine but the stax api itself.
>>
> I know - that's what I tried to say in my blog entry.
>
> But my concern was to use plain Stax instead of Woodstox just for the sake
> of minimizing dependencies and using Java standards. I prefer to rely on
> standards (if they're there).
>
> --
> Chris
> --
> View this message in context: http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2663210.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Christian Köberl <ta...@gmail.com>.

Ben Gidley wrote:
> 
> I don't think using Stax will help. It is not woodstox that breaks app
> engine but the stax api itself.
> 
I know - that's what I tried to say in my blog entry.

But my concern was to use plain Stax instead of Woodstox just for the sake
of minimizing dependencies and using Java standards. I prefer to rely on
standards (if they're there).

-- 
Chris
-- 
View this message in context: http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2663210.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Christian Edward Gruber <ch...@gmail.com>.
I can't give a definitive answer, but I can indifinitively (??) say  
that there is an ongoing discussion about what to whitelist next, and  
there are definite plans to whitelist more code where possible, but  
that the XML manipulation stuff would have to have a bit more of an  
audit because of some security concerns around file writes and subtle  
side-effects in some javax.xml areas.

Again, none of this indicates timeline, and I would be hesitant to  
rely on the GAE team to give a timeline on any particular class or  
package being whitelisted until they actually get to it - which means  
we won't know until it's almost there.  The problem is merely deciding  
if it'll take less time to remove stax, or less time to wait for the  
whitelist, and since we have no data on the latter, it's worth at  
least considering the level of effort of the former.

cheers,
Christian.

On 17-Apr-09, at 10:42 , Howard Lewis Ship wrote:

> I'm willing to remove Woodstox in 5.2 if neccessary, but I'd prefer to
> wait for a definitive statement about StAX being added to the GAE
> whitelist.
>
> On Fri, Apr 17, 2009 at 4:22 AM, Ben Gidley <be...@gidley.co.uk> wrote:
>> I don't think using Stax will help. It is not woodstox that breaks  
>> app
>> engine but the stax api itself.
>>
>> Ben Gidley
>>
>> www.gidley.co.uk
>> ben@gidley.co.uk
>>
>>
>> On Fri, Apr 17, 2009 at 11:07 AM, Christian Köberl <
>> tapestry.christian.koeberl@gmail.com> wrote:
>>
>>>
>>> While analyzing the Google App Engine problem with Stax I tried to
>>> eliminate the dependency to Woodstox (because i thought it was the  
>>> problem).
>>> I found it quite easy to remove the dependency and use "plain"  
>>> Stax. So I
>>> thought: why is this dependency necessary? In my opinion  
>>> frameworks (like
>>> Tapestry) should minimize dependencies. So why is Woodstox used  
>>> instead of
>>> Stax? Is this a performance reason or simply just the feature of  
>>> parsing the
>>> DTD header?
>>>
>>> Here are the steps to replace Woodstox with Stax (see also
>>> http://derkoe.wordpress.com/2009/04/16/tapestry-51-woodstox/)
>>>  * use XMLInputFactory instead of XMLInputFactory2 in  
>>> TemplateParserImpl
>>>  * remove inputFactory.configureForSpeed(); in TemplateParserImpl
>>>  * use XMLStreamReader instead of XMLStreamReader2 in  
>>> StaxTemplateParser
>>>  * change the dtd() method StaxTemplateParser to (this could be  
>>> nicer):
>>>      private void dtd() throws XMLStreamException
>>>      {
>>>          String dtd = reader.getText();
>>>          String[] dtdElements = dtd.split(" ");
>>>          if(dtdElements.length > 3)
>>>          {
>>>              String rootName = dtdElements[1];
>>>              String publicId = null;
>>>              String systemId = null;
>>>              if("PUBLIC".equals(dtdElements[2]))
>>>              {
>>>                  publicId = dtdElements[3];
>>>                  if(dtdElements.length > 4)
>>>                      systemId = dtdElements[4];
>>>              }
>>>              else if("SYSTEM".equals(dtdElements[2]))
>>>              {
>>>                  systemId = dtdElements[3];
>>>              }
>>>              tokenAccumulator.add(new DTDToken(rootName, publicId,
>>> systemId, getLocation()));
>>>          }
>>>      }
>>>
>>> --
>>> Chris
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2645025.html
>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>
>
>
> -- 
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Christian Edward Gruber
e-mail: christianedwardgruber@gmail.com
weblog: http://www.geekinasuit.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Howard Lewis Ship <hl...@gmail.com>.
I'm willing to remove Woodstox in 5.2 if neccessary, but I'd prefer to
wait for a definitive statement about StAX being added to the GAE
whitelist.

On Fri, Apr 17, 2009 at 4:22 AM, Ben Gidley <be...@gidley.co.uk> wrote:
> I don't think using Stax will help. It is not woodstox that breaks app
> engine but the stax api itself.
>
> Ben Gidley
>
> www.gidley.co.uk
> ben@gidley.co.uk
>
>
> On Fri, Apr 17, 2009 at 11:07 AM, Christian Köberl <
> tapestry.christian.koeberl@gmail.com> wrote:
>
>>
>> While analyzing the Google App Engine problem with Stax I tried to
>> eliminate the dependency to Woodstox (because i thought it was the problem).
>> I found it quite easy to remove the dependency and use "plain" Stax. So I
>> thought: why is this dependency necessary? In my opinion frameworks (like
>> Tapestry) should minimize dependencies. So why is Woodstox used instead of
>> Stax? Is this a performance reason or simply just the feature of parsing the
>> DTD header?
>>
>> Here are the steps to replace Woodstox with Stax (see also
>> http://derkoe.wordpress.com/2009/04/16/tapestry-51-woodstox/)
>>  * use XMLInputFactory instead of XMLInputFactory2 in TemplateParserImpl
>>  * remove inputFactory.configureForSpeed(); in TemplateParserImpl
>>  * use XMLStreamReader instead of XMLStreamReader2 in StaxTemplateParser
>>  * change the dtd() method StaxTemplateParser to (this could be nicer):
>>      private void dtd() throws XMLStreamException
>>      {
>>          String dtd = reader.getText();
>>          String[] dtdElements = dtd.split(" ");
>>          if(dtdElements.length > 3)
>>          {
>>              String rootName = dtdElements[1];
>>              String publicId = null;
>>              String systemId = null;
>>              if("PUBLIC".equals(dtdElements[2]))
>>              {
>>                  publicId = dtdElements[3];
>>                  if(dtdElements.length > 4)
>>                      systemId = dtdElements[4];
>>              }
>>              else if("SYSTEM".equals(dtdElements[2]))
>>              {
>>                  systemId = dtdElements[3];
>>              }
>>              tokenAccumulator.add(new DTDToken(rootName, publicId,
>> systemId, getLocation()));
>>          }
>>      }
>>
>> --
>> Chris
>> --
>> View this message in context:
>> http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2645025.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Woodstox dependency needed?

Posted by Ben Gidley <be...@gidley.co.uk>.
I don't think using Stax will help. It is not woodstox that breaks app
engine but the stax api itself.

Ben Gidley

www.gidley.co.uk
ben@gidley.co.uk


On Fri, Apr 17, 2009 at 11:07 AM, Christian Köberl <
tapestry.christian.koeberl@gmail.com> wrote:

>
> While analyzing the Google App Engine problem with Stax I tried to
> eliminate the dependency to Woodstox (because i thought it was the problem).
> I found it quite easy to remove the dependency and use "plain" Stax. So I
> thought: why is this dependency necessary? In my opinion frameworks (like
> Tapestry) should minimize dependencies. So why is Woodstox used instead of
> Stax? Is this a performance reason or simply just the feature of parsing the
> DTD header?
>
> Here are the steps to replace Woodstox with Stax (see also
> http://derkoe.wordpress.com/2009/04/16/tapestry-51-woodstox/)
>  * use XMLInputFactory instead of XMLInputFactory2 in TemplateParserImpl
>  * remove inputFactory.configureForSpeed(); in TemplateParserImpl
>  * use XMLStreamReader instead of XMLStreamReader2 in StaxTemplateParser
>  * change the dtd() method StaxTemplateParser to (this could be nicer):
>      private void dtd() throws XMLStreamException
>      {
>          String dtd = reader.getText();
>          String[] dtdElements = dtd.split(" ");
>          if(dtdElements.length > 3)
>          {
>              String rootName = dtdElements[1];
>              String publicId = null;
>              String systemId = null;
>              if("PUBLIC".equals(dtdElements[2]))
>              {
>                  publicId = dtdElements[3];
>                  if(dtdElements.length > 4)
>                      systemId = dtdElements[4];
>              }
>              else if("SYSTEM".equals(dtdElements[2]))
>              {
>                  systemId = dtdElements[3];
>              }
>              tokenAccumulator.add(new DTDToken(rootName, publicId,
> systemId, getLocation()));
>          }
>      }
>
> --
> Chris
> --
> View this message in context:
> http://n2.nabble.com/Woodstox-dependency-needed--tp2645025p2645025.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>