Jump to content
Sign in to follow this  

use of import

Recommended Posts

Hi all,I want to define a schema ('Users') using a element defined on other schema ('Login'). I am using the 'import' element of XML Schema but I am doing something wrong:First part of XSD for Users:

<?xml version="1.0" encoding="ISO-8859-1" ?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:log="http://www.uib.es/LogIn/"targetNamespace="http://www.uib.es/Users/"xmlns="http://www.uib.es/Users/"elementFormDefault="qualified"><xsd:import namespace="http://www.uib.es/LogIn/" schemaLocation="login-v02.xsd" />

Including the element of the other schema ('Login'):

<xsd:element name="user" type="userType" />...<xsd:complexType name="userType"><xsd:element ref="log:login" />...</xsd:complexType>

And then, in the xml document:

<user  xmlns="http://www.uib.es/Users/"		xmlns:log="http://www.uib.es/LogIn/"		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"		xsi:schemaLocation="http://www.uib.es/Users/ users-v01.xsd [url="http://www.uib.es/LogIn/"]http://www.uib.es/LogIn/[/url] login-v02.xsd">								<log:login>		<log:user>userlogin</log:user>		<log:pass>userpass</log:pass>	</log:login>...</user>

But the validator says:Element <log:login> is not allowed under element <user> Reason: An element is expected but the relevant choice is unsatisfiableHint: Perhaps one or more choices should not be emptyAny help will be welcome, the hint of the validator is not very helpfull (for me)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...