在XSD,SOAP和其他XML約定,你會經常看到像:XML:屬性還是孩子?
<book>
<title>Harry Potter</title>
<author>J.K. Rowling</author>
</book>
現在我想知道,發生了什麼屬性?對我來說更有意義,寫爲:
<book title="Harry Potter" author="J.K. Rowling" />
但很顯然,由於某些原因,聰明的人比我選擇了其他方式。 有人可以解釋爲什麼,以及什麼屬性呢?
請參閱: http://stackoverflow.com/questions/241819/xml-best-practices-attributes-vs-additional-nodes – Cuga 2009-05-05 14:37:46