I'm trying to insert a document via xdmp:document-insert()
before that is called I am validating the document against it's respective schema via validate strict { $xml }
and using that output in the insert call. However the output of the validate
call does not include the default value specified in the schema.
Simplified schema:
<xs:schema>
<xs:complexType name="fields-type" abstract="false" mixed="false">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element default="Faulkner" maxOccurs="1" minOccurs="0" name="an_author" nillable="false" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="document-type" abstract="false" mixed="false">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="fields" type="fields-type" minOccurs="1" maxOccurs="1" nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:element name="document" type="document-type" abstract="false" nillable="false"/>
</xs:schema>
The document:
<document>
<fields>
<an_author/>
</fields>
</document>
After calling validate strict { $xml }
the output document is the same as above with no default value added to the <an_author>
element. Note: I also tried using the fixed
attribute in place of default
in the schema and I'm getting the same result. xdmp:validate($xml, "strict")
isn't returning any errors either.
Edit: According to the XQuery validate specification here the output should have the default value specified.