Skip to content

Update ora/xml_util_pkg.pkb to fix #27#59

Open
datRedHeadedGuy wants to merge 6 commits into
mortenbra:masterfrom
datRedHeadedGuy:ooxml_util_pkg-XLSX-functions-return-XML-encoded-strings-#27
Open

Update ora/xml_util_pkg.pkb to fix #27#59
datRedHeadedGuy wants to merge 6 commits into
mortenbra:masterfrom
datRedHeadedGuy:ooxml_util_pkg-XLSX-functions-return-XML-encoded-strings-#27

Conversation

@datRedHeadedGuy
Copy link
Copy Markdown
Contributor

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.

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.
@mortenbra
Copy link
Copy Markdown
Owner

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?

@eaolson
Copy link
Copy Markdown
Contributor

eaolson commented Sep 23, 2019

Example:

declare
    x xmltype;
    ex varchar2(100);
begin
    x := xmltype ('<root><foo bar="three &amp; four">one &amp; 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 &amp; two
three &amp; four

Wouldn't the expected result have the & unescaped to just "&"? Would calling dbms_xmlgen.convert() be a better solution?

Removed original changes and replaced them with a new package function, get_unescaped_string().
Added new package function, get_unescaped_string().
@datRedHeadedGuy
Copy link
Copy Markdown
Contributor Author

I removed my changes where I replaced XMLType.extract(xpath).getStringVal() with the EXTRACTVALUE function and just pass the string value into a new function, get_unescaped_string(), before returning it.

@datRedHeadedGuy
Copy link
Copy Markdown
Contributor Author

resolves #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants