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 Dylan MacDonald <dy...@yahoo.com> on 2005/08/16 19:15:10 UTC

html markup in XML files

Hi -

So I am using the JSTL xml tags for a website I'm working on and am I
running into an issue.  Ideally I'd like to store all of the content in
XML files and populate the corresponding JSP files using the XML tags. 
However, the text contains some markup in it (e.g. bold, italics, etc)
which are ignored by the XML tags (I assume they are treated as nodes
or something).

Setting escapeXml="no" in my x:out statement does not solve the
problem.  Is it possible to do what I am asking?  If not, anyone have a
better idea? Below is a sample snippet from the XML file and the JSP
file:

XML
<page id="1">
	<imgSrc>img/share_your_music.jpg</imgSrc>
	<hdrText>Share your music</hdrText>
	<hdrLink>index.jsp?pid=4</hdrLink>
	<desc><strong>Share music</strong> with friends and family through
email, IM, blogs or your website.</desc>
</page>

JSP
<x:forEach select="$data//page[1]">
	<ul class="guideGridList">
		<li style="background:url(/<x:out select="imgSrc" escapeXml="no" />)
no-repeat 50% 50%;" class="guideImg"></li>
		<li class="guideText">
			<p>
				<a href="/<x:out select="hdrLink" escapeXml="no"  />"><x:out
select="hdrText" escapeXml="no"  /></a><br />
				<x:out select="desc" escapeXml="no"  />
			</p>
		</li>
	</ul>
</x:forEach>




		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: html markup in XML files

Posted by Dylan MacDonald <dy...@yahoo.com>.
That's perfect.  Just what I needed.  Thanks!

- Dylan


--- : SammyRulez: : Tue Aug 16 10: 39: 46@yahoo.com,
UNEXPECTED_DATA_AFTER_ADDRESS_IN_GROUP@.SYNTAX-ERROR.;;;;;,
"::SammyRulez::" <sa...@gmail.com> wrote:

> you should wrap your "desc" tag content in CDATA (see
> http://www.w3schools.com/xml/xml_cdata.asp)
> 
> your xml should look like this..
> 
> <page id="1">
>        <imgSrc>img/share_your_music.jpg</imgSrc>
>        <hdrText>Share your music</hdrText>
>        <hdrLink>index.jsp?pid=4</hdrLink>
>        <desc>
> <![CDATA[
> <strong>Share music</strong> with friends and family through
> email, IM, blogs or your website.
> ]]>
> </desc>
> </page>
> 
> -- 
> ::SammyRulez::
> http://sammyprojectz.blogspot.com
> 
> 2005/8/16, Dylan MacDonald <dy...@yahoo.com>:
> > Hi -
> > 
> > So I am using the JSTL xml tags for a website I'm working on and am
> I
> > running into an issue.  Ideally I'd like to store all of the
> content in
> > XML files and populate the corresponding JSP files using the XML
> tags.
> > However, the text contains some markup in it (e.g. bold, italics,
> etc)
> > which are ignored by the XML tags (I assume they are treated as
> nodes
> > or something).
> > 
> > Setting escapeXml="no" in my x:out statement does not solve the
> > problem.  Is it possible to do what I am asking?  If not, anyone
> have a
> > better idea? Below is a sample snippet from the XML file and the
> JSP
> > file:
> > 
> > XML
> > <page id="1">
> >         <imgSrc>img/share_your_music.jpg</imgSrc>
> >         <hdrText>Share your music</hdrText>
> >         <hdrLink>index.jsp?pid=4</hdrLink>
> >         <desc><strong>Share music</strong> with friends and family
> through
> > email, IM, blogs or your website.</desc>
> > </page>
> > 
> > JSP
> > <x:forEach select="$data//page[1]">
> >         <ul class="guideGridList">
> >                 <li style="background:url(/<x:out select="imgSrc"
> escapeXml="no" />)
> > no-repeat 50% 50%;" class="guideImg"></li>
> >                 <li class="guideText">
> >                         <p>
> >                                 <a href="/<x:out select="hdrLink"
> escapeXml="no"  />"><x:out
> > select="hdrText" escapeXml="no"  /></a><br />
> >                                 <x:out select="desc" escapeXml="no"
>  />
> >                         </p>
> >                 </li>
> >         </ul>
> > </x:forEach>
> > 
> > 
> > 
> > 
> > 
> > ____________________________________________________
> > Start your day with Yahoo! - make it your home page
> > http://www.yahoo.com/r/hs
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> > 
> >
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: html markup in XML files

Posted by "::SammyRulez::" <sa...@gmail.com>.
you should wrap your "desc" tag content in CDATA (see
http://www.w3schools.com/xml/xml_cdata.asp)

your xml should look like this..

<page id="1">
       <imgSrc>img/share_your_music.jpg</imgSrc>
       <hdrText>Share your music</hdrText>
       <hdrLink>index.jsp?pid=4</hdrLink>
       <desc>
<![CDATA[
<strong>Share music</strong> with friends and family through
email, IM, blogs or your website.
]]>
</desc>
</page>

-- 
::SammyRulez::
http://sammyprojectz.blogspot.com

2005/8/16, Dylan MacDonald <dy...@yahoo.com>:
> Hi -
> 
> So I am using the JSTL xml tags for a website I'm working on and am I
> running into an issue.  Ideally I'd like to store all of the content in
> XML files and populate the corresponding JSP files using the XML tags.
> However, the text contains some markup in it (e.g. bold, italics, etc)
> which are ignored by the XML tags (I assume they are treated as nodes
> or something).
> 
> Setting escapeXml="no" in my x:out statement does not solve the
> problem.  Is it possible to do what I am asking?  If not, anyone have a
> better idea? Below is a sample snippet from the XML file and the JSP
> file:
> 
> XML
> <page id="1">
>         <imgSrc>img/share_your_music.jpg</imgSrc>
>         <hdrText>Share your music</hdrText>
>         <hdrLink>index.jsp?pid=4</hdrLink>
>         <desc><strong>Share music</strong> with friends and family through
> email, IM, blogs or your website.</desc>
> </page>
> 
> JSP
> <x:forEach select="$data//page[1]">
>         <ul class="guideGridList">
>                 <li style="background:url(/<x:out select="imgSrc" escapeXml="no" />)
> no-repeat 50% 50%;" class="guideImg"></li>
>                 <li class="guideText">
>                         <p>
>                                 <a href="/<x:out select="hdrLink" escapeXml="no"  />"><x:out
> select="hdrText" escapeXml="no"  /></a><br />
>                                 <x:out select="desc" escapeXml="no"  />
>                         </p>
>                 </li>
>         </ul>
> </x:forEach>
> 
> 
> 
> 
> 
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
> 
> 
> ---------------------------------------------------------------------
> 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