Learn about namespaces in XML
If you, who have ever worked on XML files, are more or less aware of the namespace concept in XML. Let me give you the following example to give you a first look at it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<?xml version="1.0" encoding="UTF-8"?> <classes xmlns:c1="https://huongdanjava.com/class1" xmlns:c2="https://huongdanjava.com/class2"> <c1:class> <c1:students> <c1:student> <c1:name>Khanh</c1:name> <c1:address>123</c1:address> </c1:student> <c1:student> <c1:name>Quan</c1:name> <c1:address>456</c1:address> </c1:student> </c1:students> </c1:class> <c2:class> <c2:students> <c2:student> <c2:name>Khanh</c2:name> <c2:address>789</c2:address> </c2:student> <c2:student> <c2:name>Duy</c2:name> <c2:address>234</c2:address> </c2:student> </c2:students> </c2:class> </classes> |
Declaring xmlns:c1=”https://huongdanjava.com/class1″ or xmlns:c2=”https://huongdanjava.com/class2″ then the xmlns:c1 or xmlns:c2… Read More