Posted: Wed Jan 22, 2014 6:35 am Post subject: Namespace problem in esql
Apprentice
Joined: 04 Sep 2012 Posts: 36
My output format is xml and it looks like as below: (sample structure)
<dlv:DepartmentList xmlns:dlv = "http://www.xyz.com/Department-v2">
<dlv:Department>
--
--
</dlv:Department>
</dlv:DepartmentList>
I have created the structure using esql like below:
DECLARE DV2 NAMESPACE 'http://www.xyz.com/Department-v2'";
SET OutputRoot.XMLNSC.DV2:DepartmentList.(XMLNSC.NamespaceDecl)xmlns:dlv = DV2;
DECLARE dlist REFERENCE TO OutputRoot.XMLNSC.dlv:DepartmentList;
CREATE LASTCHILD OF dlist AS dlist NAME 'dlv:Department';
Though it is creating as <dlv:Department> , but while I am referring this it not parsing..what is the right syntax for to include a namespace prefix to add a child which created using 'CREATE LASTCHILD' statment.
Please help me.
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
The namespace prefix is case sensitive. In the set statement it is uppercase, further down it is lowercase.
Your CREATE statement is also wrong. Please look at the documentation on how to specify NAME and NAMESPACE.
You are also misunderstanding the usage of the ESQL namespace declaration.
You declare the ESQL namespace
You create the XML(NSC) declaration of the namespace and prefix.
However later down in the ESQL you use the namespace prefix of the xml(nsc) namespace declaration. ESQL doesn't care about that. It is only used for serialization of the message.
you need to use the ESQL NAMESPACE variable when accessing the treee.
The info center contains a lot of information on XMLNSC with namespaces. Search for 'XMLNSC namespace declaration'. If that does not help then
I suggest that you look at the XMLNSC Namespace sample. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum