xsd-1.0

How to specify minimal value for fractionDigits restriction in XML Schema?

杀马特。学长 韩版系。学妹 提交于 2019-12-07 01:02:35
问题 I have a following XML Schema: <xsd:simpleType name="fractionalSalary"> <xsd:restriction base="xsd:decimal"> <xsd:fractionDigits value="2" /> <xsd:minExclusive value="0" /> </xsd:restriction> </xsd:simpleType> Is there any option to specify minimal number of xsd:fractionDigits to 2? Because I have a following restriction for salary: positive number with 2 decimal places precision, e.g. 10000.50 and validation should fail on inputs like 1000.5452 or 14582.0001 but also on input 1000.5 or 10000

XML Schema (XSD) 1.0 xs:pattern regex to match 4 digits as a string?

笑着哭i 提交于 2019-12-06 15:06:25
问题 How can I match a specific sequence of digits as if it were a string in an XML Schema xs:pattern ? Say I have some tags containing arbitrary 10-character strings like <string>12345678990</string> And I want to rule out all tags with a specific blacklist of arbitrary sequences like 1234 , 2435 , ``9587`, or some such. How do I address the specific 4-digit sub-string in order to negate it and add it to a list of xs:pattern restrictions for <string> 's content model? 回答1: I don't think there is

What is the typical maximum length of values of the XML/XSD ID/IDREF types?

狂风中的少年 提交于 2019-12-06 05:09:38
The W3C XSD 1.0 Part 2: Datatypes specification refers to the W3C XML 1.0 specification for the definition of the ID and IDREF types, but none of these documents defines any constraints on the length of values of these types. However, it seems that some XML editors implement length limitations for these types. Also, some Web browsers seem to implement length limitations, e.g. on the "id" attribute of the HTML Hx elements (which is defined as XML ID type in both HTML 4 and XHTML 1.1). Are there any constraints on the length of the ID/IDREF types defined by a W3C specification or some other

Different sub-elements depending on attribute/element value

*爱你&永不变心* 提交于 2019-12-06 00:10:51
Another XSD question - how can I achieve that the following XML elements are both valid: <some-element> <type>1</type> <a>...</a> </some-element> <some-element> <type>2</type> <b>...</b> </some-element> The sub-elements ( either <a> or <b> ) should depend on the content of <type> (could also be an attribute). It would be so simple in RelaxNG - but RelaxNG doesn't support key integrity :( Is there a way to implement this in XSD? Note: XML schema version 1.1 supports <xs:alternative> , which might be a solution, but afaik no reference implementation (e.g. libxml2) supports this yet. So I'm

XML Schema to restrict one field based on another

こ雲淡風輕ζ 提交于 2019-12-05 18:03:07
I have the following schema, which I use to ensure that a person's PhoneNumber and PhoneNumberType (Home, Work, etc.) is not longer than 10 characters. However, I want to improve this schema so that PhoneNumberType is not required if a PhoneNumber is not provided, but is required if the PhoneNumber is provided. Is there a way to do this in XML Schema 1.0? I am aware this could be accomplished in XML Schema 1.1 using <xs:assert/> , but unfortunately I am stuck with XML Schema 1.0. <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xs:element name=

How to specify minimal value for fractionDigits restriction in XML Schema?

拟墨画扇 提交于 2019-12-05 04:33:28
I have a following XML Schema: <xsd:simpleType name="fractionalSalary"> <xsd:restriction base="xsd:decimal"> <xsd:fractionDigits value="2" /> <xsd:minExclusive value="0" /> </xsd:restriction> </xsd:simpleType> Is there any option to specify minimal number of xsd:fractionDigits to 2? Because I have a following restriction for salary: positive number with 2 decimal places precision, e.g. 10000.50 and validation should fail on inputs like 1000.5452 or 14582.0001 but also on input 1000.5 or 10000 . PS: Using XML Schema 1.0 You can add a pattern restriction: <xsd:simpleType name="fractionalSalary">

XML Schema (XSD) 1.0 xs:pattern regex to match 4 digits as a string?

天涯浪子 提交于 2019-12-04 21:15:12
How can I match a specific sequence of digits as if it were a string in an XML Schema xs:pattern ? Say I have some tags containing arbitrary 10-character strings like <string>12345678990</string> And I want to rule out all tags with a specific blacklist of arbitrary sequences like 1234 , 2435 , ``9587`, or some such. How do I address the specific 4-digit sub-string in order to negate it and add it to a list of xs:pattern restrictions for <string> 's content model? I don't think there is any practical XSD-compliant regular expression that will match all strings except those containing "1234" as

XSD schema with unordered required, optional and arbitrary tags

青春壹個敷衍的年華 提交于 2019-12-02 01:57:06
问题 I am trying to come up with a XSD 1.0 schema with the following constraints: There is no ordering Some elements must appear exactly once Some elements may appear zero or unbounded times Allow unrecognized elements (do not validate them) The reason for 3. is that I would like to validate the type if the element is present. For example, a person must have exactly one name, an optional age (at most one), optional phone numbers (unlimited) and any other tag. These should validate: <person> <name

XSD schema with unordered required, optional and arbitrary tags

℡╲_俬逩灬. 提交于 2019-12-01 22:28:53
I am trying to come up with a XSD 1.0 schema with the following constraints: There is no ordering Some elements must appear exactly once Some elements may appear zero or unbounded times Allow unrecognized elements (do not validate them) The reason for 3. is that I would like to validate the type if the element is present. For example, a person must have exactly one name, an optional age (at most one), optional phone numbers (unlimited) and any other tag. These should validate: <person> <name>Bob</name> <age>33</age> <phone>123456789</phone> <phone>123456788</phone> </person> <person> <name