Hi Orbeon,
I have a problem with indentation of xml. From my web application I am loading an XML, editing some contents and saving it using oxf:xml-converter and oxf:file-serializer. Every time I save the file the xml gets more indentation, the file size increase and after few loads and saves the performance decreases. I don't know the cause of this problem, I would like to ask you if there is a way to remove this behaviour or a processor to eliminate indentation and line breaks. I've tried with the parameters indent and indent-amount with any change in this behaviour. thanks again, Jordi -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Jordi,
Do you have an idea of what is adding the additional indentation? Do you think that this is a problem of the File serializer? If it is, can you create a simple pipeline that reads a file and writes it back and would show that the indentation has been added? Alex On 8/10/06, [hidden email] <[hidden email]> wrote: > Hi Orbeon, > > I have a problem with indentation of xml. From my web application I am loading an XML, editing some contents and saving it using oxf:xml-converter and oxf:file-serializer. Every time I save the file the xml gets more indentation, the file size increase and after few loads and saves the performance decreases. I don't know the cause of this problem, I would like to ask you if there is a way to remove this behaviour or a processor to eliminate indentation and line breaks. > I've tried with the parameters indent and indent-amount with any change in this behaviour. > > thanks again, > Jordi > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
I send you an example that I've isolated. The examples reads data.xml and saves it without modifications by clicking on an xforms:trigger. The pipeline that saves data.xml is save.xpl. I hope you can see how the xml is indented each time you save. It has 5 files: ************************************************************************ ******************page-flow.xml***************************************** ************************************************************************ <config xmlns="http://www.orbeon.com/oxf/controller" xmlns:xu="http://www.xmldb.org/xupdate" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <page id="main" path-info="/indent" view="main.xhtml"></page> <page id="save" path-info="/indent/save" model="save.xpl" view="dbg.xsl"/> <epilogue url="oxf:/config/epilogue.xpl"/> </config> ************************************************************************ ******************main.xhtml******************************************** ************************************************************************ <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"> <xhtml:head> <xhtml:title>Data</xhtml:title> <xhtml:style type="text/css">.controls-range { margin-top: 1em; margin-bottom: 2em; } .xforms-textarea { font-family: sans-serif; }</xhtml:style> <xforms:model xmlns:xs="http://www.w3.org/2001/XMLSchema" id="main-model"> <!-- This instance contains the list of documents to display --> <xforms:instance id="data"> <xi:include href="data.xml"></xi:include> </xforms:instance> <!-- Submissions --> <xforms:submission action="/indent/save" id="save-submission" method="post" ref="instance('data')"></xforms:submission> <xforms:submission action="dbg" id="dbg-submission" method="post" ref="instance('data')"></xforms:submission> </xforms:model> </xhtml:head> <xhtml:body> <h2 style="margin-top: 0">Selection</h2> <xforms:group ref="instance('data')"> <xhtml:table class="selepg"> <xhtml:tr> <xhtml:td> <xforms:label class="fixed-width">data.xml contains:</xforms:label> <xforms:input ref="/some/xml/data"/> </xhtml:td> <xhtml:td> <xforms:trigger> <xforms:label>Save xml</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:send submission="save-submission"></xforms:send> </xforms:action> </xforms:trigger> </xhtml:td> </xhtml:tr> </xhtml:table> </xforms:group> </xhtml:body> </xhtml:html> ************************************************************************ ******************save.xpl********************************************** ************************************************************************ <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xalan="http://xml.apache.org/xslt"> <p:param type="input" name="instance"/> <!--p:param type="output" name="data"/--> <!-- Find local path to directory --> <p:processor name="oxf:directory-scanner"> <p:input name="config"> <config> <base-directory>oxf:/tmWEB/indent/</base-directory> </config> </p:input> <p:output name="data" id="directory"/> </p:processor> <!-- Generate file path --> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="dir" href="#directory"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:template match="/"> <xsl:variable name="vardir" select="doc('input:dir')/directory/@path"/> <config> <directory><xsl:value-of select="$vardir"/></directory> <file>data.xml</file> <content-type>application/xml</content-type> <version>1.0</version> <indent>false</indent> </config> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="path_save_file"/> </p:processor> <p:processor name="oxf:xml-converter"> <p:input name="config"> <config> <content-type>application/xml</content-type> <encoding>iso-8859-1</encoding> <indent>true</indent> <indent-amount>1</indent-amount> </config> </p:input> <p:input name="data" href="#instance"/> <p:output name="data" id="xml_data"/> </p:processor> <p:processor name="oxf:file-serializer"> <p:input name="config" href="#path_save_file"/> <p:input name="data" href="#xml_data"/> </p:processor> </p:config> ************************************************************************ ******************dbg.xsl*********************************************** ************************************************************************ <html xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xi="http://www.w3.org/2003/XInclude" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:claim="http://orbeon.org/oxf/examples/bizdoc/claim" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Parsing XML</title> </head> <body> <p> The XML file below is produced by first reading an XML file as a binary stream, then converting it to XML with the To-XML Converter. </p> <f:box> <f:xml-source> <xsl:copy-of select="/"/> </f:xml-source> </f:box> </body> </html> ************************************************************************ ********************data.xml******************************************** ************************************************************************ <?xml version="1.0" encoding="iso-8859-1"?> <some xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xml:base="oxf:/tmWEB/indent/data.xml"> <xml> <data>Hello</data> </xml> </some> ************************* Thanks, Jordi -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Hi Jordi,
Thank you for the use case. I have been able to reproduce the problem. I have created an even smaller test case that just runs in the XForms sandbox and created this entry in the tracker: http://forge.objectweb.org/tracker/index.php?func=detail&aid=305947&group_id=168&atid=350207 Alex On 8/11/06, Jordi Amatller <[hidden email]> wrote: > Hi Alex, > > I send you an example that I've isolated. The examples reads data.xml and > saves it without modifications by clicking on an xforms:trigger. The > pipeline that saves data.xml is save.xpl. > > I hope you can see how the xml is indented each time you save. > > It has 5 files: > > ************************************************************************ > ******************page-flow.xml***************************************** > ************************************************************************ > > <config xmlns="http://www.orbeon.com/oxf/controller" > xmlns:xu="http://www.xmldb.org/xupdate" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <page id="main" path-info="/indent" view="main.xhtml"></page> > <page id="save" path-info="/indent/save" model="save.xpl" > view="dbg.xsl"/> > > <epilogue url="oxf:/config/epilogue.xpl"/> > </config> > > > ************************************************************************ > ******************main.xhtml******************************************** > ************************************************************************ > > <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"> > > <xhtml:head> > <xhtml:title>Data</xhtml:title> > <xhtml:style type="text/css">.controls-range { margin-top: > 1em; margin-bottom: 2em; } > .xforms-textarea { font-family: sans-serif; }</xhtml:style> > <xforms:model xmlns:xs="http://www.w3.org/2001/XMLSchema" > id="main-model"> > > <!-- This instance contains the list of documents to > display --> > <xforms:instance id="data"> > <xi:include href="data.xml"></xi:include> > </xforms:instance> > > <!-- Submissions --> > <xforms:submission action="/indent/save" > id="save-submission" method="post" > ref="instance('data')"></xforms:submission> > <xforms:submission action="dbg" id="dbg-submission" > method="post" ref="instance('data')"></xforms:submission> > </xforms:model> > > </xhtml:head> > <xhtml:body> > <h2 style="margin-top: 0">Selection</h2> > > <xforms:group ref="instance('data')"> > > <xhtml:table class="selepg"> > <xhtml:tr> > <xhtml:td> > <xforms:label > class="fixed-width">data.xml contains:</xforms:label> > <xforms:input > ref="/some/xml/data"/> > </xhtml:td> > > <xhtml:td> > <xforms:trigger> > <xforms:label>Save > xml</xforms:label> > <xforms:action > ev:event="DOMActivate"> > <xforms:send > submission="save-submission"></xforms:send> > </xforms:action> > </xforms:trigger> > </xhtml:td> > </xhtml:tr> > </xhtml:table> > > </xforms:group> > > </xhtml:body> > </xhtml:html> > > ************************************************************************ > ******************save.xpl********************************************** > ************************************************************************ > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:xalan="http://xml.apache.org/xslt"> > > <p:param type="input" name="instance"/> > <!--p:param type="output" name="data"/--> > > <!-- Find local path to directory --> > <p:processor name="oxf:directory-scanner"> > <p:input name="config"> > <config> > > <base-directory>oxf:/tmWEB/indent/</base-directory> > </config> > </p:input> > <p:output name="data" id="directory"/> > </p:processor> > > <!-- Generate file path --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance"/> > <p:input name="dir" href="#directory"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > <xsl:template match="/"> > > <xsl:variable name="vardir" select="doc('input:dir')/directory/@path"/> > <config> > > <directory><xsl:value-of select="$vardir"/></directory> > > <file>data.xml</file> > > <content-type>application/xml</content-type> > > <version>1.0</version> > > <indent>false</indent> > </config> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="data" id="path_save_file"/> > </p:processor> > > <p:processor name="oxf:xml-converter"> > <p:input name="config"> > <config> > <content-type>application/xml</content-type> > <encoding>iso-8859-1</encoding> > <indent>true</indent> > <indent-amount>1</indent-amount> > </config> > </p:input> > <p:input name="data" href="#instance"/> > <p:output name="data" id="xml_data"/> > </p:processor> > > <p:processor name="oxf:file-serializer"> > <p:input name="config" href="#path_save_file"/> > <p:input name="data" href="#xml_data"/> > </p:processor> > > </p:config> > > ************************************************************************ > ******************dbg.xsl*********************************************** > ************************************************************************ > > <html xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xi="http://www.w3.org/2003/XInclude" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:claim="http://orbeon.org/oxf/examples/bizdoc/claim" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns="http://www.w3.org/1999/xhtml"> > > <head> > <title>Parsing XML</title> > </head> > <body> > <p> > The XML file below is produced by first reading an XML file as a > binary stream, then > converting it to XML with the To-XML Converter. > </p> > <f:box> > <f:xml-source> > <xsl:copy-of select="/"/> > </f:xml-source> > </f:box> > </body> > </html> > > ************************************************************************ > ********************data.xml******************************************** > ************************************************************************ > > <?xml version="1.0" encoding="iso-8859-1"?> > <some xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms" > xml:base="oxf:/tmWEB/indent/data.xml"> > <xml> > <data>Hello</data> > </xml> > </some> > > > ************************* > Thanks, > Jordi > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |