2013/4/20 Jerry Malcolm <2ndgenfi...@gmail.com>:
> I have been searching for several hours for a basic JSTL answer with no
> luck.  From what I can tell, JSTL is under the umbrella of Tomcat.
> Hopefully someone can help me out.
>

You are welcome.

> I simply want to use an existing already-parsed DOM (org.w3c.dom.Document
> variable) with JSTL XML tags.  In other words, I want to skip the x:parse
> step and just tell x:out and all of the other x tags to pull data from my
> pre-existing pre-parsed DOM:
>
>        Document myDOM;  // already built by another part of the code
>

1. Have you exposed your Java variable as JspContext attribute?

I mean,  pageContext.setAttribute("myDOM", myDOM)?

> I understand basic xpath stuff.  But I'm not sure how to tell it to use a
> standard local java variable for the DOM.
>
> I've tried   <x:out select="$myDOM/aaaaa/bbbbb"/>  and <x:out
> select="${myDOM}/aaaaa/bbbbb"/>
>

2. The first should work.
The second in not valid, neither by JSTL spec, nor by XPath spec.

The latter says,
[36]   VariableReference   ::=   '$' QName

I have not actually tried it, though.

JSTL spec says:

[quote]
An XPath expression must also treat variables that resolve to implementations of
standard DOM interfaces as representing nodes of the type bound to
that interface
by the DOM specification.
[/quote]

1) What is the structure of your document

2) Maybe:  try to select a specific XML element and put it into
JspContext's attribute. Then try to output it via <x:out
select="$elem"/>.

> Both give me errors that seem to say it doesn't find a DOM.
>

How this error looks like, exactly, with a stacktrace?

> Every example I can find always assumes I want to start with a true
> non-parsed XML document.
>
> I'm sure I'm missing something obvious.  But can someone please help me out
> with the correct syntax?
>

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to