Author |
Message
|
mpong |
Posted: Tue Jun 14, 2016 1:11 am Post subject: add value to XMLNSC.Attribute |
|
|
Disciple
Joined: 22 Jan 2010 Posts: 164
|
Hello All,
Requirement is to generate a output as below but I am yet to get thru.
<param name="InputValue">test</param>
Here is what I have tried:
1) [code]SET Myreference.param.(XMLNSC.Attribute)name='InputValue';[/code]
O/P: <param name="InputValue"></param>
2) [code]SET Myreference.param.(XMLNSC.Attribute)name='InputValue' value=inRef.FieldName;[/code]
SYNTAX ERROR
3) [code]SET Myreference.param.(XMLNSC.Attribute)"name='InputValue' " value=inRef.FieldName;[/code]
O/P:<param name='InputValue'="test"</param>
The output is not the expected one. Please suggest what am I missing here. |
|
Back to top |
|
 |
mpong |
Posted: Tue Jun 14, 2016 1:47 am Post subject: |
|
|
Disciple
Joined: 22 Jan 2010 Posts: 164
|
Resolved:
First I have to set the value to param and then adding attributes is solved the issue.
Thanks! |
|
Back to top |
|
 |
maurito |
Posted: Tue Jun 14, 2016 2:11 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
mpong wrote: |
Resolved:
First I have to set the value to param and then adding attributes is solved the issue.
Thanks! |
yes, you need to SETs, one to set the Attribute of the element, the other to set the value of the element |
|
Back to top |
|
 |
timber |
Posted: Tue Jun 14, 2016 2:21 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
you need two SETs, one to set the Attribute of the element, the other to set the value of the element |
Not true. In ESQL you can simply write
Code: |
Set OutputRoot.XMLNSC.rootTagName.(XMLNSC.Attribute)attrName = 'attributeValue'; |
If you're using Java, it's usually a little more complex, and you may need two separate statements. Unless you're smart and you use the JAXB option. |
|
Back to top |
|
 |
maurito |
Posted: Tue Jun 14, 2016 7:18 pm Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
timber wrote: |
Quote: |
you need two SETs, one to set the Attribute of the element, the other to set the value of the element |
Not true. In ESQL you can simply write
Code: |
Set OutputRoot.XMLNSC.rootTagName.(XMLNSC.Attribute)attrName = 'attributeValue'; |
If you're using Java, it's usually a little more complex, and you may need two separate statements. Unless you're smart and you use the JAXB option. |
Yes, it is true.
Code: |
Set OutputRoot.XMLNSC.rootTagName.(XMLNSC.Attribute)attrName = 'attributeValue'; |
That only sets the attribute value, and not the element value.
Code: |
<rootTagName attrName="attributeValue"></rootTagName>
|
But if you want to set attribute value and element value you need to sets.
you also need
Code: |
SET OutputRoot.XMLNSC.rootTagName VALUE = 'a value'; |
Code: |
<rootTagName attrName="attributeValue">a value</rootTagName> |
|
|
Back to top |
|
 |
timber |
Posted: Wed Jun 15, 2016 5:59 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Yes, you're quite right. I thought you were claiming that it's not possible to set the attribute value at the same time as specifying XMLNSC.Attribute. Sorry for the confusion. |
|
Back to top |
|
 |
|