Author |
Message
|
monangi1 |
Posted: Wed Jun 24, 2015 4:46 am Post subject: Create XML attributes in ESQL |
|
|
Novice
Joined: 02 Feb 2014 Posts: 11
|
Hi All,
Need help!
I have create the XML attribute in ESQL in below format
<Emp z:Id="i2">
on this, I am able to create Emp element with attribute like Id = "i2", but facing trouble while creating the attribute as "z:Id".
my code as below:
Code: |
Outputroot.SOAP.Body.ns32:CreateParty.Addresses.(XMLNSC.Attribute)Id='i2'
|
Thanks in Advance |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 24, 2015 5:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So, what does the "z:" indicate, as part of an XML document?
What does the "ns32" in your OutputRoot represent? |
|
Back to top |
|
 |
monangi1 |
Posted: Wed Jun 24, 2015 5:26 am Post subject: |
|
|
Novice
Joined: 02 Feb 2014 Posts: 11
|
Thans for quick reply.
ns32 is my local namespace and to call the end systen webservice I have to construct the element with attribute value like <Emp z:Id="i2">. Beow is the request message.
Code: |
<Emp z:Id="i2" i:type="Referrer">
<ID>395206</ID>
<EmpName>XYZ</EmpName>
<EmpPartyID>229102</EmpPartyID>
</Emp> |
|
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 24, 2015 5:28 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Yes, so ns32 is a namespace reference.
What's z, then? An eggplant? (aubergine for those of you from furrin parts)
What was done to assign the value to ns32? What does the logical message tree look like when you put a trace node after your compute node? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 24, 2015 5:29 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
@monangi1
Not to keep driving the same nail into the coffin, but you did not answer the question:
What do z: and i: represent in the XML snippet you described? Where have they been defined?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
monangi1 |
Posted: Wed Jun 24, 2015 5:48 am Post subject: |
|
|
Novice
Joined: 02 Feb 2014 Posts: 11
|
Hi fjb_saper & mqjeff,
Z and I are not a namespaces declared in XML, But I have to construct the attribute with z:Id format in out put ESQL.
Example :
<Emp z:Id="i2" i:type="Referrer">
z:Id and i:type are the XML attribure here coming in the input XML.
Thanks |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 24, 2015 6:20 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can't have "z:" like that and have it *not* be a namespace.
That's not how XML works.
But if you really felt like doing that, you can simply set the name to "z:id".
And then watch things break further down the line. |
|
Back to top |
|
 |
monangi1 |
Posted: Thu Jun 25, 2015 10:32 pm Post subject: |
|
|
Novice
Joined: 02 Feb 2014 Posts: 11
|
Thanks for giving the reply guys.
I got the solution by using the FIELDVALUE.
ex Outputroot.SOAP.BOdy.Emp.(SOAP.Attribute)"z:Id" Value =FIELDVALUE(Inputroot.SOAP.Body.XyzEmp.(SOAP.Attribute)z:Id)
Then I can see the below output
<Emp z:Id = "i2">.
Regards
Monangi |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jun 25, 2015 10:53 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Have you taken the output XML and validated it using one of the many freely available XML Validators on the internet?
If so what was the result?
The reason I ask this is that while your output XML Might meet your requirement it might be invalid XML.
I tried validating your XML at
http://www.w3schools.com/xml/xml_validator.asp
This is the result.
XML Parsing Error: prefix not bound to a namespace
Location: http://www.w3schools.com/xml/xml_validator.asp
Line Number 7, Column 1:
<Emp z:Id = "i2">
As has been said at least once in this thread 'z:' implies that it is a namespace according to the XML specification.
Outputting this XML may work but may I humbly suggest that you go back to whoever told you to do this and get clarification that outputting this invalid XML won't break something else later on in the processing. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Rambabu |
Posted: Tue Jun 30, 2015 1:00 am Post subject: |
|
|
Newbie
Joined: 29 Jun 2015 Posts: 5
|
Hey smdavies99, But i'm able to validate below XML sucessfully..
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<note k:Id="2">
<Emp z:Id = "i2">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</Emp>
</note> |
|
|
Back to top |
|
 |
Rambabu |
Posted: Tue Jun 30, 2015 1:09 am Post subject: |
|
|
Newbie
Joined: 29 Jun 2015 Posts: 5
|
Apologies, It's W3schools validator mistake .... i tried in other XML validator, it's throwing error as you said. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jul 03, 2015 1:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I assume that you have searched for 'namespace declaration' in the IIB v9 info center? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|