xml-schema

empty namespace in inline xml literal - how to remove xmlns?

I am trying to use xml documents to store data for a movie database, but am having an issue, I am new to using xml for documents and have been using tutorials and MSDN to figure it out but I am stuck thanks in advance here is the code I am using Imports <"...\movies.xml"> Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e...

xml validation: validating a URI type

I'm using python's lxml to validate xmls against a schema. I have a schema with an element: <xs:element name="link-url" type="xs:anyURL"/> and I test, for example, this (part of an) xml: <a link-url="server/path"/> I would like this test to FAIL because the link-url doesn't start with http://. I tried switching anyURI to anyURL but...

How to create a schema for an unordered list of XML nodes, with occurance constraints.

Given an XML layout like this, I'm trying to create a XSD schema to validate it. <RootNode> <ChildA /> <ChildC /> <ChildB /> <ChildB /> <ChildA /> </RootNode> The requirements are as follows: ChildA, ChildB and ChildC may occur in any order. (<xs:sequence> unsuitable) ChildA is mandatory but may occur multiple times. Child...

how to make an attribute unique in xml schema?

i wanna make an attribute of an element to be unique like primary key. how to make it? ...

Create an XSD example - Hours of Operation - One of Several Types

An example of some XML that could be sent: <hours-of-operation> <monday hourType="custom"> <open unit="AM">9:00</open> <!-- open/close or closed or 24hour --> <close unit="PM">5:00</close> </monday> <tuesday hourType="closed" /> <wednesday hourType="24hour" /> <thursday hou...

How do I extend a base schema with custom elements while remaining open to change from new versions?

Given an XSD as follows: <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:std="http://..." targetNamespace="..."> <xs:element name="SomeRootNode" type="std:SomeRootNodeType" /> ... </xs:schema> that defines some elements which allow any child from a dif...

Validating XML in Perl with libxml and an XSD file

I am trying to have my perl script get an Xxml file from online and validate it according to an XSD file. The code to do this is as follows: my $url = shift @ARGV; my $response = $ua->get($url) || die "Can't fetch file"; my $file = $response->content; my $schema_file = "schema.xsd"; my $schema = XML::LibXML::Schema->new(location => $s...

How to add attributes to xml using XmlDocument in c# .net CF 3.5

Hi, I need to create an attribute "abc" with the prefix "xx" for an element "aaa". The following code adds the prefix but it also adds the namespaceUri to the element. Required Output: <mybody> <aaa xx:abc="ddd"/> <mybody/> My Code: XmlNode node = doc.SelectSingleNode("//mybody"); XmlElement ele = doc.CreateElement("aaa"); X...

How do I require that an element contain character data using XML Schema

If I have an xml document, for example: <colors> <color1>1452</color1> <color2></color2> <color3></color3> </colors> I want to define in an XML schema, that the color1 element must contain a value of type int, be non null, and non empty. So the above example would be valid, but if color1 was empty like color2 and ...

Inclusive and ordered/unordered definition of an XML element's children using RELAX NG compact syntax

I want to use RELAX NG compact syntax to validate an XML element whose children are one, two, three or n of a set of n specific elements. For instance, if the element is 'Layout' and there is a set of three specific elements: 'top', 'center' and 'bottom', the following XML element definitions would be valid: <Layout> <top/> <cen...

Using xs:extension & xs:restriction together?

While writing an XML schema, I am attempting to do something like this <xs:complexType name="ValueWithUnits"> <xs:simpleContent> <xs:extension base="xs:double"> <xs:attribute name="uom" fixed="second"/> <xs:minInclusive="0"/> <xs:maxInclusive="10"/> </xs:extension> </xs:simpleC...

(FInite State Machine) - Implementing a XML schema validator in javascript

Hello, I have been working on a project for a month or so now to develop a XML validator (XSD) in javascript. I have gotten really close but keep running into problems. The only thing I have working well is normalizing schema structures into FSA that I store in the DOM. I have tried several methods to validate my xml structures agains...

How to make a reference to others elements name ?

Hi, i have a xsd element like this : A sub element 1 sub element 2 ... sub element N This A element is retun by a webservice. I'm looking for a way to tell in the request to the webservice that i want the element A with NOT the full list but with somes of his sub elements. For example : just A with sub element 1 an...

How to extend simpleType string to add new value (enumeration) ?

i have multiple schema files : base.xsd <xs:simpleType name ="PropertyNameType"> <xs:restriction base="xs:string"> <xs:enumeration value="UniqueID" /> <xs:enumeration value="Name" /> </xs:restriction> </xs:simpleType> Now how to add enumerations list to same type in A.xsd <xs:redefine schemaLocation="base.xsd...

xml schema generation from xls

I have a .xls file, how can i define a .xsd file from that? is there any way or any tools available. ...

How should I use Stax2 Validation API against a W3 Schema

I am using com.ctc.wstx.stax.WstxOutputFactory to generate XML. I am running wstx-asl-3.2.4 I need to start validating the generated XML against a W3 Schema. When I create an instance of org.codehaus.stax2.validation.XMLValidationSchemaFactory like this private final static XMLValidationSchemaFactory xsdFact= XMLValidationSchemaF...

Graphing / Visualising XML file structure.

I'm doing some research with large XML based datasets, and I wanted a simple way to get my head around the (vague and almost obfuscated) data structures but graphing the xml nodes. I was going to write a perl script that would re-parse the xml into a GraphViz Dot compatible file, but before I dive into that; anyone got any better ideas?...

Unable to locate Spring NamespaceHandler for XML schema namespace [http://jboss.org/xml/ns/javax/validation/configuration]

I am using spring 3, hibernate validator 4. My unit test is running fine. But i am getting this(see below) for my functional test, have i miss out some dependencies? Dependencies i had added for hibernate validator: validation-api-1.0.0.GA.jar hibernate-validator-4.0.2.GA.jar Here's my the content of validation.xml: <?xml version="...

XmlSerializer.Deserialize - ignore unnecessary elements?

Hi, I've got an XSD schema which I've generated a class for using xsd.exe, and I'm trying to use XmlSerializer.Deserialize to create an instance of that class from an XML file that is supposed to conform to the XSD schema. Unfortunately the XML file has some extra elements that the schema is not expecting, which causes a System.InvalidOp...

XML schema - complex validation

Given is following XML file: <root> <customers> <customer name="CustomerA" orders="111,222" /> </customers> <orders> <order ID="111"> <description text="Some bananas ..." /> </order> <order ID="222"> <desciption text="good coffee" /> </order> </orders> </root> Now I want to validate the ord...