Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

XML Import Invalid Document Structure

Featured Replies

  • Newbies

As a Newbie in Filemaker, I'm having a hard time trying to import a XML feed from a web service, transform it with a XSLT stylesheet and import it in a Filemaker DB.

The import script is giving me an error: "Invalid Document Structure"

Any help will be grateful!

The document structure is

<itemList>

<Item>

<product_id>Product ID</product_id>

<manufacturer_part_number>Manufacturer PN<manufacturer_part_number />

<product_dateadded>M/D/YYYY</product_dateadded>

<category_ids>0123</category_ids>

<product_shortdesc>Product Short Desc</product_shortdesc>

<product_detail>Product detail</product_detail>

<product_univ>false</product_univ>

<product_barcode>0123456789</product_barcode>

<product_blu>false</product_blu>

<product_25mm>false</product_25mm>

<product_picture_0>picture.jpg</product_picture_0>

<model_ids>0123</model_ids>

<quantity>1</quantity>

<price>2.2500</price>

<product_msrp>19.9900</product_msrp>

<product_manufacture>BRAND</product_manufacture>

</Item>

<Item>

The XSLT is:

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

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

<ERRORCODE>0</ERRORCODE>

<PRODUCT BUILD="" NAME="" VERSION=""/>

<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="/itemList" TIMEFORMAT="h:mm:ss"/>

<xsl:template match='/Item'>

<METADATA>

<FIELD EMPTYOK="No" MAXREPEAT="1" NAME="product_id" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="manufacturer_part_number" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_dateadded" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="category_ids" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_shortdesc" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_detail" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_univ" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_barcode" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_blu" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_25mm" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_picture_0" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="model_ids" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="quantity" TYPE="NUMBER"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="price" TYPE="NUMBER"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_msrp" TYPE="NUMBER"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_manufacture" TYPE="TEXT"/>

</METADATA>

<RESULTSET FOUND="">

<xsl:for-each select="/Item">

<ROW MODID="0" RECORDID="0">

<COL><DATA><xsl:value-of select="./product_id"/></DATA></COL>

<COL><DATA><xsl:value-of select="./manufacturer_part_number"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_dateadded"/></DATA></COL>

<COL><DATA><xsl:value-of select="./category_ids"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_shortdesc"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_detail"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_univ"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_barcode"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_blu"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_25mm"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_picture_0"/></DATA></COL>

<COL><DATA><xsl:value-of select="./model_ids"/></DATA></COL>

<COL><DATA><xsl:value-of select="./quantity"/></DATA></COL>

<COL><DATA><xsl:value-of select="./price"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_msrp"/></DATA></COL>

<COL><DATA><xsl:value-of select="./product_manufacture"/></DATA></COL>

</ROW>

</xsl:for-each>

</RESULTSET>

</xsl:template>

</FMPXMLRESULT>

</xsl:stylesheet>

If that is the exact XML document you are trying to import, then it is indeed invalid. The <itemList> element is never closed, and a new <Item> is opened at the end.

This, too is invalid:

<manufacturer_part_number>Manufacturer PN<manufacturer_part_number />




It should be:


<manufacturer_part_number>Manufacturer PN</manufacturer_part_number>

  • 4 months later...

You have:

<xsl:template match='/Item'>

AND:

<xsl:for-each select="/Item">

This is causing the <METADATA> and actually *everything* to repeat for each /Item.

Change the xsl:template match='/' (root of the document you are importing). And put it right after your opening xsl:stylesheet. What no xsl:output ?? :)

And this:

</xsl:template>

</FMPXMLRESULT>

should be:

</FMPXMLRESULT>

</xsl:template>

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.