skip x:parse, apply x:out straight to a pre-build DOM instance
Hello, I am wondering if it is possible in JSTL A usual use of JSLT XML tags goes as (1) by x:parse var=MyDOM ... tag, parse a XML document in String to obtain DOM instance in the scoped attribute specified by attribute var, (2) by x:out select=${MyDOM}///, pull the contents as String to show view. Consider a case where a org.w3c.dom.Document object has been created and stored within a request scope attribute before the JSP is invoked. In MVC architecture, this situation is likely to happen. Actually I want to do this in Struts : a Structs Action class produces a DOM and store it in the request scope, then forward to a JSP. In this situation I want to skip calling x:parse and apply x:out to the pre-built DOM instance. The reason why I want to skip is simple: avoid unnecessary XML parsing for better performance. If I have a DOM already, then why do I have to serialize the DOM into a String to pass to x:parse tag!? I have tried to find out if this is possible in various resources, but no such article/documentation I could find. I also tried such coding : c:set var=MyDOM value=${prebuild_DOM}/ x:out select=${MyDOM}//*/ then I was welcomed by a NullPointerException. Any idea? -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
Re: skip x:parse, apply x:out straight to a pre-build DOM instance
On Thu, 14 Nov 2002 [EMAIL PROTECTED] wrote: I also tried such coding : c:set var=MyDOM value=${prebuild_DOM}/ x:out select=${MyDOM}//*/ then I was welcomed by a NullPointerException. You can do it, but the syntax you're using is wrong. The JSTL tags don't care whether the DOM you're using has come from x:parse or from a servlet. But either way, you must refer to it using XPath variables, not the JSTL EL inside the 'select' attribute. Thus, you'd write x:out select=$MyDOM//* / -- Shawn Bayern JSTL in Action http://www.manning.com/bayern -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
Re: skip x:parse, apply x:out straight to a pre-build DOM instance
Thank you very much for your reply. It worked! MATSUHASHI,kazuaki QUICK Corp, Japan Shawn Bayern bayern@essent宛先: Tag Libraries Users List ially.net[EMAIL PROTECTED] cc: 2002/11/15件名: Re: skip x:parse, apply x:out straight to a 00:04 pre-build DOM instance "Tag Libraries Users List" へ 返信してくださ い On Thu, 14 Nov 2002 [EMAIL PROTECTED] wrote: I also tried such coding : c:set var="MyDOM" value="${prebuild_DOM}"/ x:out select="${MyDOM}//*"/ then I was welcomed by a NullPointerException. You can do it, but the syntax you're using is wrong. The JSTL tags don't care whether the DOM you're using has come from x:parse or from a servlet. But either way, you must refer to it using XPath variables, not the JSTL EL inside the 'select' attribute. Thus, you'd write x:out select="$MyDOM//*" / -- Shawn Bayern "JSTL in Action" http://www.manning.com/bayern -- 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]