xsd-validation

Specify namespace for an element in XSD

跟風遠走 提交于 2019-12-11 08:11:48
问题 I've got an XML for which I need to generate an XSD. My XML goes as follows: Instance: <mes:GetInboundResponseGetInboundSMS xmlns:mes="http://abcd.com"> <response> <messages> <item> <date>15/04/2014 00:00:00</date> </item> <item> <date>01/07/2014 10:01:32</date> </item> </messages> </response> </mes:GetInboundResponseGetInboundSMS> Please note that only the outermost element GetInboundResponseGetInboundSMS belongs to a namespace http://abcd.com - the rest of the elements don't. How do I

How to validate for language attributes in XSD?

半城伤御伤魂 提交于 2019-12-11 07:25:30
问题 I have an XML document with language specific elements, example: <root lang="en fr"> <section> <title lang="en">English Title</title> <title lang="fr">French Title</title> <sequence>2</sequence> <field> <type>date</type> <label lang="en">English field label</label> <label lang="fr">French field label</label> </field> </section> <section> <title lang="en">Another English Title</title> <title lang="fr">Another French Title</title> <sequence>1</sequence> </section> </root> At the top, the root

Restrict the a XML request attribute value and few of the element value

萝らか妹 提交于 2019-12-11 06:48:46
问题 This post is an extension of the post :Restrict the attribute value and the value of the element using XSD Now I am able to restrict all the attribute & element value using the XSD. But I'm now looking to restrict only one or two of the element value and not all of them. XML: <response src="XML"> <resp name="JSON">letter.c</resp> <resp name="SWAGGER">di.js</resp> <resp name="BI">bi.j</resp> </response> XSD: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs=

Restrict the attribute value and the value of the element using XSD

血红的双手。 提交于 2019-12-11 06:13:01
问题 I have a requirement where I need to restrict the attribute value and its element's value using an XSD. I've been able to restrict the attribute value to one of JSON SWAGGER so far, but I also need to restrict the element value to one of letter.c di.js as well. XML: <response src="XML"> <resp name="JSON">letter.c</resp> <resp name="SWAGGER">di.js</resp> </response> XSD: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

XSD 1.1 - Invalid content was found starting with with element 'xs:alternative'

烈酒焚心 提交于 2019-12-11 06:04:56
问题 In my XSD, I'm trying to use alternative tag. For some reasons, I got this error in my IDE (PHPStorm) : Invalid content was starting with with element 'xs:alternative' ... XSD <xs:complexType name="tableType"> <xs:sequence> <xs:element type="columnType" name="column" maxOccurs="unbounded" minOccurs="0"/> <xs:element type="keyType" name="key" maxOccurs="unbounded" minOccurs="0"> <xs:alternative test="@type='index'" type="keyIndexType"/> <xs:alternative test="@type='unique'" type="KeyUniqueType

XSD Validation : Namespace causing root element to not be found

孤人 提交于 2019-12-11 05:52:25
问题 I'm trying to a update an existing schema to use its own namespace, so I can import it into another schema later and make it clear the types being used are from the imported schema. I tried changing the default and targeted namespaces but it's caused the schema validation to break and hide the root node. From what I can see i've hidden my root element in another namespace but I am unsure how to configure this to get my desired result. Here is a basic example of what I've tried XML <Parent Id=

Import complex types from XSD in different namespace

牧云@^-^@ 提交于 2019-12-11 05:24:21
问题 I have two XSD files in different namespaces like below book_request.xsd <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="book-request" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="book-request" elementFormDefault="qualified"> <xsd:element name="book-request" type="book-request"/> <xsd:complexType name="book-request"> <xsd:sequence> <xsd:element name="booking-code" type="xsd:string"/> <xsd:element name="room-type-code" type="xsd:string"/> <xsd:element name="customer

XSD: key and keyref validation

↘锁芯ラ 提交于 2019-12-11 04:58:41
问题 I'm having issues with schema validation, this is my xml <?xml version="1.0" encoding="utf-8" ?> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='favorites.xsd'> <Favorites> <Folder> <Name>Entertainment</Name> <Bookmarks> <Bookmark ID="1"/> <Bookmark ID="200"/> <!-- This should fail validation --> </Bookmarks> </Folder> </Favorites> <Bookmarks> <Bookmark> <ID>1</ID> <URL>www.website1.com</URL> </Bookmark> <Bookmark> <ID>2</ID> <URL>www.website2.com<

Example to validate a xml-File against an XSD v1.1 Schema in Java 1.8

一曲冷凌霜 提交于 2019-12-11 04:44:12
问题 My current validation does not work for XSD v1.1 Schemas .. I tried many things to change that, but until now without success It does not matter for me if the solution is done with Saxon or Xerces (Edit: I dont want to spend money to solve the problem and it looks like Saxon XSD1.1 validation is not for free, so I quess I have to stick with Xerces) Yes, I already searched SO for that, but so far none of the code-snippets helped me to get a working validation. The code is goin to be used in an

XSD Validation in Eclipse: “No grammar constraints” warning?

蹲街弑〆低调 提交于 2019-12-11 03:44:07
问题 I created a new project in Eclipse just to validate a xml thanks to the corresponding xsd. I wrote both the xsds and the xml files. The main XSD is like: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.myurl.com/schemas" targetNamespace="http://www.myurl.com/schemas" version="1.0"> <xs:include schemaLocation="other_xsd.xsd"/> [...] The other_xsd.xsd is in the same directory and is like: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.myurl.com