从 XML 获取名称标签
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 设备的值。
查询:
SELECT EXTRACTVALUE(xmltype(display_info_xml), '/Attribute/Categories/Properties/Property[@Name="Label"]/Locales/Locale[@Name="en"]/Value')
FROM table
现在查询 return 为空白。
我试图创建所有 XPATH 但没有用。
请帮助。
编辑:
更新查询:
/Attribute/Categories/Category[@Name="Properties"]/Properties/Property[@Name="Label"]/Locales/Locale[@Name="en"] /值
仍然失败,return 中没有数据。
您缺少 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
你写你想要作为Select设备的值在你的例子中你指向作为设备Selection按钮
的值
<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 设备的值。
查询:
SELECT EXTRACTVALUE(xmltype(display_info_xml), '/Attribute/Categories/Properties/Property[@Name="Label"]/Locales/Locale[@Name="en"]/Value')
FROM table
现在查询 return 为空白。 我试图创建所有 XPATH 但没有用。 请帮助。
编辑:
更新查询:
/Attribute/Categories/Category[@Name="Properties"]/Properties/Property[@Name="Label"]/Locales/Locale[@Name="en"] /值
仍然失败,return 中没有数据。
您缺少 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
你写你想要作为Select设备的值在你的例子中你指向作为设备Selection按钮
的值