473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading XML with HTML tags

Hi all

I have a XML file with the following:

<Step step="1">
<Text><b>Chapter 1</b>
This is a test. Click <b><i>Load</i></b>
</Text>
</Step>

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?

Thanks!

Jun 15 '06 #1
7 3198


em*******@gmail.com wrote:

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?


You could use InnerXml instead of InnerText.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 15 '06 #2
Thanks! It worked!

Martin Honnen wrote:
em*******@gmail.com wrote:

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?


You could use InnerXml instead of InnerText.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Jun 15 '06 #3
How about to save with the tags?

I tried InnerXml as well and it blows up. With InnerText stays really
messed up.

em*******@gmail.com wrote:
Thanks! It worked!

Martin Honnen wrote:
em*******@gmail.com wrote:

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?


You could use InnerXml instead of InnerText.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Jun 15 '06 #4
emferrari,
The important point here is to be able to understand what "well - formed"
means.
You don't say where you got this "XML". but I suspect it was simply
"concocted".

if you want to store markup you need to enclose it in CDATA sections.

If you want to parse HTML AS IF it were legal XML, take a look at Simon
Mourier's HtmlAgilityPack.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"em*******@gmail.com" wrote:
Hi all

I have a XML file with the following:

<Step step="1">
<Text><b>Chapter 1</b>
This is a test. Click <b><i>Load</i></b>
</Text>
</Step>

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?

Thanks!

Jun 15 '06 #5
Ok, agreed.

I don't want to use third part component. There is another way?

Peter wrote:
emferrari,
The important point here is to be able to understand what "well - formed"
means.
You don't say where you got this "XML". but I suspect it was simply
"concocted".

if you want to store markup you need to enclose it in CDATA sections.

If you want to parse HTML AS IF it were legal XML, take a look at Simon
Mourier's HtmlAgilityPack.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"em*******@gmail.com" wrote:
Hi all

I have a XML file with the following:

<Step step="1">
<Text><b>Chapter 1</b>
This is a test. Click <b><i>Load</i></b>
</Text>
</Step>

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?

Thanks!


Jun 15 '06 #6
Simon's "component" is free and open-source, written in C#, is very
sophisticated, and no, there aren't really any "other ways" unless you want
to use similar code to his.

Essentially, you are creating an HtmlDocument object that behaves like a
well-formed XmlDocument and permits accurate xpath operations.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"em*******@gmail.com" wrote:
Ok, agreed.

I don't want to use third part component. There is another way?

Peter wrote:
emferrari,
The important point here is to be able to understand what "well - formed"
means.
You don't say where you got this "XML". but I suspect it was simply
"concocted".

if you want to store markup you need to enclose it in CDATA sections.

If you want to parse HTML AS IF it were legal XML, take a look at Simon
Mourier's HtmlAgilityPack.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"em*******@gmail.com" wrote:
Hi all

I have a XML file with the following:

<Step step="1">
<Text><b>Chapter 1</b>
This is a test. Click <b><i>Load</i></b>
</Text>
</Step>

I'd like to read this node and bring the HTML tags as well. I'm reading
using node["Text"].InnerText but looks like the InnerText remove the
HTML tags from it. Does someone knows how I can read the node with the
HTML tags on it?

Thanks!


Jun 15 '06 #7


em*******@gmail.com wrote:
How about to save with the tags?

I tried InnerXml as well and it blows up.


What exactly are you trying to save in which way? Provide some code
snippets you are using and give precise error messages you get, then we
can hopefully solve things. But with a description like "it blows up" it
is not possible to tell what you tried and in which way it failed.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 16 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Franklin P Patchey | last post by:
Please look at:- http://theorangesite.mysite.freeserve.com/miscellaneous/002/001.htm and tell me how to change the purple text that says "Try Next" to black and font face Comic sans MS and...
3
by: Christian Caron | last post by:
Hi all, I have a page which contains the following tag: <head> <meta name="date_modified" content="20030730" /> </head> (...) <script> (...)
12
by: Anna | last post by:
Hi all, I posted the same question this afternoon but my message isn't showing up, so I thought I'd give it another try.... in case you should see it later I apologize for posting the same...
1
by: Cognizance | last post by:
Hi gang, I'm an ASP developer by trade, but I've had to create client side scripts with JavaScript many times in the past. Simple things, like validating form elements and such. Now I've been...
3
by: Rick | last post by:
I have a base class that inherits from System.Web.UI.Page that I need to include the ability to read the inheriting class/page meta tags. I can't find any methods in the System.Web.UI.Page members...
0
by: suridcs | last post by:
Hi guys, i want to perform one operation like i am developing a control to compare 2 documents of any format. If i am comparing 2 HTML documents all the HTML tags are appearing in the comparision...
4
by: Vikas Kumar | last post by:
propertyDescription += "<br>" + lblpropertyDescription.Text; //here i am reading some text from text area i test wrting "p" in my text area it wrks fine but when i write <pin my text...
2
by: dennis.sprengers | last post by:
Ik ben bezig met een eigen UBB editor. Als iemand aan het typen is, zorgt CTRL-B voor een \-tag en nogmaals CTRL-B voor een \ tag. Als je eerst een selectie maakt en dan CTRL-B drukt, wordt de...
3
by: Paul Moore | last post by:
I'd like to write some scripts to analyze and manipulate my music files. The files themselves are in MP3 and FLAC format (mostly MP3, but FLAC where I ripped original CDs and wanted a lossless...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.