Hi Tim, If the schema is not found, an XDMP-UNDSCHMAT will be thrown. If the namespace doesn't match the one in the schema, an XDMP-SCHMNSMISMATCH is thrown.
What result are you expecting and what are you getting? Kind regards, Geert > -----Original Message----- > From: general-boun...@developer.marklogic.com > [mailto:general-boun...@developer.marklogic.com] On Behalf Of > Tim Meagher > Sent: donderdag 4 maart 2010 19:10 > To: 'General Mark Logic Developer Discussion' > Subject: RE: [MarkLogic Dev General] Problem inserting > default namespaceincreated XML document fixed, but validation fails > > Tried it with no success. I'm not sure if it is adequately > locating the schema. > > > > ________________________________ > > From: general-boun...@developer.marklogic.com > [mailto:general-boun...@developer.marklogic.com] On Behalf Of > Geert Josten > Sent: Thursday, March 04, 2010 1:01 PM > To: General Mark Logic Developer Discussion > Subject: RE: [MarkLogic Dev General] Problem inserting > default namespaceincreated XML document fixed, but validation fails > > > > Hi Tim, > > > > Just add the following: > > > > import schema "http://mystuff.com/schema" at "/the-schema.xsd"; > > > > Kind regards, > > Geert > > > > > ________________________________ > > > From: general-boun...@developer.marklogic.com > [mailto:general-boun...@developer.marklogic.com] On Behalf Of > Tim Meagher > Sent: donderdag 4 maart 2010 18:49 > To: 'General Mark Logic Developer Discussion' > Subject: RE: [MarkLogic Dev General] Problem inserting > default namespace increated XML document fixed, but validation fails > > Hi Geert, > > > > This time I'm actually specifying a namespace as in the > XML that gets created in the example below, e.g. > > > > <record xsi:schemaLocation="/the-schema.xsd" id="1001" > > xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance > > xmlns="http://mystuff.com/schema"> > > <list> > > <item> > > ... > > > > Where "the-schema.xsd" is loaded in the root of the > Schemas database. > > > > I'm looking for validation syntax and trying to see if > I need to declare the targetNamespace in the schema. I just > can't get this puppy to validate! > > > > Thanks! > > > > Tim > > > > -----Original Message----- > From: general-boun...@developer.marklogic.com > [mailto:general-boun...@developer.marklogic.com] On Behalf Of > Geert Josten > Sent: Thursday, March 04, 2010 12:21 PM > To: General Mark Logic Developer Discussion > Subject: RE: [MarkLogic Dev General] Problem inserting > default namespace increated XML document fixed, but validation fails > > > > Hi Tim, > > > > I looked into that earlier. To summarize this is what you need: > > > > declare default element namespace ""; > > import schema "" at "/my-schema.xsd"; > > > > validate strict { > > $mydoc > > } > > > > More details can be found here > http://markmail.org/message/qauezioxxmyp64kd, comments from > Mary on the same thread may also interest you.. > > > > Kind regards, > > Geert > > > > > -----Original Message----- > > > From: general-boun...@developer.marklogic.com > > > [mailto:general-boun...@developer.marklogic.com] On Behalf Of > > > Tim Meagher > > > Sent: donderdag 4 maart 2010 18:12 > > > To: 'General Mark Logic Developer Discussion' > > > Subject: RE: [MarkLogic Dev General] Problem inserting > > > default namespace in created XML document fixed, but > validation fails > > > > > > Hi Geert, > > > > > > > > > > > > Thanks for the info. The thing that helped me most was using > > > the QName function when creating the elements. I thought > > > this would fix a problem I'm having with validating content > > > using a default namespace and schema location, but that's not > > > the case. I could use an example of using marklogic to > > > validate an xml file against a schema where the xml document > > > only contains the default namespace declaration. That > > > includes making sure the schema is configured correctly and > > > that the appropriate declarations exists in the xquery code. > > > The schema is loaded in the Schemas database. > > > > > > > > > > > > Tim > > > > > > > > > > > > -----Original Message----- > > > From: general-boun...@developer.marklogic.com > > > [mailto:general-boun...@developer.marklogic.com] On Behalf Of > > > Geert Josten > > > Sent: Thursday, March 04, 2010 2:13 AM > > > To: General Mark Logic Developer Discussion > > > Subject: RE: [MarkLogic Dev General] Problem inserting > > > default namespaceincreated XML document > > > > > > > > > > > > Hi Tim, > > > > > > > > > > > > That is because you are using computed element constructors, > > > creating list elements explicitly without namespaces (since > > > you pass in the result of a call to local-name()). Also, you > > > should not created xmlns attributes directly, but supply the > > > element constructor with a xs:QName that contains the element > > > name in the desired namespace. > > > > > > > > > > > > I think you are looking for something like this: > > > > > > > > > > > > declare namespace xsi = > "http://www.w3.org/2001/XMLSchema-instance"; > > > > > > declare namespace pre = "http://mystuff.com/pre"; > > > > > > > > > > > > declare variable $sd := "http://mystuff.com/schema"; > > > > > > > > > > > > declare function pre:passthru-nodeset($x as node()) as node()* > > > > > > { > > > > > > for $z in $x/(@* | node()) return pre:build-nodeset($z) > > > > > > }; > > > > > > > > > > > > declare function pre:build-nodeset($x as node()) as node()* > > > > > > { > > > > > > (:Revise link counts, clean up link, add link attributes to > > > mixed-citation:) > > > > > > typeswitch ($x) > > > > > > case text() return $x > > > > > > case attribute () return $x > > > > > > case element () > > > > > > return > > > > > > element {QName($sd, local-name($x))} { > > > > > > if (not($x/parent::*)) then > > > > > > attribute xsi:schemaLocation { > "/the-schema.xsd" } > > > > > > else (), > > > > > > pre:passthru-nodeset($x) > > > > > > } > > > > > > default return pre:passthru-nodeset($x) > > > > > > }; > > > > > > > > > > > > let $record := > > > > > > <record bla="boo"><list > type="unknown"><item/></list></record> > > > > > > return > > > > > > pre:build-nodeset($record) > > > > > > > > > > > > Note: you might be interested in the functions available at > > > http://www.xqueryfunctions.com/xq/. They are included in the > > > distribution of MarkLogic Server 4.1.. > > > > > > > > > > > > Kind regards, > > > > > > Geert > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > drs. G.P.H. (Geert) Josten > > > > > > Consultant > > > > > > > > > > > > > > > > > > Daidalos BV > > > > > > Hoekeindsehof 1-4 > > > > > > 2665 JZ Bleiswijk > > > > > > > > > > > > T +31 (0)10 850 1200 > > > > > > F +31 (0)10 850 1199 > > > > > > > > > > > > mailto:geert.jos...@daidalos.nl > > > > > > http://www.daidalos.nl/ > > > > > > > > > > > > KvK 27164984 > > > > > > > > > > > > P Please consider the environment before printing this mail. > > > > > > De informatie - verzonden in of met dit e-mailbericht - is > > > afkomstig van Daidalos BV en is uitsluitend bestemd voor de > > > geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, > > > verzoeken wij u het te verwijderen. Aan dit bericht kunnen > > > geen rechten worden ontleend. > > > > > > > > > > > > > From: general-boun...@developer.marklogic.com > > > > > > > [mailto:general-boun...@developer.marklogic.com] On > Behalf Of > > > > > > > Tim Meagher > > > > > > > Sent: donderdag 4 maart 2010 4:43 > > > > > > > To: 'General Mark Logic Developer Discussion' > > > > > > > Subject: [MarkLogic Dev General] Problem inserting default > > > > > > > namespace in created XML document > > > > > > > > > > > > > > Hi Folks, > > > > > > > > > > > > > > > > > > > > > > > > > > > > I'm trying to take an XML document that refers to a DTD and > > > > > > > to remove the DTD declaration and insert a default > namespace. > > > > > > > I built a recursive function that goes thru each node: > > > > > > > > > > > > > > > > > > > > > > > > > > > > declare namespace pre = "http://mystuff.com/pre"; > > > > > > > > > > > > > > > > > > > > > > > > > > > > declare function pre:passthru-nodeset($x as node()) > as node()* { > > > > > > > for $z in $x/(@* | node()) return > pre:build-nodeset($z) }; > > > > > > > > > > > > > > > > > > > > > > > > > > > > declare function pre:build-nodeset($x as node()) as > node()* { > > > > > > > (:Revise link counts, clean up link, add link attributes to > > > > > > > mixed-citation:) > > > > > > > typeswitch ($x) > > > > > > > case text() return $x > > > > > > > case attribute () return $x > > > > > > > case element (record) > > > > > > > return > > > > > > > element record { > > > > > > > attribute xsi:schemaLocation { > "/the-schema.xsd" }, > > > > > > > attribute xmlns:xsi > > > > > > > {"http://www.w3.org/2001/XMLSchema-instance"}, > > > > > > > attribute xmlns {"http://mystuff.com/schema"}, > > > > > > > pre:passthru-nodeset($x)} > > > > > > > case element () > > > > > > > return element {string(local-name($x))} { > > > > > > > pre:passthru-nodeset($x)} > > > > > > > default return pre:passthru-nodeset($x) }; > > > > > > > > > > > > > > > > > > > > > > > > > > > > The problem is that the resulting XML document from invoking > > > > > > > pre:build-nodeset($record) looks something like this: > > > > > > > > > > > > > > > > > > > > > > > > > > > > <record xsi:schemaLocation="/APAthe-schema.xsd" id="1001" > > > > > > > > > > > > > > xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance > > > > > > > > > > > > > > xmlns="http://mystuff.com/schema"> > > > > > > > <list xmlns=""> > > > > > > > <item> > > > > > > > ... > > > > > > > > > > > > > > > > > > > > > > > > > > > > and when I try to validate the resulting document a > > > > > > > validation error occurs because the default namespace has > > > > > > > been renamed at the <list> element. How can I remove the > > > > > > > xmlns="" declaration from the <list> element? > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks ahead of time, > > > > > > > > > > > > > > > > > > > > > > > > > > > > Tim Meagher > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > General mailing list > > > > > > General@developer.marklogic.com > > > > > > http://xqzone.com/mailman/listinfo/general > > > > > > _______________________________________________ > > General mailing list > > General@developer.marklogic.com > > http://xqzone.com/mailman/listinfo/general > > _______________________________________________ General mailing list General@developer.marklogic.com http://xqzone.com/mailman/listinfo/general