XML attribute vs XML element

前端 未结 20 2271
暖寄归人
暖寄归人 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:02

    I use this rule of thumb:

    1. An Attribute is something that is self-contained, i.e., a color, an ID, a name.
    2. An Element is something that does or could have attributes of its own or contain other elements.

    So yours is close. I would have done something like:

    EDIT: Updated the original example based on feedback below.

      
          something
          XYX
          
             YYZ
          
       
    

提交回复
热议问题