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

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....
 
G

Gregory A. Beamer

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,
 
A

AAaron123

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
 
G

Gregory A. Beamer

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,
 
A

AAaron123

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,


*******************************************
*******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top