Author |
Message
|
schroederms |
Posted: Mon May 04, 2009 6:40 am Post subject: Parsing question |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
I'm using the XMLNSC parser on data coming in from SAP, trying to get the PERSONNEL_NBR tag value in this case below. Tried multiple things, but still no luck. Any ideas on the syntax? thanks.
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ITAB>
<item>
<PERSONNEL_NBR>01000363</PERSONNEL_NBR>
<USERNAME>SMITH</USERNAME>
<FIRST_NAME>JOE</FIRST_NAME>
<LAST_NAME>SMITH</LAST_NAME>
<MANAGER_EMAIL>help@xyz.COM</MANAGER_EMAIL>
<COUNTRY_KEY>US</COUNTRY_KEY>
</item>
</ITAB>
</asx:values>
</asx:abap> |
|
Back to top |
|
 |
Vitor |
Posted: Mon May 04, 2009 6:50 am Post subject: Re: Parsing question |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
schroederms wrote: |
Tried multiple things, but still no luck. |
Perhaps if you posted what you've tried, and what happened / went wrong? On the face of it, it's something like (and I've not tried this):
Code: |
InputRoot.XMLNSC.asx:abap.asx:values.ITAB.item.PERSONNEL_NBR |
but that's so obvious you must have tried that. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
schroederms |
Posted: Mon May 04, 2009 6:55 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Sorry I should have included what I did. You are correct, this is what I tried that lat time:
Set Environment.ITAB_item1_Personnel = InputRoot.XMLNS.asx:abap.asx:values.ITAB.item.PERSONNEL_NBR; And the getting nothing. |
|
Back to top |
|
 |
Vitor |
Posted: Mon May 04, 2009 6:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
schroederms wrote: |
Sorry I should have included what I did. You are correct, this is what I tried that lat time:
Set Environment.ITAB_item1_Personnel = InputRoot.XMLNS.asx:abap.asx:values.ITAB.item.PERSONNEL_NBR; And the getting nothing. |
schroederms wrote: |
I'm using the XMLNSC parser |
Which is it? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
schroederms |
Posted: Mon May 04, 2009 7:01 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
I did a trace to see what it looked like coming out of the compute node and this is what it looks like:
(0x01000000):XMLNSC = ( ['xmlnsc' : 0x805850280]
(0x01000400):XmlDeclaration = (
(0x03000100):Version = '1.0' (CHARACTER)
(0x03000100):Encoding = 'utf-8' (CHARACTER)
)
(0x01000000)http://www.sap.com/abapxml:abap = (
(0x03000102)http://www.w3.org/2000/xmlns/:asx = 'http://www.sap.com/abapxml' (CHARACTER)
(0x03000100):version = '1.0' (CHARACTER)
(0x01000000)http://www.sap.com/abapxml:values = (
(0x01000000):ITAB = (
(0x01000000):item = (
(0x03000000):PERSONNEL_NBR = '01000363' (CHARACTER) |
|
Back to top |
|
 |
schroederms |
Posted: Mon May 04, 2009 7:06 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
I'm using XMLNSC, I just tried to the XMLNS as a last resort and that is what I had copied in for syntax. |
|
Back to top |
|
 |
Vitor |
Posted: Mon May 04, 2009 7:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
schroederms wrote: |
I did a trace to see what it looked like coming out of the compute node |
I assume you mean coming out of the previous compute node. Continuing the trace into the offending Compute node will give you additional details.
As a general point, don't mix parsers - it's inefficient at best. I also notice that:
schroederms wrote: |
(0x01000000)http://www.sap.com/abapxml:abap = (
(0x03000102)http://www.w3.org/2000/xmlns/:asx = 'http://www.sap.com/abapxml' (CHARACTER)
(0x03000100):version = '1.0' (CHARACTER)
(0x01000000)http://www.sap.com/abapxml:values = (
|
the values tag isn't in the asx namespace as your original post. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
schroederms |
Posted: Mon May 04, 2009 7:13 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
I'm not mixing parsers, this is XMLNSC, all the way. I'm posting what I'm seeing coming out a TRACE node. As you can tell the domain in using XMLNSC.
The input snippet looks like this:
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ITAB>
<item>
<PERSONNEL_NBR>01000363</PERSONNEL_NBR>
The Output snippet coming out of the TRACE node looks like this:
(0x01000000):XMLNSC = ( ['xmlnsc' : 0x805850280]
(0x01000400):XmlDeclaration = (
(0x03000100):Version = '1.0' (CHARACTER)
(0x03000100):Encoding = 'utf-8' (CHARACTER)
)
(0x01000000)http://www.sap.com/abapxml:abap = (
(0x03000102)http://www.w3.org/2000/xmlns/:asx = 'http://www.sap.com/abapxml' (CHARACTER)
(0x03000100):version = '1.0' (CHARACTER)
(0x01000000)http://www.sap.com/abapxml:values = (
(0x01000000):ITAB = (
(0x01000000):item = (
(0x03000000):PERSONNEL_NBR = '01000363' (CHARACTER)
I'm just wanting to get to the PERSONNEL_NBR, I was just asking about the syntax to get to this value. thanks. |
|
Back to top |
|
 |
Vitor |
Posted: Mon May 04, 2009 7:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
schroederms wrote: |
I'm not mixing parsers, this is XMLNSC, all the way. I'm posting what I'm seeing coming out a TRACE node. As you can tell the domain in using XMLNSC. |
And the code you posted (as I attempted to highlight) uses the XMLNS parser not the XMLNSC parser, hence my question.
schroederms wrote: |
I'm just wanting to get to the PERSONNEL_NBR, I was just asking about the syntax to get to this value. |
If you're trying to store the values in the Environment tree you might need to specify FIELDVALUE. As I said before, a trace of the actual Compute node will be of benefit. Particually in how the tree is actually being interpreted. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
schroederms |
Posted: Mon May 04, 2009 7:31 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Wow, I guess I'm having a communication issue. Here is the code I have in the compute node.
Set Environment.ITAB_item1_Personnel = InputRoot.XMLNSC.asx:abap.asx:values.ITAB.item[1].PERSONNEL_NBR;
Has you can see, it is using the XMLNSC parser.
The output OF THE COMPUTE NODE is the trace I've attached in the previous reply. If you know of a way to generate a trace without attaching the TRACE node to the OUT terminal of the COMPUTE node, let me know. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon May 04, 2009 7:32 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Usertrace at the debug level ( mqsichangetrace, mqsireadlog, mqsiformatlog) will show you the full individual execution of each part of your SET statement.
Did you forget to DECLARE NAMESPACE for asx? |
|
Back to top |
|
 |
schroederms |
Posted: Mon May 04, 2009 7:39 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Thanks mqjeff, I did forget the ns declare. That is all it was, thanks for the reply, I appreciate it. |
|
Back to top |
|
 |
Vitor |
Posted: Mon May 04, 2009 7:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
schroederms wrote: |
Wow, I guess I'm having a communication issue. |
Maybe
schroederms wrote: |
Set Environment.ITAB_item1_Personnel = InputRoot.XMLNSC.asx:abap.asx:values.ITAB.item[1].PERSONNEL_NBR;
Has you can see, it is using the XMLNSC parser.
|
It does. And it's also not the code you posted last time, which used XMLNS.
schroederms wrote: |
If you know of a way to generate a trace without attaching the TRACE node to the OUT terminal of the COMPUTE node, let me know. |
User trace from the broker. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|