Sure, here is the schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
vc:minVersion="1.0" vc:maxVersion="1.1">
<xs:element name="dir">
<xs:complexType>
<xs:sequence>
<xs:element name="doc" type="type-doc" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="uri-source" type="xs:string" use="required"/>
<xs:attribute name="uri-target" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="type-doc">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="unknown" type="type-unknown"/>
<xs:element name="deleted" type="type-deleted"/>
<xs:element name="updated" type="type-updated"/>
</xs:choice>
<xs:attribute name="uri-source" type="xs:string" use="required"/>
<xs:attribute name="uri-target" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="type-updated">
<xs:attribute name="id-source" type="xs:string" use="required"/>
<xs:attribute name="id-target" type="xs:string" use="required" />
<xs:attribute name="title-target" type="xs:string" use="required" />
<xs:attribute name="ancestor-title-target" type="xs:string"
use="required" />
<xs:attribute name="location-source" type="xs:string" use="required" />
<xs:attribute name="location-target" type="xs:string" use="required" />
<xs:attribute name="status" type="type-status" use="required" />
</xs:complexType>
<xs:complexType name="type-unknown">
<xs:attribute name="id-source" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="type-deleted">
<xs:attribute name="id-source" type="xs:string" use="required"/>
</xs:complexType>
<xs:simpleType name="type-status">
<xs:restriction base="xs:string">
<xs:enumeration value="unknown"/>
<xs:enumeration value="changed"/>
<xs:enumeration value="unchanged"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
And here is a simple test:
xdmp:document-insert('test-doc.xml',
<dir uri-source="/books-search/comm/flh/2014/"
uri-target="/books-search/comm/flh/2015/">
<doc uri-source="/books-search/comm/flh/2014/FLH_ch02.xml"
uri-target="/books-search/comm/flh/2015/FLH_ch02.xml">
<updated status="changed"/>
<updated id-source="/chapter/subchapter[1]/section[3]/section[3]/p"
id-target="p0f30b428fdccc"
title-target="§3.3 Rebutting community-property presumption."
ancestor-title-target="§3. Establishing Character of Marital Property"
location-source="2_a_3_3" location-target="2_a_3_3" status="unchanged"/>
</doc>
</dir>)
Followed by
validate strict { doc('test-doc.xml') }
The first <updated> element requires all the attributes from the second, so it
should fail. It doesn't for me, but after dereferencing the doc it does. Since
namespacing the docs (there aren't many) and the schema does work, that's my
current workaround (and probably better practice anyway).
Let me know if you can't reproduce it. Thanks for following up!
-Will
> On Dec 9, 2014, at 3:25 PM, Mary Holstege <[email protected]> wrote:
>
> On Tue, 09 Dec 2014 12:42:29 -0800, Will Thompson
> <[email protected]> wrote:
>
>> I recently ran into some issues validating a no-namespace document. The
>> schema was updated, which should have caused the document to fail
>> validation, but it didn't. I have been using
>> xdmp:expanded-tree-cache-clear() following schema updates, but neither that
>> nor a server restart had any affect.
>>
>> After doing some more testing, I discovered that dereferencing it before
>> validation works:
>>
>> validate strict { document { doc($uri) }/* }
>>
>> And if I namespace the document and schema, everything works as expected as
>> well. Bug, or am I missing something? This is on 7.0-4.1.
>>
>> -Will
>
> Yes, this sounds like a bug, and probably is not related to schema change
> so much as schema processing in general, since you cleared the cache.
> (Correct me if I am wrong.)
>
> Namespaced and no-namespaced schemas should work consistently.
> That said, nonamespaced schemas are a little trickier because of the
> interaction with elementForm and attributeForm, so I wouldn't be too
> shocked if there a code path somewhere that doesn't handle things
> properly.
>
> If you have a test case you'd be willing to share, I'd love to see it.
>
> //Mary
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general