473,320 Members | 1,848 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,320 software developers and data experts.

Xml Schema: won't validate

Can someone help me with this? I keep double checking my schema layout
and it looks like my implementation is correct... yet it must not be.

I have the following schema which is invalid (Says: C:\Work\WIMAR
XML\WIMARKeyedText.xsd(7): Type 'ImageHeaderType' is not declared. An
error occurred at C:\Work\WIMAR XML\WIMARKeyedTexttest.xsd, (12, 6).
):
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="project" elementFormDefault="qualified"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Roll">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="ImageHeader" type="ImageHeaderType" />
<xs:element name="RD" type="RDType" />
</xs:choice>
<xs:attribute name="number" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="WI_M_\d{1,3}" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:complexType name="ImageHeaderType">
</xs:complexType>
<xs:complexType name="RDType">
</xs:complexType>
</xs:schema>
Nov 12 '05 #1
2 2250
You must declare "project" as the default namespace in your schema. Just add
a xmlns="project" attribute on the xs:schema element like:

<xs:schema targetNamespace="project" elementFormDefault="qualified"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="project">
"George W." <us**@example.net> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
Can someone help me with this? I keep double checking my schema layout
and it looks like my implementation is correct... yet it must not be.

I have the following schema which is invalid (Says: C:\Work\WIMAR
XML\WIMARKeyedText.xsd(7): Type 'ImageHeaderType' is not declared. An
error occurred at C:\Work\WIMAR XML\WIMARKeyedTexttest.xsd, (12, 6).
):
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="project" elementFormDefault="qualified"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Roll">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="ImageHeader" type="ImageHeaderType" />
<xs:element name="RD" type="RDType" />
</xs:choice>
<xs:attribute name="number" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="WI_M_\d{1,3}" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:complexType name="ImageHeaderType">
</xs:complexType>
<xs:complexType name="RDType">
</xs:complexType>
</xs:schema>

Nov 12 '05 #2
Awesome! Thank you much!

Zafar Abbas [MSFT] wrote:
You must declare "project" as the default namespace in your schema. Just add
a xmlns="project" attribute on the xs:schema element like:

<xs:schema targetNamespace="project" elementFormDefault="qualified"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="project">
"George W." <us**@example.net> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
Can someone help me with this? I keep double checking my schema layout
and it looks like my implementation is correct... yet it must not be.

I have the following schema which is invalid (Says: C:\Work\WIMAR
XML\WIMARKeyedText.xsd(7): Type 'ImageHeaderType' is not declared. An
error occurred at C:\Work\WIMAR XML\WIMARKeyedTexttest.xsd, (12, 6).
):
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="project" elementFormDefault="qualified"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Roll">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="ImageHeader" type="ImageHeaderType" />
<xs:element name="RD" type="RDType" />
</xs:choice>
<xs:attribute name="number" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="WI_M_\d{1,3}" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:complexType name="ImageHeaderType">
</xs:complexType>
<xs:complexType name="RDType">
</xs:complexType>
</xs:schema>


Nov 12 '05 #3

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

Similar topics

4
by: Jari Kujansuu | last post by:
I can successfully parse XML document using SAX or DOM and I can also validate XML document against schema. Problem is that my program should deal with user-defined schemas which means that when...
1
by: Don Adams | last post by:
I don't think what I want to do with maxInclusive is possible, but I thought I'd ask others what they thought. As an example, here is some very simple XML: <birthday_cake>...
8
by: UndoMiel | last post by:
Hi, I am looking for a way to validate IP addresses using XML Schemas. The following is what i used: <xsd:simpleType name="IPType"> <xsd:restriction base="xsd:string"> <xsd:pattern...
1
by: Dan Bass | last post by:
There's an XML message I have, that has no namespace information. Then there is a XSD schema that is must validate against, but this has a targetNamespace and xmlns of...
6
by: LesleyW | last post by:
Hi Apologies if this is a really dumb question, but being new to XML and Schemas, I wonder if giving the namespace for eg xsd or xsi as a website address means that the user has to be online...
1
by: amir | last post by:
Hi, When compiling a page in VS2005 this morning I received 101 messages regarding schema problems in my web.config file. When I go to view an aspx page in my IIS, IE just displays a blank...
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...
3
by: Eric Lilja | last post by:
Hello again, I'm having a new problem converting a dtd to an xml schema. This once is a little bit more complicated than in my previous question. The following file validates correctly: <?xml...
1
by: JoeZ | last post by:
Hi all, I am using XMLValidatingReader to validate xml instance against schema. Now my question is: in the schema, it has the target name space. In the instance, it doesn't have the name...
4
by: syed.akhlaq | last post by:
Hi, Does anyone know how can I validate XPath expressions using xsd schema? Thanks
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.