How is empty node tag in xml and non-existence of node interpreted?
I have two XML request:
<GetPersonRequest>
<Person/>
<IncludeAddress>true</IncludeAddress>
</GetPersonRequest>
and
<GetPersonRequest>
<IncludeAddress>true</IncludeAddress>
</GetPersonRequest>
Is there a difference between empty nodes and non-existence of nodes ? Does the XML parser makes any difference ?. Does call to text of both node returns empty string ?
I w开发者_如何学运维ould like to add that second XML is similar in that element is optional. So the user might just omit. Does xml.getElement("Person") still return null ?
These XMLs are different. 1st XML contains element Person
(empty element, its text()
is null
), while 2nd doesn't. For 2nd XML (pseudo-code) xml.getElement("Person")
will return null
.
精彩评论