Read HTML tags in XML Reader

xml , html , csharp Singapore, Singapore
  • 8 years ago
    Hi all, I have an XML as following at the lower part. I'm trying to read it with the this code: DataSet cars = new DataSet(); cars.ReadXml("http://localhost/cars/newcars.xml"); All the nodes are getting properly populated into the Dataset created EXCEPT the "description" node. This node is just not populated (the value is 0 for that node). I can't find a way to make ReadXML (or similar method) to get the content of the description node and skip the HTML tags. I would like just treat that portion as pure text, ignoring the html content. My question would be: How can I read an XML file which some of the nodes have HTML tags inserted? How could I avoid that the program treats the HTML tags as XML nodes> thanks, Juan red ford

    Super
    fast

    Reasons to buy

    Just because

  • 8 years ago
    Hi all, I have an XML as following. I'm trying to read it with the following code: DataSet cars = new DataSet(); cars.ReadXml("http://localhost/cars/newcars.xml"); All the nodes are getting properly populated into the Dataset created EXCEPT the "description" node. I can't find a way to make ReadXML (or similar method) to get the content of the description node and skip the HTML tags. I would like just treat that portion as pure text, ignoring the html content. My question would be: How can I read an XML file which some of the nodes have HTML tags inserted? How could I avoid that the program treats the HTML tags as XML nodes> thanks, Juan red ford

    Super
    fast

    Reasons to buy

    Just because

  • 8 years ago
    I don't think you can do that, because xHTML is also a mark up derived from XML. The only possibility that I can think of is to make changes to your XML file. red ford <p xmlns="http://www.w3.org/1999/xhtml"><span class="textnorm" title="">Super</br>fast</br></span></p><h2 xmlns="http://www.w3.org/1999/xhtml"><span class="textnorm" title="">Reasons to buy</span></h2><p xmlns="http://www.w3.org/1999/xhtml">Just because</p> This would encode the HTML as text and when you read it, it would give you the actual HTML. I've changed the '<' to '<' and '>' to '>' Hope you understand this.
  • 8 years ago
    I don't think you can do that, because xHTML is also a mark up derived from XML. The only possibility that I can think of is to make changes to your XML file. red ford <p xmlns="http://www.w3.org/1999/xhtml"><span class="textnorm" title="">Super</br>fast</br></span></p><h2 xmlns="http://www.w3.org/1999/xhtml"><span class="textnorm" title="">Reasons to buy</span></h2><p xmlns="http://www.w3.org/1999/xhtml">Just because</p> This would encode the HTML as text and when you read it, it would give you the actual HTML. I've changed the '<' to '<' and ' <' to ' >' Hope you understand this.
  • 8 years ago
    I am sorry, I can not write what I want. This editor is changing the text I writing.
  • 8 years ago
    Hi Thulasse, thanks a lot, I got what you mean: <p xmlns="http://www.w3.org/1999/xhtml"><span class="textnorm" title="">Super</br>fast</br></span></p><h2 xmlns="http://www.w3.org/1999/xhtml"><span class="textnorm" title="">Reasons to buy</span></h2><p xmlns="http://www.w3.org/1999/xhtml">Just because</p> thanks, Juan
  • 8 years ago
    Hi, it seems I need to put that text inside a CDATA section ( & signs are also not allowed in XML) thanks for your replies, Juan

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay