2
我有XML,看起來像刪除XML節點
<MeasureSet>
<MeasureSetType val_type="name">Variant</MeasureSetType>
<Measure>
<MeasureType val_type="name">single nucleotide variant</MeasureType>
<AttributeSet>
<MeasureAttributeType val_type="name">HGVS</MeasureAttributeType>
<Attribute>NM_000054.4:c.838dupT</Attribute>
</AttributeSet>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed">10820168</ID>
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed" />
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed">9773787</ID>
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed">18726898</ID>
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed" />
</Citation>
</Measure>
</MeasureSet>
我想刪除具有引用/ ID/@來源=「考研」和引文/ ID是引用元素節點空
這僅刪除ID元素,但正確的人
SET @myBlob.modify('delete //Citation/ID[@Source = ''PubMed''
and string-length(string(number(.))) = 0]')
,這將刪除所有引用元素
SET @myBlob.modify('delete //Citation[ID/@Source = ''PubMed''
and string-length(string(number(.))) = 0]')
似乎應該有一個簡單的解決方案,我沒有打。有什麼建議麼?謝謝
非常棒,正是我所需要的,非常感謝。 – user1969944