What is the correct terminology of XML's elements?

风流意气都作罢 提交于 2019-12-08 11:40:47

问题


I am working on a SOAP app, and since it basically uses XML as it's data container, I became curious on what the correct terms for the XML elements are.

For example we have header, body, envelope, but what are is the soap actions called?

I am specifically wondering what the <something_something> field is called?

And inside a soap action one can also find keys and their values such as for example <thisIsAKey>andThisIsItsValue</thisIsAKey>

What is <thisIsAKey></thisIsAKey> called and what is andThisIsItsValue value called?

Are they called just keys and values or what?

I tried to google for XML Protocol.


回答1:


Look to the W3C XML Recommendation for answers regarding proper terminology for XML elements and attributes:

[Definition: Each XML document contains one or more elements, the boundaries of which are either delimited by start-tags and end-tags, or, for empty elements, by an empty-element tag. Each element has a type, identified by name, sometimes called its "generic identifier" (GI), and may have a set of attribute specifications.] Each attribute specification has a name and a value.

So, for your example, with an attribute added:

  • Element: <thisIsAKey attrname="attrval">andThisIsItsValue</thisIsAKey>
  • Element name: thisIsAKey
  • Start tag: <thisIsAKey>
  • End tag: </thisIsAKey>
  • Content: andThisIsItsValue
  • Attribute: attrname="attrval"
  • Attribute name: attrname
  • Attribute value: attrval


来源:https://stackoverflow.com/questions/33159531/what-is-the-correct-terminology-of-xmls-elements

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!