On Thu, 29 Aug 2013 05:50:11 -0700, Timothy W. Cook <[email protected]> wrote:

> Hi All,
>
> I am new to ML and I'm designing a project using a developer license
> for ML6 on CentOS.
>
> My XML data is schema validated, Each schema 'includes' a parent
> schema from which it constrains the complexTypes from the parent.
>
> The design of the eco-system is such that the namespace; mlhim2 is
> consistent across all versions of the parent schema. Only the namespce
> of the parent (and physical location) changes.
>
> For example:
> xmlns:mlhim2="http://www.mlhim.org/xmlns/mlhim2/2_4_0";
> xmlns:mlhim2="http://www.mlhim.org/xmlns/mlhim2/2_4_1";
> xmlns:mlhim2="http://www.mlhim.org/xmlns/mlhim2/2_4_2";
>
> all point to a schema named mlhim2.xsd
>
> I use a catalog.xml in other tools to resolve which local mlhim2.xsd
> is referenced by the child schemas.
>
> I see that using the Flow editor I can set the URI to something like:
> /content/mlhim2/2_4_x" for each schema and import them.  But how do I
> tell ML that the parent schema locally resides here when the child
> does the include?

Just to make sure I am understanding your setup properly:

schema A1: namespace A1
    imports schema B namespace http://www.mlhim.org/xmlns/mlhim2/2_4_1

schema A2: namespace A2
    imports schema B namespace http://www.mlhim.org/xmlns/mlhim2/2_4_2

etc.

Right?

The easiest answer, if there is only one schema document for
each of the http://www.mlhim.org/xmlns/mlhim2/... namespaces,
is to just not put a schema location in the import at all.
MarkLogic will look up the schema via its namespace,
and will find it as long as it in is in the schemas database.

If you do have a location on the import, then it matters
whether it is abolute (http://whatever) or relative
("mlhim2.xsd"). An absolute URI will find that schema
at the given URI in the schemas database.  So if
you said the location was "http://www.example.org/ns1/mlhim2.xsd";
then doc("http://www.example.org/ns1/mlhim2.xsd";) (in the
schemas database) is where we go looking for the schema.
If the URI on the import is relative, then we will use
the base uri of the importing schema to resolve that
URI.  Suppose schema A1 were at "/ns1/A1.xsd" and
schema A2 were at "/ns2/A2.xsd" and the import
said simply "mlhim2.xsd", then A1 would look for
the schema at "/ns1/mlhim2.xsd" and A2 would look for
the schema at "/ns2/mlhim2.xsd".  Where this gets
tricky is if you have the base schemas at some relative
location, such as "A1.xsd". Resolving a relative
URI against a relative path ends up not working
as you'd expect (in this case I believe we'd end up
looking at "/mlhim2.xsd"), and we don't recommend
that practice.

//Mary

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

Reply via email to