xsd

Webservice proxy class generation

I include the below xsd file: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="http://www.xxxx.com/schemas/2005/06/messages" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.xxxx.com/schemas/2005/06/messages" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; <xs:include schemaLocation...

How to exclude an enumeration value in XML file using XSD?

Is it possible to specify the value of a tag or attribute should not be like some_value ? I have a strange requirement, where the xsd isn't aware of the values being sent to it. The value of that particular tag can be a string with any value except one value ( say data_migration). The sender should be acknowledged with the error, if t...

Iterate through deserialized xml object

I have a deserialized xml c# objet. I need to iterate through the oject to display all items, in this case there's just one, and display the name, colors and sizes for each item. The xml: <?xml version="1.0" encoding="utf-8"?> <Catalog Name="Example"> <Items> <Item Name="ExampleItem"> <Colors> <Color Name="Black" Va...

Defining recursive algebraic data types in XML XSD

Imagine I have a recursive algebraic data type like this (Haskell syntax): data Expr = Zero | One | Add Expr Expr | Mul Expr Expr I'd like to represent this in XML, and I'd like an XSD schema for it. I have figured out how to achieve this syntax: <Expr> <Add> <Expr> <Zero/> </Expr> <...

Getting started with XSD validation with .NET

Here is my first attempt at validating XML with XSD. The XML file to be validated: <?xml version="1.0" encoding="utf-8" ?> <config xmlns="Schemas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <levelVariant> <filePath>SampleVariant</filePath> </levelVariant> <levelVariant> ...

large XSD validation with PHP - performance problem

Hallo, I have a very long XSD scheme. And the validation process (via PHP) is taking 10 seconds. Do you have some ideas how I can improve performance? The XSD file is not changes often, but I can not change it, it is external. the XML validated is about 500 lines. Any ideas on XSD validation performance? Thanks. ...

xsd:keyref from hierarchical nodes structure

I try to refer with an xsd:keyref from within a node/subnode structure to a global table that is child of the xml root element. Here is an example xml <?xml version="1.0" encoding="UTF-8"?> <Root xmlns="http://www.example.org/keyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/keyTe...

Generate XSD from my model

I am writing a WCF REST service, and I am needing to generate my XSD's which provide the information for my models. What is the easiest way of doing this? It would be nice to have it generate the validation within the XSD too, if possible? ...

XML Schema to restrict one field based on another

I have the following schema, which I use to ensure that a person's PhoneNumber and PhoneNumberType (Home, Work, etc.) is not longer than 10 characters. However, I want to improve this schema so that PhoneNumberType is not required if a PhoneNumber is not provided, but is required if the PhoneNumber is provided. Is there a way to do this ...

w3schools xsd example won't work with dom4j. How do I use dom4j to validate xml using xsds?

I am trying to use dom4j to validate the xml at http://www.w3schools.com/Schema/schema_example.asp using the xsd from that same page. It fails with the following error: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'shiporder'. I'm using the following code: SAXReader reader = new SAXReader(); reader...

Automatically extracting inline XSD from WSDL into XSD file(s)

I am using a third party Web Service whose definition and implementation are beyond my control. This web service will change in the future. The Web Service should be used to generate an XML file which contains some of the same data (represented by the same XSD types) as the Web Service plus some extra information generated by the progra...

XMlSerialization is not serializing a Datetime

When I serialize an object which has a DateTime in it this is returning empty in the XML string. Please see below for my XSD, serializable class generated from the XSD, and serialization helper class which handles the serialization of the XSD. XSD: <?xml version="1.0" encoding="utf-8"?> <xs:schema id="test" xmlns="" xmlns:xs="ht...

xml schema and vb.net

I have a xml schema file that was supplied by a vendor. At the root, the file has three main elements: Customer, ShipDate, and Items. Once I have added the XSD file to my project, I am not able to access the ShipDate attribute. I am not sure how to handle this. I tried creating a new element for the ShipDate similar to the other elements...

How to generate several versions of Java classes generated by JAXB ?

Hello, I recently generate two versions of Java classes generated by JAXB. So I get two packages : V1_0 and V2_0 I notice that I have only one ObjectFactory generated. The problem is that this ObjectFactory is specific to a version (here it's specific to my version v1_0). So the question is : Could I configure JAXB to allow to make on...

XML Schema: Restricting the valid type of an element to a subset of types derrived from an abstract type

I have the following type structure: Foo (abstract) Bar extends Foo Baz extends Foo Bar1 extends Bar Baz1 extends Baz I have two elements I'd like to restrict the types of: Is this possible in XSD? ...

Flattening XSD schema documents (HR-XML 3.0)

I have several "main" XSD documents, which import "supporting" XSD documents. These schema documents happen to be from the HR-XML 3.0 specification, in particular related to Background Screening. For the purposes of code-generation and convenient single-file schema to reference in my WSDL, I am trying to "flatten" the schema. The import...

Looking for a free xsd scheme editor

I'm looking for a free alternative to all the XML/XSD editors around here (that are relatively expensive--at least for me). I totally fail to find one. I need it to allow me to edit xsd files to help in writting an xml-based language specification. I need it to be visual to help with the design, making it clear. Other features are less ...

How do I substitute an xsd when using dom4j?

I'm using dom4j to load an xml file which references an xsd. If the xml file references the xsd http://foo/bar.xsd, how can I tell dom4j to instead use an xsd file located in the classpath? I was hoping that I could open an inputstream to the local xsd and then pass that to dom4j to use when it encounters that url. The next best thing w...

Find elements based on xsd type with lxml

I am trying to get a list of elements with a specific xsd type with lxml 2.x and I can't figure out how to traverse the xsd for specific types. Example of schema: <xsd:element name="ServerOwner" type="srvrs:string90" minOccurs="0"> <xsd:element name="HostName" type="srvrs:string35" minOccurs="0"> Example xml data: <srvrs:ServerOwner...

What is the correct syntax for XSD to restrict attrributes values in the elements list?

What is the correct syntax for XSD schema to define the following restriction: In the list of elements we have to specify that attribute can contain value of "c" unlimited number of times, but value of "b" - the zero or only one time. For example, the correct xml looks like this: <root> <elem atr="c">111</elem> <elem atr="c">222</elem...