Link to home
Start Free TrialLog in
Avatar of Kalpesh Chhatrala
Kalpesh ChhatralaFlag for India

asked on

HTML Page to XML

How can we Convert HTML to XML

i want to save this xml to SQL Database

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of CombatGold1
CombatGold1

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?
@CombatGold1

Well-formed HTML is a subset of XML  :  )
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?
Avatar of Kalpesh Chhatrala

ASKER

i want to save html data column by column into SQL Server.

i attached here with html page sample

html-page.htm
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.
Partially helpful.