Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » XSD, XML Catalog, schemaLocation vs noNamespaceSchemaLocation
XSD, XML Catalog, schemaLocation vs noNamespaceSchemaLocation [message #756710] Mon, 14 November 2011 18:44 Go to next message
Roger  is currently offline Roger
Messages: 11
Registered: September 2011
Junior Member
So I have a weird one...

ALl code snippets are just the 'headers' of the files, as the contents don't affect the outcode (for brevity)

if I put some XSD in as a catalog contribution
templates.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://www.asdf.com/2010/templates"
xmlns:tpl="http://www.asdf.com/2010/templates">

knowledgebase.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://www.asdf.com/2010/templates/knowledgebase"
xmlns:tpl="http://www.asdf.com/2010/templates"
xmlns:kb="http://www.asdf.com/2010/templates/knowledgebase">
<xs:import namespace="http://www.asdf.com/2010/templates" id="tpl"/>
id="tpl"/>

So.. templates has a targetNamespace
knowledgebase has a targetNamespace

I put both in my xml catalog like this:
Entry element: URI
Location: studio/assets/etc/templates/templates.xsd
URI: platform:/resource/studio/assets/etc/templates/templates.xsd
Key type: Namespace name
Key: http://www.asdf.com/2010/templates
(same for knowledgebase.xsd.. they are in the same folder)...

so.. this is where weirdness kicks in..

if I make an XML file:
<?xml version="1.0" encoding="UTF-8"?>
<knowledgebase id="$qname"
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="http://www.asdf.com/2010/templates/knowledgebase">

"that works".. using noNamespaceSchemaLocation.

I get content assist etc.

if I try to change it to
xsi:schemaLocation

all content assist stops.

My concern, is that both my XSD's have targetNamespace.. which I *thought* meant I should be using xsi:schemaLocation *not* noNamespaceSchemaLocation

what the heck!?

anyone have any insight as to why this appears to work 'perfectly backwards'?

[Updated on: Mon, 14 November 2011 18:45]

Report message to a moderator

Re: XSD, XML Catalog, schemaLocation vs noNamespaceSchemaLocation [message #756995 is a reply to message #756710] Tue, 15 November 2011 21:45 Go to previous message
David Carver is currently offline David Carver
Messages: 174
Registered: July 2009
Senior Member
In your xml file, you need to defin the default namespace:

<knowledge xmlns="http://www.asdf.com/2010/templates/knowledgebase"... />

Then if you remove the schemaLocation, the WTP Editor and Validators should look in the xml catalog for your schemas and use those for content assistance.

Previous Topic:Axis debug spam
Next Topic:Adding XML Catalog contributions programmatically
Goto Forum:
  


Current Time: Tue Sep 16 15:36:21 GMT 2014

Powered by FUDForum. Page generated in 0.06026 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software