xml-validation

XmlReader always validates a Xsd file against another Xsd file as valid

核能气质少年 提交于 2019-12-11 03:33:48
问题 I've got strange behaviour of the XmlReader. When using it for validation Xml against Xsd everythink works fine and how I expect. But when I try validate a Xsd file against another Xsd, it throws no validation exception. For better explenation of my use case: I have an application where an user can upload a Xml file like data input. The user must upload a xsd file for already uploaded xml file and after that, the Xml file is validated against the Xsd file already uploaded. But in the case

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

Should .Net XML Schema Validation stop upon reaching first invalid element?

六月ゝ 毕业季﹏ 提交于 2019-12-11 01:12:23
问题 I have an XML string and a Schema loaded up and passed into a function. I have it validating the XML against the schema correctly, however it always stops validating at the scope of the first invalid element. Invalid data, it keeps going, invalid/missing attributes, keeps going, but invalid elements, it stops and will not validate further within that scope. The schema is as follows: <?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs

XML validation against DTD

跟風遠走 提交于 2019-12-11 00:34:08
问题 I have this XML along with an embedded DTD: <?xml version="1.0" ?> <!DOCTYPE customers [ <!ELEMENT customers (name,age,roll,sex)> <!ELEMENT name (#CDATA)> <!ELEMENT age (#CDATA)> <!ELEMENT roll (#CDATA)> <!ELEMENT sex (#CDATA)> ]> <customers> <name>XYZ</name> <age>19</age> <roll>23</roll> <sex>M</sex> </customers> When i try to validate the XML, its showing me an error. But if i change the #CDATA to #PCDATA then the validation is successful. Question 1) I don't have a proper explanation why

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

Element or attribute do not match QName production

…衆ロ難τιáo~ 提交于 2019-12-10 20:57:28
问题 I have a schema that i have "flattened" using XML Editor. After i flatten it i get a validation error. What can i do to fix it? Error Message: F [Xerces] Element or attribute do not match QName production: QName::=(NCName':')?NCName. code: <xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" xmlns:="http://www.opengis.net/gml/3.1.1" /> <xs:annotation xmlns:="http://www.opengis.net/sps/1.0"> <xs:documentation> <copyright> SPS is

How to exclude root elements in an XSD?

余生长醉 提交于 2019-12-10 19:17:26
问题 I have several elements defined in my XSD file that I use as references later on in the document. I do want any of these "reference" elements to constitute a valid xml file. For example I have <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Section"> <xs:complexType> <xs:sequence> <xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="code"/> <xs:attribute

XSD - how to specify element structure depending on its attribute value?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 00:40:34
问题 I have an XML which I validate by an XSD schema. inside the XML, I have the element . depending on value of stereotype attribute, I want to have different inner structure for the element; take following two variations: 1) <step stereotype="checkerStep" taskType="tableChecker"> <tableName>employee</tableName> </step> 2) <step stereotype="branchStep"> <branchName>whichStep</branchName> </step> as you can see, if stereotype is "checkerStep", as taskType attribute would be necessary, and a

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

JAXB schema validation not occurring in outbound message with CXF 2.3.1

安稳与你 提交于 2019-12-08 19:31:27
Using CXF 2.3.1. Generated Java from WSDLs using JAXB. Using <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> in the client configuration. My test creates an object that fails this particular requirement of the WSDL: <xsd:simpleType name="UUID.Content"> <xsd:annotation> <xsd:documentation xml:lang="EN"> Universally Unique Identifier </xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:token"> <xsd:length value="36" /> <xsd:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" /> </xsd:restriction> <