Solved

HTML Page to XML

Posted on 2011-03-17
8
270 Views
Last Modified: 2012-05-11
How can we Convert HTML to XML

i want to save this xml to SQL Database

Thanks
0
Comment
Question by:Kalpesh Chhatrala
8 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 35156657
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
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35156667
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
 
LVL 3

Expert Comment

by:CombatGold1
ID: 35156678
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
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35156790
@CombatGold1

Well-formed HTML is a subset of XML  :  )
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 23

Expert Comment

by:wdosanjos
ID: 35157912
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
 
LVL 16

Author Comment

by:Kalpesh Chhatrala
ID: 35158525
i want to save html data column by column into SQL Server.

i attached here with html page sample

html-page.htm
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35160066
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
 
LVL 16

Author Closing Comment

by:Kalpesh Chhatrala
ID: 35163802
Partially helpful.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now