xsd-validation

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=

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

Get enum value from string using xslt and xsd

北城余情 提交于 2021-01-28 18:03:36
问题 I am trying to get the enum value of the corresponding string. I am translating one XML into another. For example, the source element is <VehicleBodyType>Van</VehicleBodyType> I need to transform it to <VehicleTypeCode>5</VehicleTypeCode> This is in an XSD: <xs:simpleType name="VehicleBodyType"> <xs:restriction base="xs:string"> <xs:enumeration value="NotProvided" /> <xs:enumeration value="NotApplicable" /> <xs:enumeration value="PassengerCar" /> <xs:enumeration value=

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

XSD requiring a specific root element exist in an XML document?

余生长醉 提交于 2021-01-28 03:35:03
问题 I want to validate a XML file and to make sure it has a root element called speak like this: <speak> <!--other node here...--> </speak> the speak element must exist in XML and must appears only once. I try to add code below in my XSD file: <xsd:element name="speak" type="speak" minOccurs="1" maxOccurs="1"/> But it does not work. 回答1: In the schema itself, you can't put a constraint on what the root element must be. (That's by design, though not everyone thinks it's a good design.) Any global

XSD define element by name or alternate attribute

自作多情 提交于 2021-01-28 00:43:42
问题 Consider two possible implementations of a "tag group": Authors are allowed to use either an element named <tag-group> or any element with attribute role="tag-group" . I'd like to write an XSD schema that will validate either case. Ideally, the schema can also validate that children are valid within a given parent. The "tag group", for example, allows children to be either an element named <tag> or any element with attribute role="tag" . So the ideal schema would validate, that given <tag

Error: It was detected that X is in namespace Y, but components from this namespace are not referenceable from schema document

泄露秘密 提交于 2021-01-27 22:02:02
问题 What's wrong in this xsd elements? <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="MessageInfoType"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="TimeStamp" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:element name="GetData"> <xsd:annotation> <xsd:documentation>Send data</xsd:documentation> </xsd:annotation> <xsd

XSD Error: This element is not expected

情到浓时终转凉″ 提交于 2021-01-27 05:30:31
问题 I was writing an XSD to validate a XML, but when I was validating this error appeared: Output - error Validation of current file using XML Schema: ERROR: Element '{http://www.w3.org/2001/XMLSchema-instance}Gasto': This element is not expected. Expected is ( Gasto ) ... and I'm not understanding the error Here is a sample of my XML: <?xml version="1.0" encoding="UTF-8"?> <Armazem> <Lista_Gastos xmlns:artGasto="http://www.w3.org/2001/XMLSchema-instance" artGasto:noNamespaceSchemaLocation=

Validate XML against XSD with JavaScript on client side

╄→гoц情女王★ 提交于 2021-01-20 04:27:57
问题 I am required to show a user an XMLfile in a friendly way as a result I am creating a tree like structure such as: http://thecodeplayer.com/walkthrough/css3-family-tree instead of showing the user the raw XML. Right now when creating a new node I am validating that on the server side. If the server validates the new proposed XML(tree) then I go ahead and create a new node for example. Anyways now I will like to allow the user to drag these nodes. When dragging the nodes if I validate the