Franz B
Franz B

Reputation: 69

adding and using xsd from marklogic java api

I`m using Marklogic 9.0.4 with Java Client API 4.0.4.

I'd like to use XSD from the Java API for

Unfortunately I found no Java API methods for this.

UseCase: Scanning an external XML file we programmatically determine the underlying schema and then load the schema and document into the MarkLogic database. Afterwards we transform the data and validate on read/write on parts of the content.

Upvotes: 1

Views: 49

Answers (1)

ehennum
ehennum

Reputation: 7335

Yes, the approach from the second bullet is correct approach when using the Java API. You can specify the schema database and write the schema as a document.

Typically, you would validate on write from Java so the database contains only valid documents.

My impression is that, if you write an XML document to a content database whose schema database has a schema that validates the root element namespace and name of the document:

http://docs.marklogic.com/guide/app-dev/loading_schemas#id_70282

If that impression is incorrect, you can install a transform that validates and returns the input document

http://docs.marklogic.com/guide/app-dev/loading_schemas#id_42480

and apply the transform when writing a document

http://docs.marklogic.com/guide/rest-dev/transforms

Hoping that helps,

Upvotes: 1

Related Questions