Re: JSTL x:parse problems

2002-04-18 Thread Steve Appling

In section 11.2 of the JSTL 1.0 public draft specification it says that
xmlText can take a String or a Reader.  I can't use xmlUrl (or body content
of the parse tag) because my xml is in a section of the web application that
is in a restricted security domain.  I can't provide authentication
information in the url to use xmlUrl.  I probably can read the entire
document into a single String myself, then use that in xmlText, but that
seems somewhat silly.  If it really can take a Reader as the documentation
states, then I would rather use that approach - I was hoping there was
something simple I was missing that was keeping this from working.

- Original Message -
From: peter lin [EMAIL PROTECTED]
To: Tag Libraries Users List [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 8:42 AM
Subject: Re: JSTL x:parse problems



 I think you're problem is that xmlText expects String.  Have you tried
 xmlURL, isntead of xmlText.  here is the way I use parse, which works
 fine.

 c:set var=xmlurlsample.xml/c:set

 x:parse var=dom
   c:import url=${xmlurl}/
 /x:parse


 peter lin


 Steve Appling wrote:
 
  I am having problems using the standard tag library x:parse tag using a
  reader.  The JSTL spec says that the xmlText attribute can take either a
  String or a Reader.  I am trying the following:
 
  %
  InputStream is = application.getResourceAsStream(/test.xml);
  InputStreamReader reader = new InputStreamReader(is);
  %
  x:parse xmlText=${reader} var=doc/
 
  This results in the following exception:
  javax.servlet.ServletException: The xmlText attribute illegally
  evaluated to null or  in parse
 
  Does anyone know how to do this?
 
  If anyone from the expert group is monitoring this, it would be really
nice
  if there were usage examples for each of the tags.  Also in the 1.0
Public
  Draft ALL of the examples provided for x:parse are wrong, they use an
older
  syntax with a source attribute which is not allowed now.

 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]





--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: JSTL x:parse problems

2002-04-18 Thread Steve Appling
)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:215)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http10.HttpProcessor.process(HttpProcessor.jav
a:676)
at
org.apache.catalina.connector.http10.HttpProcessor.run(HttpProcessor.java:79
9)
at java.lang.Thread.run(Thread.java:484)

- Original Message -
From: Shawn Bayern [EMAIL PROTECTED]
To: Tag Libraries Users List [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 3:25 PM
Subject: Re: JSTL x:parse problems


 On Thu, 18 Apr 2002, Steve Appling wrote:

  Thank you Shawn!  I had hoped I was just doing something stupid.
 
  Unfortunately that isn't the only thing I'm doing wrong - this just
moved me
  to my next problem.  Here's a simplified example-
  ignoring the reader code I have:
  x:parse xmlText=${reader} var=doc/
  x:out select=$doc/action/

 That does indeed look right.  Can I see the SAXPathException you're
 getting, as well as pehaps an entire page, in context?

 The following, just as a reference, works correctly:

   %@ taglib uri=http://java.sun.com/jstl/core; prefix=c %
   %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; %

   c:import url=foo.xml varReader=reader
 x:parse xml=${reader} var=doc/
   /c:import
   x:out select=$doc/root/action/

 where he file foo.xml contains your sample document:

   root
 action title=First Action
This is my first action.
 /action
   /root

 Note, by the way, that to access the 'action' element, you'll need to use
 the expression $doc/root/action, not $doc/action.  $doc refers to the
 document (logically the document root node), not the root element (which
 is logically a child of that node).  But that wouldn't lead to an
 exception, just an empty result.

 --
 Shawn Bayern
 Author, JSP Standard Tag Library  http://www.jstlbook.com
 (coming this summer from Manning Publications)


 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]





--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: JSTL x:parse problems

2002-04-18 Thread Steve Appling

Thank you - I was under the mistaken impression that jstl.jar and
standard.jar contained the entire JSTL implementation (at least what wasn't
already in Tomcat's common lib).  That definitely needs to make it into the
documentation.

BTW, in the example you sent you had:
x:parse xml=${reader} var=doc/

In my version, the attribute for the parse action needs to be xmlText.
Was that a typo or are you using a different version than I am?  Also I was
not aware that I could get a reader from the import action with:
c:import url=foo.xml varReader=reader


That's cool!



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]