Xsd required element content

I'm trying to create xsd for an element like this: <ElementType attr1="a" attr2 ="b">mandatory_string</ElementType> and I want to make the mandatory_string required. What should I add to this xsd: <xs:complexType name="ElementType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="attr1" type="StringLength1to2" use="required"/> <xs:attribute name="attr2" type="StringLength1to2" use="required"/> </xs:extension>

XSD choice inside all

You can't put choice tag inside the all tag. So, is there any workaround to get this functionallity? For example, I have<settings> tag like: <settings> <logging /> <sending /> <useonly /> </settings> Or something like <settings> <logging /> <notuseonly /> <sending /> </settings> So I want to prevent <useonly> and <notuseonly> showing up together, while the order is not important. And if al

Xsd XML Schema Types

If I have an element, animal: <animal name="dog"/> Which can take the following as values to the name attribute: dog cat bird $(ANY_STRING) Where $(ANY_STRING) is a simple name, value substitution that some software will perform and validate later (ANY_STRING being literally any string). What would the XML Schema for this element look like? Restricting on the three known names is easy enough: <xs:simpleType name="AnimalNames"> <xs:restriction base="xs:string">

xsd factor out multiple use attribute

I'm not sure how to factor out this piece of XSD: <xs:attribute name="status" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="not run"/> <xs:enumeration value="passed"/> <xs:enumeration value="failed"/> </xs:restriction> </xs:simpleType> </xs:attribute> which is needed in both <test> and <step> tags: <?xml version="1.0" encod

How do create enum with Eclipse XSD editor

I'm creating an XSD for common web service types that will be used in WSDLs. One of the common types I need is an enum. My problem is when I execute wsimport the artifact generated is a class not an enum. I'm using Eclipse Indigo's XSD and WSDL editor. This is what I do in design mode to create my enum: Create new Complex Type (ResponseCodeType) Add new string element (code) in ResponseCodeType In the constraints property of code, I add the following constraint values: SUCCESS, WARNING,

Is it possible to define a XSD element with an arbitrary name but with specific attributes

I would like to validate a custom XML document against a schema. This document would include a structure with any number of elements, each having a specific attribute. Something like this: <Root xmlns="http://tns"> <Records> <FirstRecord attr='whatever'>content for first record</FirstRecord> <SecondRecord attr='whatever'>content for first record</SecondRecord> ... <LastRecord attr='whatever'>content for first record</LastRecord>

Xsd Enunciate isn't generating Descriptions from xs:documentation on xs:elements

We're using maven-enunciate-plugin version 1.26.2 and are encountering an issue during the generation of our documentation. We have added comments to our XSDs in the following manner: <xs:complexType name="PagingParameters"> <xs:annotation> <xs:documentation>information about PagingParameters</xs:documentation> </xs:annotation> <xs:sequence> <xs:choice minOccurs="0"> <xs:element name="StartPos" type="xs:long" n

XSD - how to add two 'ref' to the same element

I have been trying to form this XSD, can someone help please... I have an element 'country' as below: <xs:element name="country"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:long" minOccurs="0" /> <xs:element name="isoCode" type="xs:string" minOccurs="0" /> <xs:element name="currencyCode" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element

XSD optional conditional

Sorry if this is simple or already answered somewhere - I couldn't find anything useful with any of the search terms I tried. I have some date input, that I would like to make in a conditional cascade, like this: Entire date is in ISO format order - YYYY-MM-DD Month and day may contain 'illegal' values, in particular, zero or Feb. 30 Key (and the reason for this post), if month is present, year must be present; if day is present, month and year must be present. So effectively, the date may be

Is it possible in an XSD to xs:redefine the xs:complexType element to require the type attribute?

Goals: Create an XSD where the "type" attribute is required for every xs:element defined in the schema Be able to re-use the redefined http://www.w3.org/2001/XMLSchema in other schemas to force all defined xs:element(s) to require the "type" attribute For example, I would like the following to be "not valid" in our XSD (e.g. in XMLSpy) <xs:element name="SomeElement"/> whereas the following would be valid <xs:element name="SomeElement" type="abc:SomeType"/> Here is an exampl

How to eliminate duplicated classes generated from XSD imported schemes?

I need to generate csharp classes from a bunch of XSD files, the problem I'm coming across now is there're lots duplicated classes generated from the imported schemes, this is quite annoying. I tried wscf.blue, xsd2code, but cannot solve it. For xsd2code, there's an option in xsd2code 'ExcludeImportedTypes', unfortunately with setting the value to 'True', it always crashed my vs2013, vs2010. For wscf.blue, I can generate all the classes in separated files, but over 600 files got generated, and

