How can I construct an XML file to contain HTML tags in the data for a Literal element?

  • Thread starter Thread starter AAaron123
  • Start date Start date
A

AAaron123

Started to make an .xml file to be used by asp:XmlDataSource like so:

<asp:Literal Mode ="PassThrough" ID="lblLastName" runat="server"
Text='<%#XPath("Header")%>' />

Now I realize that <h4>, for example, looks like an XML tag rather than the
HTML tag I wanted.

How can I construct an XML file to contain HTML tags in the data for the
Literal element?



Thanks

The xml file:

<DefaultDataItems>

<DataItem>

<Header>

<h4>

SOMETEXT</h4>

</Header>

<Contents>

<p>

some text.

</p><p>

more text. <br />

more text <br />

more text</p>

</Contents>

</DataItem>

<DataItem>

<Header>

.....snip....
 
Started to make an .xml file to be used by asp:XmlDataSource like so:

<asp:Literal Mode ="PassThrough" ID="lblLastName" runat="server"
Text='<%#XPath("Header")%>' />

Now I realize that <h4>, for example, looks like an XML tag rather
than the HTML tag I wanted.

How can I construct an XML file to contain HTML tags in the data for
the Literal element?

CDATA if you want to "hide" the tags in a column.

Otherwise, you use XHTML, where the HTML tags are XML tags.

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

My vacation and childhood cancer awareness site:
http://www.crazycancertour.com

*******************************************
| Think outside the box! |
*******************************************
 
I'm not sure of the terninology.
I use the file as shown below.
In the file data I have things like <p></p> that I want to be interpreted by
the browser as HTMP tags.
Appears to be working OK using CDATA.
I think what you told me is that CDATA hides the tags from the XmlDataSource
so they will be part of the data, which sounds like what I need.
Not sure about your comment about using XHTML.

Thanks much
 
I'm not sure of the terninology.
I use the file as shown below.
In the file data I have things like <p></p> that I want to be
interpreted by the browser as HTMP tags.
Appears to be working OK using CDATA.
I think what you told me is that CDATA hides the tags from the
XmlDataSource so they will be part of the data, which sounds like what
I need. Not sure about your comment about using XHTML.


XHTML is HTML formatted with XML rules. It is not magic, just making
sure you close tags, etc.

If you are making the HTML part of the data, CDATA should work. If you
have to consume as XML, you will have to properly encode some charaters,
but it is the best if the HTML is actually part of the data.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

My vacation and childhood cancer awareness site:
http://www.crazycancertour.com

*******************************************
| Think outside the box! |
*******************************************
 
Thanks
XHTML is HTML formatted with XML rules. It is not magic, just making
sure you close tags, etc.

If you are making the HTML part of the data, CDATA should work. If you
have to consume as XML, you will have to properly encode some
charaters, but it is the best if the HTML is actually part of the
data.

Peace and Grace,


*******************************************
*******************************************
 
Back
Top