XML attribute vs XML element

前端 未结 20 2613
暖寄归人
暖寄归人 2020-11-22 01:34

At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of ou

20条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 02:15

    Use elements for data and attributes for meta data (data about the element's data).

    If an element is showing up as a predicate in your select strings, you have a good sign that it should be an attribute. Likewise if an attribute never is used as a predicate, then maybe it is not useful meta data.

    Remember that XML is supposed to be machine readable not human readable and for large documents XML compresses very well.

提交回复
热议问题