HTML Page to XML

How can we Convert HTML to XML

i want to save this xml to SQL Database

Thanks
LVL 16
Kalpesh ChhatralaSoftware ConsultantAsked:
Who is Participating?
 
DhaestCommented:
Exactly what XML format are you looking for? Do you want to convert that HTML document to an XHTML document? SgmlReader can help doing that, http://developer.mindtouch.com/en/docs/SgmlReader

Convert HTML to XHTML and clean unnecessary tags and attributes / Utilities / C#
http://netcode.ru/dotnet/?lang=&katID=30&skatID=281&artID=7730
0
 
käµfm³d 👽Commented:
You HAVE to ensure the HTML is well-formed (as in XML well-formed). Other than that, it should just be a matter of having an XML-typed column in your database and inserting the data.

If you cannot guarantee that your HTML is well-formed, then you will not be able to store this data.
0
 
CombatGold1Commented:
I think you've misunderstood what XML is. HTML is mark-up for both presentation and data/content whereas XML is mark-up specifically for data/content only, it has no presentation information.

Essentially they are formatted very similar so they shouldn't need much conversion, though I'm still unsure why you would need to convert HTML to XML to store it in an SQL database.

Could you possibly show us the HTML you want converted (or a portion of it) and why you need it in XML?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
käµfm³d 👽Commented:
@CombatGold1

Well-formed HTML is a subset of XML  :  )
0
 
wdosanjosCommented:
My 2 cents... I'm not sure what's your specific need, but I think it would be simpler to store the HTML in a nvarchar(max) column.

Can you elaborate on why you need it to be in XML?
0
 
Kalpesh ChhatralaSoftware ConsultantAuthor Commented:
i want to save html data column by column into SQL Server.

i attached here with html page sample

html-page.htm
0
 
käµfm³d 👽Commented:
Your attached example is not well-formed XML. You will need to either correct it if you want to store it in an XML-typed column, or store it in a string-typed column.
0
 
Kalpesh ChhatralaSoftware ConsultantAuthor Commented:
Partially helpful.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.