Set indent no at database label (globally)

Friday, 18 May 2018 · 8 messages
DS
DK Singh18 May 2018 12:13 #
Hi All, I have to set indent='no' at the database label how can i achieve this, i have gone thorough the documentation and found that either we can do: (1) declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization <https://www.google.com/url?q=http://www.w3.org/2010/xslt-xquery-serialization&sa=D&source=hangouts&ust=1526716808805000&usg=AFQjCNHuPURcLY13OLNLQMfuRP2l5yPkbw> "; declare option output:indent "no"; but the problem is that all the XQUERY module i have library module so it is throwing error. so is there any option. Regards Dharmendra Kumar Singh
CG
Christian Grün18 May 2018 12:20 #
Hi Dharmendra Kumar, You can set this option globally by adding the line SERIALIZER = indent=no at the bottom of your .basex configuration file [1]. If you use HTTP services, you can add an entry to your web.xml file [2]. Both solutions will affect all databases; there is currently no way to define serialization parameters for specific databases. Hope this helps, Christian [1] http://docs.basex.org/wiki/Options#SERIALIZER [2] http://docs.basex.org/wiki/Web_Application#Configuration
Quoted text · DK Singh · 18 lines
On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> wrote: > Hi All, > > I have to set indent='no' at the database label how can i achieve this, i > have gone thorough the documentation and found that either we can do: > (1) > declare namespace output = > "http://www.w3.org/2010/xslt-xquery-serialization"; > declare option output:indent "no"; > > but the problem is that all the XQUERY module i have library module so it is > throwing error. > so is there any option. > > Regards > Dharmendra Kumar Singh > >
DS
DK Singh18 May 2018 13:01 #
Hi Grun, I am using HTTP services so as i set chop false like
<context-param>
  <param-name>org.basex.chop</param-name>
  <param-value>false</param-value>
</context-param>
so in this format i have to set SERIALIZER = indent=no or other way in the web.xml file.
Quoted text · Christian Grün · 41 lines
On Fri, May 18, 2018 at 3:50 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Hi Dharmendra Kumar, > > You can set this option globally by adding the line > > SERIALIZER = indent=no > > at the bottom of your .basex configuration file [1]. If you use HTTP > services, you can add an entry to your web.xml file [2]. > > Both solutions will affect all databases; there is currently no way to > define serialization parameters for specific databases. > > Hope this helps, > Christian > > [1] http://docs.basex.org/wiki/Options#SERIALIZER > [2] http://docs.basex.org/wiki/Web_Application#Configuration > > > On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> wrote: > > Hi All, > > > > I have to set indent='no' at the database label how can i achieve this, i > > have gone thorough the documentation and found that either we can do: > > (1) > > declare namespace output = > > "http://www.w3.org/2010/xslt-xquery-serialization"; > > declare option output:indent "no"; > > > > but the problem is that all the XQUERY module i have library module so > it is > > throwing error. > > so is there any option. > > > > Regards > > Dharmendra Kumar Singh > > > > >
CG
Christian Grün18 May 2018 13:05 #
Quoted text · DK Singh · 9 lines
> I am using HTTP services so as i set chop false like > > <context-param> > <param-name>org.basex.chop</param-name> > <param-value>false</param-value> > </context-param> > > so in this format i have to set SERIALIZER = indent=no or other way in the > web.xml file.
Exactly. Try this:
  <context-param>
    <param-name>org.basex.serializer</param-name>
    <param-value>indent=no</param-value>
  </context-param>
