Extensible Markup Language
-> XML is deferent from HTML.
-> HTML is describes how to display the data. used to design data in web.
-> XML is used to defined the data, and focus on what data is.
Script 1
Loading XML file
SetXMLDta = XMLUtil.CreateXMLFromFile("D:\login.xml")
Script 2
Reading name of the root node
XMLDta = XMLUtil.CreateXMLFromFile("D:\login.xml")
Set XMLRootElmnt = XMLDta.GetRootElement()
Print("Root Elemement is="&XMLRootElmnt.ElementName)
Script 3
Enumerate attributes of the root node
XMLDta = XMLUtil.CreateXMLFromFile("D:\login.xml")
Set XMLRootElmnt = XMLDta.GetRootElement()
Set attrcol = XmlRootElmnt.Attributes
for i=1 to attrcol.count
Set attr=attrcol.item(i)
print("Attribute name =" &attr.name & " attribute values are="&attr.value)
Next
attr.name = its return the name of the attributes
attr.value = its return the value of the attributes
Script 4
Enumerate the Child element of the root node
XMLDta = XMLUtil.CreateXMLFromFile("D:\login.xml")
Set XMLRootElmnt = XMLDta.GetRootElement()
Set Childcol= XMLRootElmnt.ChildElements()
for i=1 to childcol.count
childnam = childcol.item (i)
print("ChilD Elements are =" &childnam.ElementName)
Next
Script 5
compare two XML file
set XMLFile1=XMLUtil.CreateXMLFromFile("D:\login1.xml")
set XMLFile2=XMLUtil.CreateXMLFromFile("D:\login1.xm2")
res = XMLFile1.compare(XMLFile2)
if res eqv True then
msgbox("Two files are same")
else
msgbox("Two files are different")
end if
No comments:
Post a Comment