xsd-validation

Vary type in XSD according to element value?

眉间皱痕 提交于 2019-12-11 02:04:38
问题 I have the following two XML documents: <struct> <type>a</type> <p1 xsi:nil="true"/> <p2 xsi:nil="true"/> </struct> <struct> <type>b</type> <p1 xsi:nil="true"/> <p2 xsi:nil="true"/> </struct> I wish to build a schema which validates that in case the value of the element type is "a", then it's sub elements (aka p1 & p2 ) should be nil or empty. Whereas when the element type is something else, such as "b", then p1 or p2 elements can contain anything or nothing. 回答1: That's a classic example of

XML Restrict based on another element value

杀马特。学长 韩版系。学妹 提交于 2019-12-10 22:53:13
问题 Basically I have my XML version 1.0 and I have a complex element with following example: <tile> <position>5</position> <type>floor</type> <towerPlacement>true</towerPlacement> </tile> I have defined following in my XML Schema: <xs:element name="type"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="road"/> <xs:enumeration value="floor"/> <xs:enumeration value="startPos"/> <xs:enumeration value="endPos"/> </xs:restriction> </xs:simpleType> </xs:element> Is there a way

XSD Validation Pattern to Enforce LastName/FirstName

纵然是瞬间 提交于 2019-12-10 21:06:47
问题 I need to enforce the pattern LASTNAME/FIRSTNAME Something like Smith/John. The characters can be Alphanumeric (lowercase/uppercase) also includes special characters like ë etc. Pattern: <xsd:pattern value="[a-zA-Z0-9]/[a-zA-Z0-9]"/> Basically the rules will be - Anything before the slash - Anything after the slash - Patterns like "/John", "John/" should not be allowed Thanks in advance. 回答1: ASCII Assuming that you don't want numbers in the names: <xs:pattern value="[a-zA-Z]+/[a-zA-Z]+"/> If

XML Schema reference

核能气质少年 提交于 2019-12-10 20:53:03
问题 I have two XML Schemas. First ( A.xsd ) is located in a library jar file ( mylib.jar ) and the second one ( B.xsd ) is in my project. I want to import A.xsd into the B.xsd and validate incoming XML via Jaxb2Marshaller embedded validator. However I'm unable to make it work properly: it seems that inner XML validator of Jaxb2Marshaller does not understand references to files in jar-files (I just want to write something like <xs:import namespace="http://my/schema.xsd" schemaLocation="classpath

XSD assert not recognised

て烟熏妆下的殇ゞ 提交于 2019-12-10 19:36:16
问题 I have an XSD where I want to use an xs:assert statement. The issue is I don't know how to make the assert functionality available to me. I am using Visual Studio to write it, and it gets a blue line saying it doesn't support the assert element. My XSD looks like this: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.client.co.uk/quote" targetNamespace="http://www.client.co.uk/quote" elementFormDefault="qualified"

MaxLength restriction for MultiLineText field in SDL Tridion 2011

拥有回忆 提交于 2019-12-10 14:56:24
问题 My schema source looks like follows: <xsd:schema xmlns="uuid:b8fd4596-56ec-4718-ad00-bf2a70a148c2" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="uuid:b8fd4596-56ec-4718-ad00-bf2a70a148c2"> <xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance"></xsd:import> <xsd:annotation> <xsd:appinfo> <tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0"> <tcm:Label

XMLSchema validation on Android

不打扰是莪最后的温柔 提交于 2019-12-09 14:36:46
问题 I maintain the JDOM project and I am trying to 'certify' it on Android. Most things work fine, but XML Schema validation is proving problematic... My questions are: Is there a way to do XMLSchema validation on Android? If there is, how? Questions like this have been asked before, but no conclusive answer is given: Android schema validation XML Schema Validation in Android This is what I currently 'know' (correct me if I am wrong)...: SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema

Dynamic XML Schema Validates Subsection of Document

时间秒杀一切 提交于 2019-12-09 02:19:29
I have a situation similar to " XSD with elements from other namespace ", where I have 2 peices of XML. One peice of XML acts as a wrapper to the other. In a simple example - we have a single MESSAGES wrapper, containing at least one MESSAGE elements. Each MESSAGE element contains a PAYLOAD which is validated against an XSD. Each PAYLOAD in a given MESSAGES parent will validate against the same XSD. However, different MESSAGES can contain PAYLOADs that validate against a whole host of XSDs. I literally have hundreds of XSDs to validate different types of PAYLOAD. I want to have my own XSD that

Turn on the validation XSD 1.1 in Intellij IDEA

纵饮孤独 提交于 2019-12-08 17:38:13
问题 is any way how to turn on the validation of XSD version 1.1 in Intellij IDEA instead of default 1.0? As I know to be able to validate against version 1.1 the processor should just take -xsdversion:1.1, but I don't see any configuration point in IDE how I can set it. 回答1: This feature was added in Intellij 15 Settings -> Languages & Frameworks -> Schemas and DTDs -> Default XML Schemas 回答2: If anyone will stuck with this issue, please be aware that this functionality is missing in the Intellij

Allowing ANY elements from a particular namespace with two schemas

走远了吗. 提交于 2019-12-08 10:44:02
问题 EDIT:Preface: Below is a particular instance of the problem described in the title. I have a single namespace shared by two documents; one imports the other. However, the import seems to confuse the namespace attribute on element"any". The Goal: To have the xml validate; "any" element should check only the target namespace for elements. I.e., Only element "stuff" or "Product" (and it's children) should validate. The Error: "The matching wildcard is strict, but no declaration can be found for