Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have modified a copy of a well working script for XML export. I have modified the fieldheaders in the xsl-file and changed the destination of the output file, but no further changes.

I makes an error (see attachment). It states that the is an invalid character somewhere, but where do I find and correct it?

For the record (and yes, the separator is TAB):

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



<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

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



<xsl:output method="text" encoding="ISO-8859-1"/>



<xsl:variable name="CRLF">

<xsl:text>&#x000D;&#x000A;</xsl:text>

</xsl:variable>



<xsl:variable name="delimiter">

<xsl:text> </xsl:text>

</xsl:variable>



<xsl:template match="/">

<xsl:text>v_products_model v_products_name_1 v_products_short_description_1 v_products_description_1 v_products_page_title_1 v_products_meta_keywords_1 v_products_meta_description_1 v_products_image v_products_price_per v_products_manufacturer_model v_products_ean v_products_price v_products_quantity v_products_weight v_date_avail v_date_added v_categories_name_1_1 v_categories_name_2_1 v_manufacturers_name v_tax_class_title v_status EOREOR&#x000D;&#x000A;</xsl:text>



<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

<xsl:for-each select="fmp:COL">

<xsl:value-of select="fmp:DATA"/>

<xsl:choose>

<xsl:when test="position()=last()">

<xsl:value-of select="$CRLF"/>

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="$delimiter"/>

</xsl:otherwise>

</xsl:choose>

</xsl:for-each>

</xsl:for-each>



</xsl:template>

</xsl:stylesheet>

post-106146-0-94259800-1343980450_thumb.

Posted

The error message seems to indicate that the invalid character is in one of the exported fields. The character is a non-printing control code - perhaps inadvertently pasted into the field.

Posted

The error message seems to indicate that the invalid character is in one of the exported fields. The character is a non-printing control code - perhaps inadvertently pasted into the field.

That sounds reasonable, BUT ... How am I surposed to search for something I don't what is?

Likely it's line ends, e.g. CR and/or LF. I recall something about the character codes 010 and 013, but how do I search (inside FM) for 013? &013; or ...?

Or can I "clean" a CSV-file for later re-import?

Posted

I have not tried it but you define CRLF in UTF-16 while the output is set to UTF-8. Did you change the encoding?

Apart from that: the xml standard defines all ASCII chars except (9, 10 & 13) in the range 0-31 as illegal. My guess it's the 000a 000d combos.

Posted

That sounds reasonable, BUT ... How am I surposed to search for something I don't what is?

Try defining a calculation field (or an expression in Data Viewer) as =

PatternCount ( Field1 & Field2 & ... & FieldN ; Char ( 1 ) )

Then see which record returns a result > 1.

Before you do that, see if the error is thrown when you export as XML without a stylesheet.

you define CRLF in UTF-16

What makes you think so?

Posted

What makes you think so?


<xsl:variable name="CRLF">

<xsl:text>&#x000D;&#x000A;</xsl:text>

</xsl:variable>

Looks to me like CR+LF in UTF-16BE.

But I was wrong on that being the error.

Posted


<xsl:variable name="CRLF">

<xsl:text>&#x000D;&#x000A;</xsl:text>

</xsl:variable>





Looks to me like CR+LF in UTF-16BE.



But I was wrong on that being the error.

The code shown in my message above has been working perfectly in months now. The only change is the field names in this line:

<xsl:text>
Posted

Try defining a calculation field (or an expression in Data Viewer) as =

PatternCount ( Field1 & Field2 & ... & FieldN ; Char ( 1 ) )

Then see which record returns a result > 1.

I don't know why, but ... IT WORKED!

Two records with ... ehhhhm, a lot of errors (content pasted from another application) :cry:

Thanks a lot :hug:

This topic is 4494 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.