cancel
Showing results for 
Search instead for 
Did you mean: 

Exception in XML Parser (format problem?):

Former Member
0 Kudos

Hello Experts,

I am getting the error as

Transform: failed to execute the transformation: com.sap.aii.af.sdk.xi.adapter.trans.TransformException: Error converting Message: java.lang.Exception: Exception in XML Parser (format problem?):java.lang.Exception: Message processing failed in XML parser: java.lang.Exception


Is it happening due to special character in the message? How to figure out what that special character is?


If not what is the other root cause?


Really appreciate your expert advise.


Thanks and regards,

Vikas

Accepted Solutions (0)

Answers (4)

Answers (4)

amarnath_m
Explorer
0 Kudos

Hello BRM,

Just open the failed payload in moni --> Right click and view the payload in notepad. Analyse the xml file for any inconsistency.

Another idea, download the file from Moni and save it in xml format. Now open the file with Mozilla browser. If the file has any inconsistency or parser error, mozilla will give you the exact line where it cause the issue.

Regards

Amar.

Former Member
0 Kudos

Thanks Satanik,Anoop and Amarnath.

I checked the input payload in Stylus studio and it is well formed . What I feel is that there are 2 reasons why this error should occur.

1.Source payload field length not matching the fixed ones

2.As the input file is incomplete,(I am not saying it is incorrect but there is a scope to say so as I can see in the field value there are 2 spaces and the prefix is also missing as compared to the successful one), the target payload is not getting created and because of this, the payload and the adapter configurations are not matching and it is resulting into this error.

Regarding Cannot create the target element error, it generally occurs if the values needed to populate the target fields is not there in the source payload, is it so?

Please correct my understanding and let me know if the 2 causes I think are the reasons for this error are correct.

Thanks in advance

Vikas

Former Member
0 Kudos

Hi Vikas,

If you have a fixed length condition maintained then that can very well be a reason for an error while

converting the message during XML parsing.

If you are directly receiving an XML from the source then try to test the data in the test tab of the mapping with the changes in the payload that you have mentioned above. If you are using FCC or Plain to XML conversion then please try triggering the data in test environment with the changes you have mentioned above

Thanks Regards,

Satanik

Former Member
0 Kudos

Thanks Satanik.

Means my understanding regarding root cause makes sense, is it?

Thanks and regards,

Vikas

Former Member
0 Kudos

Hi Vikas,

If there is a fixed length scenario in scope then yes your understanding can be a root cause of the issue. But you need to further try to confirm on that.

Thanks and Regards,

Satanik

former_member207703
Active Participant
0 Kudos

Hi,

Open payload with Word, WordPad or Notepad++. Some time invalid character visible as space in Notepad and payload at MONI.

It's definitely an error while parsing this xml by sender adapter due to some invalid character/s in it.

Answers of your further questions:-

1.    Is it because there is no prefix 00 and there are 2 spaces in the field value for <XXX>00AAAXXX<XXX> in the failed message?

Ans: If you written some UDF for it to throw such exceptions, then it must throw an exception. If not, then it will not throw any such exception.

     But as it clearly showing "Message processing failed in XML parser", means its error while reading this xml file by sender adapter.

     2. it it coming because of the mismatching field lengths between the source and target fields ir because the input payload for the failed messages seems to be incomplete?

Ans: Yes, it will throw error if target fields don't get input. But error will be "Cannot create target element  or Values missing in queue context. ".

     So i don't think it's similar to your error. And more than that, sender adapter didn't able to parse it, so there is no question of massage mapping as per pipeline steps of SAP PI.

Best to check your source payload.

Good luck,

Anoop Rai

Former Member
0 Kudos

Hi,

Please check if the source payload has a valid structure. You may face the error if the document is not well formed. An easy way to do this would be to open the payload using a browser or Notepad++ [make sure the doc is in .xml format].

If the document looks valid then you can look in to the text encoding format maintained in your channels or if the error is at mapping level then check if the source structure maintained in your mapping matches with the structure of the incoming data.

Thanks and Regards,

Satanik

Former Member
0 Kudos

Hello Experts,

Some further findings,

compared the success and failed messages payloads, in success I can find in the header as a complete value while the one in the header field of the failed one I can see 2 spaces and the payload is not complete as compared to that of the successful payload . is it the reason why the error is coming?

Please help me.

Thanks in advance

Vikas

former_member190293
Active Contributor
0 Kudos

Hi BRM Fresher!

Wouldn't you provide both of your payloads?

Regards, Evgeniy.

Former Member
0 Kudos

Hello Evgeniy

Failed Message

<?xml version="1.0" encoding="utf-8"?>

<n0:MT_XXXXX xmlns:n0="http://XYZ.com" xmlns:YYY="urn.123com:XXX:XXX:/.../...:.../../..">

     <Root>

         <Root1>

             <XXX>AAA   XXX<XXX>

         </Root1>

     </Root>

</n0:MT_XXX>


Success Message

<?xml version="1.0" encoding="utf-8"?>

<n0:MT_XXXXX xmlns:n0="http://XYZ.com" xmlns:YYY="urn.123com:XXX:XXX:/.../...:.../../..">

     <Root>

         <Root1>

             <XXX>00AAAXXX<XXX>

         </Root1>

         <Root2>

          field1

          field2

          .

          .

          .

</Root2>

     </Root>

</n0:MT_XXX>


Can you please let me know what is the root cause of this error? Isit because there is no prefix 00 and there are 2 spaces in the field value for <XXX>00AAAXXX<XXX> in the failed message? or it it coming because of the mismatching field lengths between the source and target fields ir because the input payload for the failed messages seems to be incomplete?


Really appreciate your quick response.


Thanks and regards,

Vikas

former_member190293
Active Contributor
0 Kudos

Hi BRMFresher!

What is your scenario? Do you use graphical, java or XSLT mapping? Did you check your fault payload in message mapping test?

Regards, Evgeniy.