Author Topic: XML row format  (Read 2965 times)

Lincoln

  • Jr. Member
  • *
  • Posts: 80
XML row format
« on: December 30, 2013, 09:12:33 AM »
Out of the box with Imatch5 I can get all the data I want into a xml file. My only problem is getting the rows to display in this format so I can import it into an online database.This was produced with a script in Imatch3.6

<row><row>
         <Category1ImportID></Category1ImportID>
         <Category1Name></Category1Name>
         <Category1Description></Category1Description>
         <Category1Image></Category1Image>
         <Category2ImportID></Category2ImportID>
         <Category2Name></Category2Name>
         <Category2Description></Category2Description>
         <Category2Image></Category2Image>
         <ProductName>Anglican Church - Hill End</ProductName>
         <ProductNumber>ICDR_30464</ProductNumber>
         <Category3></Category3>
         <EAN></EAN>
         <ISBN></ISBN>
         <Free1></Free1>
         <Free2>© Lincoln Fowler</Free2>
         <Free3></Free3>
         <KeyWords>Central Tablelands;gold mine;gold rush;Hill End;mining community;religious building</KeyWords>
         <ProductImage></ProductImage>
         <UnitCost></UnitCost>
         <UnitCost2></UnitCost2>
         <UnitCost3></UnitCost3>
         <UnitCost4></UnitCost4>
         <UnitCost5></UnitCost5>
         <UnitCost6></UnitCost6>
         <Description></Description>
         <DescriptionHTML>Anglican Church in former Gold Rush Village of Hill End New South Wales Australia</DescriptionHTML>
         <URL></URL>
         <Featured></Featured>
         <SalePrice></SalePrice>
         <MetaDescription></MetaDescription>
         <MetaAuthor></MetaAuthor>
         <ToolTip></ToolTip>
         <AdvCatsImportIDs>Photos;Photos.Australia;Photos.Australia.New South Wales;Photos.Australia.New South Wales.Central Tablelands;Photos.Australia.New South Wales.Central Tablelands.Hill End;Photos.Images;Photos.Images.Architecture;Photos.Images.Architecture.Religious Buildings</AdvCatsImportIDs></row></row>

Below is what the Imatch 5 create XML resource script produces for me. Do I need to write a script to get the above format - ie. <KeyWords>Central Tablelands;gold mine;gold rush;Hill End;mining community;religious building</KeyWords> instead of <F1>@Keywords|Australian Architecture;@Keywords|Central Tablelands;@Keywords|Colonial Architecture;@Keywords|gold mine;@Keywords|gold rush;@Keywords|Hill End;@Keywords|mining community</F1>



<?xml version="1.0" encoding="utf-8" ?>
<photools.com-imatch xmlns:ptrm='http://schemas.photools.com/textexport.xsd' vendor='photools.com' version='1.0'>
   filerec>
      <F1>@Keywords|Australian Architecture;@Keywords|Central Tablelands;@Keywords|Colonial Architecture;@Keywords|gold mine;@Keywords|gold rush;@Keywords|Hill End;@Keywords|mining community</F1>
      <F2></F2>
      <F3></F3>
      <F4></F4>
      <F5>Northey’s Store built cira 1873 in the former Gold Rush Village of Hill End New South Wales Australia</F5>
      <F6>Northey’s Store built cira 1873 in the former Gold Rush Village of Hill End New South Wales Australia</F6>
      <F7>Australian Architecture;Central Tablelands;Colonial Architecture;gold mine;gold rush;Hill End;mining community</F7>
      <F8>0</F8>
      <F9>ICDR_30463</F9>
      <F10>Northey’s Store built cira 1873 in the former Gold Rush Village of Hill End New South Wales Australia</F10>
   </filerec>
   
</photools.com-imatch>

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 29382
Re: XML row format
« Reply #1 on: December 30, 2013, 09:46:45 AM »
Quote
Below is what the Imatch 5 create XML resource script produces for me

Which script do you mean? The output looks more like what the Text Export module produces when you choose XML as the output format.

The <F1>,<F2>,... field names are only used when you don't specify the field name to use in the dialog box, e.g.:

FileName:{File.FullName}
Keywords:{File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0}

results in something like


<?xml version="1.0" encoding="utf-8" ?>
<photools.com-imatch xmlns:ptrm='http://schemas.photools.com/textexport.xsd' vendor='photools.com' version='1.0'>
  <filerec>
    <FileName>V:\__PERF-TEST\Import Test\KW\0027.jpg</FileName>
    <Keywords>abstract;aged;ancient;antique;art;artistic;background;blood;chaotic;coarse;wallpaper;worn</Keywords>
  </filerec>
</photools.com-imatch>


This way you can control the element names used for the XML file.

The XML output format created by the Text Exporter is very generic and can be easily transformed by a script or maybe even a set of XSLT rules which transform the generic format produced by IMatch into the specific format required by your online database. Producing application-specific XML is outside the scope of the Text Export module in IMatch.

Check out the sample script "" which shows how easy it is to produce XML files from IMatch. Combine that with the ParseVariables method of the Database class to produce any XML format you'll ever need.

Lincoln

  • Jr. Member
  • *
  • Posts: 80
Re: XML row format
« Reply #2 on: December 30, 2013, 11:06:12 AM »
Thanks Mario
It was the Text Export I was looking at. Just confused as to what is the sample script  ""  is that the XMLwriter? That certainly has the format I after.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 29382
Re: XML row format
« Reply #3 on: December 30, 2013, 03:47:03 PM »
Yeah, I meant the XMLWriter script. Just forget to fill in the place holder while posting  :-[

The XMLWriter is a class I've written for IMatch 5 to make it easy to produce XML from a script.

Lincoln

  • Jr. Member
  • *
  • Posts: 80
Re: XML row format
« Reply #4 on: December 30, 2013, 11:28:31 PM »
Got it now  8) Just love how easy it is to use. Great work Mario  ;D