我有一個XMLDocument
作爲查詢的結果。XML節點在空時缺失
我想爲每個條目提取<Property>
值和適當的<Notes>
。
<?xml version="1.0"?>
<EADATA version="1.0" exporter="Enterprise Architect">
<Dataset_0>
<Data>
<Row>
<PropertyID>439</PropertyID>
<Object_ID>683</Object_ID>
<Property>tagged value</Property>
<ea_guid>{5BF3E019-277B-45c2-B2DE-1887A90C6944}</ea_guid>
</Row>
<Row>
<PropertyID>444</PropertyID>
<Object_ID>683</Object_ID>
<Property>Another Tagged value</Property>
<Notes>Another tagged value notes.</Notes>
<ea_guid>{42BE8BAA-06B8-4822-B79A-59F653C44453}</ea_guid>
</Row>
</Data>
</Dataset_0>
</EADATA>
但是,如果<Notes>
是空的,沒有<Notes>
標籤都沒有。
什麼XPath
我應該寫在這種情況下?
這是我不清楚你的願望輸出。所以沒有''元素,所以你想輸出什麼?也許一些預期的輸出爲給定的例子會有所幫助... –
dirkk