What does mean in XML?

后端 未结 1 1269
清酒与你
清酒与你 2020-12-07 00:06

I have a question about XML syntax. I know that the closing tag looks like , but what does mean? For example:



        
相关标签:
1条回答
  • 2020-12-07 00:16

    In your example,

    <a>
      <b>
        <c/>
        <d/>
      </b>
    </a>
    

    <c/> and <d/> are empty element tags:

    Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword EMPTY. For interoperability, the empty-element tag should be used, and should only be used, for elements which are declared EMPTY.

    How would this XML tree look like?

    The containment tree would be as shown above via indentation.

    Is a only going to have b as a child?

    Yes. b and c would be descendants, but not children, of a.

    Would b also have c and d as children?

    c and d are children of b alone, not of a.

    0 讨论(0)
提交回复
热议问题