I have a simple problem with XML got from database. Now, this XML can have no values inside it, as follows:
<TryXML xmlns="">
<TryXML_XML_VERSION>1.0</TryXML_XML_VERSION>
<TITLE_DESC />
<ISCI_CODE />
<PRODUCT_DESC />
<PLAY_LENGTH />
<START_TIME />
<COMPRESSION_LEVEL_CODE />
<ENCODER_TYPE_DESC />
<OUTPUT_RATE />
<FRAME_RATE />
<FILE_NAME />
<FILE_SIZE />
<COPY_DATE />
<ADVERTISER />
<AGENCY_VENDOR />
</TryXML>
or it could have values inside, like this
<TryXML xmlns="">
<TryXML_XML_VERSION>1.0</TryXML_XML_VERSION>
<TITLE_DESC>asd</TITLE_DESC>
<ISCI_CODE>asd</ISCI_CODE>
<PRODUCT_DESC>sd</PRODUCT_DESC>
<PLAY_LENGTH>asdklgh</PLAY_LENGTH>
<START_TIME>sdghkl</START_TIME>
<COMPRESSION_LEVEL_CODE />
<ENCODER_TYPE_DESC />
<OUTPUT_RATE />
<FRAME_RATE />
<FILE_NAME>sdfgjkl</FILE_NAME>
<FILE_SIZE />
<COPY_DATE />
<ADVERTISER>sdfgklj</ADVERTISER>
<AGENCY_VENDOR>sdfgjkl</AGENCY_VENDOR>
</TryXML>
How can I check if the said XML nodes has values or not? NOTE: The values can be anything alpha-numeric.
Assuming you’re using SQL Server, you can use
value:This only shows the first row, where
/root/ahas a value. As requested in the comment an example with acase:Example at SE.Data.