XML with namespace
<? XML version = "1.0" encoding = "UTF-8" ?>
< Root Version = "1" Xmlns = "Http://xspf.org/ns/0" >
< Users ID = "User" >
< User >
< User_name Name = "Zzz" > Zhang San </ User_name >
< User_age > 23 </ User_age >
< User_birth > 1984-02-21 </ User_birth >
< Email > Zhangsan@hotmail.com </ Email >
</ User >
</ Users >
</ Root >
XML without a namespace
<? XML version = "1.0" encoding = "UTF-8" ?>
< Root Version = "1" >
< Users ID = "User" >
< User >
< User_name Name = "Zzz" > Zhang San </ User_name >
< User_age > 23 </ User_age >
< User_birth > 1984-02-21 </ User_birth >
< Email > Zhangsan@hotmail.com </ Email >
</ User >
</ Users >
</ Root >
Read method example
VaR Gxml: XML = XML (event. Result );
Trace (gxml ); // Output the entire XML
VaR NS: namespace = New Namespace ( " Http://xspf.org/ns/0/ " );
Trace (gxml. NS: users. NS: User. NS: user_name.tostring ()); // Output XML with namespace
Trace (gxml. Users. User. user_name.tostring ()); // Output XML without a namespace
translate namespaces into namespaces. To prevent tag conflicts in XML, if xmlns is defined in XML, the value is read using the "namespace: Sub-tag" method.
Note: namespace cannot be used to read attributes in tags.
for example, the ID attribute in the NS: User label cannot be written as ns: user. NS: @ ID, which should be written as ns: user. @ ID.