Solved

XML validation error: Description: TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of ...

Posted on 2009-05-19
3
1,914 Views
Last Modified: 2012-05-07
Hello,

The following error is reported in Oxygen XML but the parser does successfully validate my XML document against the given XSD:  "Description: TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'http://schemas/jupiter'."

Otherwise it appears to work. If I change noNamespaceSchemaLocation to schemaLocation the error changes to "There is no schema or DTD associated with the document" and the validation stops working. It appears that not using a namespace is not an option because the type used to validate the currency-short-name must be qualified with a namespace.

I would like this error to go away and ultimately have this properly defined.

Thank you,
Peter
Jupiter.xsd
 

<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:jupiter="http://schemas/jupiter"

   targetNamespace="http://schemas/jupiter"

   elementFormDefault="unqualified" attributeFormDefault="unqualified">

   <simpleType name="currency-short-name-type">

      <restriction base="string">

         <enumeration value="EUR"/>

         <enumeration value="USD"/>

         <enumeration value="GBP"/>

         <enumeration value="CHF"/>

         <enumeration value="ON_EUR"/>

         <enumeration value="ON_GBP"/>

      </restriction>

   </simpleType>

   . . .

   <element name="estimate">

      <complexType>

         <sequence>

            <element name="estimate-currency" maxOccurs="unbounded">

               <complexType>

                  <sequence/>

                  <attribute name="name" type="string"/>

                  <attribute name="short-name" type="jupiter:currency-short-name-type"/>

                  <attribute name="exchange-rate" type="float"/>

               </complexType>

            </element>

    . . .
 

Sample.xml
 

<?xml version="1.0" encoding="ISO-8859-1"?>

<jupiter:estimate name="XXX" description="X" rev-number="X"

    notice-to-proceed="2009-09-30" status="In Process" base-currency="EUR"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

    xmlns:jupiter="http://schemas/jupiter" xsi:noNamespaceSchemaLocation="Jupiter.xsd"

    >

    <estimate-currency name="US Dollar" short-name="USD" exchange-rate="0.800000"/>

    <estimate-currency name="Euro" short-name="EURx" exchange-rate="1.000000"/>
 

Note: The above line correctly fails validation because EURx is not a valid currency-short-name-type

Open in new window

0
Comment
Question by:pdegregorio
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 24423614
xsi:noNamespaceSchemaLocation="Jupiter.xsd"

needs to become

xsi:schemaLocation="http://schemas/jupiter Jupiter.xsd"

if there is a targetNamespace, you need to point to it
before the space is the namespace, after the space is the location of the schema
0
 

Author Comment

by:pdegregorio
ID: 24423821
Thank you, that worked! Does anything appear embarrassingly out of kilter that I should look at?
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24424251
Welcome
Nothing embarrassing in this, it is a bit tricky anyway
It is the schema that decides whether you have a namespace or not in your XML
so if there is no targetnamespace in the schema use the reference as you did
if there is a target namespace, you need to reference that as well,
a bit perculiar, don't worry, now you know
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel VBA and XML - traversing the nodes 2 68
Specific format 21 181
json format text only 4 75
ASP.NET reading ATOM 2 51
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now