xml-schema

WCF, implementing a web services from an existing schema

I have to implement a SOAP web service that conforms to a (large) standard schema for the travel industry. Here's an example .XSD file: http://www.opentravel.org/2008B/OTA_HotelAvailRQ.xsd I think that rules out simply putting a [WebMethod] attribute to a method. How do you recommend implementing an existing schema using C#? PS: I'm u...

What namespace should I use for an XML schema?

I'm developing a custom XML schema for communicating data between application components. What do the SO folks consider a good (or, ideally, best) practice for selecting the URI for the namespace? Why? Some basic consideration: Our product has many components, and it's probably a good idea if the namespace indicates which component w...

One XML Schema for Multiple but similar XML files

How can I create one XML Schema that will work with multiple but similar XML files. For instance, for a Food Recipes website I have a recipe XML called 'dessert' another 'indian' and another 'vegetarian', they are all pretty much the same, the only thing that changes is the root element. Here's an example of a file: <?xml version="1.0" ...

XSD Visualization?

I've been working with a lot of semi-complicated XSD's lately and am wondering: What are some of the better tools for working with XML schema? Are there any graphical tools? Standalone or Eclipse-based are ideal as we aren't a .net shop. ...

XSD attributeGroup optional?

I have an attributeGroup defined in my XSD schema. From what I've read and tried out, there is no way I could specify the optionality of the usage of whole group (so that either all of the attributes are specified, or none), something like: <xs:attributeGroup name="NameDesc"> <xs:attribute name="n" type="xs:string" use="required"/>...

How do I validate a subset of content in an XML document when it can occur in any order?

Hi, I have a document with a bunch of elements under a single root element which has a few elements I care about, and want to validate; but those elements may occur anywhere in the document. There are also other elements that I don't want to validate; I don't care if they're there or what's in 'em. I tried the obvious thing, an XSD wi...

Can you prevent node insertion into an XmlDocument if it's invalid against the xsd?

I have a schema, and I have a document. I want to allow insertion of an xml fragment into that document, but, it must be valid according to the schema. Is it possible to do this in C#? ...

Problem with xml schema elements hierarchy

What's wrong with this xml schema? It doesn't parse correctly, and I can't realize a hierarchy between cluster(element)->host(element)->Load(element). <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; <xs:element name="cluster"> <xs:complexType> <xs:sequence> <xs:element ref="host"/> ...

Is there any free to use XSD (DTD) for Rx documents (drug prescription)

I'd like to explore and possibly use (reuse) open XML formats/schemes (DTD/XSD) for drug (medication) prescription documents (Rx) issued by medical doctors and later processed by licenced pharmacists and health insurance companies. Is there any such freely XSD available and what I have to take care when considering and incorporating int...

Validating xml nodes, not the entire document.

I'm working with some xml 'snippets' that form elements down the xml. I have the schema but I cannot validate these files because they are not complete xml documents. These snippets are wrapped with the necessary parent elements to form valid xml when they are used in other tools so I don't have much option in making them into valid xml ...

Equivalence of DTDs and XMLSchemas

Hi, I've always understood XMLSchemas and DTDs to be equivalent but that the latter is more cumbersome to use when modeling complex relationships (like inheritance). Recently I wanted to build a schema to validate documents that have a structure like this: <data> <array> <int></int> <int></int> </array> </array> <float><...

How to use SAXParseException effectively in Java

Hi, I'm validating against XMLSchema in Java, and getting SAXParseExceptions thrown when I have non-valid content models. I'm going to be using these exceptions to highlight where the validation has failed - but the SAXParseExceptions seem to be a little too low-level. For example, for a failure on an enumeration, I get the validity e...

Xml schema: empty targetNamespace

Is it legal to use no targetNamespace attribute or an empty one in an Xml schema? If so then what does it mean, are we "adding" something to the "empty namespace" (which always exists) or creating an "anonymous namespace" which is not related to other schemas? How would an instance xml document look like, do elements need to be explici...

Emded XHTML snippet in XML document, and validate against a schema

Essentially I want to embed some XHTML in an XML document that must validate against a custom schema. Full background: I have a webservice that consumes an XML document. This XML document is validated against a custom schema. The data in the XML is parsed and stored in a database, and displayed in a useful format on a website. The cus...

Tools to help me generate an xml schema for a mssql database?

I'd like to be able generate an xsd of my MSSQL database's structure. Are there any tools or libraries that help me to this? The VS designer for typed datasets come's close, but I'm looking for a programmatic approach. ...

Why would a schema make an XML column slower?

I have a table with an XML column. The documents are pretty large and numerous, and I've been trying various ways to improve the performance of basic queries. Because the documentation indicates that applying an XML Schema to the column can help SQL Server to optimize queries — and because one was available — I created a schema collect...

Schema Element definition with sub-elements in ANY order

Hello, I'm trying to create an element in a schema where its sub-types can appear in any order and as many times as necessary: <xs:element name="workflowNodes"> <xs:complexType> <xs:sequence minOccurs="0" maxPO> <xs:element ref="nodeType1" /> <xs:element ref="nodeType2" /> <xs:element ref="nodeType3" /> <xs:element r...

Evaluate accuracy of generated XML Schema

Hi, I found a few tools on the web which generate XML Schema for a given XML data instance. Something like - link text I'm also thinking of developing one, but I'm kind of confused with the evaluation of the generated schema. How can the schema generated be evaluated i.e. the schema generated confirms to the given data? Is there any ...

How to programmatically add and populate <xs:annotation> and <xs:documenation> tags in C#

I need to add some tags to an existing XML schema and write it to file. However, I need to add tags to every of the existing schema. What is the best way to accomplish it in C#? Thanks! I have the following code that parses the schema: /// <summary> /// Iterates over all elements in a XmlSchema and prints them out ...

Unique Particle Violations

I've been looking at this issue for too long. I suspect I'm missing something obvious because I'm overfamiliar with it. I have a schema that suffers from a unique particle violation error. I can see why but I've spent too long fiddling with it to be able to step back and solve the problem. How do I phrase this schema so that it can va...