how to get partner from duplicates tags

已查看 38 次
跳至第一个未读帖子

shik...@gmail.com

未读,
2022年9月22日 04:34:482022/9/22
收件人 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

未读,
2022年9月22日 04:38:572022/9/22
收件人 '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

未读,
2022年9月22日 04:55:012022/9/22
收件人 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

未读,
2022年9月23日 04:27:372022/9/23
收件人 Bots Open Source EDI Translator
Do you have any idea? 

best regards,
Ke

Henk-Jan Ebbers

未读,
2022年9月23日 04:34:532022/9/23
收件人 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

未读,
2022年9月27日 07:18:532022/9/27
收件人 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

未读,
2022年9月27日 09:38:472022/9/27
收件人 bots...@googlegroups.com
Credential__domain and identity are not records but fieldd

kind regards
Henk-Jan Ebbers

shik...@gmail.com

未读,
2022年9月27日 15:52:392022/9/27
收件人 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
回复全部
回复作者
转发
0 个新帖子