cancel
Showing results for 
Search instead for 
Did you mean: 

Facing problem while removing XML tags which has been generated from SAP

Former Member
0 Kudos

Hi All,

I am facing problem in MII, while i trying to remove 1st 2 XML tags of XML as generated from SAP.

Here is XML which has been generated from SAP

u201C<?xml version="1.0"; encoding="UTF-8"?>

<ZCIFSCHEDULE>

<SCHEDULE>

<MESSAGE_TYPE/>

<SITE>A300</SITE>

<SHOP_ORDER>2012020856</SHOP_ORDER>

<QTY_TO_BUILD>6.000<;/QTY_TO_BUILD>

<DATE_TIME>08-FEB-2012 20:57:21 +05:30</DATE_TIME>

<OPERATION>PRS</OPERATION>

<ITEM>IN-CT00228</ITEM>

<DPICS_CODE>1229</DPICS_CODE>

<REVISION/>

<CYC_TIME_CURING/>

<FLAG_AGING/>

<AGING_MIN/>

<PRODUCTION_VERSION/>

<CYC_TIME_OC/>

<CYC_TIME/>

</SCHEDULE>

</ZCIFSCHEDULE>u201D

From above i want to remove 1st 2 tags and last one tag i.e. u201C<?xml version="1.0"; encoding="UTF-8"?> , <ZCIFSCHEDULE> and last tag ZCIFSCHEDULE>u201D

Its urgent!

Did anyone done regarding this issues. Thanks in advance.

Kind Regards,

Praveen Reddy

Accepted Solutions (0)

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

Hi Praveen,

Are you trying to make the xml into a string? I think if you remove the first tag, it will either automagically reappear or it will throw and error as being poorly formed xml.

In general, you can remove the nodes by the use of indexes. Since you are operating at the root level, I am not sure how well it will work, but if your xml is in a property, you can reference the specific nodes by something like this: myXML.Output{/*[1]} which if you put it in a tracer will display the contents of the first node (or blank if there are child nodes). The node index can be dynamically set, but start with the simple hard coded one. I would also start at the lowest child level to verify that it is working properly (a tracer will display the contents specified by the index). You can also google xml indices (or indexes) and it will point to some other useful xml operators.

I suggest that you play around with it and also work with the Link Types (hint: removeXML).

Regards,

Mike

Former Member
0 Kudos

Hi Michael,

Very thanks for fast response.

If i change this XML into string then its possible to remove header tags. If its possible, please give me instructions regarding how i need to do.

And even i am saving this XML file directly into oracle database with data type varchar.

My client requirement is, they don't want 1st 2 tags and last one Tag of XML . And in database, data should be saved in XML tags only.

And i believing that, its not possible to remove header tags from XML. Please give me conclusion wether its possible or not.

Thanks,

Kind Regards,

Praveen Reddy M

Former Member
0 Kudos

Dear Praveen,

according to me XML handing in string is error prone method.

You can use another xml variable in which you can assign the child xml node of your root xml node.

then you can use new variable in place of your xml variable.

Regards

Anshul

Former Member
0 Kudos

Hi Anshul,

Thanks for your reponse

but i unable to divide it.

can you please give me any steps are way of procedure to divide these child nodes from parent node.

Thanks,

Kind Regards,

Praveen Reddy M

Former Member
0 Kudos

Hi Praveen,

Use the following steps:-

1. Create new xml variable.

2. Add assignment action block in your transaction.

3. In Configure Links Expand select SCHEDULE node from your xml and assign it to new variable. (Use Assign XML link type)

4. Check the new xml

Hope this will help.

Regards'

Anshul

Former Member
0 Kudos

Hi Anshul,

Where do i need to create this new xml variable.

Thanks,

Kind Regards,

Praveen Reddy M

agentry_src
Active Contributor
0 Kudos

I think he meant to create a new Transaction Property of type xml. Then copy the child node into the new xml property.

But while that will help in removing rows other than the first, the first row will still be populated by default. However, it is worth experimenting as I could be wrong.

Regards,

Mike

Former Member
0 Kudos

Hi,

Thanks for both response and spending time on this issues

i have tired Anshul as you told, but i doesn't worked. xml file itself not coming to xpath.

But Problem has solved through repeater and with small query which as added in SQL query action block.

I have return below code in SQL query i.e.

insert into <Tablename> values( '[Param1]', replace(trim('[Param.2]'),'<?xml version="1.0" encoding="UTF-8"?>',''))

here i am passing Parameter 2 as XML file from repeater item.

once again thanks to both

Kind Regards,

Praveen Reddy M