xsd

XML schema; multiple from a list of valid attribute values

吃可爱长大的小学妹 提交于 2020-01-01 10:52:16
问题 I'm reasonably new to working with XML schemas, so excuse my incompetence if this is more trivial than I myself believe it must be. I'm trying to create a required attribute that must contain 1 or more white-space-separated string values from a list. The list is the 4 typical HTTP request methods; get , post , put , and delete . So valid elements would include: <rule methods="get" /> <rule methods="get post" /> <rule methods="post put delete" /> Whereas invalid elements would include: <rule

XML schema; multiple from a list of valid attribute values

巧了我就是萌 提交于 2020-01-01 10:51:29
问题 I'm reasonably new to working with XML schemas, so excuse my incompetence if this is more trivial than I myself believe it must be. I'm trying to create a required attribute that must contain 1 or more white-space-separated string values from a list. The list is the 4 typical HTTP request methods; get , post , put , and delete . So valid elements would include: <rule methods="get" /> <rule methods="get post" /> <rule methods="post put delete" /> Whereas invalid elements would include: <rule

JAXB xsd:include and separate packages

♀尐吖头ヾ 提交于 2020-01-01 10:46:07
问题 I have the following situation: There are 2 xsd files. The 1st one defines a root element, and several types. The second one includes the first, and extends one of the types. There is no root type defined in this file. From the first xsd, a model is generated in a package (a). The second schema should create a new package (b) for the additional types, but reuse the generated package a. I solved this by using a binding file which points to the previously generated elements (in package a). So

XML Schema - only one element should have attribute set to true

懵懂的女人 提交于 2020-01-01 09:33:12
问题 How can i define an boolean attribute that can be set "true" only in one element. Following snippet must be invalid. <products> <product featured="yes">Prod 1</product> <product featured="yes">Prod 2</product> </products> 回答1: You can't do that with XML Schemas. You can define attributes on an element, but not limit them to one instance of the element. 回答2: You could add an attribute in products element indicating which product is featured. 回答3: You can't do this with XMLSchema. If you want

Java/XSD parsing

泄露秘密 提交于 2020-01-01 09:28:12
问题 I doubt if there is something like this but I thought to ask though: Does anyone know if there is a library in Java that reads an xsd file and "creates" the defined elements e.g. in a String format to use in the code? E.g. read in the following schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element name="Street" type="xs:string" /> <xs:element

How to generate XSD from elements of XML

狂风中的少年 提交于 2020-01-01 08:32:47
问题 I have a XML input <field> <name>id</name> <dataType>string</dataType> <maxlength>42</maxlength> <required>false</required> </field> I am looking for a library or a tool which will take an XML instance document and output a corresponding XSD schema. I am looking for some java library with which I can generate a XSD for the above XML structure 回答1: If all you want is an XSD so that the XML you gave conforms to it, you'd be much better off by crafting it yourself rather than using a tool. No

Element-Mandatory Attribute declaration in XSD Schema:

半腔热情 提交于 2020-01-01 08:20:09
问题 I want to declare an element to be included in a complex type declaration, and the element has a mandatory attribute: "option=MyOption", but the value of the "option" attribute could be anything, depending on the context. That is: the attribute "option" with some unknown value should be mandatory in any document using the complex type containing this element. Example: <xs:element name="SpecialOption" type="xs:string"/> <xs:complexType name="SpecialOptions"> <xs:sequence> <xs:element ref=

Where I can find the official XSD schema for RSS 2.0

我的梦境 提交于 2020-01-01 07:55:10
问题 I am looking for the XSD schema of RSS. Via Wikipedia I have found several pages on the specifications of RSS 2.0 but none offers an XSD schema. I found several correct xsd files around on the web but all these schemas are created by individual developers. I'm surprised not to find a site official RSS 2.0 specification and provides a formal XSD. Do you know where I can find a perfect match of the official XSD schema for RSS 2.0? 回答1: Google "rss 2.0 xsd schema" returns a bunch of hits, for

What's the meaning of "xsd:extension base = …?

烈酒焚心 提交于 2020-01-01 07:39:24
问题 What's the meaning of ? Does SubParameter type included all the information of MainParameter.type content? and attribute MyIndex attached. <xsd:complexType name="SubParameter.type"> <xsd:complexContent> <xsd:extension base="MainParameter.type"> <xsd:attribute name="MyIndex" type="xsd:nonNegativeInteger"/> </xsd:extension> </xsd:complexContent> </xsd:complexType> Thank you. 回答1: You are declaring a type that extends MainParameter.type. In other words, your new type "SubParameter.type" will

Parser configuration exception parsing XML from class path resource

只愿长相守 提交于 2020-01-01 07:22:30
问题 I am trying to run a junit test case for testing whether the applicationcontext is initialized and it throws the following error. Is it something related to the xml or the java version. How do I fix this? org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from class path resource [tasospring-online-context.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org