xsd-validation

Refer to specific element of an XSD model group?

六眼飞鱼酱① 提交于 2019-12-24 07:33:14
问题 Can we create a group and refer to element of that group? For example, we have a group say <xs:group name="custGroup"> <xs:sequence> <xs:element name="customerId" type="xs:string"/> <xs:element name="customerName" type="xs:string"/> <xs:element name="Address1" type="xs:string"/> <xs:element name="Address2" type="xs:string"/> <xs:element name="mobile" type="xs:string"/> </xs:sequence> </xs:group> Suppose I want to create another element to have only customerId and mobile : <xs:element name=

Not sure why my XML file is coming up as invalid/no grammar found and why my schema is not validating either?

对着背影说爱祢 提交于 2019-12-24 03:37:17
问题 I am somewhat new to XML, but I have been unable to figure out these errors. This is my first time attempting to create "advanced" schemas, but I was uncertain about importing and how exactly to reference the "urlset" in the schema... These are the errors: Ln 14 Col 7 - Document is invalid: no grammar found. Ln 14 Col 7 - Document root element "sites", must match DOCTYPE root "null". 2 Errors ... Ln 31 Col 98 - s4s-att-invalid-value: Invalid attribute value for 'ref' in element 'element'.

XSD <xs:all> with multi occurrences unordered

牧云@^-^@ 提交于 2019-12-23 23:34:42
问题 I've the following XML <?xml version="1.0" encoding="UTF-8" standalone="no"?> <props> <id>someId</id> <file_size> <size>123</size> <unit>MB</unit> </file_size> <file_size> <size>123</size> <unit>MB</unit> </file_size> </props> And the corresponding XSD: <?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> <xs:element name="props"> <xs:complexType> <xs:sequence> <xs:element type="xs

XML Schema 1.1 not recognizing 'assert' or 'assertion'

不羁的心 提交于 2019-12-23 07:00:40
问题 I am trying to use the following in an XSD <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" > <xs:element name="dimension"> <xs:complexType> <xs:attribute name="height" type="xs:int"/> <xs:attribute name="width" type="xs:int"/> <xs:assert test="@height = @width"/> </xs:complexType> </xs:element> I know assert/assertion are part of XML Schema 1.1 but not 1.0. However everything I have read indicates the namespace is the same for both: http://www.w3.org/2001

Issue while converting XSD with complextype to XML using MSDN Microsoft.Xml.XMLGen( XmlSampleGenerator API)

耗尽温柔 提交于 2019-12-23 06:10:52
问题 I am trying to convert an XSD with complex type into XML I could not getting the expected result. The xsd is shown below. But only one of the node showing correct data but the second one not showing the correct result attaching the screenshot enter image description here any idea on this?? I can able to convert it through online, at that time it is working fine Do we have any limitation in samplegenerator to use same complex type in multiplenode? Here is the XSD: <xs:schema xmlns:xs="w3.org

Example of extending complex types in XSD?

你离开我真会死。 提交于 2019-12-23 02:19:13
问题 I am trying to use data within an element without breaking this element existing contract. Let's simplify my case: <xs:element name="ExistingContract"> <xs:complexType> <xs:sequence> <xs:element name="first" type="FirstType"/> <xs:element name="second" type="SecondType"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="NewContract"> <xs:complexType> <xs:sequence> <xs:element name="first" type="FirstType"/> <xs:element name="second" type="SecondType"/> <xs:element name=

Why do I have to prefix attributes from imported XSD?

此生再无相见时 提交于 2019-12-22 16:45:15
问题 I have the following two XSDS, test.xsd <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:ns1="http://www.test.com/ns1" targetNamespace="http://www.test.com" elementFormDefault="qualified" attributeFormDefault="unqualified"> <import namespace="http://www.test.com/ns1" schemaLocation="test1.xsd"/> <element name="Root"> <complexType> <sequence> <element name="Child" type="string"/> </sequence>

Create an XSD optional decimal element with restrictions

做~自己de王妃 提交于 2019-12-22 08:38:51
问题 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

Limit number of elements with attribute via XSD?

南楼画角 提交于 2019-12-20 05:38:04
问题 There is a fragment of XML <items> <itemUID>uid-1</itemUID> <itemUID>uid-2</itemUID> <itemUID key="true">uid-3</itemUID> <itemUID>uid-4</itemUID> <itemUID>uid-5</itemUID> <itemUID key="true">uid-6</itemUID> <itemUID>uid-7</itemUID> </items> Rule : Element items can contain from 1 to unbounded elements itemUID , but only 0 or 2 or 3 elements with attribute key . Can I define this rule with XSD restrictions only? 回答1: You cannot express your constraint in XSD 1.0, but in XSD 1.1, you can use xs

How to declare element

一笑奈何 提交于 2019-12-20 05:26:36
问题 I'm looking for validate an XML document with xrm prefix as you can read here : I wrote the following XML Schema : </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> However, when I check my XML document, I get the following error: 'xrm:plugin' is not a valid value for 'NCName' I understand I can't put xrm: in my name, but how can I validate my xrm:plugin and xrm:header ? Because, if I try to validate my XML document, I get this error: Cannot find the declaration of