7 Replies Latest reply on Jan 22, 2012 11:54 AM by glimmieglimbo

    Importing XML fails need XSLT?

    glimmieglimbo

      Dear people,

       

      I needed to import several XML files. XML file generated with Excel no problems. Now from a company I get XML-files like this attachments (and many more) and I'm really a nobe instead of an newbe with xml and xslt.

      So I'm desperate....... and need your help...please.

      It's an export from the same database but different records.

      1st question: Why doesn't they look the same.....less fields are filled?!?

      2nd question: Apparently I need an XSLT file to do this import. Why? XML sould be a standard. I don't get this???

      3th question: Is there anyone who can make this XSLT-file or is there an conversion tool to do this?

       

      Please help me out!!

       

      Thanks very, very, very much.......

        • 1. Re: Importing XML fails need XSLT?
          comment

          glimmieglimbo wrote:

           

          1st question: Why doesn't they look the same.....less fields are filled?!?

           

          That's not unusual and shouldn't be a problem, as long as they all follow the same structure.

           

           

          glimmieglimbo wrote:

           

          2nd question: Apparently I need an XSLT file to do this import. Why? XML sould be a standard.

           

          Yes, you do. It's necessary in order to translate the data from their schema into yours. XML is a very flexible language, and you need a tool to pick say the contents of the Naam element of OpdrachtgeverUitvoerend and direct it into the ContractorExecutiveName field of your solution, while the Naam element of ExpertisebureauAchterliggend will be imported by the ExpertiseOfficeLaidBackName field.

           

          This is a highly customized job; it needs to match the source schema on  one side, and your file's structure (and Filemaker's own XML syntax) on the other side.

           

          Note also that an XML document can contain data that needs to be imported into more than one table; for example multiple addresses belonging to the same parent dossier. In such case, you'll need to perform 2 imports using 2 different XSL stylesheets.

          1 of 1 people found this helpful
          • 2. Re: Importing XML fails need XSLT?
            beverly

            TIP: export as FMPXMLRESULT *from* your database. That shows you the structure as it needs to be imported INTO your database! I often use this as a basis when creating the XSLT for use with the import. You can open the file in any text editor (or some browsers give you a "tree-view" of the XML). You may notice that the "METADATA" is much like the header of a spreadsheet. The "RECORD" is each row, so you can import multiple records.

             

            Yes, you can have some "fields" elements in the XML that appear or not appear. I also recommend that you get a DTD or XSD of this schema so you will know what elements *might* occur in this type of XML for import. Otherwise, you will have to guess and then revise your XSLT when you discover that some fields/elements are new.

             

            XML *is* a standard, but it's also "extensible" (the "X"), meaning that you can have different formats. Just as your database is not the same as my database, the XSLT is a way to "transform" the XML you have into the FMPXMLRESULT that FileMaker needs for IMPORT.

             

            There is no conversion tool, because your database is not the same as my database, although we could both import this data!

             

            Michael/Comment is correct. You may have multiple imports (with multiple XSLT), using the XML you are importing.

             

            Beverly

            1 of 1 people found this helpful
            • 3. Re: Importing XML fails need XSLT?
              comment

              Here is a very thin skeleton stylesheet for your data. It will create a new record for each Dossier and import 3 fields. It shouldn't be too difficult to flesh it out.

              • 4. Re: Importing XML fails need XSLT?
                glimmieglimbo

                Hi Michael,

                This is really helpfull. Now I can see how it works.

                I have one question left I hope ;-)

                 

                In the XML I see several fields multiple times:

                <OpdrachtgeverAchterliggend>

                         <Relatienummer>50009</Relatienummer>

                         <Naam>Unive233; Dichtbij</Naam>

                </OpdrachtgeverAchterliggend>

                                                                                                   

                <OpdrachtgeverUitvoerend>

                          <Relatienummer>50009</Relatienummer>

                          <Naam>Univ&#233; Dichtbij</Naam>

                                       <Behandelaar>

                                                 <Naam>Sindie van Wieren</Naam>

                                                  <Telefoonnummer>0591-664583</Telefoonnummer>

                                                  <Emailadres>correspondent@peer.demon.nl</Emailadres>

                                         </Behandelaar>

                </OpdrachtgeverUitvoerend>

                 

                How let I recognize the XSLT the same fieldnames so I can import it FM in de right fields in one record?

                for example:

                OpdrGAchterl<<naam>>

                OpdrGUitv<<naam>>

                OpdrGUitvBehand<<naam>>

                 

                Again thanks very much.

                 

                Martin

                • 5. Re: Importing XML fails need XSLT?
                  comment

                  I have added the three to the example stylesheet - I believe that should be easier than trying to explain.

                   

                  See also:

                  http://www.w3schools.com/xpath/default.asp

                  • 6. Re: Importing XML fails need XSLT?
                    beverly

                    REMINDER: FileMaker uses XPath 1.0, XML 1.0 and XSLT 1.0 when importing/exporting XML.

                    What you can and cannot do may vary.

                     

                    TIP: There are several example XML & XSLT files with the standard installation of FileMaker Pro (or Pro Advanced). The XML technologies page may also help <http://www.filemaker.com/support/technologies/xml.html>.

                     

                    Beverly

                    • 7. Re: Importing XML fails need XSLT?
                      glimmieglimbo

                      Dear Beverly and especially Michael for the examles,

                       

                      Thank you very much for your input.

                      Thanks to you I'm now traying to upgrade from a nobe to a newbe

                      Tomorrow I shall try with all this input to expand the xlst and try to import the data into filemaker.

                      I shall give you feedback on the results.

                       

                      Again I'm very greatfull and take a deep bow!!!

                       

                      Martin van Wijnen

                      The Netherlands.