namespace prefix problem [message #358522] |
Tue, 11 November 2008 14:42 |
kanis
Messages: 61 Registered: November 2006
|
Member |
|
|
We are having an issue with resolving the namespace prefix on element names within xml.
This is just an example but we are processing incoming xml using database 10g and plsql.
We have no issues if the element names are not prefixed with the namespace prefix 'vdcsvc'.
But if the element names have the namespace prefix as the example below shows, we are unable to process it.
Any ideas on how to process this senario using plsql would be greatly appreciated.
I have been unable to find any good examples so far in my search. Thanks in advance.
declare
var XMLType;
doc dbms_xmldom.DOMDocument;
ndoc dbms_xmldom.DOMNode;
docelem dbms_xmldom.DOMElement;
node dbms_xmldom.DOMNode;
childnode dbms_xmldom.DOMNode;
nodelist dbms_xmldom.DOMNodelist;
buf varchar2(2000);
L_NL DBMS_XMLDOM.DOMNODELIST;
L_N DBMS_XMLDOM.DOMNODE;
LVALUE VARCHAR2(100);
begin
var := xmltype('<vdcsvc:PERSON xmlns:vdcsvc="http://www.aa.com/schema/aa/010/vdcsvc"> <NAME> ramesh </NAME> </vdcsvc:PERSON>');
--var := xmltype('<PERSON> <NAME> ramesh </NAME> </PERSON>');
-- Create DOMDocument handle:
doc := dbms_xmldom.newDOMDocument(var);
L_NL := DBMS_XSLPROCESSOR.SELECTNODES(DBMS_XMLDOM.MAKENODE(doc),'/');
DBMS_OUTPUT.PUT_LINE('LENGTH--'||DBMS_XMLDOM.GETLENGTH(L_NL));
FOR CUR_EMP IN 0 .. DBMS_XMLDOM.GETLENGTH(L_NL) - 1 LOOP
L_N := DBMS_XMLDOM.ITEM(L_NL, CUR_EMP);
LVALUE:= DBMS_XSLPROCESSOR.VALUEOF(L_N,'//PERSON/NAME' );
DBMS_OUTPUT.PUT_LINE('VALUE--'||LVALUE);
END LOOP;
end;
|
|
|