I have an XML Schema element like this:
<xs:element type="xs:string" name="IsActive" minOccurs="0"> </xs:element>
I'm using dom4j XPath to evaluate the element.
It seems impossible to determine whether element is present in the XML document or if its value is simply ""
.
I want <IsActive>
to be either, 1) ""
2) "anyvalue1"
3) "anyvalue"
Also I would like to know if <IsActive>
is present.
XPath valuePath;
Node obj = (Node)valuePath.selectSingleNode(requestElement);
obj.getText()
always returns ""
, even if <IsActive>
is not present.
valuePath.valueOf(requestElement); // does the same
So my question is: How to distinguish null and empty string?