Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / October 2006

Tip: Looking for answers? Try searching our database.

Attribute targetNamespace does not match the designated namespace

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fedrok - 27 Oct 2006 14:55 GMT
Hi you all.
I've got a problem validating an XML file using the following Schema (I'll
post only the beginning of this):

----------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://tempuri.org/ae" elementFormDefault="qualified"
targetNamespace="http://tempuri.org/ae"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="FileContratti">
   <xs:complexType>
  .... (to be continue)...
----------------------------------------------------------------------------

The header of the XML file to validate is the following:
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<FileContratti CodiceFiscaleFornitore=""
CodiceFiscaleConto="a1" CodiceUfficio="" ValutaPrelievo="1">
  ...(omitted)... ...
</FileContratti>
----------------------------------------------------------------------------

The XML parser arises an error:

----------------------------------------------------------------------------
System.Exception ---> System.Xml.Schema.XmlSchemaException:
The attribute targetNamespace does not match the designated namespace URI.
An error occurred at file:///C:/tmp/schema.xsd, (2, 2).
----------------------------------------------------------------------------

Does anything miss in the declaration/header of the XML file?
What's the problem?
Can anybody help me?

Thx!

Signature

fedrok

Martin Honnen - 27 Oct 2006 17:01 GMT
> <xs:schema xmlns="http://tempuri.org/ae" elementFormDefault="qualified"
> targetNamespace="http://tempuri.org/ae"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="FileContratti">

> <FileContratti CodiceFiscaleFornitore=""
> CodiceFiscaleConto="a1" CodiceUfficio="" ValutaPrelievo="1">

You need e.g.
  <FileContratti xmlns="http://tempuri.org/ae"

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

fedrok - 27 Oct 2006 17:13 GMT
Hi Martin.
Thanks for your attention.

I've tried what you suggest before my first post, but nothing was changed!
Any other suggestion?

:-((

Signature

fedrok

Martin Honnen - 28 Oct 2006 13:12 GMT
> I've tried what you suggest before my first post, but nothing was changed!
> Any other suggestion?

Can you show us the code that performs the validation? The error message
sounds a bit as if you use the API to set the schema namespace but
mistakenly set a different namespace than the schema's targetNamespace
attribute defines.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

fedrok - 30 Oct 2006 10:02 GMT
Marvellous!
I solved with your last suggestion.
The problem was I didn't specify the URI in the validation process!

Now all works!

Thank you very much!

Signature

fedrok

> > I've tried what you suggest before my first post, but nothing was changed!
> > Any other suggestion?
[quoted text clipped - 3 lines]
> mistakenly set a different namespace than the schema's targetNamespace
> attribute defines.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.