You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by satish <sa...@hotmail.com> on 2004/01/24 00:36:08 UTC
QUESTION ABOUT XML
All,
I need some help with XML parsing and retrieving values.
My XML element is as follows
<entity eid="5769562">
<name>test</name>
<address>123 main st</address>
</entity>
How do I x:out the value of eid , For example 5769562 in this case.
Please help me out.
Thanks
satish
Re: QUESTION ABOUT XML
Posted by Martin Cooper <ma...@apache.org>.
On Fri, 23 Jan 2004, satish wrote:
> All,
>
> I need some help with XML parsing and retrieving values.
>
> My XML element is as follows
>
> <entity eid="5769562">
> <name>test</name>
> <address>123 main st</address>
> </entity>
>
> How do I x:out the value of eid , For example 5769562 in this case.
If you've parsed the above XML into a variable named 'xml', you would use
this:
<x:out select="$xml/entity/@eid"/>
--
Martin Cooper
>
> Please help me out.
>
> Thanks
> satish
>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: QUESTION ABOUT XML
Posted by satish <sa...@hotmail.com>.
Thanks Siddharth
This example works , where as in my case I am reading xml string session
scope , pasring the string
and trying to set a variable which can be used as url parameter .
This is what my code looks like..
<c:set var="file" value="${sessionScope.FILE1}" />
<x:parse xml="${file}" var="doc" />
<x:forEach var="entity" select='$doc//RESPONSE/results/entity' >
<x:out select='@eid' />
<x:set var="ENTITY" select='@eid' scope='request' />
<x:forEach var="name" select='name' >
<html:link page="/personview.jsp" paramId="ENTITY" paramName="ENTITY"
paramScope="request">
<x:out select="." />
</html:link >
</x:forEach>
Then , I want to retrieve the request parameter in personview.jsp and
continue further.
Please let me know If I have the right approach.
Thanks
satish
----- Original Message -----
From: "Siddharth" <si...@cbk.com>
To: "'Tag Libraries Users List'" <ta...@jakarta.apache.org>
Sent: Sunday, January 25, 2004 6:11 AM
Subject: RE: QUESTION ABOUT XML
> Hi sathish,
>
> It would be
>
> <c:set var="xmlTxt">
> <entity eid="5769562">
> <name>test</name>
> <address>123 main st</address>
> </entity>
> </c:set>
> <x:parse xml="${xmlTxt}" var="xml"/>
> <x:out select="$xml/entity/@eid"/>
>
>
> Check it out...
>
> Regards,
> Siddharth.
>
> -----Original Message-----
> From: satish [mailto:satishgi@hotmail.com]
> Sent: 24 January 2004 02:36
> To: taglibs-user@jakarta.apache.org
> Subject: QUESTION ABOUT XML
>
> All,
>
> I need some help with XML parsing and retrieving values.
>
> My XML element is as follows
>
> <entity eid="5769562">
> <name>test</name>
> <address>123 main st</address>
> </entity>
>
> How do I x:out the value of eid , For example 5769562 in this case.
>
> Please help me out.
>
> Thanks
> satish
>
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs Email
> Security System. For more information on a proactive email security
> service working around the clock, around the globe, visit
> http://www.messagelabs.com
> ________________________________________________________________________
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
RE: QUESTION ABOUT XML
Posted by Siddharth <si...@cbk.com>.
Hi sathish,
It would be
<c:set var="xmlTxt">
<entity eid="5769562">
<name>test</name>
<address>123 main st</address>
</entity>
</c:set>
<x:parse xml="${xmlTxt}" var="xml"/>
<x:out select="$xml/entity/@eid"/>
Check it out...
Regards,
Siddharth.
-----Original Message-----
From: satish [mailto:satishgi@hotmail.com]
Sent: 24 January 2004 02:36
To: taglibs-user@jakarta.apache.org
Subject: QUESTION ABOUT XML
All,
I need some help with XML parsing and retrieving values.
My XML element is as follows
<entity eid="5769562">
<name>test</name>
<address>123 main st</address>
</entity>
How do I x:out the value of eid , For example 5769562 in this case.
Please help me out.
Thanks
satish
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org