aspose file tools*
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
Author

Unable to refer global element

Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 68
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 'http://www.w3.org/2001/XMLSchema',
but components from this namespace are not referenceable from schema document
'mySchema.xsd'.
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
'mySchema.xsd'.

how to resolve this?
Ravinderjit Singh
Ranch Hand

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

Joined: Jan 18, 2011
Posts: 464
    
    2
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: http://aspose.com/file-tools
 
subject: Unable to refer global element
 
Similar Threads
Defining XSD for an XML file with constraint on the contents of a tag
Doubt on XML Schema validity
Is Nillable same as an empty element
Unable to send a SOAP request to a service implementing Provider
JAXB: Two xsd - Create single JAXBContext