Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to load HTML file using XmlDocument class

How to load HTML file using XmlDocument class

Scheduled Pinned Locked Moved C#
xmlhtmltutorial
5 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ElCachubrey
    wrote on last edited by
    #1

    How to load HTML file using XmlDocument class I try to do System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(path); but html document not considered by doc.Load method like regullar xml document since what have some unclosed tags such as an other unwell formated things( Can i actually load this html file by using System.Xml.XmlDocument() for purpose transform this HTML file into an XML file by using XSLT. THANK

    C P U E 4 Replies Last reply
    0
    • E ElCachubrey

      How to load HTML file using XmlDocument class I try to do System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(path); but html document not considered by doc.Load method like regullar xml document since what have some unclosed tags such as an other unwell formated things( Can i actually load this html file by using System.Xml.XmlDocument() for purpose transform this HTML file into an XML file by using XSLT. THANK

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      As you have found, not all HTML documents are XHTML. Therefore, a DOM class will not load them. An XSLT can generate non XML documents, but it cannot work with documents that are not XML to start with, you need a different solution.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • E ElCachubrey

        How to load HTML file using XmlDocument class I try to do System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(path); but html document not considered by doc.Load method like regullar xml document since what have some unclosed tags such as an other unwell formated things( Can i actually load this html file by using System.Xml.XmlDocument() for purpose transform this HTML file into an XML file by using XSLT. THANK

        P Offline
        P Offline
        pmarfleet
        wrote on last edited by
        #3

        HTML doesn't conform to XML standards. However XHTML does. The following text comes from the Wikipedia article for XHTML: Whereas HTML is an application of Standard Generalized Markup Language (SGML), a very flexible markup language, XHTML is an application of XML, a more restrictive subset of SGML. A solution to your problem would be to convert your HTML code to XHTML which can be understood by the XML parser. I'm not aware of a component that can do this. However this article[^] explains the processes involved.

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        1 Reply Last reply
        0
        • E ElCachubrey

          How to load HTML file using XmlDocument class I try to do System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(path); but html document not considered by doc.Load method like regullar xml document since what have some unclosed tags such as an other unwell formated things( Can i actually load this html file by using System.Xml.XmlDocument() for purpose transform this HTML file into an XML file by using XSLT. THANK

          U Offline
          U Offline
          Uwe Keim
          wrote on last edited by
          #4

          Personally, I do use SgmlReader[^]. In addition you could use my Zeta Html Tidy[^] library. I am using both, SgmlReader andy Zeta Html Tidy, together in some projects.

          • My personal 24/7 webcam - Always live ;-) • Zeta Producer Desktop CMS - Intuitive, completely easy-to-use CMS for Windows. • Zeta Helpdesk - Open Source ticket software for Windows and web. • Zeta Uploader - Easily send large files by e-mail. Windows and web client.

          1 Reply Last reply
          0
          • E ElCachubrey

            How to load HTML file using XmlDocument class I try to do System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(path); but html document not considered by doc.Load method like regullar xml document since what have some unclosed tags such as an other unwell formated things( Can i actually load this html file by using System.Xml.XmlDocument() for purpose transform this HTML file into an XML file by using XSLT. THANK

            E Offline
            E Offline
            ElCachubrey
            wrote on last edited by
            #5

            THNAK ALL

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups