473,387 Members | 1,512 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.

XSD Validation Errors of an XML File

Problem: I've designed a XSD of which I wish to validate a valid XML
file. However, I cannot seem to get the .xsd to align properly with
the .xml file. Here are my source files:

album.xsd:

<?xml version="1.0" encoding="iso-8859-1"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:marist="http://www.marist.edu/msis517"
targetNamespace="http://www.marist.edu/msis517"
elementFormDefault="unqualified">

<complexType name = "AlbumType">
<sequence>
<element name = "photo" type = "marist:PhotoType" minOccurs = "1"
maxOccurs = "unbounded" />
</sequence>
</complexType>

<complexType name = "PhotoType">
<sequence>
<element name = "title" type = "string" />
<element name = "filename" type = "string" />
<element name = "width" type = "integer" />
<element name = "height" type = "integer" />
</sequence>
<attribute name = "id" type = "integer" />
</complexType>

<element name="album" type="marist:AlbumType" />

</schema>

album.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<album xmlns="http://www.marist.edu/msis517">
<photo id="1">
<title>Jason and I Egging Houses</title>
<filename>egging1996.jpg</filename>
<width>640</width>
<height>480</height>
</photo>
<photo id="2">
<title>Senior Prom 1999</title>
<filename>prom1999.jpg</filename>
<width>768</width>
<height>1024</height>
</photo>
<photo id="3">
<title>Marist Bowling Championships</title>
<filename>mbowlchampionships2001.jpg</filename>
<width>1280</width>
<height>1440</height>
</photo>
<photo id="4">
<title>WWE Live Event - Edge</title>
<filename>wwepoughkeepsie-edge.jpg</filename>
<width>2140</width>
<height>2820</height>
</photo>
<photo id="5">
<title>WWE Live Event - Batista</title>
<filename>wwepoughkeepsie-batista.jpg</filename>
<width>2140</width>
<height>2820</height>
</photo>
</album>
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 12 '05 #1
1 1243
Hi,

One problem I see is that you are using elementFormDefault="unqualified" in
your schema, and using a default namespace declaration in your XML document.
This combination does not work.

You should either:
(1) change it to elementFormDefault="qualified", OR
(2) change your XML document to use a prefix for the namespace, and only
prefix the album element, as in:

<pre:album xmlns:pre="http://www.marist.edu/msis517">
<photo id="1">
<title>Jason and I Egging Houses</title>
......
</pre:album>

Hope that helps,
Priscilla
------------------------------------------------------------------
Priscilla Walmsley http://www.datypic.com
Author, Definitive XML Schema / XML in Office 2003
------------------------------------------------------------------

"Stryker227" <St********@yahoo-dot-com.no-spam.invalid> wrote in message
news:42********@127.0.0.1...
Problem: I've designed a XSD of which I wish to validate a valid XML
file. However, I cannot seem to get the .xsd to align properly with
the .xml file. Here are my source files:

album.xsd:

<?xml version="1.0" encoding="iso-8859-1"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:marist="http://www.marist.edu/msis517"
targetNamespace="http://www.marist.edu/msis517"
elementFormDefault="unqualified">

<complexType name = "AlbumType">
<sequence>
<element name = "photo" type = "marist:PhotoType" minOccurs = "1"
maxOccurs = "unbounded" />
</sequence>
</complexType>

<complexType name = "PhotoType">
<sequence>
<element name = "title" type = "string" />
<element name = "filename" type = "string" />
<element name = "width" type = "integer" />
<element name = "height" type = "integer" />
</sequence>
<attribute name = "id" type = "integer" />
</complexType>

<element name="album" type="marist:AlbumType" />

</schema>

album.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<album xmlns="http://www.marist.edu/msis517">
<photo id="1">
<title>Jason and I Egging Houses</title>
<filename>egging1996.jpg</filename>
<width>640</width>
<height>480</height>
</photo>
<photo id="2">
<title>Senior Prom 1999</title>
<filename>prom1999.jpg</filename>
<width>768</width>
<height>1024</height>
</photo>
<photo id="3">
<title>Marist Bowling Championships</title>
<filename>mbowlchampionships2001.jpg</filename>
<width>1280</width>
<height>1440</height>
</photo>
<photo id="4">
<title>WWE Live Event - Edge</title>
<filename>wwepoughkeepsie-edge.jpg</filename>
<width>2140</width>
<height>2820</height>
</photo>
<photo id="5">
<title>WWE Live Event - Batista</title>
<filename>wwepoughkeepsie-batista.jpg</filename>
<width>2140</width>
<height>2820</height>
</photo>
</album>
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ewan B | last post by:
Hi, I'm using Xerces to parse XML files using SAX2, and am wondering if there is any information as to what exceptions are being thrown when certain validation errors occur. Taking a simple...
2
by: Keith Russell | last post by:
Hi. I am trying to learn a little bit of XML (and XHTML), using "XHTML Black Book" by Steven Holzner. I am getting numerous validation errors from the XML examples in the book. I have tried...
3
by: CJM | last post by:
I'm adding some extra features to an intranet-based ASP application...(IE6 clients) As part of the process, I thought I would give the html a mid-life upgrade, ie. remove much of the tag-soup,...
2
by: Sudip Chakraborty | last post by:
Is there a way to see constraint validation errors while loading xml into a DataSet ? I'm interested in the line number in the xml file which is causing the error. I've enclosed the relevant stack...
1
by: Prodika | last post by:
With the 1.0 Framework, I've worked out using the XmlValidatingReader. Since I'm using the validation errors as feedback to the end user, I'm hoping to get away from techy messages such as "The...
1
by: Alan Silver | last post by:
Hello, I have a site that uses master pages. To enable simple switching of the master page, and to avoid potential inconsistencies between pages, I set the master page file in the web.config...
7
by: jimrich | last post by:
Hi, using firefox browser and have a FrontPage built site: www.irenezart.com. used W3C markup validation service which came up with lots of errors in my index page. then I changed the doctype...
3
by: hardieca | last post by:
Hi, I've created an n-tier app where validation rules reside in the business layer. When a webform is saved, a business object examines its state, and if some property is invalid, throws a...
4
by: Lit | last post by:
Hi, I have a web page that does not fit all on the screen vertically. At the bottom I have a submit button, When I click on the Submit button and have Validation Errors at the top. the...
0
by: kenkejas | last post by:
Hello public, Got a problem. While generating proxy classes getting warnings: Schema Validation Errors: Error compiling schema. WSDL descriptor is public:...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.