Hi Steve,

Schemas *should* have a target namespace--all of the ones I have seen
used in MarkLogic do.  But in theory you can use one without a namespace
(I think the noTargetNamespace or something like that...), but I have
never tried that.

As for the serialization, in 3.2, the output encoding is always
serialized as UTF-8.

-Danny

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Mallen
Sent: Tuesday, August 12, 2008 1:44 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Schema aware XQuery andXML
SerializationOptions in ML 3.2?

Thanks, Danny.

I will give that a try, and have a look through the older messages.

Do you need to have a target namespace in the schema to use it, or will 
it work without namespaces?
Also, any ideas on the serialization stuff?

Cheers,
-Steve

Danny Sokolsky wrote:
> Hi Steve,
>
> I think you need something like this:
>
> import schema "uri-of-your-schema-you-are-importing" at "schema-path"
> declare namespace foo="uri-of-your-schema-you-are-importing"
>
> define variable $input as element(foo:result) { doc('myfile.xml')/* }
>
> You are correct that schemas are used for typing.  There are some
other
> threads that talk about schemas like this one:
>
> http://markmail.org/message/snhlrjv5kp4bbfrk
>
> -Danny
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Steve
> Mallen
> Sent: Monday, August 11, 2008 2:20 AM
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] Schema aware XQuery and XML
> SerializationOptions in ML 3.2?
>
> Hi everyone,
>
> The dev guide and admin docs talk about how to load and retrieve an
XML 
> Schema, and in various parts of the marketing material Mark Logic is 
> described as "schema-aware".  The dev guide has a section on Loading 
> Schemas and says:
>
>     "Schemas are automatically invoked by the server when loading 
> documents (for conducting content repair) and when evaluating queries 
> (for proper data typing)."
>
> and
>
>     "The most common activity developers want to carry out with schema

> is to read them."
>
> I've managed to load a schema into the database, and import it into my

> XQuery (using "import schema"), but how can I declare variables as 
> elements of my schema?
>
> In XQuery 1.0, I can do this:
>
>     declare variable $input as schema-element(result) := 
> doc('myfile.xml')/*;
>
> There is another similar construct for attributes.  Does anyone know 
> what the equivalent syntax in ML 3.2 (XQuery WD 2003) is?  I've tried 
> reading the specs but they're not very clear on the issue.  It seems 
> that my schemas are not being automatically invoked, as I can
construct 
> XPath expressions which do not conform to my Schema and the query 
> processor does not complain.
>
> Can anyone explain the "schema-awareness" of ML?  What does it use the

> schema for?  As I understand it, I can't validate documents using the 
> Schema?
>
> As an unrelated XQuery side issue, I'd also like to have some control 
> over XML serialization.  What control does ML give me in this regard?

> The dev guide seems silent on the issue.  For example, I'd like to be 
> able to output a DOCTYPE and specify an encoding for my results.  In 
> XSLT I can do this:
>
>     <xsl:output doctype-public=""-//W3C//DTD XHTML 1.0 Strict//EN" 
> doctype-system=""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; 
> encoding="UTF-8" />
>
> http://www.w3.org/TR/xslt-xquery-serialization/ lists many other 
> options.  There are "declare options" settings for these in eXist.
Can 
> I do the equivalent in ML - or is this not possible? 
>
> Many thanks,
> -Steve
>
> p.s. The following article by Michael Kay has a very good overview of 
> schema aware queries, and it is from here that I got the idea:
>
>     http://www.stylusstudio.com/schema_aware.html
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>   

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

Reply via email to