Re: Parsing out a data Island in a FrontPage document using VBA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Ken,
Don't you need to also define the xml tag and then call it by using the headtag as the object.
something like this:

Sub GetDataIsland()
Dim pg As WebFile
Set pg = ActiveWeb.RootFolder.Files("sample.htm")
pg.Open
Dim pgwindow
Set pgwindow = ActiveWebWindow.PageWindows("sample.htm")
' Need to parse the XML in here
Set headtag = pgwindow.Document.all.tags("head")
Set xmltag = headtag.Document.all.tags("xml") 'added this line
For Each obj In xmltag 'changed this line.
Debug.Print obj.outerHTML
Next
End Sub

This is off the top of my head so it might need some tweaking

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@xxxxxxxxxxxx> wrote in message
news:12A59A79-8410-48C5-A679-ABFD0CCB2109@xxxxxxxxxxxxxxxx
> I'm trying to use VBA and the FrontPage object model to retrieve data from
> an embedded XML data island.
>
> In the code below, I can open the file (sample.htm) and get the content of
> the HEAD tag. However, the tags collection doesn't pick out the xml tag,
> obviously because it isn't seen as an object in the object model.
>
> There's a reference in the documentation to FPHTMLUnknownElement and
> IHTMLElement which may provide a solution here, but so far they escape me.
>
> The simple demonstration code appears below.
>
> Thanks for any help,
>
> Ken
>
>
> Sub GetDataIsland()
> Dim pg As WebFile
> Set pg = ActiveWeb.RootFolder.Files("sample.htm")
> pg.Open
> Dim pgwindow
> Set pgwindow = ActiveWebWindow.PageWindows("sample.htm")
> ' Need to parse the XML in here
> Set headtag = pgwindow.Document.all.tags("head")
> For Each obj In headtag
> Debug.Print obj.outerHTML
> Next
> End Sub
>
> <html>
> <head>
> <title></title>
> <xml>
> <MSHelp:TOCTitle Title="The title of the page goes here"/>
> <MSHelp:RLTitle Title="The title of the page goes here"/>
> <MSHelp:Keyword Index="K" Term="title parsing" />
> <MSHelp:Keyword Index="K" Term="xml data" />
> </xml>
> </head>
> <body>
> Sample page for parsing the XML Data Island
> </body>
> </html>
>
>


.



Relevant Pages

  • RE: using myXslDoc.Transform
    ... and xml file ... Dim strXML As String = SqlHelper.ExecuteScalar(cn, ... ' get xsl file from database and load xsl file ...
    (microsoft.public.dotnet.xml)
  • RE: ASP.Net app cannot read XML with Anonymous Authentication disabled
    ... ASP.Net app cannot read XML with Anonymous Authentication ... | Dim ProjReader As XmlReader = Nothing ... | Dim ProjURL As String = Session ... | 'Get XML Data for Projector and load in Projector Dropdown ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: using myXslDoc.Transform
    ... 'get xml file from the database and load xml file ... Dim strXML As String = SqlHelper.ExecuteScalar(cn, ... the transform can be applied as usual. ...
    (microsoft.public.dotnet.xml)
  • Re: Word 2007 XML document and the w namespace
    ... The word2007 docx format follows the EMCA Office Open XML standard ... Dim zEntry As ZipEntry 'holds a zip file entry ... Dim xmlDoc As System.String="" 'holds your extracted xml ... While totalread < entrySize ...
    (microsoft.public.dotnet.xml)
  • RE: ASP.Net app cannot read XML with Anonymous Authentication disabled
    ... ASP.Net app cannot read XML with Anonymous Authentication ... | Dim ProjReader As XmlReader = Nothing ... | Dim ProjURL As String = Session ... | 'Get XML Data for Projector and load in Projector Dropdown ...
    (microsoft.public.dotnet.framework.aspnet.security)