Open datRedHeadedGuy opened 6 years ago
Hesitant to approve this, as the EXTRACTVALUE function has been deprecated since at least Oracle 11.2 (see https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions061.htm#SQLRF06173 ).
Can you describe the problem in more detail?
Example:
declare
x xmltype;
ex varchar2(100);
begin
x := xmltype ('<root><foo bar="three & four">one & two</foo></root>');
ex := xml_util_pkg.extract_value( x, '/root/foo/text()' );
dbms_output.put_line( ex );
ex := xml_util_pkg.extract_value( x, '/root/foo/@bar' );
dbms_output.put_line( ex );
end;
Returns:
one & two
three & four
Wouldn't the expected result have the & unescaped to just "&"? Would calling dbms_xmlgen.convert() be a better solution?
Modified the xml_util_pkg and changed the use of XMLType.extract(xpath).getStringVal() to EXTRACTVALUE(XMLType, xpath) so that special characters are not escaped.