Author |
Message
|
schroederms |
Posted: Tue Feb 01, 2011 10:48 am Post subject: XMLNSC parsing question |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Cant seem to figure out how to get to the level of data in this XML message. I'm trying to get to the actual error (in RED)
This:
Set Environment.AdapterMessage = InputRoot.XMLNSC.eda.error.(XMLNSC.Attribute)source;
gets me "com.ibi.agents.XDAdapterAgent" but that is not what I need.
Any help is appreciaited.
Thanks,
Mike
<?xml version="1.0" encoding="UTF-8" ?>
<eda>
<error timestamp="2011-02-01T17:34:28Z" code="6" stage="AGENT"
source="com.ibi.agents.XDAdapterAgent"> Problem processing agent request, type FAIL, source
AGENT: getMessage(): com.ibi.sap.SapAdapterException: Field: CHAR_IN exceeds defined in
structure INPUT allowed length 8: TEST DATE.int getError(): Client.getAdapterCode():
null.getVendorThrowable(): null<data type="xml">
<ZCS_QE01_ADDL_CHAR>
<PRUEFLOS_IN>000001361616</PRUEFLOS_IN>
<METHOD_IN>MOIST-R3</METHOD_IN>
<CHAR_IN>TEST DATE</CHAR_IN>
<VORNR_IN>0030</VORNR_IN>
<WERKS_IN>WES1</WERKS_IN>
<MATKL_IN>010</MATKL_IN>
</ZCS_QE01_ADDL_CHAR>
</data>
</error>
</eda> |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 01, 2011 11:04 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to retain mixed content.
Then you need to get the value of the "error" element, or possibly an unnamed child under it.
Use Trace node to see the structure of the message once you've retained mixed content to preserve the string data. |
|
Back to top |
|
 |
schroederms |
Posted: Tue Feb 01, 2011 11:07 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Thanks mqjeff.
I had put a trace node in there to see what it looks like and the data I want is not there.
(0x01000000:Name ):AdapterMessage2 = (
(0x03000000:NameValue):timestamp = '2011-02-01T17:34:28Z' (CHARACTER)
(0x03000000:NameValue):code = '6' (CHARACTER)
(0x03000000:NameValue):stage = 'AGENT' (CHARACTER)
(0x03000000:NameValue):source = 'com.ibi.agents.XDAdapterAgent' (CHARACTER)
(0x01000000:Name ):data = (
(0x03000000:NameValue):type = 'xml' (CHARACTER)
(0x01000000:Name ):ZCS_QE01_ADDL_CHAR = (
(0x03000000:NameValue):PRUEFLOS_IN = '000001361616' (CHARACTER)
(0x03000000:NameValue):METHOD_IN = 'MOIST-R3' (CHARACTER)
(0x03000000:NameValue):CHAR_IN = 'TEST DATE' (CHARACTER)
(0x03000000:NameValue):VORNR_IN = '0030' (CHARACTER)
(0x03000000:NameValue):WERKS_IN = 'WES1' (CHARACTER)
(0x03000000:NameValue):MATKL_IN = '010' (CHARACTER)
) |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 01, 2011 11:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
schroederms wrote: |
Thanks mqjeff.
I had put a trace node in there to see what it looks like and the data I want is not there. |
Yes.
Because you have not retained mixed content.
It's a flag on the parser options on the input node. |
|
Back to top |
|
 |
schroederms |
Posted: Tue Feb 01, 2011 11:12 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Thanks, I'll give it a try. Never used this option before. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 01, 2011 11:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So to be clear on what mixed content is...
<tag1>This is mixed content<tag2>this is data</tag2><tag1>
vs.
<tag1><tag2>this is data</tag2><tag3>this is data</tag3></tag1>
You have (simplified)
Quote: |
<error>mixed content<data>data</data></error> |
And it's the mixed content that you've marked in red. |
|
Back to top |
|
 |
schroederms |
Posted: Tue Feb 01, 2011 11:30 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Well I'm getting closer, now I'm trying to figure out how to get to it. I see where there is NO attribute associated with it. Not sure WHY the vendor of the adapter is building this way, but I have no control of that. Any pointers on how to get to it? thanks.
(0x01000000:Name ):AdapterMessageInput = (
(0x03000000:NameValue):timestamp = '2011-02-01T17:34:28Z' (CHARACTER)
(0x03000000:NameValue):code = '6' (CHARACTER)
(0x03000000:NameValue):stage = 'AGENT' (CHARACTER)
(0x03000000:NameValue):source = 'com.ibi.agents.XDAdapterAgent' (CHARACTER)
(0x02000000:Value ): = ' Problem processing agent request, type FAIL, source
AGENT: getMessage(): com.ibi.sap.SapAdapterException: Field: CHAR_IN exceeds defined in
structure INPUT allowed length 8: TEST DATE.int getError(): Client.getAdapterCode():
null.getVendorThrowable(): null. ' (CHARACTER)
(0x01000000:Name ):data = (
(0x03000000:NameValue):type = 'xml' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
(0x01000000:Name ):ZCS_QE01_ADDL_CHAR = (
(0x02000000:Value ): = '
' (CHARACTER)
(0x03000000:NameValue):PRUEFLOS_IN = '000001361616' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
(0x03000000:NameValue):METHOD_IN = 'MOIST-R3' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
(0x03000000:NameValue):CHAR_IN = 'TEST DATE' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
(0x03000000:NameValue):VORNR_IN = '0030' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
(0x03000000:NameValue):WERKS_IN = 'WES1' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
(0x03000000:NameValue):MATKL_IN = '010' (CHARACTER)
(0x02000000:Value ): = '
' (CHARACTER)
)
(0x02000000:Value ): = '
' (CHARACTER)
)
(0x02000000:Value ): = '
' (CHARACTER) |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 01, 2011 11:35 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
it's either
Code: |
FIELDVALUE(InputRoot.XMLNSC.eda.error) |
or it's
Code: |
InputRoot.XMLNSC.eda.error.[<] |
|
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 01, 2011 11:44 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need something like this:
Code: |
SET errorText = InputRoot.XMLNSC.AdapterMessageInput.(Value)*[1]; |
You might even be able to do this:
Code: |
SET errorText = FIELDVALUE(InputRoot.XMLNSC.AdapterMessageInput); |
...which is simpler and safer because it still works if the error message is the second or third piece of mixed content. Note that t will pick up *all* of the mixed content, including the line feeds that occur between the later child tags of AdapterMessageInput.
It would be much easier to read your trace if you had used [code] tags when posting it. |
|
Back to top |
|
 |
schroederms |
Posted: Tue Feb 01, 2011 11:44 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
mqjeff, thanks!
It was (in RED)
set Environment.AdapterAttribute5a = InputRoot.XMLNSC.eda.error.[<];
set Environment.AdapterAttribute5b = FIELDVALUE(InputRoot.XMLNSC.eda.error); |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 01, 2011 11:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's been a bit since I've played with mixed content, so I'll defer on [<] to kimbert's (Value)*[1]. |
|
Back to top |
|
 |
schroederms |
Posted: Tue Feb 01, 2011 11:51 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Actually after reading kimbert's response, I would want to get all mix content no matter where it resides anyway, so that is what I went with.
Thanks folks.
Mike |
|
Back to top |
|
 |
|