[英]Get Name tag from XML
<Attribute DisplayOrder="-1">
<Categories>
<Category Name="Properties">
<Properties>
<Property Name="Visible" Value="True"/>
<Property Name="Enabled" Value="False"/>
<Property Name="Mandatory" Value="True"/>
<Property Name="Button" Value="True"/>
<Property Name="Label">
<Locales>
<Locale Name="en" Value="Device Selection Button"/>
</Locales>
</Property>
<Property Name="Style" Value=""/>
<Property Name="ShowHelpText" Value="False"/>
<Property Name="EventChange" Value="False"/>
<Property Name="Mask" Value=""/>
<Property Name="NumberOfLines" Value="1"/>
<Property Name="EditType" Value="0"/>
<Property Name="ButtonCaption">
<Locales>
<Locale Name="en" Value="Select Device"/>
</Locales>
</Property>
</Properties>
</Category>
<Category Name="External Functions">
<Properties>
<Property Name="function" Value="SelectEquipmentByCategory"/>
<Property Name="actionType" Value="SetOne"/>
<Property Name="Parameters" Value="Devices_Cat,4355608"/>
</Properties>
</Category>
</Categories>
</Attribute>
我有此XML,在SQL中,我希望選擇設備的值。
查詢:
SELECT EXTRACTVALUE(xmltype(display_info_xml), '/Attribute/Categories/Properties/Property[@Name="Label"]/Locales/Locale[@Name="en"]/Value')
FROM table
現在,查詢返回空白。 我試圖創建所有XPATH,但是沒有用。 請幫忙。
編輯:
更新的查詢:
/屬性/分類/類別[@名稱= “屬性”] /屬性/屬性[@名稱= “標簽”] /區域設置/區域設置[@名稱= “EN”] /值
仍然失敗,沒有返回任何數據。
您缺少Category
標簽。
另外, Value
屬性應以@
開頭。 ( http://www.tizag.com/xmlTutorial/xpathattribute.php )
正確的XPATH是/Attribute/Categories/Category/Properties/Property[@Name="Label"]/Locales/Locale[@Name="en"]/@Value
。
我想你應該這樣嘗試
SELECT EXTRACTVALUE(xmltype(display_info_xml), '//Property[@Name="ButtonCaption"]/Locales/Locale[@Name="en"]/Value')
FROM table
要么
SELECT EXTRACTVALUE(xmltype(display_info_xml), '/Attribute/Categories/Category/Properties/Property[@Name="ButtonCaption"]/Locales/Locale[@Name="en"]/Value')
FROM table
您在示例中編寫了想要作為“選擇設備”的值,將“ AS”的值指向“設備選擇”按鈕
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.