læs xml
jeg har dette XML<collection>
<cd>
<title>The Hour of Bewilderbeast</title>
<band>Badly Drawn Boy</band>
<tracks>
<track id="1" artist="Joe"/>
</tracks>
</cd>
<cd>
<title>Gorillaz</title>
<band>Gorillaz</band>
<tracks>
<track id="1" artist="Joe"/>
</tracks>
</cd>
</collection>
så har jeg denne asp:
<%@ language="vbscript" %>
<% Option Explicit %>
<%
Dim xmlDoc, root, success
Set xmlDoc = Server.CreateObject("msxml2.DOMDocument")
' Allow the document to complete loading
xmlDoc.async = False
success = xmlDoc.Load(Server.MapPath("xml/cd.xml"))
If success = True Then
Set root = xmlDoc.documentElement
displayNode root
Set root = Nothing
End If
Set xmlDoc = Nothing
Private Sub displayNode(ByVal node)
Dim child, strName, strData
strName = node.nodeName
strData = node.Text
Response.Write strName & ": " & strData & "<br />"
' Check for child nodes
If node.childNodes.length > 1 Then
For Each child In node.childNodes
displayNode child
Next
End If
End Sub
%>
Den indlæser hele xml og udskriver alle værdier(næsten)
Hvordan fanger jeg de værdier som står inde i et tag???
fx. id=1 og artist=Joe
(<track id="1" artist="Joe"/>)
