xml-validation

Control element cardinality based on an attribute enumeration in XSD?

馋奶兔 提交于 2019-12-11 14:02:45
问题 I want the character element to be repeatable if the cell @type is filled , numbered , specialNumbered , or specialUnnumbered . I want the character element NOT to be repeatable if the cell @type is multiCharacterNumbered or multiCharacterUnnumbered . If the cell type is blank , I'd like to disallow the character element altogether. Does this require XSD 1.1? How do I form the conditional or test? <xs:element name="cell" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name=

Max occurs of element which depend on value of other element using XML Schema

◇◆丶佛笑我妖孽 提交于 2019-12-11 13:36:29
问题 I would need help with XML Schema. I would like to write some condition where max occurs of element depend on value of other element My XML: <databaza> <dvd> <id>01</id> <type>DVD-R</type> <number_of_movies>2</number_of_movies> <movie> <movie_id>1</movie_id> <movie_name>X-man</movie_name> <number_of_characters>2</number_of_characters> <character> <character_id>1</character_id> <character_name>Andy Dufresne</character_name> <main_character>YES</main_character> <performer>Tim Robbins</performer

SAXParseException when trying to print data in table

泪湿孤枕 提交于 2019-12-11 07:34:18
问题 Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'jr:table'. One of '{"http://jasperreports.sourceforge.net/jasperreports":component}' is expected. Why it occurs? 回答1: you provide almost no context for your question, so your chances of getting a helpful answer are slim. however, that looks like the sort of exception you would get if you are parsing an xml document with a schema defined and the document does not match the schema.

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

How do I write this Schematron validation test for XML snippet?

一曲冷凌霜 提交于 2019-12-11 05:53:11
问题 I have an XML snippet as such: <AAA> <Field name="a"/> <Field name="b"/> <Field name="x"/> <User id="x" id2="f"/> <User id="y"/> </AAA> <AAA> <Field name="r"/> <Field name="z"/> </AAA> I need rule such that if the User tag exists, it should check to see if the Attribute values of id and id2 exist under the name Attribute of a Field. So in the first AAA tag, it will validate and give 2 errors because "f" doesn't exist as a field name and neither does "y" . The AAA tags don't always have User

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

XML validation using jQuery.parseXML( data )

懵懂的女人 提交于 2019-12-11 05:15:43
问题 I wanted to ask if I could use the jQuery.parseXML(data) to validate XML string? I mean I know it's used for parsing XML, and if the XML is not valid I will get an error message, but will the function fail every time that there will be even a minor error in the XML? I've tried googling about it, but all I found is regarding parsing, and not about validation. Thanks! 回答1: No, not via jQuery (at least not in Mozilla and most likely the other non-IE browsers). In the case of IE, it is stated at

Validating xml against xsd file generated through JAXB and XSD build option in eclipse

怎甘沉沦 提交于 2019-12-11 04:13:31
问题 I am trying to have a sample code for validating my xml file against xsd file, which is getting generated through jaxb and xsd build through Eclipse. I am trying to do a sample validator file, that validates my xml against my xsd file. Now, I have found a lot of examples for the java code, and I am using one of them. Also I have recieved a lot of answers for the issue that I am facing, but some way the answers suggests to either update my xsd or xml file. For me, I cannot do any of these, as