Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Insert entire XML into database


Not applicable
I have created a form variable "frmData" , and an init form .xdp with XML schema data binding.

After the user filled in the form and submitted, is there any way I can retrieve the xml and store the entire xml into database(MS SQL)?

I'm using Database QPAC (jdbc.jar) to insert value.

I tried the following SQL statement but the value stored is empty.

INSERT into ClaimDetails(formData)

values ('{$/process_data/frmData$}');

Any idea?


8 Replies


Level 9

Try something like:

{$ serialize(/process_data/frmData/form-data/data/*,false) $}

I haven't actually tried it, but I think it should work.

{$ serialize(/process_data/frmData/form-data/data/xdp/datasets/data/*, false) $}

will give you results slightly deeper in the hierarchy.

Bear in mind, if your XML data contains a quote (') character, it will prematurely complete your values clause and cause a SQL error.



Not applicable
Hello -

Yes I would agree with Howard, I would approach this problem using the Serialize function.

If you find that you do have things you need to escape in your data you can try using the "translate" String XPath function. You could also of course write some simple java code in a script QPac to accomplish this.

Good luck!



Not applicable
Thanks for helping~ will try it later...

btw, any good reference for the syntax of XPATH?



Not applicable
Hi all,

I have just tried the code and it works very fine! Many many thanks...

one question, why is it the syntax of XPATH is abit different from

w3c? for example, why does this "{$" (curly bracket and dollar sign) mean? is it only for use in Workflow database QPAC?

thanks again




Level 9
Hi Leia

The {$...$} syntax is not part of Xpath, it's specific to Workflow. It's kindof like a mail-merge syntax, that allows you to embed an xpath expression into a string.

A good example is in the email qpac, in the Subject line, you might type: "RE: Your purchase"

Or, if you wanted to embed the purchase order number into the subject line, you could type:

"RE: PO Number: {$/process_data/@po_number$} - your purchase"

Workflow will locate any string between the {$ and $}, and try to evaluate it as an xpath expression.

So your email might go out with a subject of:

"RE: PO Number: 112233 - your purchase"

In your case, the xpath expression is a little more complex, but it's essentially the same thing.

If you used

INSERT into ClaimDetails(formData)

values ('/process_data/frmData');

then the value you inserted into the table would be '/process_data/frmData' - the {$ $} is the hint to workflow that it should evaluate the xpath expression.

Hope this helps...



Not applicable
Could you please explain how to use 'Serialize' funtion in script QPAC.


Level 9
The serialize xpath function will turn a DOM (XML) document (or a set of nodes) into the xml string representation of that document.