Quoted text · Christian Grün · 44 lines
> On Fri, May 18, 2018 at 3:50 PM, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> Hi Dharmendra Kumar, >> >> You can set this option globally by adding the line >> >> SERIALIZER = indent=no >> >> at the bottom of your .basex configuration file [1]. If you use HTTP >> services, you can add an entry to your web.xml file [2]. >> >> Both solutions will affect all databases; there is currently no way to >> define serialization parameters for specific databases. >> >> Hope this helps, >> Christian >> >> [1] http://docs.basex.org/wiki/Options#SERIALIZER >> [2] http://docs.basex.org/wiki/Web_Application#Configuration >> >> >> On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> wrote: >> > Hi All, >> > >> > I have to set indent='no' at the database label how can i achieve this, >> > i >> > have gone thorough the documentation and found that either we can do: >> > (1) >> > declare namespace output = >> > "http://www.w3.org/2010/xslt-xquery-serialization"; >> > declare option output:indent "no"; >> > >> > but the problem is that all the XQUERY module i have library module so >> > it is >> > throwing error. >> > so is there any option. >> > >> > Regards >> > Dharmendra Kumar Singh >> > >> > > >
DS
DK Singh18 May 2018 13:57 #
Thanks U Christian, I have done as you suggested but problem is still there XML getting indent, after setting i had re-started the HTTP service and run the query to transform the document after transformation XML getting indent. below is the setting snapshot Regards Dharmendra Kumar Singh
Quoted text · Christian Grün · 70 lines
On Fri, May 18, 2018 at 4:35 PM, Christian Grün <christian.gruen at gmail.com> wrote: > > I am using HTTP services so as i set chop false like > > > > <context-param> > > <param-name>org.basex.chop</param-name> > > <param-value>false</param-value> > > </context-param> > > > > so in this format i have to set SERIALIZER = indent=no or other way in > the > > web.xml file. > > Exactly. Try this: > > <context-param> > <param-name>org.basex.serializer</param-name> > <param-value>indent=no</param-value> > </context-param> > > > > > On Fri, May 18, 2018 at 3:50 PM, Christian Grün < > christian.gruen at gmail.com> > > wrote: > >> > >> Hi Dharmendra Kumar, > >> > >> You can set this option globally by adding the line > >> > >> SERIALIZER = indent=no > >> > >> at the bottom of your .basex configuration file [1]. If you use HTTP > >> services, you can add an entry to your web.xml file [2]. > >> > >> Both solutions will affect all databases; there is currently no way to > >> define serialization parameters for specific databases. > >> > >> Hope this helps, > >> Christian > >> > >> [1] http://docs.basex.org/wiki/Options#SERIALIZER > >> [2] http://docs.basex.org/wiki/Web_Application#Configuration > >> > >> > >> On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> > wrote: > >> > Hi All, > >> > > >> > I have to set indent='no' at the database label how can i achieve > this, > >> > i > >> > have gone thorough the documentation and found that either we can do: > >> > (1) > >> > declare namespace output = > >> > "http://www.w3.org/2010/xslt-xquery-serialization"; > >> > declare option output:indent "no"; > >> > > >> > but the problem is that all the XQUERY module i have library module so > >> > it is > >> > throwing error. > >> > so is there any option. > >> > > >> > Regards > >> > Dharmendra Kumar Singh > >> > > >> > > > > > >
CG
Christian Grün18 May 2018 14:13 #
hi ​ Dharmendra, Maybe your database contains whitespace text nodes? If it does, these whitespaces will simply be returned as part of your document. Only if it doesn’t, the "indent" parameter will add new whitespaces [1]. You can count the number of these text nodes with the following query:
  count(
    for $text in db:open('db')//text()
    where normalize-space($text) = ''
    return $text
  )
