These are some rough notes on techniques for using XML Schemas with MarkLogic.
Loading an XML Schema using cq:
The quickest way I've found to get a schema into your local MarkLogic instance is to copy your xsd file into your MarkLogic Docs folder (I also made a folder called schemas), then open a cq instance (or DQ if you prefer), select Schemas as your content source and use some XQuery like this:
Loading an XML Schema using XCC/J:
Another method would be to use XCC/J - I hope to write another post on this technique at another time with a more detailed example (note this method is untested at the time of writing):
After the cq process has been executed, running either:
or:
Should show you the schema.
It's important to note that when MarkLogic loads schemas into its database, it will put in any values that have defaults on load. This caused some confusion when I was testing the "Schema Aware" aspects of the server. I added the following attribute to my schema's parent element:
Here's a very basic example of a schema layout:
Most of this information is available elsewhere, so this post will hopefully serve to pull a few pieces together in the interests of saving time.
Recommended reading:
http://developer.marklogic.com/howto/tutorials/2007-04-schema.xqy
http://geekswithblogs.net/dmillard/archive/2004/10/20/12935.aspx
Subscribe to:
Post Comments (Atom)
Blog Archive
-
►
2011
(35)
-
►
June
(6)
- MarkLogic/XCC: Copying a Module with User Content ...
- MarkLogic: clearing a forest in a database program...
- MarkLogic: Enabling debug options when using the S...
- Linux: SCP syntax and structure note
- MarkLogic/XCC: Installing Modules Programatically
- Eclipse: Installing XQDT (and DLTK) on Eclipse Ind...
-
►
June
(6)
-
▼
2010
(43)
-
►
September
(7)
- MarkLogic: Creating Multiple Range Element Indexes...
- MarkLogic: Listing all Collections in a Database
- MarkLogic: Basic Database Cloning Script
- MarkLogic: Estimating the number of documents cont...
- MarkLogic: Search: Compound OR Queries
- MarkLogic: XQuery: Check for the presence of an el...
- MarkLogic: XQuery: Type Validation using xsi:type
-
►
September
(7)
0 comments:
Post a Comment