Jump to content
Server Maintenance This Week. ×

XML into filemaker - no validation errors


Dali

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

Recommended Posts

Hi everyone,

Is it possible or are there any tools that can validate data imported into filemaker from an xml file

For example say I have a Contact table with fields:

CONTACT:

company

fname

lname

After I export this into xml the xml file would contain nodes company, fname and lname.

Sometime later my database schema changes and fields fname and lname are renamed to first_name and last_name

Now if I import the original xml file with nodes fname and lname the import will still work without any errors thrown from filemaker and only company will be imported since fname and lname fields no longer exists in the database.

I understand I could create an xsd to validate the xml file coming in but let's say the xml schema hasn't changed and it still expects fname, lname and company.

So is there are a way for filemaker to throw an error when not all of the xml nodes are mapped i.e. when I created the import scripts nodes required were fname and lname. It's just too hard to identify all of these fields changes and update the xsd schemas every time something changes in the database. Would be nice if there were some errors thrown when the xml no longer conforms to the mapping based in the import script. It's a major problem and these sometimes go undetected. System has over a 1000 scripts and over 150 tables.

Any thoughts would be helpful

Thanks,

Dali

Link to comment
Share on other sites

I don't have an answer for throwing an error other than using a third-party tool or a plug-in that provides XML utility (e.g. SmartPill PHP or ScriptMaster).

But you might consider the option of modifying your XSLT files to recognize the changes in the files using conditionals. Either solve the translation problem directly in XSLT or log its findings to a FileMaker field that you reliably import.

Another thing to consider is to add a tag or version="" attribute to be required in your XML document. You can then check the version independently of importing all of the data. Obsolete formats would then either lack the version information or would have an earlier version number.

Edited by Guest
Link to comment
Share on other sites

is there are a way for filemaker to throw an error when not all of the xml nodes are mapped

Well, the thing is that your existing XSLT stylesheet still HAS those nodes - so they ARE mapped correctly in the import dialog. The problem is that they are empty.

I am not sure it's possible to properly validate the source XML against a schema during the XSL transformation stage (I believe the parser DOES validate, if there is a DTD included/referenced in the XML document - but of course that would be the NEW schema). However, you could do your own "pedestrian" validation, and generate records only if all tests passed. If there are no records, nothing will be imported - and you will get an error message.

Link to comment
Share on other sites

Thank you for your replies,

I use command tools to validate against xsd schema and handle xslt 2.0 transformations so no hiccups there.

Could you give little more detail regarding your comment. Not really sure what a "pedestrian" validation is. What's the best way for testing data importing/migration?

"However, you could do your own "pedestrian" validation, and generate records only if all tests passed. If there are no records, nothing will be imported - and you will get an error message.

Link to comment
Share on other sites

I use command tools to validate against xsd schema and handle xslt 2.0 transformations so no hiccups there.

I am afraid I don't follow: if you validate against xsd schema and the source doesn't conform, then it should fail right there - and no attempt to import should take place. I thought you were importing directly into Filemaker, using a stylesheet to transform the source during the import.

Not really sure what a "pedestrian" validation is

For example:

...

This will create records only when a element exists as a child of .

Edited by Guest
Link to comment
Share on other sites

This topic is 5251 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
×
×
  • Create New...

Important Information

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