CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2008
    Posts
    2

    HTML and XML Help!!!!!!!!

    Hey everyone. I have been trying to find a solution for this but i can't find it anywhere.

    In my C# Windows Applications, I am getting html text from a sql server database. I need to pass this html in an xml tag. But that isn't the problem. The person receiving the xml, wants the information in the html with all the formatting, but not the htlm tags that go with it.

    For example.

    What I get from database and put into BodyXML node:

    <BodyXML><p>Hello,</p><p>I have a question bla bla bla</p><p>Any hints</p><p>Regards,</p><p>Klaus</p></BodyXML>

    What the receiver of the XML wants in the BodyXML node:

    <BodyXML>Hello,

    I have a question bla bla bla

    Any hintsRegards,

    Klaus</BodyXML>

    Basically, he wants an executed HTML with all the formatting in the xml node. how do i do this in C# before I assign it to the XML?

    Right now I am just getting the HTML from the database and putting it in the XML node, HTML tags and all.

    Any help would be great. thanks.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: HTML and XML Help!!!!!!!!

    Quote Originally Posted by wchl
    Basically, he wants an executed HTML with all the formatting in the xml node. how do i do this in C# before I assign it to the XML?
    Can you clarify whether you need formatting in the xml node? You state this but your example shows that all the html formatting is stripped out. If you need formatting, can you give an xml example of what you are looking for?

  3. #3
    Join Date
    May 2008
    Posts
    2

    Re: HTML and XML Help!!!!!!!!

    Quote Originally Posted by Arjay
    Can you clarify whether you need formatting in the xml node? You state this but your example shows that all the html formatting is stripped out. If you need formatting, can you give an xml example of what you are looking for?

    Hey Arjay. Thanks for the quick reply. Currently I am passing the HTML code with the tags and stuff. What they want is the executed HTML. As in the example without the html tags, there are spaces between each line because of the <p></p> tags.

    basically, for example, if the html i get from the database is

    Hello<BR>World

    I need it to show in the BodyXML node:

    Hello
    World

    with the <BR> executed

    let me know, thanks

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: HTML and XML Help!!!!!!!!

    I would apply an xsl transform to the html before putting it into the xml node.

    Of course the is imperfect because you are lose some of the formatting.

    For example:

    <B>Hello</B><BR>World

    is going to show up as

    Hello
    World

    not

    Hello
    World

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured