Reputation: 4541
Let's say I have this xml file :
<root>
<id>2</id>
</root>
Code :
myParser := DBMS_XMLPARSER.newParser;
ficContent := DBMS_XSLPROCESSOR.Read2Clob('MY_DIR', 'myfile.xml' , '0');
DBMS_XMLPARSER.parseBuffer(myParser,ficContent);
dom := DBMS_XMLPARSER.getDocument(myParser);
rootElement := DBMS_XMLDOM.getDocumentElement(dom);
nl := DBMS_XMLDOM.getChildrenByTagname(rootElement, 'id');
node := DBMS_XMLDOM.item(nl, 0);
DBMS_OUTPUT.PUT_LINE('Node name : ' || DBMS_XMLDOM.getNodeName(node) || ' / value : ' || DBMS_XMLDOM.getNodeValue(node));
Result:
Node name : id
/ value : it is empty !!!!
So I have to problem to reach the node but cannot get the value
I think it must be obvious but...I dont see it. Should I call another method?
Ty
Upvotes: 0
Views: 1077
Reputation: 4541
Indeed, it was obvious :
I should write:
DBMS_XMLDOM.getNodeValue(DBMS_XMLDOM.getFirstChild(node));
Upvotes: 1