keyref

How to use unique and keyref properly in XML schema?

本小妞迷上赌 提交于 2019-12-13 13:39:12
问题 I have this XML schema but I don't know how to complete it in order to achieve what I need. I searched a lot online about unique and keyref usage, but all I can find are basic examples. This is my schema: <xs:element name="access" type="myaccess" /> <xs:complexType name="myaccess"> <xs:sequence> <xs:element name="user" type="myuser" minOccurs="0" maxOccurs="unbounded"> <xs:unique name="u_idunique"> <xs:selector xpath="user" /> <xs:field xpath="@id" /> </xs:unique> </xs:element> <xs:element

How can I create a XML instance with a XSD that includes keyref from another namespace

假装没事ソ 提交于 2019-12-11 11:42:54
问题 I am trying to validate a XML instance that depends on another instance (from a different namespace), and it has a keyref to a key in that namespace. When I try to validate the instance, it produces an error that says the key is out of scope. These are my XSDs: test1.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="test1" xmlns="test1"> <xs:complexType name="Host"> <xs:attribute name="id" type="xs

XSD key/keyref beginner question

寵の児 提交于 2019-12-01 03:19:38
I'm trying to implement a very simple XML schema constraint. The idref attribute on elements of type <batz> should only be allowed to have a value that matches the id attribute on at least one element <bar> . If that doesn't make any sense to you then please just look at the example XML-document below, I think it actually explains it better than my attempt to put it in words. So, question: Why does xmllint let the below schema/xml combination pass (it says the document is valid)? How to fix it to achieve the desired constraint? The schema: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www

XSD key/keyref beginner question

假如想象 提交于 2019-11-30 23:48:41
问题 I'm trying to implement a very simple XML schema constraint. The idref attribute on elements of type <batz> should only be allowed to have a value that matches the id attribute on at least one element <bar> . If that doesn't make any sense to you then please just look at the example XML-document below, I think it actually explains it better than my attempt to put it in words. So, question: Why does xmllint let the below schema/xml combination pass (it says the document is valid)? How to fix