xsd-validation

how to simulate lack of network connectivity in unit testing

强颜欢笑 提交于 2019-12-04 04:13:35
问题 The general question is how to simulate (as part of a JUnit suite of test cases) lack of network connectivity as this is an important consideration in some test cases. Is there a way to do so via a Java API (or via a JVM option) so that certain test cases can be run under network dis-connectivity? (simulated or real?). The more specific case (if there is no generally applicable solution) is that I am doing a bunch of XML-file processing (including XSD-validation) and I need to ensure that

Restrict type of xsd:any to xsd:string only?

こ雲淡風輕ζ 提交于 2019-12-04 04:00:52
问题 So I'm writing a new XSD and I've come across a little issue. Now I'll admit I'm not the best with these, but I would have thought what I have done should have worked but it doesn't. What I am after is I have an element called extraInfo and this element can have up to 42 child elements with any name but only of type string. Here is what I have: <xsd:element name="extraInfo" minOccurs="0" maxOccurs="1"> <xsd:annotation> <xsd:documentation></xsd:documentation> </xsd:annotation> <xsd:complexType

XSD: Cannot resolve the name 'type' to a(n) 'type definition' component

强颜欢笑 提交于 2019-12-04 01:43:45
I am defining the schema but on validating it in eclipse it gives following error. src-resolve: Cannot resolve the name 'common:Name' to a(n) 'type definition' component. My schema looks like following: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://www.mycompany.com/myproject/service/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.mycompany.com/myproject/service/v1" xmlns:product="http://www.mycompany.com/otherproject/service/products/v1" xmlns:common="http://www.mycompany.com/myproject/service/common/v1" elementFormDefault="qualified"> <xsd

XMLSchema validation on Android

纵然是瞬间 提交于 2019-12-03 23:01:37
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 ") - fails with IllegalArgumentException the default 'ExpatParser' in Android from the Harmony

xml schema validation error “prefix is not bound”

微笑、不失礼 提交于 2019-12-03 15:17:42
问题 I am entirely new to XML Schema and am trying to get the basics down. Here is my xml schema code (filename: example1.xsd): <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sample="http://www.example" targetNamespace="http://www.example.com" elementFormDefault="qualified"> <xs:element name="school"> <xs:complexType> <xs:sequence> <xs:element name="element1" type="xs:string"/> <xs:element name="element2" type="xs:string"/> <xs:element name="element3" type="xs

xml schema validation error “prefix is not bound”

北慕城南 提交于 2019-12-03 04:59:47
I am entirely new to XML Schema and am trying to get the basics down. Here is my xml schema code (filename: example1.xsd): <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sample="http://www.example" targetNamespace="http://www.example.com" elementFormDefault="qualified"> <xs:element name="school"> <xs:complexType> <xs:sequence> <xs:element name="element1" type="xs:string"/> <xs:element name="element2" type="xs:string"/> <xs:element name="element3" type="xs:string"/> <xs:element name="element4" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element>

XSD for varying element names

谁都会走 提交于 2019-12-02 12:38:26
问题 I want to form an xsd schema for an XMl whose elements will range from z1-zx. Is it possible to define this in the xml schema without having to write out declare each of the elements. Please see below: <?xml version="1.0"?> <Zones> <Z1>Asset00</Z1> <Z2>Asset00</Z2> </Zones> I want the zones to be able to go upto Zxxx without having to declare each and every one in the XSD, is it possible to do this? Please note that I wouldn't be able to change the structure of the xml, as I am using this for

Setting max length of date type as 0 in XSD

China☆狼群 提交于 2019-12-02 12:02:11
问题 <xsd:simpleType name="Date10"> <xsd:restriction base="xsd:date"> <xsd:pattern value="??"/> </xsd:restriction> </xsd:simpleType> The date field shouldn't be able to accept any value in it. I want it to appear like an empty tag. How do I do that? 回答1: Your requirements contradict each other. You cannot constrain an element to be a date and also to be empty concurrently because dates cannot have zero length. If you intend to allow either a date or an empty string, see Allow XSD date element to

XSD schema with choice

折月煮酒 提交于 2019-12-02 11:43:34
问题 I need to validate XML request data in below array: <studyYear></studyYear> <orgID></orgID> <originID></originID> <providerID></providerID> <userOID></userOID> Problem - I have to get either ( orgID ) or ( userOID ) or ( originID and providerID ) together. 'studyYear' will always be there. How I can realise it? If need more information just write. I referenced this link to use so as to try using xs:choice inside xs:all but could not get it working. 回答1: This XSD, <?xml version="1.0" encoding=

Allow only other existing XML values in XSD? (xs:key and xs:keyref)

前提是你 提交于 2019-12-02 10:12:31
问题 Let's take the following example XML: <device> <name>NiceDevice</name> <value>123</value> </device> <user> <name>user1</name> <usesDevice>NiceDevice</usesDevice> </user> <user> <name>user2</name> <usesDevice>NiceDevice</usesDevice> </user> validated by this XSD: <xs:element name="device" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <element name="name" type="xs:string"/> <element name="value" type="xs:integer"/> </xs:complexType> </xs:element> <xs:element name="user" minOccurs="0"