Hi there!
I am working on a Delphi Application, where I must read an XML doc in Tamino and transform it in my object model, to be presented to the user as a Treeview.
The thing is, we have worked on a funtion to deserialize an XML file into our object model, but it has to be a ‘pure’ XML with no specific wrapping from Tamino.
It means, I cannot have something like:
-------------------------------------
<?xml version="1.0" encoding="windows-1252" ?>
- <ino:response
xmlns:ino=“http://namespaces.softwareag.com/tamino/response2”
xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”>
- <xq:query
xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result
”>
- <![CDATA[
declare namespace
tf="http://namespaces.softwareag.com/tamino/TaminoFunction"
for $b in input()/Werke
where tf:getDocname(root($b))="vauban"
return $b
]]>
</xq:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Request processing</ino:messageline>
</ino:message>
- <xq:result
xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result
”>
-
- <Werk_1 interpretation=“Werk” key=“0” type=“ToppWerk”>
second test
etc
.
.
.
-----------------------------------------
but only:
----------------------------------------
<?xml version="1.0" encoding="windows-1252" ?>
- <Werk_1 interpretation=“Werk” key=“0” type=“ToppWerk”>
second test
etc
.
.
.
-----------------------------------------------
My test query is like:
declare namespace
tf=“http://namespaces.softwareag.com/tamino/TaminoFunction”
for $b in input()/Werke
where tf:getDocname(root($b))=“first”
return $b
And I call it from my application like:
//Query: define and execute
abfrage := 'for $b in input()/Werke return $b/Werk_1/Titel ';
DOMDocResult :=TaminoX1.XQuery(abfrage);
I found a similar question at the forum but it had to do with Quip Query results, and I work with XQuery…
Can anyone help me???
Thanks so much!
Alda Campos
Him
starting with Tamino 4.2, you can switch off the wrapper by using
{?serialization method=xml?}
Regards
Harald
Hallo Harald,
Thanks a lot for your attention. Your answer is so short and direct, it seems to be a very ovious and simple procedure.
Unfortunetly not for me
The thing is, I have no idea where / how I should insert this instruction. I tried to insert it in my query (through the Interactive Interface from Tamino), and the system does not complain, but it also does not work…
Maybe I should explain to you that when I use the expression deserialization, I mean turning my XML File into objects yes, but I do this in a very simple way: basically through string
manipulation and the use of specific attributes, I initialize and populate my objects.
So I do not know if such an instruction that you mean have anything to do with complex deserialization… it is not my case.
Well, Harald, if you allow me to abuse of your patiente once more, can I ask you to be more precise to how I give in this instruction? It could only be either inserting it (???) in my
XML doc or through my query in my application… Could you put it in context, maybe with an example?
Thanks a million,
Alda
Hi Alda,
sorry for being too short. I ment the following:
an xquery such as
declare namespace
tf=“http://namespaces.softwareag.com/tamino/TaminoFunction”
for $b in
<Werk_1 interpretation=“Werk” key=“0” type=“ToppWerk”>
second test
</Werk_1>
return $b
delivers the result:
<ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”>
- <xq:query xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
- <![CDATA[
declare namespace
tf="http://namespaces.softwareag.com/tamino/TaminoFunction"
for $b in
second test
return $b
]]>
</xq:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Request processing</ino:messageline>
</ino:message>
- <xq:result xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
-
- <Werk_1 interpretation=“Werk” key=“0” type=“ToppWerk”>
second test
</Werk_1>
</xq:result>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Request processed</ino:messageline>
</ino:message>
</ino:response>
while the following query
{?serialization method=“xml”?}
declare namespace
tf=“http://namespaces.softwareag.com/tamino/TaminoFunction”
for $b in
<Werk_1 interpretation=“Werk” key=“0” type=“ToppWerk”>
second test
</Werk_1>
return $b
delivers the result
<?xml version="1.0" encoding="windows-1252" ?>
-
- <Werk_1 interpretation=“Werk” key=“0” type=“ToppWerk”>
second test
</Werk_1>
You can check this out using the Tamino Interactive Interface
Note: in my original reply, there was an error: I wrote method=xml instead of method=“xml” - sorry!
Hope this clarifies my answer