Subject:Xquery XML document with spceial characters Author:Ivan Pedruzzi Date:10 Mar 2010 06:27 PM
Hi Ahmad,
You should not be concern about the serialization form.
The text you are seeing is valid XML, therefore any XML parser will take it. Notice that after going through a parser the text node will be properly re-escaped.
Another option is to use a cdata-section with the DataDirect XQuery
The following wraps the text node with a CDATA
Subject:Xquery XML document with spceial characters Author:Ahmad Abusalah Date:11 Mar 2010 01:57 PM
Let me elaborate on how we are using the above Xquery.
We are evaluating an idea where we will push all work items (WI) with code changes as elements in one big XML file. Each WI element consists of many elements and one of those will be <CODE>.
We will run the Xquery above to get the contents of those code elements.
The output of above Xquery will be SQL script that will be used as part of an automated process.
Therefore, I am concerned about the output to exactly match the contents of <code> elements. So, I want & to appear as & and not as & in the output. The same thing for < and >.
I proposed the use of StylusStudio Enterprise edition and currently we are using the evlaution copy of it to do a proof of concept.
insert into table_name(Col_1, Col_2) values ('A & D', 'A-->B');
BTW are you aware that our XQuery engine allows you to execute SQL update statements against almost all major database products (SQL Server, DB2, Oracle, Sybase, MySQL, Informix) direclty from your query?
Here is an example
ddtek:sql-insert("table_name", "Col_1", "A & D", "Col_1", "A-->B")