Or (shorter):
    count(db:open('db')//text()[not(normalize-space())])
If your database has no whitespace-only nodes, you might need to provide us with a step-by-step description. Best, Christian [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#xml-indent
Quoted text · DK Singh · 91 lines
On Fri, May 18, 2018 at 1:57 PM, DK Singh <dharam.mahi at gmail.com> wrote: > Thanks U Christian, > > I have done as you suggested but problem is still there XML getting > indent, after setting i had re-started the HTTP service and run the query > to transform the document after transformation XML getting indent. > > below is the setting snapshot > > > > Regards > Dharmendra Kumar Singh > > On Fri, May 18, 2018 at 4:35 PM, Christian Grün <christian.gruen at gmail.com > > wrote: > >> > I am using HTTP services so as i set chop false like >> > >> > <context-param> >> > <param-name>org.basex.chop</param-name> >> > <param-value>false</param-value> >> > </context-param> >> > >> > so in this format i have to set SERIALIZER = indent=no or other way in >> the >> > web.xml file. >> >> Exactly. Try this: >> >> <context-param> >> <param-name>org.basex.serializer</param-name> >> <param-value>indent=no</param-value> >> </context-param> >> >> >> >> > On Fri, May 18, 2018 at 3:50 PM, Christian Grün < >> christian.gruen at gmail.com> >> > wrote: >> >> >> >> Hi Dharmendra Kumar, >> >> >> >> You can set this option globally by adding the line >> >> >> >> SERIALIZER = indent=no >> >> >> >> at the bottom of your .basex configuration file [1]. If you use HTTP >> >> services, you can add an entry to your web.xml file [2]. >> >> >> >> Both solutions will affect all databases; there is currently no way to >> >> define serialization parameters for specific databases. >> >> >> >> Hope this helps, >> >> Christian >> >> >> >> [1] http://docs.basex.org/wiki/Options#SERIALIZER >> >> [2] http://docs.basex.org/wiki/Web_Application#Configuration >> >> >> >> >> >> On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> >> wrote: >> >> > Hi All, >> >> > >> >> > I have to set indent='no' at the database label how can i achieve >> this, >> >> > i >> >> > have gone thorough the documentation and found that either we can >> do: >> >> > (1) >> >> > declare namespace output = >> >> > "http://www.w3.org/2010/xslt-xquery-serialization"; >> >> > declare option output:indent "no"; >> >> > >> >> > but the problem is that all the XQUERY module i have library module >> so >> >> > it is >> >> > throwing error. >> >> > so is there any option. >> >> > >> >> > Regards >> >> > >> ​​ >> Dharmendra Kumar Singh >> >> > >> >> > >> > >> > >> > >
DS
DK Singh18 May 2018 14:18 #
Thank U Christian, It worked now after transformation i was writing the file into filesystem using file:write() so i defined the third parameter there map { "method": "xml", 'indent':no } again Thank U so much Regards Dharmendra Kumar Singh
Quoted text · Christian Grün · 126 lines
On Fri, May 18, 2018 at 5:43 PM, Christian Grün <christian.gruen at gmail.com> wrote: > hi > ​ > Dharmendra, > > Maybe your database contains whitespace text nodes? If it does, these > whitespaces will simply be returned as part of your document. Only if it > doesn’t, the "indent" parameter will add new whitespaces [1]. > > You can count the number of these text nodes with the following query: > > count( > for $text in db:open('db')//text() > where normalize-space($text) = '' > return $text > ) > > Or (shorter): > > count(db:open('db')//text()[not(normalize-space())]) > > If your database has no whitespace-only nodes, you might need to provide > us with a step-by-step description. > > Best, > Christian > > [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#xml-indent > > > > > On Fri, May 18, 2018 at 1:57 PM, DK Singh <dharam.mahi at gmail.com> wrote: > >> Thanks U Christian, >> >> I have done as you suggested but problem is still there XML getting >> indent, after setting i had re-started the HTTP service and run the query >> to transform the document after transformation XML getting indent. >> >> below is the setting snapshot >> >> >> >> Regards >> Dharmendra Kumar Singh >> >> On Fri, May 18, 2018 at 4:35 PM, Christian Grün < >> christian.gruen at gmail.com> wrote: >> >>> > I am using HTTP services so as i set chop false like >>> > >>> > <context-param> >>> > <param-name>org.basex.chop</param-name> >>> > <param-value>false</param-value> >>> > </context-param> >>> > >>> > so in this format i have to set SERIALIZER = indent=no or other way in >>> the >>> > web.xml file. >>> >>> Exactly. Try this: >>> >>> <context-param> >>> <param-name>org.basex.serializer</param-name> >>> <param-value>indent=no</param-value> >>> </context-param> >>> >>> >>> >>> > On Fri, May 18, 2018 at 3:50 PM, Christian Grün < >>> christian.gruen at gmail.com> >>> > wrote: >>> >> >>> >> Hi Dharmendra Kumar, >>> >> >>> >> You can set this option globally by adding the line >>> >> >>> >> SERIALIZER = indent=no >>> >> >>> >> at the bottom of your .basex configuration file [1]. If you use HTTP >>> >> services, you can add an entry to your web.xml file [2]. >>> >> >>> >> Both solutions will affect all databases; there is currently no way to >>> >> define serialization parameters for specific databases. >>> >> >>> >> Hope this helps, >>> >> Christian >>> >> >>> >> [1] http://docs.basex.org/wiki/Options#SERIALIZER >>> >> [2] http://docs.basex.org/wiki/Web_Application#Configuration >>> >> >>> >> >>> >> On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> >>> wrote: >>> >> > Hi All, >>> >> > >>> >> > I have to set indent='no' at the database label how can i achieve >>> this, >>> >> > i >>> >> > have gone thorough the documentation and found that either we can >>> do: >>> >> > (1) >>> >> > declare namespace output = >>> >> > "http://www.w3.org/2010/xslt-xquery-serialization"; >>> >> > declare option output:indent "no"; >>> >> > >>> >> > but the problem is that all the XQUERY module i have library module >>> so >>> >> > it is >>> >> > throwing error. >>> >> > so is there any option. >>> >> > >>> >> > Regards >>> >> > >>> ​​ >>> Dharmendra Kumar Singh >>> >> > >>> >> > >>> > >>> > >>> >> >> >
CG
Christian Grün18 May 2018 14:21 #
Quoted text · DK Singh · 5 lines
> > It worked now after transformation i was writing the file into filesystem > using file:write() so i defined the third parameter there map { "method": > "xml", 'indent':no } >
​Perfect! And it’s true, file:write (and other serializing functions) do not consider which global serialization​ parameters have been set.
Quoted text · DK Singh · 135 lines
> > again Thank U so much > > Regards > Dharmendra Kumar Singh > > On Fri, May 18, 2018 at 5:43 PM, Christian Grün <christian.gruen at gmail.com > > wrote: > >> hi >> ​ >> Dharmendra, >> >> Maybe your database contains whitespace text nodes? If it does, these >> whitespaces will simply be returned as part of your document. Only if it >> doesn’t, the "indent" parameter will add new whitespaces [1]. >> >> You can count the number of these text nodes with the following query: >> >> count( >> for $text in db:open('db')//text() >> where normalize-space($text) = '' >> return $text >> ) >> >> Or (shorter): >> >> count(db:open('db')//text()[not(normalize-space())]) >> >> If your database has no whitespace-only nodes, you might need to provide >> us with a step-by-step description. >> >> Best, >> Christian >> >> [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#xml-indent >> >> >> >> >> On Fri, May 18, 2018 at 1:57 PM, DK Singh <dharam.mahi at gmail.com> wrote: >> >>> Thanks U Christian, >>> >>> I have done as you suggested but problem is still there XML getting >>> indent, after setting i had re-started the HTTP service and run the query >>> to transform the document after transformation XML getting indent. >>> >>> below is the setting snapshot >>> >>> >>> >>> Regards >>> Dharmendra Kumar Singh >>> >>> On Fri, May 18, 2018 at 4:35 PM, Christian Grün < >>> christian.gruen at gmail.com> wrote: >>> >>>> > I am using HTTP services so as i set chop false like >>>> > >>>> > <context-param> >>>> > <param-name>org.basex.chop</param-name> >>>> > <param-value>false</param-value> >>>> > </context-param> >>>> > >>>> > so in this format i have to set SERIALIZER = indent=no or other way >>>> in the >>>> > web.xml file. >>>> >>>> Exactly. Try this: >>>> >>>> <context-param> >>>> <param-name>org.basex.serializer</param-name> >>>> <param-value>indent=no</param-value> >>>> </context-param> >>>> >>>> >>>> >>>> > On Fri, May 18, 2018 at 3:50 PM, Christian Grün < >>>> christian.gruen at gmail.com> >>>> > wrote: >>>> >> >>>> >> Hi Dharmendra Kumar, >>>> >> >>>> >> You can set this option globally by adding the line >>>> >> >>>> >> SERIALIZER = indent=no >>>> >> >>>> >> at the bottom of your .basex configuration file [1]. If you use HTTP >>>> >> services, you can add an entry to your web.xml file [2]. >>>> >> >>>> >> Both solutions will affect all databases; there is currently no way >>>> to >>>> >> define serialization parameters for specific databases. >>>> >> >>>> >> Hope this helps, >>>> >> Christian >>>> >> >>>> >> [1] http://docs.basex.org/wiki/Options#SERIALIZER >>>> >> [2] http://docs.basex.org/wiki/Web_Application#Configuration >>>> >> >>>> >> >>>> >> On Fri, May 18, 2018 at 12:13 PM, DK Singh <dharam.mahi at gmail.com> >>>> wrote: >>>> >> > Hi All, >>>> >> > >>>> >> > I have to set indent='no' at the database label how can i achieve >>>> this, >>>> >> > i >>>> >> > have gone thorough the documentation and found that either we can >>>> do: >>>> >> > (1) >>>> >> > declare namespace output = >>>> >> > "http://www.w3.org/2010/xslt-xquery-serialization"; >>>> >> > declare option output:indent "no"; >>>> >> > >>>> >> > but the problem is that all the XQUERY module i have library >>>> module so >>>> >> > it is >>>> >> > throwing error. >>>> >> > so is there any option. >>>> >> > >>>> >> > Regards >>>> >> > >>>> ​​ >>>> Dharmendra Kumar Singh >>>> >> > >>>> >> > >>>> > >>>> > >>>> >>> >>> >> >

⚡Generated with XQuery