Kris M Posted January 12, 2009 Posted January 12, 2009 I am trying to import data from an .xml file generated by a program from the google aps library called xlm-dir-listing. I am not having any success at import i think because the .xml data does not conform to the fmpxmlresult.dtd How do i transform the xml-dir-listing output .xls data to conform to the Filemaker dtd requirements before triggering the import? Any thoughts on how i can get this to work? TIA Kris
comment Posted January 12, 2009 Posted January 12, 2009 You need an XSLT stylesheet to transform the source file into FMPXMLRESULT grammar. It's hard to be more specific without seeing the source and knowing what you want to import from it, and to where.
Kris M Posted January 13, 2009 Author Posted January 13, 2009 (edited) output from the utility is where file can be nested many times in the directory. Here is the utility output dtd and the data goes into fields in a table of the same name except the sort and reverse attributes are not stored. <?xml version="1.0" encoding="ISO-8859-1"?> name CDATA #REQUIRED lastModified CDATA #REQUIRED date CDATA #REQUIRED size CDATA #REQUIRED absolutePath CDATA #REQUIRED sort CDATA #IMPLIED reverse CDATA #IMPLIED> name CDATA #REQUIRED lastModified CDATA #REQUIRED date CDATA #REQUIRED size CDATA #REQUIRED absolutePath CDATA #REQUIRED> so my basics question here is...ready? How does a style sheet work to accomplish the goal? I thought that xml parser calls the stylesheet to make the output look nice and that it would not affect the underlying data structure. obviously i am wrong. can you point me to a resource that explains this? Edited January 13, 2009 by Guest
comment Posted January 13, 2009 Posted January 13, 2009 How does a style sheet work to accomplish the goal? I thought that xml parser calls the stylesheet to make the output look nice and that it would not affect the underlying data structure. obviously i am wrong. can you point me to a resource that explains this? Oh, my - you're about to discover a new continent. I'd suggest you start with these: http://en.wikipedia.org/wiki/XSLT http://www.w3schools.com/Xsl/xsl_intro.asp http://my.advisor.com/doc/12009 You'll find countless additional resources on the web and/or in bookstores. XSLT is a widely used technology, and its implementation in Filemaker is only a tiny fraction of what's out there. the data goes into fields in a table of the same name except the sort and reverse attributes are not stored. That only answers half of my question. The document you describe has a "Russian doll" structure: each element (file or directory) can have any number of parent elements. There is no similar STRUCTURE in Filemaker (though the DATA MODEL can be recreated using recursive relationships). I believe it wouldn't be too difficult to import each element as a record, then use the absolutePath attribute to link to the immediate parent record. Is that what you have in mind? IOW, what's your purpose here? BTW, the dtd is helpful but if you have an actual example of the output, please post that too (preferably as a zipped attachment).
Kris M Posted January 13, 2009 Author Posted January 13, 2009 (edited) I went through the w3c xml, xml dom, xml namespaces tutorial and have learned alot. I see now how misinformed by previous questions were. Sorry. I am currently working through the xslt tutorial and hope to at least understand any solution you might provide. Here is the severely truncated output xml file. The database has one table and 4 fields.. Filename, date_time, path, and size that correspond to the file attributes Could i just xslt remove the directories? MusicList.zip Edited January 13, 2009 by Guest
comment Posted January 13, 2009 Posted January 13, 2009 You still haven't told us what's the purpose. Anyway, you might want to try the following: drop your 'MusicList.xml' file onto Filemaker, and when asked, tell it to use the attached 'filedir.xsl' stylesheet (as a file). Archive.zip
Kris M Posted January 13, 2009 Author Posted January 13, 2009 The purpose is to produce a catalog of files in an fmp database as repeatably and easily as possible. Ill try the solution and let you know. Thanks
Kris M Posted January 13, 2009 Author Posted January 13, 2009 your xsl file works perfect. thanks. When i think i understand what you did ill post again so you can get a laugh.
Recommended Posts
This topic is 5793 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now