cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cocoon User" <>
Subject too large XSP logicsheet? aka How to cut XML in to pieces and generate from each one independly (using Cocoon not text editor ;) )
Date Tue, 26 Apr 2005 13:44:28 GMT

I've got a problem with too large XSP logicsheet (hypothesis).

Problem origin:
    I must INSERT INTO a Postgres database a large amount of data from
XML source.
    XML source is something about 1MB. Lots of records like:

<ENTRY start="2005-03-05 05:45" next="2005-03-05 06:15" duration="26"
language="PL" age_category="NA">
  <TITLE>Pod słońcem Afryki</TITLE>
  <INSTALMENT number="22/26" />
  <DESCRIPTION short="">Serial o przyrodzie Afryki. Autorzy filmu
koncentrują się na problemach związanych z ochroną        zagrożonych
gatunków i ekosystemów.</DESCRIPTION>
  <PRODUCTION country="RPA" />
  <CATEGORY formal="SER" a="DOK">serial dokumentalny</CATEGORY>
  <FEATURES x="no" k="no" z="no" p="no" s="no" b="no" m="no" d="no" />

I thought it would work fine with one big XSP generated by XSL
for each <ENTRY> in source XML target XSP gets:

        cal.set(<xsl:value-of select="$y"/>,<xsl:value-of select="$m -
1"/>,<xsl:value-of select="$d"/>);
        dayofweek = cal.get(Calendar.DAY_OF_WEEK);
          INSERT INTO programs ( Channel, Title, Chapter, MaxChapters,
Description, ProductionCountry, Category, Date, DayOfWeek, StartTime,
          VALUES ('<xsl:value-of select="parent::*/@name"/>'
          ,'<xsl:value-of select="PRODUCTION/@country"/>'
          ,'<xsl:value-of select="CATEGORY"/>','<xsl:value-of
select="substring-before(@start,' ')"/>'
          ,'<xsl:value-of select="substring-after(@start,'
')"/>','<xsl:value-of select="substring-after(@next,' ')"/>');
        <esql:results>Dodano do bazy</esql:results>
        <esql:no-results>Nie dodano do bazy</esql:no-results>
        <esql:error-results>Error typu Błont</esql:error-results>

(Each INSERT has its own connection in case of possible connection
timeout postgres feature)

It works fine for several <ENTRY> tags but when I try to run pipeline
for whole XML (really big number of <ENTRY>) it chokes for several
minutes then browser returns err. 500. Nothing is inserted into DB.

My guess is: too large XSP. (XML structure and content defects would
return different errors probably)

So I'm looking for some way to iteratively cut source XML into pieces,
transform into smaller XSP's and generate from each indepedently and
sequentially. But I can't find a way how to do it in Cocoon. (maybe flow
control could be of some use).

Any suggetions, maybe some smarter way how to insert a lot of data from
XML to DB, or any hint about a possible trival mistake i might have
done, would be appreciated.

Thanx and sorry for my clumsiness in en.

Marcel Gołuński
  ul. Kozłowskiej 1, 00-710 Warszawa
  tel.: (0-22) 6519430, fax: (0-22) 6518604

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message