Xquery with basex Cdata

Monday, 24 February 2014 · 3 messages
EE
eitan elmalam24 Feb 2014 08:23 #
Hi, I try to extract the Cdata by the follow query:
for $x in doc('input.xml')//App//package//text() return $x
On the follow xml
<?xml version="1.0" encoding="UTF-8"?>
<App name="BasexTest_1">
 <package name="main/resources/xml">
    <![CDATA[ -- dd --]]>
    <!-- ff -->
  <file name="input.xml"></file>
 </package>
  <!-- ff -->
 <package name="org/basex/examples/local">
  <file name="RunCommands.java"></file>
    <!-- dd -->
    <!-- ff -->
 <folder>lib</folder></package>
</App>
and it is not return the cdata ,why ? Thanks Eitan
DK
Dirk Kirsten24 Feb 2014 09:43 #
Hi Eitan, works for me. What is your expected output and what do you get instead? General advise for your query: Using / instead of // would be sufficient in this case and is in general is much more performant. Cheers, Dirk
Quoted text · eitan elmalam · 36 lines
On 24/02/14 08:23, eitan elmalam wrote: > Hi, > > I try to extract the Cdata by the follow query: > > for $x in doc('input.xml')//App//package//text() return $x > > On the follow xml > > <?xml version="1.0" encoding="UTF-8"?> > <App name="BasexTest_1"> > <package name="main/resources/xml"> > <![CDATA[ -- dd --]]> > <!-- ff --> > <file name="input.xml"></file> > </package> > <!-- ff --> > <package name="org/basex/examples/local"> > <file name="RunCommands.java"></file> > <!-- dd --> > <!-- ff --> > <folder>lib</folder></package> > </App> > > and it is not return the cdata ,why ? > > Thanks > Eitan > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
HR
Hans-Juergen Rennau24 Feb 2014 14:28 #
Hi Eitan, perhaps there is a misunderstanding concerning CDATA sections? In case you are not aware of it: 1) XQuery cannot see CDATA sections - their content is just part of the text content. Regard it as an evelope which does not influence the letter contained. As a consequence, it is principally not possible to *select* any text based on whether or not they are in CDATA sections. 2) XQuery output does not use CDATA sections, unless you supply the serialization parameter "cdata-section-elements", which contains a whitespace-separated list of element names. The contents of these elements will then by serialized as CDATA sections. Example: basex -i input.xml -s "cdata-section-elements=package folder" myquery.xq Kind regards, Hans-Juergen
Quoted text · Dirk Kirsten · 1 line
Dirk Kirsten <dk at basex.org> schrieb am 9:43 Montag, 24.Februar 2014:
Hi Eitan, works for me. What is your expected output and what do you get instead? General advise for your query: Using / instead of // would be sufficient in this case and is in general is much more performant. Cheers, Dirk
Quoted text · eitan elmalam · 37 lines
On 24/02/14 08:23, eitan elmalam wrote: > Hi, > > I try to extract the Cdata by the follow query: > > for $x in doc('input.xml')//App//package//text() return $x > > On the follow xml > > <?xml version="1.0" encoding="UTF-8"?> > <App name="BasexTest_1"> > <package name="main/resources/xml"> > <![CDATA[ -- dd --]]> > <!-- ff --> > <file name="input.xml"></file> > </package> > <!-- ff --> > <package name="org/basex/examples/local"> > <file name="RunCommands.java"></file> > <!-- dd --> > <!-- ff --> > <folder>lib</folder></package> > </App> > > and it is not return the cdata ,why ? > > Thanks > Eitan > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 _______________________________________________ BaseX-Talk mailing list BaseX-Talk at mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery