Hi Christian,
True. I forgot to mention that the 'stripns' option (as all other XML parsing options [1]) only applies to newly parsed XML strings.
But these strings belong to new documents being added using db:add. Anyway, how can I strip the namespaces in my new database? I don't need them.
Anyway, maybe because the xml are not valid, I get always 0 hits unless I ask to return the doc itself.
Hm, the stored data must be well-formed, otherwise it couldn't be stored. And it will always be well-formed if you store it via db:add (in XML terminology, validity requires a schema [2]).
Did you already have a look at the data stored in your new database? Christian
I've used db:add. The data is not well-formed. It's just like copy&paste of the relevant xml. No headers. This is how I've created it:
declare namespace gco = "http://www.isotc211.org/2005/gco"; declare namespace gmd = "http://www.isotc211.org/2005/gmd"; declare namespace gml = "http://www.opengis.net/gml"; declare namespace gmx="http://www.isotc211.org/2005/gmx"; declare namespace sdn = "http://www.seadatanet.org";
declare namespace fn = "http://www.w3.org/2005/xpath-functions"; declare namespace xs = "http://www.w3.org/2001/XMLSchema";
let $db := db:open("ENTIRE-CDI","Vertical_profiles") for $x in $db/gmd:MD_Metadata/gmd:identificationInfo/sdn:SDN_DataIdentification let $id := string($x/gmd:citation/gmd:CI_Citation/gmd:alternateTitle/gco:CharacterString) return db:add("CDI", $x, 'Vertical_profiles/' || $id || '.xml', map { 'stripns': true(), 'intparse': true() })
With kind regards, Menashè
On 06/25/2015 03:05 PM, Christian Grün wrote:
Hi Menashè,
I've used map { 'stripns': true(), 'intparse': true() }) in db:add, but the namespaces were not removed, e.g. there is gml:beginPosition.
True. I forgot to mention that the 'stripns' option (as all other XML parsing options [1]) only applies to newly parsed XML strings.
Anyway, maybe because the xml are not valid, I get always 0 hits unless I ask to return the doc itself.
Hm, the stored data must be well-formed, otherwise it couldn't be stored. And it will always be well-formed if you store it via db:add (in XML terminology, validity requires a schema [2]).
Did you already have a look at the data stored in your new database? Christian
[1] http://docs.basex.org/wiki/Options#STRIPNS [2] https://en.wikipedia.org/wiki/XML#Schemas_and_validation