How to create and XSD schema file from a Codefluent CFP file?

I'm working on a project which uses Codefluent entities to define the application's schema and produce and SQL database, class libraries, web pages, and winforms. Also used are the Altova XmlSpy products. I am trying to figure out how I can extract from the Codefluent model an XSD schema representation of the Codefluent model so that it could be used with Altova's XmlStyleVision. In Softfluent's documentation, https://www.softfluent.com/documentation/CF_Tools_Builder.html, there is a compile

Xsd Enterprise Architect set positions of elements and associated complex types

I have to determine the position of XML elements in a sequence model group. I use the "position" tagged value (starting from 1) to achieve that. It works, if the XSDcomplexType only contains elements with the XSDelement stereotype or if it has only associations to other XSDcomplexTyp classes (with the tagged value "position" on the "Connector Source"). If I try to sort the sequence of complex types, which have XSDelements and associations to other XSDcomplexTyp clas

XSD how to have maxOccurs to value of previous element count

Hi i need to create an xsd for a xml where there are many elements of name columns, and rows. Kindly suggest the XSD, i have made cols as unbounded how should i make the element rows. <cols> <id>a</id> <type>string</type> </cols> <cols> <id>b</id> <type>string</type> </cols> <cols> <id>c</id> <type>number</type> </cols> <rows> <c> <v>

Xsd XBRL and its link and xlink specification mapping from xml to C# classes

I want to model XBRL (consisting of one XSD and many included XSD files and a bunch of referenced linkbases which themselves have xlink elements that point to elements within themselves of outside themselves). I want to be able to do some automatic xml deserialization so I can deal with C# classes at run time which objects are pre-populated using XML deserialization. Thanks, Rad

Xsd How to extend a choice complexType without sequencing the choice?

I have a choice complexType named abType: <xs:complexType name="abType"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="a"/> <xs:element name="b"/> </xs:choice> </xs:complexType> This type can be used to create elements with a and b nodes in any order like this for example: <ab> <b/> <a/> </ab> Now I want to create a derived type called abcType to allow the nodes a, b and c in any

Xsd Using Rally's REST API to retrieve User Stories for a project

I am tyring to retrieve the details of all User Stories for a specific project. I am using the REST URL: https://rally1.rallydev.com/slm/webservice/1.34/hierarchicalrequirement?project={Rally_REST_URL_for_the_project}&fetch=true I am using JAXB to unmarshal the XML response. However, the result consists of objects of type DomainObjectType and hence I cannot cast them into HierarchicalRequirementType - in fact the data pertaining to User Stories are not retrievable. Is there any other way o

Validate uniqueness of multiple attibute values in XSD

It's easier to state my question with an XML snippet below: <Hosts> <Host Ip1="1.2.3.4" Ip2="1.2.3.5" /> <Host Ip1="1.2.3.6" Ip2="1.2.3.4" /> ... <Hosts> Is there a way to validate with XSD that the values across all instances of Ip1 and Ip2 attributes are unique? For example, the second element above would fail validation since it's Ip2 value is a duplicate of the Ip1 value of the first element. Thanks! Pai-Hung

Xsd xs:attributeGroup value restriction

I have this xsd <xs:attributeGroup name="PropertyAttributes"> <xs:attribute name="IsAttached" type="xs:boolean" default="false" /> <xs:attribute name="IsStatic" type="xs:boolean" default="false" /> </xs:attributeGroup> I like to restrict this case IsAttached=true IsStatic=true How can I do this?

Xsd OSB "The dependency mapping is not configured in WSDL resource"

I'm using Oracles Service Bus (OSB) and I'm trying to use an XSD in my WSDL that has the following schemaLocation in its XSD import: schemaLocation="http://docs.oasis-open.org/wsn/br-2.xsd" My problem is that OSB is not able to resolve this dependency and gives me error : "The dependency mapping is not configured in WSDL resource". I'm able to do a work around by importing the XSD into the OSB project and use a relative path to the resource (schemaLocation="../myXSDs/br-2.xsd"), but I don

Mutually exclusive elements in XSD

I want to implement a relationship where "Rate" element should only exists when "ComponentInstId and "ComponentInstIdServ" are not present and vice versa. How can I do that in below xsd code? <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Request"> <xs:complexType> <xs:sequence> <xs:element name="Component"&g

