xsd-validation

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 --> <

Create an XSD optional decimal element with restrictions

二次信任 提交于 2019-12-05 19:25:53
I've managed to create an optional decimal element using this: <xs:simpleType name="OptionalDecimal"> <xs:union memberTypes="xs:decimal empty-string" /> </xs:simpleType> but I also need to add restrictions so that if it has been entered, to limit it to a maximum length of 10 and maximum number of 3 decimal places for example. So I've got this: <xs:restriction base="xs:decimal"> <xs:maxInclusive value="9999999999"/> <xs:fractionDigits value="3"/> </xs:restriction> The problem is I don't know how to combine them. Can they be combined? Or is there a better way of doing this? Thanks to Kevin's

XSD Two elements with the same name but different attribute value

混江龙づ霸主 提交于 2019-12-05 11:03:12
I am trying to define an XSD template for the following: <template_data> <given_name lang="ENG">Zluty</given_name> <given_name lang="CES">Žlutý</given_name> </template_data> So far, I've come up with <xs:complexType name="attribute_CES"> <xs:attribute name="lang" type="xs:string" use="required" fixed="CES"/> </xs:complexType> <xs:complexType name="attribute_ENG"> <xs:attribute name="lang" type="xs:string" use="required" fixed="ENG"/> </xs:complexType> <xs:element name="template_data"> <xs:complexType> <xs:sequence> <xs:element name="given_name" type="attribute_CES"/> <xs:element name="given

XSD attribute NILLABLE not working

非 Y 不嫁゛ 提交于 2019-12-05 02:36:39
I am working on getting an xml file to validate against an XSD schema and I'm having trouble with the validations. Every time I validate I get errors saying "Schemas validity error: Element '{http://services.website.com/ProgramResponse}Population': '' is not a valid value of the atomic type 'xs:double'." I believe this error happens because I have a null character in that field, displayed like this: < HarvPop>< /HarvPop> So, to solve this I tried using the nillable="true" attribute for the elements so they will be able to be null, but still show up as empty. This seems to be the only solution,

The prefix “xs” for element “xs:schema” is not bound

只谈情不闲聊 提交于 2019-12-04 23:58:44
问题 Following is the xsd that i am trying to use while generating a client for SOAP Service, Eclipse is throwing an error : The prefix "xs" for element "xs:schema" is not bound. <xs:schema version="1.0" targetNamespace="bdo.com.ph/RemitAPI"> <xs:element name="CheckServiceResponse" nillable="true" type="xs:string"/> <xs:element name="apiRequest" nillable="true" type="tns:APIRequest"/> ............................. <xs:element name="referenceNo" type="xs:string" form="qualified"/> </xs:sequence> <

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

Local XML validation with DTD or XSD using a relative path?

故事扮演 提交于 2019-12-04 11:31:47
An XML file can be defined and validated with an Document Type Description (DTD) or XML Schema (xsd) as follows: <?xml version='1.0' encoding='UTF-8'?> <annotation xmlns="http://www.xyz.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com file:system.xsd" > or <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE annotation SYSTEM "http://www.xyz.de/system.dtd"> Both ways define a URL where the DTD or XSD is found. Is there a way to give a relative or local path? So I can store them allong with the XML files instead of relying on a server? It's easy.

How do I extend a base schema with custom elements while remaining open to change from new versions?

拜拜、爱过 提交于 2019-12-04 08:34:51
问题 Given an XSD as follows: <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:std="http://..." targetNamespace="..."> <xs:element name="SomeRootNode" type="std:SomeRootNodeType" /> ... </xs:schema> that defines some elements which allow any child from a different namespace. I want to extend this schema with my own and insert child elements and attributes of specific elements in the base document. For example, myElementX

xs:unique how to implement into attribute?

爱⌒轻易说出口 提交于 2019-12-04 05:06:57
问题 I would like to pass uniqueness of each attribute in the list of passengers in XML file. My xml file look like this: <passengers> <passenger resnumb="872-AA"> <name>John</name> <surname>Doe</surname> <datebirth>1997-10-01</datebirth> <pricetix>1321</pricetix> <telephone>+48 128382812</telephone> <dateofbuy>2015-10-01</dateofbuy> <comment>Confirmed</comment> </passenger> <passenger resnumb="962-AA"> <name>Jack</name> <surname>Lawnmower</surname> <datebirth>1993-01-01</datebirth> <pricetix>1243

How to exclude an enumeration value in XML file using XSD?

 ̄綄美尐妖づ 提交于 2019-12-04 04:33:09
问题 Is it possible to specify the value of a tag or attribute should not be like some_value ? I have a strange requirement, where the xsd isn't aware of the values being sent to it. The value of that particular tag can be a string with any value except one value ( say data_migration ). The sender should be acknowledged with the error, if that particular value is sent. Is it possible to specify this restriction? 回答1: I'm no regex expert, but this simpleType makes everything starting with data