Upgraded from V9.7.3 to V12, problem in xQuery search when node has a blank line
Dear All,
I upgraded from v9.7.3 to v12 and all my queries are giving an error because of a simple problem. This is my XML:
<xml><number integer="0"><number></xml>xQuery: for $b in //*[@integer] where $b = '' return replace value of node $b with '0'
The above works without problems. It puts a zero and this is the result: <xml><number integer="0">0</number></xml>
BUT if there is a CRLF in the <number> node it does not replace the node with a 0.
<xml><number integer="0">
<number></xml>Now the same query does not work in v12. It works in v9.7.3, so I have had to downgrade. All my queries where I am looking for a blank node have stopped working.
Could you please show me some option using which I can ignore the CRLF and continue searching for blank nodes the way I used to be in the past ?
Quoted text · shripal at orior.in · 20 lines
On 07/07/2025 11:56, shripal at orior.in wrote: > Dear All, > > I upgraded from v9.7.3 to v12 and all my queries are giving an error because of a simple problem. This is my XML: > > <xml><number integer="0"><number></xml> > > xQuery: > for $b in //*[@integer] where $b = '' return replace value of node $b with '0' > > The above works without problems. It puts a zero and this is the result: <xml><number integer="0">0</number></xml> > > BUT if there is a CRLF in the <number> node it does not replace the node with a 0. > > <xml><number integer="0"> > <number></xml> > > Now the same query does not work in v12. It works in v9.7.3, so I have had to downgrade. All my queries where I am looking for a blank node have stopped working. > > Could you please show me some option using which I can ignore the CRLF and continue searching for blank nodes the way I used to be in the past ?
I think with previous versions the default XML parsing stripped whitespace while that is no longer the case. So look in the XML parser options in the BaseX documentation.
Quoted text · Martin Honnen · 16 lines
On 07/07/2025 11:59, Martin Honnen via BaseX-Talk wrote: > > On 07/07/2025 11:56, shripal at orior.in wrote: >> >> Now the same query does not work in v12. It works in v9.7.3, so I >> have had to downgrade. All my queries where I am looking for a blank >> node have stopped working. >> >> Could you please show me some option using which I can ignore the >> CRLF and continue searching for blank nodes the way I used to be in >> the past ? > > > I think with previous versions the default XML parsing stripped > whitespace while that is no longer the case. So look in the XML parser > options in the BaseX documentation.
So setting https://docs.basex.org/main/Options#stripws to true would give you the old behaviour, I think.
Yes it works now. I did that. Thank you so much for your quick response.
Quoted text · Martin Honnen · 25 lines
On Mon, Jul 7, 2025 at 3:36 PM Martin Honnen via BaseX-Talk < basex-talk at mailman.uni-konstanz.de> wrote: > > On 07/07/2025 11:59, Martin Honnen via BaseX-Talk wrote: > > > > On 07/07/2025 11:56, shripal at orior.in wrote: > >> > >> Now the same query does not work in v12. It works in v9.7.3, so I > >> have had to downgrade. All my queries where I am looking for a blank > >> node have stopped working. > >> > >> Could you please show me some option using which I can ignore the > >> CRLF and continue searching for blank nodes the way I used to be in > >> the past ? > > > > > > I think with previous versions the default XML parsing stripped > > whitespace while that is no longer the case. So look in the XML parser > > options in the BaseX documentation. > > > So setting https://docs.basex.org/main/Options#stripws to true would > give you the old behaviour, I think. > >
Written for BaseX 12.0. BaseX may have changed since: please check the current documentation.