xml-validation

How to reference global types in XSD?

早过忘川 提交于 2021-02-10 08:21:22
问题 How to implement XSD inner reference to simpleType? I am facing the error you see in the image below. XSD <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.com/ct-required" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" targetNamespace="http://example.com/know-type"> <xs:import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="http://www.w3.org

Invalid XDocument is getting validated

情到浓时终转凉″ 提交于 2021-02-05 09:31:13
问题 I have following xml schema <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.MySchema.net" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="RootElement"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="name" type="xs:string" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element

Allow XML element in any order with any number of appearance via XSD?

a 夏天 提交于 2021-02-05 09:13:09
问题 I have trouble to write XSD with these constraints: Name element is required; Value element could appear 0 or multiple times; Category element is optional. I now have XSD like this: <xs:element name="Detail" maxOccurs="unbounded" minOccurs="0"> <!-- 0 or more Details --> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="Name"/> <!-- Name element is required --> <xs:element type="xs:string" name="Value" maxOccurs="unbounded" minOccurs="0"/> <!-- 0 or more occurences of Value

Allow XML element in any order with any number of appearance via XSD?

拜拜、爱过 提交于 2021-02-05 09:12:11
问题 I have trouble to write XSD with these constraints: Name element is required; Value element could appear 0 or multiple times; Category element is optional. I now have XSD like this: <xs:element name="Detail" maxOccurs="unbounded" minOccurs="0"> <!-- 0 or more Details --> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="Name"/> <!-- Name element is required --> <xs:element type="xs:string" name="Value" maxOccurs="unbounded" minOccurs="0"/> <!-- 0 or more occurences of Value

XML validation against XSD with javax.xml.validation.Validator: cannot resolve types come from 2nd XSD

我怕爱的太早我们不能终老 提交于 2021-01-29 17:11:57
问题 I am trying to write a method that validates XML against XSD. In my case, I have multiple XSD files. When I use tools like IntelliJ IDEA to generate a sample XML from my main XSD everything looks fine: the sample XML is generated and looks as I expect. So I think that my XSD files are okay. This is my simplified main XSD: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <xsd:import schemaLocation=

SonarQube requires separate xsd schema files and displays the error: “Error resolving component in XSD file”

依然范特西╮ 提交于 2021-01-29 06:13:31
问题 I'm using two different xsd schema files in one project. First one is input.xsd . This file uses targetNamespace : <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w3s="https://www.w3schools.com" targetNamespace="https://www.w3schools.com"> <xsd:element name="Mobiles"> <xsd:complexType> <xsd:sequence> <xsd:element name="Mobile" type="w3s:Mobile" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name=

XSD elements with same name but different types

雨燕双飞 提交于 2021-01-29 04:02:09
问题 I need to write a XSD which will validate the attribute as well as the value of the element. So far I am able to validate the attributes but not the value. Thanks for your help in advance. My XML: <params> <param dataType="java.lang.String">12A</param> <param dataType="java.lang.Integer">6455</param> <param dataType="oracle.jbo.domain.Date">2014-10-01</param> <param dataType="oracle.jbo.domain.Date">2018-10-01</param> <param dataType="java.lang.String">H1</param> <param dataType="java.lang

Unique element in XSD is not enforced

故事扮演 提交于 2021-01-29 02:25:24
问题 I am trying to create an XSD for a XML and trying to enforce an xs:unique constraint, but it's not enforcing the constraint. What am I doing wrong? Here is the XSD <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1" xmlns:o="http://www.osames.org/osamesorm"> <xs:element name="DATA"> <xs:annotation> <xs

Unique element in XSD is not enforced

独自空忆成欢 提交于 2021-01-29 02:13:05
问题 I am trying to create an XSD for a XML and trying to enforce an xs:unique constraint, but it's not enforcing the constraint. What am I doing wrong? Here is the XSD <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1" xmlns:o="http://www.osames.org/osamesorm"> <xs:element name="DATA"> <xs:annotation> <xs

XSD for XML containing XSD

我的未来我决定 提交于 2021-01-28 05:07:31
问题 I have created XML Schema for an XML document that describes functionality of components of a complex modular system. Within that XML document, I want to include XML Schema which will be read and parsed to allow for configuration. meta-schema.xsd (heavily edited for brevity): <xs:schema targetNamespace="urn:project" xmlns="urn:project" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="Schema" type="SchemaType"/> <xs:complexType name="SchemaType">