Please Help With XML Namespace in XQuery
407338Nov 22 2006 — edited Nov 22 2006Hi gurus,
Yesterday I posted my interim conditions xml. Because I was struggling with the XQuery part, I took out the xml namespace part from the file. Then I added the @ sign and it worked. But today I put back the namespace and I got this error:
ORA-19276: XP0005 - XPath step specifies an invalid element/attribute name: (oeKey ='http://www.court.....)
This is the xml with the namespace,
<InterimConditionsNotification xmlns="http://www.courts.state.mn.us/CourtXML/1.0.0">
<TriggeredDateTime>2005-07-21T14:48:57-05:00</TriggeredDateTime>
<NotificationEvent>InterimConditionsAdded</NotificationEvent>
<InterimConditionsOrder orderEventKey="1760247">
and this is my xmltable with xmlnamespace
xmltable
(
xmlnamespaces
(
default 'http://www.courts.state.mn.us/CourtXML/1.0.0'
),
'for $ics in /CaseNotification/InterimConditionsNotification/InterimConditionsOrder[@orderEventKey = $val/oeKey]/InterimConditions
return
<ICS>
<ICSText>{$ics/InterimConditionText}</ICSText>
<ICSAmount>{$ics/InterimConditionAmount}</ICSAmount>
</ICS>'
passing v_xml, xmlelement("oeKey", v_OEKey) as "val"
columns
ICSText varchar2(100) path '/ICS/ICSText',
ICSAmount number path '/ICS/ICSAmount'
) ics;
The Oracle docs say if I declare the default namespace, I need not do anything extra inside the for clause. This is from the docs, (Chapter 17 of the XDB Develepoer's Guide)
Because the same namespace is used throughout the XMLTable expression, a default namespace could be used: XMLNAMESPACES (DEFAULT 'http://emp.com'). The qualified name $i/e:emps/e:emp could then be written without an explicit prefix: $i/emps/emp.
Please help! I could remove the namespace from the xml because when I get the xml data, it is a clob type or a varchar2 type depending on the size determined by messaging gateway. But I want to make sure that I don't have to do that because I have to know that I am processing XML from our partner.
Thanks.
Ben