Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When to use dbms_xmlparser

Status
Not open for further replies.

userMikeD

Programmer
Nov 5, 2008
28
US
Hi,

I'm trying to figure out when it's a good idea to use or not use dbms_xmlparser. It seems like I can create a domDocument without needing a parser, but most examples I see online use a parse. Something like this:

Code:
OPEN emp_refcur FOR 
   SELECT *
     FROM employees;
      
xml_ctx := dbms_xmlgen.newContext(emp_refcur);  
xml_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseCLOB(xml_parser, dbms_xmlgen.getXml(xml_ctx));
xml_dom := dbms_xmlparser.getDocument(xml_parser);
dbms_xmlparser.freeParser(xml_parser);
  
row_node_list := dbms_xmldom.getElementsByTagName(xml_dom, 'ROW');

However, it's possible to get the same result by leaving out the parser, and just doing:
Code:
OPEN emp_refcur FOR 
   SELECT *
     FROM employees;
      
xml_ctx := dbms_xmlgen.newContext(emp_refcur);   
xml_dom := dbms_xmldom.newDOMDocument(dbms_xmlgen.getXml(xml_ctx));

row_node_list := dbms_xmldom.getElementsByTagName(xml_dom, 'ROW');

When is it appropriate to use the parser? Does one do better than the other for small and/or large result sets?

Thanks,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top