📄 xmldomread.aspx
字号:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Xml" %>
<script runat=server>
private i as integer
private strOutput as string = ""
sub Page_Load(obj as object, e as eventargs)
dim xmldoc as new XMLDocument()
try
xmldoc.Load(Server.MapPath("books.xml"))
ShowTree(xmldoc.DocumentElement)
catch ex as Exception
strOutput = "Error accessing XML file"
end try
output.Text = strOutput
end sub
sub ShowTree(node as XMLNode)
Dim attrnode As XmlNode
Dim map As XmlNamedNodeMap
If Not(node.HasChildNodes)
strOutput += " <b>" & node.Name & "</b> <" & _
node.Value & "><br>" & vbcrlf
Else
strOutput += "<b>" & node.Name & "</b>"
If node.NodeType = XmlNodeType.Element Then
map = node.Attributes
For Each attrnode In map
strOutput += " <b>" & attrnode.Name & "</b> <" & _
attrnode.Value & "> " & vbcrlf
Next
End If
strOutput += "<br>"
End If
If node.HasChildNodes then
node = node.FirstChild
While not IsNothing(node)
ShowTree(node)
node = node.NextSibling
end while
end if
end sub
</script>
<html><body>
<asp:Label id="output" runat="server" />
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -