xsd

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=

XPath evaluation - Error trying to bind to a schema

≡放荡痞女 提交于 2021-01-29 16:50:28
问题 I am using Java 14 with Maven and Spring Boot. I was getting the following error: org.springframework.oxm.MarshallingFailureException: JAXB marshalling exception; nested exception is javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.SAXException2: unable to marshal type "com.travellinck.client.approval.ApprovalRequest" as an element because it is missing an @XmlRootElement annotation] To which I found the following solution: I would like to add @XmlRoot annotation on

Even with ErrorHandler, why is schema validation ending after the first error?

爷,独闯天下 提交于 2021-01-29 11:50:28
问题 I’m working on schema validation. The goal is to take an XSD file and validate an incoming document against it. If there are errors, I want to capture all of them. I’m getting only the first error in the ErrorHandler and then the processing ends. There’s lots of internet examples of people asking this same question, and the answer seems to be always what I’m doing (create a custom error handler). Further, the documentation for the ErrorHandler interface has this to say about how the error

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 1.1: Attribute is supposed to only have values of another attribute

 ̄綄美尐妖づ 提交于 2021-01-28 08:30:49
问题 For a card-game that I am supposed to design, I have the task of implementing an attribute that can only have values that two other attributes can have. I already asked a question close to this one, where I was able to restrict that attribute to have the same value as another attribute. However, when it has not the same value, the compiler is giving an error message. Background: I have the element "card" which is divided into the element "type" (which also defines a "color" as an attribute)

xsd.exe does not seem to work for C++ with newer versions of Visual Studio

江枫思渺然 提交于 2021-01-28 08:08:29
问题 I am trying to use the xsd.exe tool to generate C++ classes from XML schema files. According to this post I should simply be able to use the tool from a Visual Studio developer command prompt, but it doesn't seem to work for C++ in newer versions of Visual Studio (2017 or 2019) When I try to execute the command I get the error: Error: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be

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