OK, I'm fairly new to XML and FileMaker. I keep getting an error: "XML Parsing Error: The main document cannot be empty". I'm a little fuzzy on the syntax.
The import I'm trying to accomplish has three parts: the FMP database, an XML output file from a third-party program that churns out the file names in a given Windows XP directory, and an XSL stylesheet that is supposed to transform the XML file to a workable format.
To-Be-Imported XML File: xml_listing.xml
XSL Stylesheet: k4_import.xsl
I thought I had everything formatted properly, but I guess not. The database file has four fields: name, size, type and url. Here is the XML file I want to import, and and XSL stylesheet I want to use to do the import. I continue to get the error above. I can't figure out what's wrong, so any help is appreciated.
The import I'm trying to accomplish has three parts: the FMP database, an XML output file from a third-party program that churns out the file names in a given Windows XP directory, and an XSL stylesheet that is supposed to transform the XML file to a workable format.
To-Be-Imported XML File: xml_listing.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hdlg:filesystem SYSTEM "[URL unfurl="true"]http://www.hdlg.info/XML/filesystem.dtd">[/URL]
<hdlg:filesystem xmlns:hdlg="[URL unfurl="true"]http://www.hdlg.info/XML/filesystem">[/URL]
<hdlg:folder name="pdfs" url="file:/c:/pdfs/">
<hdlg:file name="FEB248.pdf" size="17407400" type="unknown" url="file:/c:/pdfs/FEB248.pdf">
</hdlg:file>
<hdlg:file name="FEB249.pdf" size="13918425" type="unknown" url="file:/c:/pdfs/FEB249.pdf">
</hdlg:file>
<hdlg:file name="FEB250.pdf" size="38914" type="unknown" url="file:/c:/pdfs/FEB250.pdf">
</hdlg:file>
<hdlg:file name="FEB251.pdf" size="21109720" type="unknown" url="file:/c:/pdfs/FEB251.pdf">
</hdlg:file>
<hdlg:file name="FEB252.pdf" size="35559" type="unknown" url="file:/c:/pdfs/FEB252.pdf">
</hdlg:file>
<hdlg:file name="FEB253.pdf" size="7288156" type="unknown" url="file:/c:/pdfs/FEB253.pdf">
</hdlg:file>
<hdlg:file name="FEB254.pdf" size="11409973" type="unknown" url="file:/c:/pdfs/FEB254.pdf">
</hdlg:file>
<hdlg:file name="pdf_listing.html" size="7368" type="unknown" url="file:/c:/pdfs/pdf_listing.html">
</hdlg:file>
<hdlg:file name="xml_listing.xml" size="0" type="unknown" url="file:/c:/pdfs/xml_listing.xml">
</hdlg:file>
</hdlg:folder>
</hdlg:filesystem>
XSL Stylesheet: k4_import.xsl
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:output indent="yes" method="xml"/>
<xsl:template match="k4_file_names">
<FMPXMLRESULT xmlns="[URL unfurl="true"]http://www.filemaker.com/fmpxmlresult">[/URL]
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="08-14-2007" NAME="FileMaker Pro" VERSION="8.0v3"/>
<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="k4_file_names.fp7" RECORDS="10" TIMEFORMAT="h:mm:ss a"/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="name" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="size" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="type" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="url" TYPE="TEXT"/>
</METADATA>
<RESULTSET FOUND="10">
<xsl:for-each select="k4_file_names">
<ROW MODID="0" RECORDID="{position()}">
<COL>
<DATA>
<xsl:value-of select="name"/>
</DATA>
</COL>
<COL>
<DATA>
<xsl:value-of select="size"/>
</DATA>
</COL>
<COL>
<DATA>
<xsl:value-of select="type"/>
</DATA>
</COL>
<COL>
<DATA>
<xsl:value-of select="url"/>
</DATA>
</COL>
</ROW>
</xsl:for-each>
</RESULTSET>
</FMPXMLRESULT>
</xsl:template>
</xsl:stylesheet>
I thought I had everything formatted properly, but I guess not. The database file has four fields: name, size, type and url. Here is the XML file I want to import, and and XSL stylesheet I want to use to do the import. I continue to get the error above. I can't figure out what's wrong, so any help is appreciated.