Jump to content

import xml with attributes ?


Waki
 Share

This topic is 5718 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Pict and "image" would be 2 separate tables in FileMaker, parent and child. So you need 2 xml imports, each with its own xsl stylesheet, into its own table. The image xsl would be almost the same, just one more level down. Example:

					

						

							

								

							

						

Notice that the attributes are almost the same. They just have an "i" in front. This can be easily done on a copy of the xsl using a text editor, such as BBEdit or TextWrangler (free) from http://www.barebones.com

Find: @

Replace: @i

You could leave the field names as they are, since they're in their own Images table. Also, I dropped the @year, and the final "." (who knows?), because they're not in the image data.

Edited by Guest
RECORDID="{position()}"
Link to comment
Share on other sites

thank you Fenton for your quickly replay. I've also thinked your solutions and it works well, the problem is that i have to edit the fm records (example i wanna add pict node to the xml to add pict to the website) and export back the xml for flash. Is there a way to export the same xml i have imported?

thank so much

Link to comment
Share on other sites

Yes, you can export the data back out. But what xml structure does the export need to be? I'm assuming that it would be different from the orignal xml (else why would you be asking)? Or is that you have the data in FileMaker originally, but want to export in the xml structure that you posted originally (but then why ask about importing it)?

Link to comment
Share on other sites

yes, i need to export in the same structure. The purpose is to permit to my customer, to modify or add picture to his site without use a xml editor (bbedit, oxygen) but with a more user friendly interface like filemaker. So i have to import in first time the original xml, edit, add, remove record (picture), and save again an xml to upload to the site. I have many website with this tecnology so this will be very useful for me.

i attatch the original xml file, note that non every pict node will have a image node.

thanks fendon for your interest

mosaicOriginal.zip

Link to comment
Share on other sites

Sorry to take so long. Yes, you can export out again, recreating the original xml. I was trying to come up with some kind of "generic and universal" xsl to do this, including related records, but was unable to do so. If anyone can do this (I think it can be done, but it's tricky), please post. Anyway, this is what I came up with. I'm assuming that you ONLY can have 2 Images. Otherwise you need to add another test. And I only put a few of the fields (columns), as it's tedious. But you can easily add. You do not need the FM Metadata, etc., in the export xsl. But you do need to see what the column order/numbers are. Do a raw xml export to see.

<?xml version="1.0" encoding="utf-8"?>

Link to comment
Share on other sites

  • 3 weeks later...

fenton, exporting XML will be much easier when you use the (depreciated, but much appreciated ) FMPDSORESULT grammar. that way you don't have to count on field order and can export/transform by (field)name....

MUCH more flexible when copying/modyfying scripts (provided you don't change your field names ....) and a lot easier to debug ...

Link to comment
Share on other sites

This topic is 5718 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.