Distribute XSD files over multiple Maven Artifacts

Here is a small Example of what I would like to achieve: Maven Artifact A is one of many Webservices and defines a XSD Schema with definitions for Requests and Responses. (src/main/resources/xsd) Artifact A depends on Artifact B wich is a simple JAR Project and contains a multitude of Master XSDs with low level Type descriptions. (src/main/resources/xsd) The XSDs in Artifact A use the type definitions (include) that are specified once in Artifact B. If at all possible I would really like t

xml element enumerated attribute and enumerated value in xsd

Of interest is the following xml child element: <optInItem type='MARKETING_EMAILS'>NO</optInItem> I'd like to enumerate possible values (assume 2 possible values) for attribute 'type' and enumerate possible values for the text value of optInItem (values could be Yes | No). I am starting with the following xsd but am not sure how to add in the two separate enumerations. <xs:element name="optInItem" maxOccurs="2" minOccurs="2"> <xs:complexType> <xs:sim

XSD and JAXB for sequence of repeating elements

I am creating a XSD to represent the following XML structure. <DETAILS> <REFERENCE></REFERENCE> <INFORMATION> <INFO> <KEY></KEY> <VALUE></VALUE> <KEY></KEY> <VALUE></VALUE> <KEY></KEY> <VALUE></VALUE> <KEY></KEY> <VALUE></VALUE> .....

XSD Design - One or more rule

I am designing a new XSD to capture points information from a business partner. For each transaction the partner must provide a value of points for at least one points type. I have the following: <xs:element name="Points"> <xs:complexType> <xs:sequence> <xs:element name="SKUPointsQty" type="xs:int" minOccurs="0"/> <xs:element name="WelcomePointsQty" type="xs:int" minOccurs="0"/> <xs:element name="ManualPointsQty" type="xs:int"

xsd sequence of any type of element that is an extension of specific complex type

Basically if this was .NET, it would look like this: ISomething { string A { get; } int B { get; } } var somethings = new List<ISomething>(); something.Add(new SomethingSomething()); something.Add(new AnotherSomething()); something.Add(new AnythingSomething()); Basically I want the sequence of elements to be named anything they want to be, as long as their complex type is an extension of a complex type I define. So it may look something like: <somethings> <something-so

Xsd what is the use of xsi:schemaLocation?

I see that we have multiple url's as value of this attribute like in spring: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> Why is it nee

Xsd Nillable SOAP headers

I would like to allow some of my SOAP header elements to be nillable. This is possible for body elements, but I am not sure if it is allowed from header elements. In the sample message below, I would like to allow the MessageDateTime to be null. <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://mycompany.com/repositoryserv

Xsd get all fields from DynamicForm

I use DataSource generated from xsd schema. I need to get all fields from DataSource, also nested ones. My problem is the same like in this topic from Smartclient forum forum, when I use DataSource.getFields() its return only first level fields. Does anyone know how can I get also nested fields?

Xsd Why does the W3C XML Schema specification allow integers to have leading zeros?

Recently I had an example where in a xml message integer fields contained leading zeros. Unfortunately these zeros had relevance. One could argue why in the schema definition integer was chosen. But that is not my question. I was a little surprised leading zeros where allowed at all. So I looked up the specs which of course told me the supertype is decimal. But as expected specification don't really tell you why certain choices where made. So my question is really what is the rationale for allow

XSD: How to have (A*|B*), C?, (A*|B*)

