xsd-1.1

restriction of elements based on another attribute using XSD 1.1

匆匆过客 提交于 2019-12-04 16:15:27
I am trying to create a schema definition using XSD 1.1 in which the number of other elements is dependent on the attribute of another element. E.g. The number of the BaPath elements BaPath depends on the value of the attribute "service" of the "Conn" element. The xsd I wrote is <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Mapping"> <xsd:complexType> <xsd:sequence> <xsd:element ref="Link" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Env"> <xsd:complexType> <xsd

Difference between xs:redefine and xs:override in XML schema 1.1

吃可爱长大的小学妹 提交于 2019-12-04 06:06:15
What is the difference between <xs::redefine> and <xs::override> in XML schema 1.1. I've got two books on XML Schema in front of me and I still can't tell the difference. The only thing that I'm sure of is that both are pervasive and that <xs::redefine> is deprecated. Using redefine you can extend or restrict a component (complex types, simple types, model groups and attribute groups). So, you reuse the original definition of the component and you extend or restrict it. The override allows you to replace the definition of a component. So, you create a new component with the same name that

How to access parent element in XSD assertion XPath?

早过忘川 提交于 2019-12-02 02:36:05
I am trying to write an assertion that will make the values of @row and @column less than or equal to the values of @rows and @columns in the parent element <structure> . <xs:element name="structure"> <xs:complexType> <xs:sequence> <xs:element name="cell" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="row" type="xs:positiveInteger"/> <xs:attribute name="column" type="xs:positiveInteger"/> <xs:assert test="@row le @rows"/> <xs:assert test="@column le @columns"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="rows" type="xs:positiveInteger" use="optional"/> <xs

XML validation against XSD 1.1 with Xerces in Java

一个人想着一个人 提交于 2019-12-01 03:47:18
I have installed Xerces through Maven: <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jdom</groupId> <artifactId>jdom</artifactId> <version>2.0.2</version> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> </dependencies> I then tried the code given in this example from the Xerces FAQ to validate a XML file against a schema in version 1.1. This is my code: private static void validateFile(File

How to indicate that an xml schema that requires schema 1.1 features?

試著忘記壹切 提交于 2019-11-30 12:37:41
If I create an XML Schema that requires schema 1.1 features (especially subtle ones, like removing an optional element in restriction of a base type), what is the best way to indicate that this schema should not be used with a processor that only understands version 1.0? In an XSLT stylesheet file, it is possible to indicate the version of the XSLT specification that is used using a version attribute. But in an XSD file, the version attribute does not have this meaning - it is a free-form attribute that says something about the version of the schema, not about the version of the specification

Extend XSD Type based on element value?

好久不见. 提交于 2019-11-29 16:52:25
Is it possible to extend an element in XSD 1.1 based on another element's value? For example: <Field> <Title>Text Field</Title> <Type>Text</Type> <Length>100</Length> </Field> <Field> <Title>Date Field</Title> <Type>Date</Type> <Format>mm/dd/yyyy</Format> <Field> Both Field elements share common Title and Type elements. For the Text Field, it can have a Length element, but Date cannot. The Date Field can have Format , but Text cannot. I'd like to extend both Text and Date fields, if possible, from a common type. Note: I'm assuming the above is not possible in XSD 1.0 No, an element's type

XSD 1.1 xs:alternative/xs:assert

安稳与你 提交于 2019-11-29 08:55:11
Is that possible with xsd 1.1? I want to switch the attributes depending on the "type" if its "A" or "B". How can I write an XSD 1.1 syntax for this simple problem? <?xml version="1.0"?> <node type="A" a1="asd" a2="d"/> <node type="B" b="4" /> Yes, you can define alternative types for node depending on the value of the type attribute using xs:alternative . You don't need xs:assert in this case. Your example seems so similar to the ones in the spec that I'm not quite sure why you are asking the question. For example: <xs:element name="message" type="messageType"> <xs:alternative test="@kind=

Extend XSD Type based on element value?

*爱你&永不变心* 提交于 2019-11-28 11:13:39
问题 Is it possible to extend an element in XSD 1.1 based on another element's value? For example: <Field> <Title>Text Field</Title> <Type>Text</Type> <Length>100</Length> </Field> <Field> <Title>Date Field</Title> <Type>Date</Type> <Format>mm/dd/yyyy</Format> <Field> Both Field elements share common Title and Type elements. For the Text Field, it can have a Length element, but Date cannot. The Date Field can have Format , but Text cannot. I'd like to extend both Text and Date fields, if possible,

Dynamic enumeration restriction using XSD 1.1

随声附和 提交于 2019-11-28 10:16:22
I am trying to create a schema definition using XSD 1.1 in which outcome of one element is dependent on other. For example, I have drop-down for list of countries and list of states for each country. When a person selects a country, only the states of that country can be selected. The pseudo-code of what I am trying to attain looks something like this. <xs:schema xmlns:ie="http://www.interviewexchange.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="country"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="USA" /> <xs

XSD 1.1 xs:alternative/xs:assert

半世苍凉 提交于 2019-11-28 02:11:22
问题 Is that possible with xsd 1.1? I want to switch the attributes depending on the "type" if its "A" or "B". How can I write an XSD 1.1 syntax for this simple problem? <?xml version="1.0"?> <node type="A" a1="asd" a2="d"/> <node type="B" b="4" /> 回答1: Yes, you can define alternative types for node depending on the value of the type attribute using xs:alternative . You don't need xs:assert in this case. Your example seems so similar to the ones in the spec that I'm not quite sure why you are