在 XSD、SOAP 和其他 XML 约定中,您经常会看到如下内容:
<book>
<title>Harry Potter</title>
<author>J.K. Rowling</author>
</book>
现在我想知道,属性发生了什么?对我来说,把它写成这样更有意义:
<book title="Harry Potter" author="J.K. Rowling" />
但显然,出于某种原因,比我更聪明的人选择了其他方式。有人可以解释为什么,然后是什么属性?
在 XSD、SOAP 和其他 XML 约定中,您经常会看到如下内容:
<book>
<title>Harry Potter</title>
<author>J.K. Rowling</author>
</book>
现在我想知道,属性发生了什么?对我来说,把它写成这样更有意义:
<book title="Harry Potter" author="J.K. Rowling" />
但显然,出于某种原因,比我更聪明的人选择了其他方式。有人可以解释为什么,然后是什么属性?