XML Import problem

Stef-B
Stef-B Member Posts: 26
first of all: YES I used the forum search and YES I read the manual.

:oops: Nevertheless I have a problem to generate an XML-Port to import an XML-File with a (what looks to me) simple structure:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> 
<p_data>
  <pla>
    <id value="37814" /> 
    <ko>
      <g value="15" /> 
      <s value="1" /> 
      <p value="0" /> 
      <string value="15:1:0" /> 
    </ko>
    <p_typ value="So" /> 
    <o_typ value="---" /> 
    <p_username value="" /> 
    <p_name value="" /> 
  </pla>
  <information>
    <time value="1159352848" /> 
  </information>
</p_data>

I tried all possible combinations in Dataport but I always get weird messages saying that expecting <ko> but found <id> and when I change the dataport element/attribute i get a different message.

I even tried to track the problem down by shrinking the xml-File to
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> 
<p_data>
  <pla>
    <id value="37814" /> 
  </pla>
</p_data>
I'm so frustrated, that i cant even import a single field XML-File...
neither
p_data	Element	Text	<p_data>
pl	Element	Table	<XML-G>(XML-G)
id	Element	Text	<id>
value	Attribute	Field	<XML-G>::ID

nor
p_data	Element	Text	<p_data>
pl	Element	Table	<XML-G>(XML-G)
id	Attribute	Field	<XML-G>::ID

nor anything else I tried works...
Is it probably with the syntax of the source XML-File?
I'm almost willing to give up this kind of import and importing the XML-File to Excel and exporting as CSV to create a simple dataport that works. But I thought that the XML-Port should work better for this.

Thanks in advance for your help.

Answers

  • ara3n
    ara3n Member Posts: 9,258
    Hello Stef-B. I'm sorry that you had problems with xmlports.
    I've created an example xml port that you can use for the given xml above.

    Paste in text file and import into navision. Good luck.
    OBJECT XMLport 50001 TADA1
    {
      OBJECT-PROPERTIES
      {
        Date=10/30/06;
        Time=10:06:30 AM;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      ELEMENTS
      {
        { [{135E24C8-C20B-45B6-BCF0-95976957CB33}];  ;p_data              ;Element ;Text     }
    
        { [{93DE274A-CA57-4329-93AB-B5332CFE9460}];1 ;pla                 ;Element ;Text     }
    
        { [{202F5DEE-7117-4142-B38D-AFEE0ABAD2B6}];2 ;id                  ;Element ;Text     }
    
        { [{9B54F7A8-1FB7-4ED4-BCB8-6970AC37A2C5}];3 ;value               ;Attribute;Text   ;
                                                      VariableName=idvalue }
    
        { [{FD6DD73E-7F12-403A-9833-6320BAF7E39F}];2 ;ko                  ;Element ;Text     }
    
        { [{9EB2E8A3-9907-43A1-A86D-CC5B9B1C42DC}];3 ;g                   ;Element ;Text     }
    
        { [{23326171-2B1C-4883-9D4D-8C435ACE287E}];4 ;value               ;Attribute;Text   ;
                                                      VariableName=gvalue }
    
        { [{38C31350-9A69-445F-996C-998B9FFF2132}];3 ;s                   ;Element ;Text     }
    
        { [{79409561-BFF9-47F4-80DA-50B1B2A237F6}];4 ;value               ;Attribute;Text   ;
                                                      VariableName=svalue }
    
        { [{A428C381-3410-4FE7-9852-A9B2901F831A}];3 ;p                   ;Element ;Text     }
    
        { [{D22386D7-AAC4-45A2-B0BB-C9257F6A29E4}];4 ;value               ;Attribute;Text   ;
                                                      VariableName=pvalue }
    
        { [{AD7CD78A-0562-4C63-A451-E985C37A2917}];3 ;string              ;Element ;Text     }
    
        { [{B3C34D7A-11D6-4600-81F8-AB467DA5ED4E}];4 ;value               ;Attribute;Text   ;
                                                      VariableName=stringvalue }
    
        { [{00F3DA61-C0CA-4882-B241-9A83501793C8}];2 ;p_typ               ;Element ;Text    ;
                                                      VariableName=<p_typ> }
    
        { [{0DE01112-4F71-4EFD-9BC8-243EA8FA132E}];3 ;value               ;Attribute;Text   ;
                                                      VariableName=p_typvalue }
    
        { [{831A0A6A-CB06-4CAC-BE51-32BF4E1C3BBF}];2 ;o_typ               ;Element ;Text    ;
                                                      VariableName=<o_typ> }
    
        { [{3032C7AB-76A7-4BE4-86A4-49EAC9BFB59E}];3 ;value               ;Attribute;Text   ;
                                                      VariableName=o_typvalue }
    
        { [{39C1009B-D190-41D6-A41A-1666D06E9359}];2 ;p_username          ;Element ;Text    ;
                                                      VariableName=<p_username> }
    
        { [{495B6570-4E10-4170-BC96-E3C0F0977E9A}];3 ;value               ;Attribute;Text   ;
                                                      VariableName=p_usernamevalue }
    
        { [{7DBE5A99-4ED8-4A15-B941-0DBC9A15C2CB}];2 ;p_name              ;Element ;Text    ;
                                                      VariableName=<p_name> }
    
        { [{630B9878-175A-4B9D-B5FA-429D5F97E73B}];3 ;value               ;Attribute;Text   ;
                                                      VariableName=p_namevalue }
    
        { [{76DEECB9-10AE-466A-9726-04635D0AF427}];1 ;information         ;Element ;Text     }
    
        { [{0D73D153-8C9A-453E-B2A3-8FFFB1DEB7A3}];2 ;time                ;Element ;Text    ;
                                                      VariableName=<time> }
    
        { [{205B9ECC-9E41-4AC4-B333-239B60570FD4}];3 ;value               ;Attribute;Text   ;
                                                      VariableName=timevalue }
    
      }
      EVENTS
      {
      }
      CODE
      {
    
        BEGIN
        END.
      }
    }
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n