基于属性名的XML提取
我有以下结构的xml。希望仅从以下内容中提取名称信息。我正在为此使用提取函数。但对于只提取“名称”的xml路径应该是什么?我试了各种方法。请帮助如何填写此查询基于属性名的XML提取,xml,xpath,Xml,Xpath,我有以下结构的xml。希望仅从以下内容中提取名称信息。我正在为此使用提取函数。但对于只提取“名称”的xml路径应该是什么?我试了各种方法。请帮助如何填写此查询 <Employee> <Basics> <Attribute Name="Scope">LOCAL</Attribute> <Attribute Name="Name">Narendra</Attribute>
<Employee>
<Basics>
<Attribute Name="Scope">LOCAL</Attribute>
<Attribute Name="Name">Narendra</Attribute>
<Attribute Name="Id">12345</Attribute>
<Attribute Name="Type">EMPLOYEE</Attribute>
<Attribute Name="Revision"/>
</Basics>
</Employee>
在xpath中,您使用谓词(
[]
)来过滤具有特定条件的元素。例如,您可以使用以下xpath获取属性值等于“Name”
的
元素:
SELECT
extract(value(N), 'Attribute/text()').getStringVal() AS Emp_Name
FROM Employee A,
table(xmlsequence(extract(A.XML_INFO, '/Employee/Basics/Attribute'))) N
/Employee/Basics/Attribute[@Name="Name"]