问题
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