XML attribute vs XML element

前端 未结 20 2228
暖寄归人
暖寄归人 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 01:59

    How about taking advantage of our hard earned object orientation intuition? I usually find it is straight forward to think which is an object and which is an attribute of the object or which object it is referring to.

    Whichever intuitively make sense as objects shall fit in as elements. Its attributes (or properties) would be attributes for these elements in xml or child element with attribute.

    I think for simpler cases like in the example object orientation analogy works okay to figure out which is element and which is attribute of an element.

提交回复
热议问题