Option
Explicit
Public
Sub
ParseXml()
Dim
xml
As
Object
Set
xml = CreateObject(
"MSXML2.DOMDocument"
)
Call
xml.SetProperty(
"SelectionLanguage"
,
"XPath"
)
xml.validateOnParse =
True
xml.async =
False
If
Not
xml.Load(
"C:\Test\Beispiel.xml"
)
Then
Call
MsgBox( _
Buttons:=vbCritical, _
Prompt:=xml.ParseError.Reason, _
Title:=
"Fehler in Zeile "
& xml.ParseError.Line &
", Spalte "
& xml.ParseError.LinePos)
Exit
Sub
End
If
Dim
xmlAttr
As
Object
Set
xmlAttr = xml.SelectSingleNode(
"//renderedResult/@concentration"
)
Call
MsgBox(
"'"
& xmlAttr.Name &
"' = "
& xmlAttr.NodeValue, vbInformation)
End
Sub