on 09-20-2010 5:44 PM
Hi,
I would like to know how to remove the empty tag of an xml schema in the expression editor according to a condition. I will brief my requirement. I have a local xml variable as MainSchema in my transaction. I fetch the data using a sql query and populate this xml schema (MainSchema). In case the query is not returning the data for an xml tag, I want to remove that xml tag from the schema. Currently it is displaying empty tags in the schema.
Can any one help me on this?
Thanks
Shaji
After fecthing data using SQL query, how are you populating XML ?
If you are using repeater for filling SQL data , You can use XPath for repeater to exlcude blank/null values.
In this way you can avoide empty tags.
If this doesn't suit your need then plz explain in requirement details
Regards,
Shalaka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am using a repeater to populate the data in xml schema. I know I can put an if condition to check the empty value. In case value is empty i should not assign the empty value to tag. But my tag is still exists there in the schema. I would like to remove the empty tag from the schema
Thanks
Shaji
Shaji,
See Michael Otto's response.
Using an assignment block, you can remove the xml node by selecting the node you wish to remove and in the middle of the link editor select Link Type - Remove XML, then hit update. A new link will be created and the Expression will be "<<REMOVE>>".
Test it to see how to integrate it into your situation.
Regards,
Mike
Hi Shaji,
for removing tags (nodes) from xml, you can use the assignment action. Use the Link Type "RemoveXml" for this as described in the [Link Type|http://help.sap.com/saphelp_mii121/helpdata/en/43/e80b59ad40719ae10000000a1553f6/frameset.htm].
Hope this helps.
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the Conditional action to check if a value is empty, and use the true branch of the action with an assignment action and Link Type RemoveXML.
Is this what you are looking for, or do you problems with the Link Type "RemoveXML"?
Michael
Edited by: Michael Otto on Sep 21, 2010 12:45 PM
Hi Michel,
Thanks for your response. In this case for each tag I have to add one Conditional action block which make my transaction very big. If I have to check 25 tags then there will be 25 Conditional action block. I am looking some otherway to fix the problem.
Something like using stringif() I check the empty value and remove that particular tag from schema.
Please let me know if you have any thoughts
Thanks
Shaji
Hi Shaji,
if you really have to remove many nodes from the XML, the Conditional / RemoveXML proposal is not really useful. The stringif will not work as desired in this case. XPath may do the trick, but not without some try and error effort.
Have you thought about using a XSL transformation to solve the request? MII offers a [XSL Transformation action|http://help.sap.com/saphelp_mii121/helpdata/en/43/e80b59ad40719ae10000000a1553f6/frameset.htm]. You could copy the input XML to output and omit the empty nodes.
Michael
User | Count |
---|---|
10 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.