File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Unable to refer global element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Unable to refer global element" Watch "Unable to refer global element" New topic

Unable to refer global element

Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 78
Hello All,

This is my xml schema where I am trying to refer to global element, but getting error.

Line number 11 causing the below error.

src-resolve.4.2: Error resolving component 'schema'. It was detected that 'schema' is in namespace '',
but components from this namespace are not referenceable from schema document
If this is the incorrect namespace, perhaps the prefix of 'schema' needs to be changed.
If this is the correct namespace, then an appropriate 'import' tag should be added to

how to resolve this?
Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 78
any pointer?
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 630
Since w3c schema is in a different namespace than the present target namespace of the schema, you've to import it. The import element is a top level element, hence, you place the following accordingly.

I deliberately omit the schemaLocation in the above as it is only a suggestive data and you could be overridden at the application level. If you let the validation engine do the import implicitly with the data so supplied, you can put it there as well, like this.

That is the schema for schema supplied by the consortium. (It includes some dtd and sometime could cause trouble to some engine's default loading.) If you've anything better or a more restructive subset of it, you can actually supply any other location as long as the required schema for schema is properly pointed to.
I agree. Here's the link:
subject: Unable to refer global element
It's not a secret anymore!