xml-schema

How would create define an element in an XSD which has attributes and has restrictions

How to set enumeration restrictions for a complex type restriction?? i-e I want to define an element in the XSD such that it can have attributes and has restrictions. ...

XML+XSD (pay1+ | pay2* | pay3* | pay4*)+

I'm trying to construct a xsd scheme to validate a xml. The xml is: <payments> <pay3>5.1</pay3> <pay1>1</pay1> <pay2>50</pay2> <pay3>2</pay3> </payments> Tags <pay2>, <pay3> and <pay2> are optional and <pay1> is mandatory. All the <payX> tags may occur in any order and more than once or not to occur (except for <pay1>). So far...

How can I mix and match custom Spring schema types with traditional Spring schema types?

Let's say I have a class Person with properties name and age, and it can be configured with Spring like so: <beans:bean id="person" class="com.mycompany.Person"> <beans:property name="name" value="Mike"/> <beans:property name="age" value="38"/> </beans:bean> I'd like to have a custom Spring schema element for it, which is easy to ...

XML Schema - How do I model many-many relationships (i.e. Photos/Tags)

I need an XML schema for Albums/Photos/Tags where Photos & Tags have many-many relationships. I'd like to have a generalized xml schema solution for the following: 1 container (Album) of PhotoType elements, and 1 container (Tags) of TagType elements. 1 instance document with only a single occurance of Photo/Tag element data But how...

How to make any tag mandatory in xml schema

My xml tag is given below <ADCNT> <EM> <RUID> </ADCNT> I can make EM tag as mandatory also the same thing I can do with RUID by providing minOccurs = 1 (<EM minOccurs=1>). But I want if both of them are not present then do not validate the xml against schema. If any one of them is present then validate the xml against sche...

Is there a way to allow 'this' attribute or 'this other' attribute, but not both?

I am trying to allow for two attribute values for one element. This is how I have it done now, but I only want to allow 1 of the 2, but not both. <contact phoneH="cell">8025550000</contact> <contact phoneW="work"> 8025550094</contact> I am looking to be able to do something like this: <xsd:attribute name="phoneH|phoneW" type="xsd:st...

How should I refactor a long chain of try-and-catch-wrapped speculative casting operations

I have some C# code that walks XML schemata using the Xml.Schema classes from the .NET framework. The various simple type restrictions are abstracted in the framework as a whole bunch of classes derived from Xml.Schema.XmlSchemaFacet. Unless there is something I've missed, the only way to know which of the derived facet types a given fac...

schemagen.exe doesn't skip @XmlTransient annotated class

I annotated a XmlAdapter class like so: @XmlTransient public class DateTimeXmlAdapter extends XmlAdapter<String, DateTime> { but schemagen.exe generates <xs:complexType name="xmlAdapter" abstract="true"> <xs:sequence/> </xs:complexType> so does't skip the class, which was what I expected. XmlAdapter indeed is an abstract clas...

schemagen.exe generates a tns prefix

The tool schemagen.exe generates xsd definitions from classes, e.g. the result is <xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="aa/bb" xmlns:a="aa/bbb" xmlns:tns="aa/bb" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; when I put in package-info.class on the package level: @XmlSchema(namespace = "aa/bb", ...

Is DTD or XML schema better?

What are the pros / cons in DTD and XML Schemas (I'm not even sure what the official name of the latter is!)? Which is better? Why do we need two ways to do the same thing? Seems dumb, IMHO. :) Thanks, LES Edit: I found this in an article I was reading, which is what prompted me to ask the question: Why W3C XML Schema Language? ...

Represent script source code in XML

Are there any resources on how to represent (script) code in XML? Libraries, XML schema definitions for this? What I want to try is to generate a XML representation of (at first) simple script code (such as Bash shell scripts). So I would need support for variables, if/else, loops. Later on I want to be able to write language-independen...

Use XML Schema to extend an element rather than a complexType

Suppose I have some schema: <xsd:schema ...> <xsd:element name="foo"> <xsd:complexType> <xsd:sequence> <xsd:element name="fooElement" type="xs:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> This defines some element foo which has inside it...

Warning in XML Editor on Typed DataSet ".XSC" File

It all about a typed Dataset... The 'urn:schemas-microsoft-com:xml-msdatasource:DataSetUISetting' element is not declared <?xml version="1.0" encoding="utf-8"?> <!--<autogenerated> This code was generated by a tool. Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. </autogener...

children element with namespace prefix were considered invalid by xerces

I use xerces to valid a xml instance against schema: parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", true); parser.setProperty("http://apache.org/xml/properties/schema/external-schemaL...

How to specify (XSD) element has sub tag or simple content - but not both

Edit: This is not a dupe of my last question as I didn't want to do both at the same time anymore. I want to specify that my setting node has either : <setting name='Some Setting'> SomeData </setting> schema is : <xs:element name="setting"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:...

Free DTD to XSD conversion utility?

I have a DTD that I need to convert to an XSD (XML schema) file. Is there a free utility or simple way to accomplish this? ...

How do i validate XML against a schema (php or perl or possible C++)

I need to take in XML and validate it against a schema file. Afterward i must call a function based on the command (example updateContactList). What is the best way to do this? I am worried about validating the XML (and report errors) and i have no idea what is the best way to put the data into a function to run -edit- NOTE: By validati...

How to attach an xsd file to xml in .net?

I have one xsd file having definition of two tables suppose A and B, and i want to create two files as A.xml and B.xml. When i enter the data in these xml files data should validate with xsd My question is how can i validate the data while entering data in xml file? ...

Validate a remote schema (http) with include schemas and specific proxy server settings

Validate a remote schema (http) with include schemas and specific proxy server settings I can access the schemas on the other server via http, it resolves the include schemas (.xsd), no problem. I guess it uses the proxy server settings from Internet Explorer. However, for this to work on other machines I need to be able to specify th...

XML DTD/Schema validation maven plugin

Does anyone knows maven plugin that validate xml documents against DTD or Schema and generates reports? ...