473,387 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Simple XML Schema validation

I am relatively new to XML Schema and have a question about validation. I want to create a Schema to validate a huge customer XML files that we get. I do not have control over the entire XML document, but there are some specific elements I want to validate.

For eg. In the XML document, I want to validate all <Customer> elements, and within <Customer> element I want to make sure there is a couple of important elements: <Name>, <Age>, <City>, <ZipCode>. I do not care about any other elements, text, attributes etc under <Customer>. It seems to me that schema is very heavy weight and does not give me flexibility to specify only required elements.

Please let me know your thoughts.
May 1 '07 #1
3 2383
dorinbogdan
839 Expert 512MB
Welcome to TheScripts TSDN....

It seems not very complicate.
I'd recommend to take a look at this easy XSD tutorial. It will answer better your questions in about 30 min.

Dorin.
May 2 '07 #2
Thanks for your response. I have tried various options under Schema and it seems to me that I cannot express my requirement with Schema. I would like to validate my understanding.

I am interested in validating an element that has a set of sub elements:

Eg. element <Top> "must" have one occurrance of elements <a>, <b>, <c>, <d>. I do not want any other restriction on <Top> ie)

<Top><fish><a/><car><b/><c/><car><d/><Top>
<Top><fish><c/><motor><b/><a/><car><d/><Top>
<Top><fish><c/><motor><d/><a/><car><b/><Top>
...
...

All these are valid. <a>, <b>, <c>, <d> must be child elements of <Top> in any order. And <Top> can have any other elements.

I do not see a way to express this under XSchema. Please let me know if I am missing something
May 2 '07 #3
dorinbogdan
839 Expert 512MB
Please try yourself to write and play with a schema, and then come back for further help.
We will not write full source code, this is against site rules.
But we'll give suggestions and small code snippets whenever is possible.

Thanks,
Dorin.
May 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mike | last post by:
Note: My XML experience to date has (unfortunately) been limited to reading and thinking, rather than implementation. Anyway, I am in the process of trying to figure out the most efficient way...
2
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For...
2
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data....
2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
0
by: Mark Parter | last post by:
I'm trying convert an XML Schema (http://www.elframework.org/projects/xcri/efc_r1.0.xsd/view) to a VB.Net class using the XSD tool provided with the .NET 2 SDK. However, it's failing to generate...
3
by: Chris Lieb | last post by:
I am new to XML Schema and am running into a bit of a snag. I have defined an XML-based scripting language for an updater program that I am working on. I would like to make a schema for this...
2
by: Mark | last post by:
Hi... I've been trying the .Validate() method on the XmlDocument to validate some xml against a schema, but one thing I noted was that unless the document explicitly declares the schema as a...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
3
by: Eric Lilja | last post by:
Hello, this is an xml-file with a nested DTD. It validates, test-1- with-dtd.xml: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE persons > <persons> <person name="Eric Lilja" /> </persons>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.