Oracle 中的复杂 XML 处理
谁能告诉我如何在 oracle 中处理复杂的 XML?例如,我有下面的 XML:
<?xml version="1.0" encoding="utf-8" ?>
<UserEmailPreferences>
<EmailOffering>
<EmailGroupID>1</EmailGroupID>
<EmailOfferingID>0</EmailOfferingID>
<Service>
<val>service-1</val>
<val>service-2</val>
</Service>
<Title>Clinical Focus</Title>
<SubscriptionOption>D</SubscriptionOption>
</EmailOffering>
</UserEmailPreferences>
<UserEmailPreferences>
<EmailOffering>
<EmailGroupID>1</EmailGroupID>
<EmailOfferingID>0</EmailOfferingID>
<Service>
<val>service-1</val>
</Service>
<Title>XYZ</Title>
<SubscriptionOption>D</SubscriptionOption>
</EmailOffering>
</UserEmailPreferences>
在上面的 XML 中,我有两个
节点。它可以是两个、三个或任何其他......这是动态的。
在
节点中,我有
块,它对于相应的
节点又是动态的。
谁能帮助我如何在 Oracle 中处理此类 XML?
Can anyone please tell how I can process complex XML in oracle? For e.g I have the XML below:
<?xml version="1.0" encoding="utf-8" ?>
<UserEmailPreferences>
<EmailOffering>
<EmailGroupID>1</EmailGroupID>
<EmailOfferingID>0</EmailOfferingID>
<Service>
<val>service-1</val>
<val>service-2</val>
</Service>
<Title>Clinical Focus</Title>
<SubscriptionOption>D</SubscriptionOption>
</EmailOffering>
</UserEmailPreferences>
<UserEmailPreferences>
<EmailOffering>
<EmailGroupID>1</EmailGroupID>
<EmailOfferingID>0</EmailOfferingID>
<Service>
<val>service-1</val>
</Service>
<Title>XYZ</Title>
<SubscriptionOption>D</SubscriptionOption>
</EmailOffering>
</UserEmailPreferences>
In the above XML, I have two <UserEmailPreferences>
nodes. It can be two, three or whatever...That is dynamic.
In <UserEmailPreferences>
node, I have <Service>
block which is again dynamic for corresponding <EmailOffering>
node.
Can anyone please help me how I can process such XML in Oracle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用SO问题 "Oracle Pl/SQL: Loop through 中描述的方法XMLTYPE 节点”,例如:
请注意,您的 XML 不是有效文档,因为它缺少封闭标签(我添加了标签
/document
)you can use the method described in the SO question "Oracle Pl/SQL: Loop through XMLTYPE nodes", for example:
Note that your XML wasn't a valid document since it was missing an enclosing tag (I added the tag
/document
)