PC Review


Reply
Thread Tools Rate Thread

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

 
 
AAaron123
Guest
Posts: n/a
 
      26th Sep 2009
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....

 
Reply With Quote
 
 
 
 
AAaron123
Guest
Posts: n/a
 
      27th Sep 2009
I found a way.
Use
<![CDATA[




AAaron123 wrote:
> 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....



 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      28th Sep 2009
"AAaron123" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> 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! |
*******************************************
 
Reply With Quote
 
AAaron123
Guest
Posts: n/a
 
      28th Sep 2009
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



Gregory A. Beamer wrote:
> "AAaron123" <(E-Mail Removed)> wrote in
> news:(E-Mail Removed):
>
>> 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,
>
>
>
> *******************************************
>> Think outside the box! |

> *******************************************



 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      28th Sep 2009
"AAaron123" <(E-Mail Removed)> wrote in
news:#(E-Mail Removed):

> 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! |
*******************************************
 
Reply With Quote
 
AAaron123
Guest
Posts: n/a
 
      28th Sep 2009

Thanks

Gregory A. Beamer wrote:
> "AAaron123" <(E-Mail Removed)> wrote in
> news:#(E-Mail Removed):
>
>> 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,
>
>
> *******************************************
>> Think outside the box! |

> *******************************************



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Start and End HTML tags as 2 different Literal controls. Hetal Microsoft ASP .NET 1 12th Sep 2008 10:13 AM
Start and End HTML Tags as 2 different Literal controls. Hetal Microsoft ASP .NET 0 10th Sep 2008 06:09 PM
html tags in report OR image url to display in exported html file =?Utf-8?B?SGFpIE5n?= Microsoft Access 0 5th Jan 2007 06:09 AM
Get inner html of an HTML element from codebehind file eggie5@gmail.com Microsoft ASP .NET 5 7th Oct 2006 05:04 AM
How to tell VS to wite HTML element's styles in the CSS file automaticly instead of in the body of the HTML file. oranmeir@gmail.com Microsoft ASP .NET 1 9th Jun 2006 07:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:30 PM.