how to get partner from duplicates tags

38 views
Skip to first unread message

shik...@gmail.com

unread,
Sep 22, 2022, 4:34:48 AM9/22/22
to Bots Open Source EDI Translator
Hello, 

i want to get the partner from xml file and do the mapping for different partners. 
But the tag for the frompartner and topartner are duplicates in the xml file. like: 
<From>
<Credential
domain="NetworkId">
<Identity>xxxxxxx</Identity>
</Credential>
<Credential
domain="SystemID">
<Identity>xxxxxxx</Identity>
</Credential>
</From>
<To>
<Credential
domain="NetworkId">
<Identity>xxxxx</Identity>
</Credential>
<Credential
domain="internalsupplierid">
<Identity>xxxxxxx</Identity>
</Credential>
<Credential
domain="buyersystemid">
<Identity>xxxxxxxx</Identity>
</Credential>
</to >

how can i query the frompartner and to partner in the xml grammer file? 
my grammer file is like: 
structure = [
{ID:'cXML',MIN:0,MAX:99999,LEVEL:[
{ID:'Header',MIN:0,MAX:99999,LEVEL:[
{ID:'From',MIN:0,MAX:99999,LEVEL:[
{ID:'Credential',MIN:0,MAX:99999}
]},
{ID:'To',MIN:0,MAX:99999,LEVEL:[
{ID:'Credential',MIN:0,MAX:99999},
{ID:'Credential',MIN:0,MAX:99999},
{ID:'Credential',MIN:0,MAX:99999},
...... 

It does not work. 

best regards,
Ke

Eppye Bots

unread,
Sep 22, 2022, 4:38:57 AM9/22/22
to 'Chuck Turco' via Bots Open Source EDI Translator
it is possible.
but if xml tag repeats, you will have to change the grammar (the element should be in structure, not in recorddef)
kind regards, Henk-Jan Ebbers


--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/b83c59fa-28b8-4992-ad6d-dd315f9f142dn%40googlegroups.com.

shik...@gmail.com

unread,
Sep 22, 2022, 4:55:01 AM9/22/22
to Bots Open Source EDI Translator
i tried this, but not works: 
structure = [
{ID:'cXML',MIN:0,MAX:99999,LEVEL:[
{ID:'Header',MIN:0,MAX:99999,LEVEL:[
{ID:'From',MIN:0,MAX:99999,LEVEL:[
{ID:'Credential',MIN:0,MAX:99999, LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
{ID:'Credential',MIN:0,MAX:99999,
QUERIES:{
'frompartner': {'BOTSID':'Credential','Credential__domain':None},},
LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
]},
{ID:'To',MIN:0,MAX:99999,LEVEL:[
{ID:'Credential',MIN:0,MAX:99999, LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
{ID:'Credential',MIN:0,MAX:99999, LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
{ID:'Credential',MIN:0,MAX:99999,
QUERIES:{
'topartner': {'BOTSID':'Credential','Credential__domain':None},},
LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
........

recorddefs = {
'Credential':
[
['BOTSID', 'M', 256, 'AN'],
# ['Credential__domain', 'C', 256, 'AN'],
# ['Identity', 'C', 256, 'AN'],
],
'Credential__domain':
[
['BOTSID', 'M', 256, 'AN'],
],
'Identity':
[
['BOTSID', 'M', 256, 'AN'],
],
......

shik...@gmail.com

unread,
Sep 23, 2022, 4:27:37 AM9/23/22
to Bots Open Source EDI Translator
Do you have any idea? 

best regards,
Ke

Henk-Jan Ebbers

unread,
Sep 23, 2022, 4:34:53 AM9/23/22
to bots...@googlegroups.com
it is possible.
but you will need to think about the grammar. (and make a good one)

kind regards, henk-jan ebbers


shik...@gmail.com

unread,
Sep 27, 2022, 7:18:53 AM9/27/22
to Bots Open Source EDI Translator
Hey henk-jan, 

i tried this, but it's still not working.. Could you give me a hint? 

structure = [
{ID:'cXML',MIN:0,MAX:99999,LEVEL:[
{ID:'Header',MIN:0,MAX:99999,
LEVEL:[
{ID:'From',MIN:0,MAX:99999,
LEVEL:[
{ID:'Credential',MIN:0,MAX:99999,LEVEL:[
{ID:'Identity',MIN:0,MAX:99999},]},
{ID:'Credential',MIN:0,MAX:99999,
QUERIES:{
'frompartner': ({'BOTSID':'From'},{'BOTSID':'Credential', 'Identity': None})},
LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
]},
{ID:'To',MIN:0,MAX:99999,
LEVEL:[
{ID:'Credential',MIN:0,MAX:99999},
{ID:'Credential',MIN:0,MAX:99999},
{ID:'Credential',MIN:0,MAX:99999,
QUERIES:{
'topartner': ({'BOTSID':'To'},{'BOTSID':'Credential', 'Identity': None})},
LEVEL:[
{ID:'Credential__domain',MIN:0,MAX:99999},
{ID:'Identity',MIN:0,MAX:99999},
]},
......
recorddefs = {
'Credential':
[
['BOTSID', 'M', 256, 'AN'],
],
'Credential__domain':
[
['BOTSID', 'M', 256, 'AN'],
],
'Identity':
[
['BOTSID', 'M', 256, 'AN'],
],
.......

Henk-Jan Ebbers

unread,
Sep 27, 2022, 9:38:47 AM9/27/22
to bots...@googlegroups.com
Credential__domain and identity are not records but fieldd

kind regards
Henk-Jan Ebbers

shik...@gmail.com

unread,
Sep 27, 2022, 3:52:39 PM9/27/22
to Bots Open Source EDI Translator
Hey Henk-Jan, 

i got confused by your replies. First you said, "but if xml tag repeats, you will have to change the grammar (the element should be in structure, not in recorddef)"--> my elements were in structure, so i thought, you might mean the Credential__domain and identity, so i put them in the structure and out of Credential record, which means i have to add the records for them. 
Now, you said that,"Credential__domain and identity are not records but fieldd", which was i have done as i first wrote here. 
So, i got really confused and struggle with that. 
here are the xml file and my grammer file. Could you take a look at this? i will appreciate it. 

regards, Ke
input_file.xml
grammer.py
Reply all
Reply to author
Forward
0 new messages