Hi Geert, et al,

 

I'm still having a little problem.  I can construct the new document node so
that the default namespace is appropriately applied to the root element,
e.g.

For example, the contents of the newly created $record variable include the
following:

 

  <record xmlns="http://mystuff.com/schema";>

    <list>

      <item>shoes</item>

    </list>

  </record>

 

So if I write the xquery expression:

 

   return $record        

 

it will return the contents above, but if I write the xquery expression:

 

    return $record//list

 

it will return nothing.  I think this is because it needs to be aware of the
namespace, but I cannot declare the default element namespace without
confusing the construction of the $record node. How do I go about
referencing the list element within $record node without declaring the
default element namespace?

 

Thank you!

 

Tim Meagher

 

  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Tim Meagher
Sent: Saturday, March 06, 2010 7:26 PM
To: 'General Mark Logic Developer Discussion'
Subject: RE: [MarkLogic Dev General] Problem
insertingdefaultnamespaceincreated XML document fixed, but validation fails

 

Hi Geert,

 

I was receiving neither of these errors.  As it turns out, I had neglected
to use the QName to create the root element (I was fashioning it separately
from the rest of the nodeset in my code), even though one of the attributes
was the xmlns reference (which is why I thought it wouldn't have a problem).

 

Thank you for your help!

 

Tim

 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Geert Josten
Sent: Thursday, March 04, 2010 2:39 PM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] Problem inserting
defaultnamespaceincreated XML document fixed, but validation fails

 

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: [email protected] 

> [mailto:[email protected]] 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: [email protected] 

> [mailto:[email protected]] 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: [email protected] 

> [mailto:[email protected]] 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: [email protected] 

> [mailto:[email protected]] 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: [email protected] 

> 

>     > [mailto:[email protected]] 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.

> 

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to