xsd-1.1

Restrict use of an attribute in an XSD assertion

筅森魡賤 提交于 2019-12-11 12:58:37
问题 Given XSD: <xs:element name="color"> <xs:complexType> <xs:attribute name="type"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="white"/> <xs:enumeration value="black"/> <xs:enumeration value="red"/> <xs:enumeration value="green"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="number" use="optional/> </xs:complexType> </xs:element> How would I write an assertion so that if <color> has @type white or black, it cannot also have the @number

Restrict the attribute value and the value of the element using XSD

血红的双手。 提交于 2019-12-11 06:13:01
问题 I have a requirement where I need to restrict the attribute value and its element's value using an XSD. I've been able to restrict the attribute value to one of JSON SWAGGER so far, but I also need to restrict the element value to one of letter.c di.js as well. XML: <response src="XML"> <resp name="JSON">letter.c</resp> <resp name="SWAGGER">di.js</resp> </response> XSD: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

XSD 1.1 - Invalid content was found starting with with element 'xs:alternative'

烈酒焚心 提交于 2019-12-11 06:04:56
问题 In my XSD, I'm trying to use alternative tag. For some reasons, I got this error in my IDE (PHPStorm) : Invalid content was starting with with element 'xs:alternative' ... XSD <xs:complexType name="tableType"> <xs:sequence> <xs:element type="columnType" name="column" maxOccurs="unbounded" minOccurs="0"/> <xs:element type="keyType" name="key" maxOccurs="unbounded" minOccurs="0"> <xs:alternative test="@type='index'" type="keyIndexType"/> <xs:alternative test="@type='unique'" type="KeyUniqueType

Example to validate a xml-File against an XSD v1.1 Schema in Java 1.8

一曲冷凌霜 提交于 2019-12-11 04:44:12
问题 My current validation does not work for XSD v1.1 Schemas .. I tried many things to change that, but until now without success It does not matter for me if the solution is done with Saxon or Xerces (Edit: I dont want to spend money to solve the problem and it looks like Saxon XSD1.1 validation is not for free, so I quess I have to stick with Xerces) Yes, I already searched SO for that, but so far none of the code-snippets helped me to get a working validation. The code is goin to be used in an

XSD Validation Pattern to Enforce LastName/FirstName

纵然是瞬间 提交于 2019-12-10 21:06:47
问题 I need to enforce the pattern LASTNAME/FIRSTNAME Something like Smith/John. The characters can be Alphanumeric (lowercase/uppercase) also includes special characters like ë etc. Pattern: <xsd:pattern value="[a-zA-Z0-9]/[a-zA-Z0-9]"/> Basically the rules will be - Anything before the slash - Anything after the slash - Patterns like "/John", "John/" should not be allowed Thanks in advance. 回答1: ASCII Assuming that you don't want numbers in the names: <xs:pattern value="[a-zA-Z]+/[a-zA-Z]+"/> If

XML validation against XSD 1.1 with Xerces in Java

僤鯓⒐⒋嵵緔 提交于 2019-12-09 02:59:02
问题 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

restriction of elements based on another attribute using XSD 1.1

我只是一个虾纸丫 提交于 2019-12-06 09:48:56
问题 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

Java library that supports XSD 1.1 [closed]

最后都变了- 提交于 2019-12-06 06:59:58
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Is there a java library that supports XSD 1.1. I have tried finding it for 2 days. The only implementation I found was Xerces2 Java 2.11.0 (XML Schema 1.1) (Beta) which works along with JAXP 1.4. This beta version did not work well either. Basic things like 'assert test' that were introduced in XSD 1.1 were

XSD 1.1 Conditional Type Assignment <alternative test=“”> to check if an element hasn't an attribute set?

◇◆丶佛笑我妖孽 提交于 2019-12-05 21:44:02
I would like to ask if someone knows how to make an XSD 1.1 Conditional Type Assignment check if an element hasn't an attribute using the XPath query, e.g.: <!--inline alternative type definitions --> <element name="TimeTravel" type="TravelType"> <alternative test="@direction='Future'"> <complexType> <complexContent> <restriction base="TravelType" .... <!-- some past travel related elements go here --> </complexType> </alternative> <alternative test="@direction='Past'"> <complexType> <complexContent> <restriction base="TravelType" .... <!-- some future travel related elements go here --> <

Element 'assert' is invalid, misplaced, or occurs too often

孤人 提交于 2019-12-05 18:26:51
We were provided a set of schemas from a vendor, (we have alerted them to the error as well). When I try to generate the Java classes using xjc, it fails with the error below C:\Users\...>"C:\Program Files (x86)\Java\jdk1.7.0_80\bin\xjc.exe" -d output ICSv1.01.xsd parsing a schema... [ERROR] s4s-elt-invalid-content.1: The content of 'ICSBatchV01' is invalid. Element 'assert' is invalid, misplaced, or occurs too often. line 77 of file:/C:/Users/.../ICSv1.01.xsd [ERROR] s4s-elt-invalid-content.1: The content of 'ICSDocBody' is invalid. Element 'assert' is invalid, misplaced, or occurs too often.