I have a XSD with XML elements A, B, and C. I would like these to appear in a parent element in this way: A and B can appear any times, C only once, optionally. The order does not matter, but A and B should ideally be "together", (so it's rather (A*), C?, (B*) | (B*), C?, (A*)), but the "A and B together" is not necessary). How can I achieve that with XSD? Actual XSD what I have tried: <!-- Hint --> <xs:element name="hint"> <xs:complexType mixed="true"> <xs

Xsd XML Schema multiple import effect

While looking at XML schema examples, I have seen the following case (in xml schema test suite, microsoft schema schG1_a/b/c.xsd): Conceptually, schema document A (target a) imports schema document B (target b) which in turn imports schema document C (target c). My reading of the schema specs is that A must directly import C in order to refer to anything in C (import is not transitive). It does not. This is not an issue because A itself does not refer to anything in C or even in B. It defines

Enterprise architect: Generate a list of Ids and not full instances in xsd

I want to model a container that has a list of references by id in enterprise architect. A xsd is generated from that model. <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Container" type="Container"/> <xs:complexType name="Container"> <xs:sequence> <xs:element name="Element" type="Element" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <

XSD: Restricting a substitutionGroup

It seems like it should be possible to restrict a substitution group to a single element in that group. Due to the handling of substitution groups and elements during validation, however, the intuition only applies to certain cardinalities. For example, the following schema is not valid: <xs:element name="representedOrganization" type="Organization"/> <xs:element name="scopingOrganization" type="Organization" substitutionGroup="representedOrganization"/> <xs:complexType name="T

Generating XSD from RelaxNG while keeping root-element restriction

I want to convert the following schema from RNC/RNG to W3C XSD. default namespace = "" namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" namespace rng = "http://relaxng.org/ns/structure/1.0" start = starting_risk starting_risk = element risk { element continents { Continents }? } Continents = element continent { Continent }+ Continent = element country { Country }*, element sea { Sea }* Country = xsd:string { minLength = "1" maxLength = "100" } Sea = xsd:string

Xsd XML-schema version 1.1 to Java-classes using xjc.exe

I am having trouble converting xsd-files to java-classes using the xjc command with XML version 1.1. I believe it is a known problem that xjc.exe and XML 1.1 are not very friendly towards each other. If there is no viable solution using xjc and XML-schema 1.1 then is there any similar solution for converting XML-schema 1.1?

Semantic difference between element and complexType in XSD

Given this XSD: <xsd:element name="ServiceList"> <xsd:complexType> <xsd:sequence> ... </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="ServiceList"> <xsd:sequence> ... </xsd:sequence> </xsd:complexType> What is kind of the semantic difference between these two? I.e. named elements and complexTypes which are direct children of a schema. The reason for me ask

XSD schema for Mandatory or Optional fields

If an element in an xsd is defined as below : <element name="test" minOccurs="0" maxOccurs="1" type="string" /> Does that mean that : 1. The tag can be completely removed the XML and still there won't be any validation errors OR 2. The tag can be empty/blank without any value Which is the best way/practice to define mandatory/optional elements. Thanks WN

Xsd Convert local element in global element declaration

I am looking to automate a method to replace local element declaration in global element declaration. Like this: <xs:schema> ... <xs:element name="aaa"> <xs:complexType> <xs:sequence> <xs:element name="bbb"> ....content bbb ... <xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ccc"> <xs:complexType> <xs:sequence> <xs:el

Copying .xsd code into a wsdl

I have a wsdl that includes a couple of import schema statements, as follows: <types> **<xsd:schema> <xsd:import namespace="http://quickfeedback.ws.cdb.skoda.vwg" schemaLocation="CDBQuickFeedbackService_schema1.xsd"/> </xsd:schema> <xsd:schema> <xsd:import namespace="http://common.ws.cdb.skoda.vwg" schemaLocation="CDBQuickFeedbackService_schema2.xsd"/> </xsd:schema>** I am using a tool (wsdl2rpg) that will create interfaces into the

Problem with restriction in xsd complex type inheritance

I have the a little problem with the xsd below. I have created a type of vaultobject with a type attribute that can have any value in a enumeration. Then I derived VaultServiceObject from vaultobject en set a restriction to limit type to a fixed value for the derived object. The editor (liquid-xml) design service seems to understand this and displays correctly, but the text editor marks the line 26 as and error. <xs:attribute name="Type" fixed="ServiceConfiguration" type=&

Xsd What is the size of special characters for facettes?

How are handle the special characters for length related facettes in an xml schema ? Are they one character, or the number with special form ? For instance, is < (&lt;) one character, or four characters ? if it is four characters, how is it possible to say to the users something like Excuse me, if you type < it's four characters ? Thanks.

How to get the white space in xsd?

Following is the code snippet : <xs:element name="A_Record"> <xs:complexType> <xs:sequence> <xs:element name="A8_Filler" type="xs:string" /> <xs:element name="A10_ReferenceNumber" type="xs:string" /> <xs:element name="A11b_EffectiveDate" type="xs:string" /> <xs:element name="A11c_Filler" type="xs:string" /> </xs:sequence> </xs:complexType>

Error in prolog when parsing xsd using xjc

I am getting "Error in Prolog" when parsing followinf xsd by xjc <?xml version="1.0" encoding="utf-16"?> <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="info"> <xsd:complexType> <xsd:sequence> <xsd:element name="a" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>

  1    2   3   4   5  ... 下一页 共 5 页