Well, XHTML is XML, so you'd really be loading XML into an XMLDocument, but
once it's loaded, you can parse out whatever you like using the DOM.
Dim xmlDoc As New System.XML.XMLDocument()
'You can load the XML in one of two ways...
'docPath represents a path to an file containing the XML
xmlDoc.Load(docPath)
'or
'Here you can load a string directly
xmlDoc.LoadXML(string)
'Example of getting all the paragraph tags and then the text of the first
one using the DOM...
dim theParagraphs As XMLNodeList = xmlDoc.GetElementsByTagName("P")
dim firstParagraphText As String = theParagraphs(0).Text
-Scott
"Mohammad-Reza" <> wrote in message
news:9980C3BA-D1A3-4BDC-B1FF-...
> Can you give a sample code for loading XHTML to a XMLDocument?
>
> "Scott M." wrote:
>
>> What I had in mind was, if the HTML in question was well-formed (XHTML),
>> you
>> could just load it into an XMLDocument (from a string) object and use the
>> XML DOM to parse from there.
>>
>>
>>
>> "John Saunders" <john.saunders at trizetto.com> wrote in message
>> news:...
>> > "Scott M." <s-> wrote in message
>> > news:...
>> >>I don't know where you have gotten your information, but this is
>> >>exactly
>> >>what the DOM is for.
>> >
>> > Scott,
>> >
>> > I used this approach with a Windows Forms application back in 2001,
>> > with
>> > .NET 1.0. It worked, but was a bit clumsy, and it was time-consuming. I
>> > used the ActiveX Internet Browser control to load the page I was
>> > interested in, and once the page was loaded, I could access the DOM
>> > from
>> > C# code. Did you have a different technique in mind when you talk about
>> > the DOM?
>> >
>> > Perhaps a faster technique would be to use regular expressions to parse
>> > the HTML and find what you're looking for.
>> >
>> > John
>> >
>> >
>>
>>
>>
|