XML Schema Versions for Marklogic

I read elsewhere that using version strings in XML Schema URLs is generally bad practice - for reasons I understand.

I wonder if this mantra is used when used Marklogic DB? My reason is because namespaces and stored XML objects look very closely related to Marklogic. The generally recommended way to store a version in XML seems to be potentially less useful in this scenario where you want the DB engine to understand which XSD > schema version to use. This tells me that, contrary to popular wisdom, version strings in the namespace may be the best way.

The current version of our XSD does not have any version in it, but we will also need to create an extended version a few months after we have the existing XML documents imported and working

Edit - if this was not obvious, I'm new to Marklogic!

+4
source share
2 answers

Another way of versioning is to use xsi:schemaLocationto indicate which version of the schema is being used by physical location.

Schema Database:

/ Schemes / versions / 1.0 /A.xsd
/ Schemes / versions / 2.0 /A.xsd

xsi: schemaLocation = "http://www.example.com/schemas/A/schemas/versions/ 1.0/A.xsd"

xsi: schemaLocation = "http://www.example.com/schemas/A/schemas/versions/ 2.0/A.xsd"

, MarkLogic xsd, schemaLocation , .

=============================================== ==========
EDIT:. Mary, , . . schemaLocation , .

, :

/schemas/versions/3.0/A.xsd
/schemas/versions/3.0/common/something.xsd
/schemas/versions/3.0/common/something-else.xsd

, A.xsd import . /common/something.xsd
something.xsd . /something -else.xsd

, /schemas/versions/ 3.0/A.xsd, MarkLogic .

=============================================== ==========
2: . SchemaLocation, MarkLogic , WHICH. - sc: xxxx. xs: schema. , . . :

, http://my/A/Namespace:

/schemas/v3/A.xsd
   /schemas/v 4/A.xsd

, schemaLocation ​​ 4:

<document
xmlns="http://my/A/Namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://my/A/Namespace /schemas/v4/A.xsd"
>
<something>Bla Bla</something>
</document>/sc:schema()

: [164, http://my/A/Namespace /schemas/v4/A.xsd ok]

, schemaLocation ​​ 3:

<document
xmlns="http://my/A/Namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://my/A/Namespace /schemas/v3/A.xsd"
>
<something>Bla Bla</something>
</document>/sc:schema()

: [164, http://my/A/Namespace /schemas/v3/A.xsd ok]

, schemaLocation NOT SET:

<document
xmlns="http://my/A/Namespace"
>
<something>Bla Bla</something>
</document>/sc:schema()

: [164, http://my/A/Namespace /schemas/v3/A.xsd ok] MarkLogic ...

, schemaLocation ​​ , :

<document
xmlns="http://my/A/Namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://my/A/Namespace /schemas/v9999/A.xsd"
>
<something>Bla Bla</something>
</document>/sc:schema()

: [108, http://my/A/Namespace ok]

MarkLogic - . schemLocation, xsd, MarkLogic . , , , .. .. , "", .

+4

, - URI Schemas, . , URI. URI - , , , - , , , , , MarkLogic , .

+3

Source: https://habr.com/ru/post/1606591/


All Articles