Editing the XML file nodes

Started by Lincoln, September 09, 2016, 09:40:12 AM

Previous topic - Next topic

Lincoln

Straight out of the box the  Text Export script/plugin produces the XML file I am after.  All I need to do is have the script write the nodes as <items> and <item>
instead of <photools.com-imatch xmlns:ptrm='http://schemas.photools.com/textexport.xsd' vendor='photools.com' version='1.0'> and <filerec>
What would be the best approach to doing this? At present the nodes <items> & <item> are all I need as a default

Mario

Usually you would just apply a XSLT to transform the standard XML format produced by IMatch into whatever XML format you need.
See, for example, http://www.w3schools.com/xsl/
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Lincoln

I was hoping to eliminate as many steps as possible. The XML output from iMatch is what I am after for a SQL database. But the root node needs to be called <items> and the elements node <item> for the XML file to be imported correctly.
With iMatch 3 I had a script that enabled me to control those node names. I have not been able to find the template file that is used to give the

<photools.com-imatch xmlns:ptrm='http://schemas.photools.com/textexport.xsd' vendor='photools.com' version='1.0'>

<filerec>
nodes their names.

Mario

You cannot change the node names or the format the Text Exporter, it's a standardized format.

If the receiving application is inflexible and requires a specific format, applying an XSLT to the XML file produced by IMatch should neatly transform it into the format you need for your SQL database. Once written you can apply it any time when you produce new XML output using the IMatch Text Exporter.

Should be quicker than to write your own XML export script as well.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Lincoln

I got lucky - after spending hours trying to find the bit of code to change my node names - it turned out the simplest of answers!
I only have to change the root node from <photools.com-imatch> to <items> and I have my file. Not as neat as the iMatch 3.6 script but I can live with that. Problem solved.