473,387 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

xml schema import help

Hi

I'm stuck with the following schema validation problem in VS.NET 2003:
I have two types of xml document and related schema:
project and projectCollection.
A projectcollection is just a set of projects.
Therefore, I wish to include the project customType in the projectCollection
namespace.
I therefore have declared two xsd documents: project.xsd and
projectcollection.xsd
These both validate.
and two xml documents to test validation:
project.xml and projectcollection.xml.
project.xml validates perfectly, however all of the project tags within
projectcollection.xml are not validated.
Can anyone tell me where I'm going wrong?

Thanks.
Iain Mcleod

The documents are as follows:
project.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Project" targetNamespace="http://www.golds.co.uk/Project"
elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/Project"
xmlns:mstns="http://www.golds.co.uk/Project"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="projectType">
<xs:sequence>
<xs:element name="projectDescription" minOccurs="0" maxOccurs="1" />
<xs:element name="projectMemberCollection" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="projectMember" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence />
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
<xs:key name="ProjectMemberNameKey">
<xs:selector xpath=".//mstns:projectMember" />
<xs:field xpath="@name" />
</xs:key>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="version" type="xs:decimal" />
</xs:complexType>
<xs:element name="project" type="projectType" />
</xs:schema>

projectCollection.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ProjectCollection"
targetNamespace="http://www.golds.co.uk/ProjectCollection"
elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/ProjectCollection"
xmlns:mstns="http://www.golds.co.uk/ProjectCollection"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:projectNS="http://www.golds.co.uk/Project"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:import namespace="http://www.golds.co.uk/Project"
schemaLocation="Project.xsd" />
<xs:element name="projectCollection" type="projectCollectionType">
<xs:key name="ProjectPrimaryKey" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@id" />
</xs:key>
<xs:key name="ProjectNameVersionKey">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@name" />
<xs:field xpath="@version" />
</xs:key>
</xs:element>
<xs:complexType name="projectCollectionType">
<xs:sequence>
<!-- Project Elements defined in Project.xsd -->
<xs:element name="project" type="projectNS:projectType" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:schema>
project.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://www.golds.co.uk/Project" id="1" name="PM"
version="1">
<projectDescription>Project Management</projectDescription>
<projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
projectCollection.xml:

<?xml version="1.0" encoding="utf-8"?>
<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection">
<project id="1" name="PM" version="1.0">
<projectDescription>Project Management</projectDescription>
<projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
<project id="2" name="PM" version="1.1">
<projectDescription>This is a description</projectDescription>
<projectMemberCollection>
<projectMember name="GOLDS\PC" />
<projectMember name="GOLDS\IAM" />
</projectMemberCollection>
</project>
</projectCollection>
Nov 12 '05 #1
4 2461
All <project> elements need to be prefixed so their namespace since it does
not belong to the same namespace as ProjectCollection.

<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"
xmlns:projectNS="http://www.golds.co.uk/Project">
<projectNS:project id="1" name="PM" version="1.0">
..
..
..


"Iain A. Mcleod" <mc******@dcs.gla.ac.uk> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm stuck with the following schema validation problem in VS.NET 2003:
I have two types of xml document and related schema:
project and projectCollection.
A projectcollection is just a set of projects.
Therefore, I wish to include the project customType in the projectCollection namespace.
I therefore have declared two xsd documents: project.xsd and
projectcollection.xsd
These both validate.
and two xml documents to test validation:
project.xml and projectcollection.xml.
project.xml validates perfectly, however all of the project tags within
projectcollection.xml are not validated.
Can anyone tell me where I'm going wrong?

Thanks.
Iain Mcleod

The documents are as follows:
project.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Project" targetNamespace="http://www.golds.co.uk/Project"
elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/Project"
xmlns:mstns="http://www.golds.co.uk/Project"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="projectType">
<xs:sequence>
<xs:element name="projectDescription" minOccurs="0" maxOccurs="1" />
<xs:element name="projectMemberCollection" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="projectMember" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence />
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
<xs:key name="ProjectMemberNameKey">
<xs:selector xpath=".//mstns:projectMember" />
<xs:field xpath="@name" />
</xs:key>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="version" type="xs:decimal" />
</xs:complexType>
<xs:element name="project" type="projectType" />
</xs:schema>

projectCollection.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ProjectCollection"
targetNamespace="http://www.golds.co.uk/ProjectCollection"
elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/ProjectCollection"
xmlns:mstns="http://www.golds.co.uk/ProjectCollection"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:projectNS="http://www.golds.co.uk/Project"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:import namespace="http://www.golds.co.uk/Project"
schemaLocation="Project.xsd" />
<xs:element name="projectCollection" type="projectCollectionType">
<xs:key name="ProjectPrimaryKey" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@id" />
</xs:key>
<xs:key name="ProjectNameVersionKey">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@name" />
<xs:field xpath="@version" />
</xs:key>
</xs:element>
<xs:complexType name="projectCollectionType">
<xs:sequence>
<!-- Project Elements defined in Project.xsd -->
<xs:element name="project" type="projectNS:projectType" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:schema>
project.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://www.golds.co.uk/Project" id="1" name="PM"
version="1">
<projectDescription>Project Management</projectDescription>
<projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
projectCollection.xml:

<?xml version="1.0" encoding="utf-8"?>
<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection">
<project id="1" name="PM" version="1.0">
<projectDescription>Project Management</projectDescription>
<projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
<project id="2" name="PM" version="1.1">
<projectDescription>This is a description</projectDescription>
<projectMemberCollection>
<projectMember name="GOLDS\PC" />
<projectMember name="GOLDS\IAM" />
</projectMemberCollection>
</project>
</projectCollection>

Nov 12 '05 #2
Hi

Thanks for the suggestion, I tried it but still no joy.
It still won't recognise project and and its sub-
elements. Something is really wacky (visual studio?!) I
even tried making both schemas have the same namespace and
using an include instead of an import, and it wouldn't
recognise either of the schemas. I tried making the
elementFormDefault="unqualified", I tried everything!
If anyone knows how visual studio handles xml schema could
they possibly explain it because it's got me absolutely
stumped. I'm really surprised there aren't more posts
like this, it's obviously something I'm doing wrong,
visual studio must be able to handle imports and includes?!

Many thanks
Iain
-----Original Message-----
All <project> elements need to be prefixed so their namespace since it doesnot belong to the same namespace as ProjectCollection.

<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"xmlns:projectNS="http://www.golds.co.uk/Project">
<projectNS:project id="1" name="PM" version="1.0">
..
..
..


"Iain A. Mcleod" <mc******@dcs.gla.ac.uk> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema:
project and projectCollection.
A projectcollection is just a set of projects.
Therefore, I wish to include the project customType in the
projectCollection
namespace.
I therefore have declared two xsd documents:

project.xsd and projectcollection.xsd
These both validate.
and two xml documents to test validation:
project.xml and projectcollection.xml.
project.xml validates perfectly, however all of the project tags within projectcollection.xml are not validated.
Can anyone tell me where I'm going wrong?

Thanks.
Iain Mcleod

The documents are as follows:
project.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Project" targetNamespace="http://www.golds.co.uk/Project" elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/Project"
xmlns:mstns="http://www.golds.co.uk/Project"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="projectType">
<xs:sequence>
<xs:element name="projectDescription" minOccurs="0" maxOccurs="1" /> <xs:element name="projectMemberCollection" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="projectMember" minOccurs="0" maxOccurs="unbounded"> <xs:complexType>
<xs:sequence />
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
<xs:key name="ProjectMemberNameKey">
<xs:selector xpath=".//mstns:projectMember" />
<xs:field xpath="@name" />
</xs:key>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="version" type="xs:decimal" />
</xs:complexType>
<xs:element name="project" type="projectType" />
</xs:schema>

projectCollection.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ProjectCollection"
targetNamespace="http://www.golds.co.uk/ProjectCollection" elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/ProjectCollection"
xmlns:mstns="http://www.golds.co.uk/ProjectCollection"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:projectNS="http://www.golds.co.uk/Project"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:import namespace="http://www.golds.co.uk/Project"
schemaLocation="Project.xsd" />
<xs:element name="projectCollection" type="projectCollectionType"> <xs:key name="ProjectPrimaryKey" msdata:PrimaryKey="true"> <xs:selector xpath=".//mstns:project" />
<xs:field xpath="@id" />
</xs:key>
<xs:key name="ProjectNameVersionKey">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@name" />
<xs:field xpath="@version" />
</xs:key>
</xs:element>
<xs:complexType name="projectCollectionType">
<xs:sequence>
<!-- Project Elements defined in Project.xsd -->
<xs:element name="project" type="projectNS:projectType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:schema>
project.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://www.golds.co.uk/Project" id="1" name="PM" version="1">
<projectDescription>Project Management</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
projectCollection.xml:

<?xml version="1.0" encoding="utf-8"?>
<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"> <project id="1" name="PM" version="1.0">
<projectDescription>Project Management</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
<project id="2" name="PM" version="1.1">
<projectDescription>This is a description</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
<projectMember name="GOLDS\IAM" />
</projectMemberCollection>
</project>
</projectCollection>

.

Nov 12 '05 #3
Wierdly enough, it now seems to be working. I took out
the projectNS declaration withing the
projectCollection.xml file, and it seems to accept
projectNS because it was defined within the
projectCollection.xsd file. It just didn't seem to like
the duplicate declaration of projectNS.
My projectCollection document now reads:

<?xml version="1.0" encoding="utf-8"?>
<projectCollection
xmlns="http://www.golds.co.uk/ProjectCollection">
<projectNS:project id="1" name="PM" version="1.0">
<projectNS:projectDescription>Project
Management</projectDescription>
<projectNS:projectMemberCollection>
<projectNS:projectMember name="GOLDS\PC" />
</projectMemberCollection>
</projectNS:project>
<projectNS:project id="2" name="PM" version="1.1">
<projectNS:projectDescription>This is a
description</projectNS:projectDescription>
<projectNS:projectMemberCollection>
<projectNS:projectMember name="GOLDS\PC" />
<projectNS:projectMember name="GOLDS\IAM" />
</projectNS:projectMemberCollection>
</projectNS:project>
</projectCollection>

Bit of a pain having to prefix everything with projectNS,
but the schemas don't validate without the
elementFormDefault="qualified". Ask Microsoft why - 'cos
I don't understand!

Thanks for your help, I'll post again if I encounter any
more wierd behaviour.

IM
-----Original Message-----
All <project> elements need to be prefixed so their namespace since it doesnot belong to the same namespace as ProjectCollection.

<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"xmlns:projectNS="http://www.golds.co.uk/Project">
<projectNS:project id="1" name="PM" version="1.0">
..
..
..


"Iain A. Mcleod" <mc******@dcs.gla.ac.uk> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema:
project and projectCollection.
A projectcollection is just a set of projects.
Therefore, I wish to include the project customType in the
projectCollection
namespace.
I therefore have declared two xsd documents:

project.xsd and projectcollection.xsd
These both validate.
and two xml documents to test validation:
project.xml and projectcollection.xml.
project.xml validates perfectly, however all of the project tags within projectcollection.xml are not validated.
Can anyone tell me where I'm going wrong?

Thanks.
Iain Mcleod

The documents are as follows:
project.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Project" targetNamespace="http://www.golds.co.uk/Project" elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/Project"
xmlns:mstns="http://www.golds.co.uk/Project"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="projectType">
<xs:sequence>
<xs:element name="projectDescription" minOccurs="0" maxOccurs="1" /> <xs:element name="projectMemberCollection" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="projectMember" minOccurs="0" maxOccurs="unbounded"> <xs:complexType>
<xs:sequence />
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
<xs:key name="ProjectMemberNameKey">
<xs:selector xpath=".//mstns:projectMember" />
<xs:field xpath="@name" />
</xs:key>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="version" type="xs:decimal" />
</xs:complexType>
<xs:element name="project" type="projectType" />
</xs:schema>

projectCollection.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ProjectCollection"
targetNamespace="http://www.golds.co.uk/ProjectCollection" elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/ProjectCollection"
xmlns:mstns="http://www.golds.co.uk/ProjectCollection"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:projectNS="http://www.golds.co.uk/Project"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:import namespace="http://www.golds.co.uk/Project"
schemaLocation="Project.xsd" />
<xs:element name="projectCollection" type="projectCollectionType"> <xs:key name="ProjectPrimaryKey" msdata:PrimaryKey="true"> <xs:selector xpath=".//mstns:project" />
<xs:field xpath="@id" />
</xs:key>
<xs:key name="ProjectNameVersionKey">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@name" />
<xs:field xpath="@version" />
</xs:key>
</xs:element>
<xs:complexType name="projectCollectionType">
<xs:sequence>
<!-- Project Elements defined in Project.xsd -->
<xs:element name="project" type="projectNS:projectType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:schema>
project.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://www.golds.co.uk/Project" id="1" name="PM" version="1">
<projectDescription>Project Management</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
projectCollection.xml:

<?xml version="1.0" encoding="utf-8"?>
<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"> <project id="1" name="PM" version="1.0">
<projectDescription>Project Management</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
<project id="2" name="PM" version="1.1">
<projectDescription>This is a description</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
<projectMember name="GOLDS\IAM" />
</projectMemberCollection>
</project>
</projectCollection>

.

Nov 12 '05 #4
Nope, It's actually still not working.

I found the text below in someone's blog:
located at:
http://www.hanselman.com/blog/PermaLink.aspx?guid=297
He describes the exact same problem that I am having.
Can anyone tell me how I can avoid it with visual studio?

Many thanks
Iain
<---snip--->

Import.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema
targetNamespace="http://www.import.org"
elementFormDefault="qualified">
<xs:complexType name="rootType" >
<xs:sequence>
<xs:element name="child1"
type="xs:string" maxOccurs="2" />
<xs:element name="child2"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

The Outer xsd:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org"
xmlns:tns="http://www.example.org"
xmlns:imp="http://www.import.org">
<xs:import namespace="http://www.import.org"
schemaLocation="file:///c:/import.xsd"/>
<xs:element name="root" type="imp:rootType" />
</xs:schema>
This schema appears to be valid – in fact, the .NET
framework agrees. But when you try and run the outer
schema through xsd.exe, you get the following error:

C:\>xsd /c root.xsd
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights
reserved.

Schema validation warning:
Type 'http://www.import.org:rootType' is not declared. An
error occurred at file:///C:/root.xsd, (10, 3).

Warning: Schema could not be validated. Class generation
may fail or may produce incorrect results.

Error: Error generating classes for schema 'root'.
- The datatype 'http://www.import.org:rootType' is
missing.

Update: Tomas was kind enough to point out not only that I
had originally posted the same schema TWICE, doh! But
also, more importantly, that XSD.EXE doesn't resolve
schemaLocation on imports or includes, presuambly because
the W3C Schema spec describes the schemaLocation attribute
as a hint, not a true location.

I'm back in business as I ran XSD.EXE again with all
necessary files specified on the commandline, in order to
give XSD.EXE a choice of namespaces - as opposed to hoping
it would somehow glean my intent!

<---snip--->


-----Original Message-----
All <project> elements need to be prefixed so their namespace since it doesnot belong to the same namespace as ProjectCollection.

<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"xmlns:projectNS="http://www.golds.co.uk/Project">
<projectNS:project id="1" name="PM" version="1.0">
..
..
..


"Iain A. Mcleod" <mc******@dcs.gla.ac.uk> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema:
project and projectCollection.
A projectcollection is just a set of projects.
Therefore, I wish to include the project customType in the
projectCollection
namespace.
I therefore have declared two xsd documents:

project.xsd and projectcollection.xsd
These both validate.
and two xml documents to test validation:
project.xml and projectcollection.xml.
project.xml validates perfectly, however all of the project tags within projectcollection.xml are not validated.
Can anyone tell me where I'm going wrong?

Thanks.
Iain Mcleod

The documents are as follows:
project.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Project" targetNamespace="http://www.golds.co.uk/Project" elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/Project"
xmlns:mstns="http://www.golds.co.uk/Project"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="projectType">
<xs:sequence>
<xs:element name="projectDescription" minOccurs="0" maxOccurs="1" /> <xs:element name="projectMemberCollection" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="projectMember" minOccurs="0" maxOccurs="unbounded"> <xs:complexType>
<xs:sequence />
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
<xs:key name="ProjectMemberNameKey">
<xs:selector xpath=".//mstns:projectMember" />
<xs:field xpath="@name" />
</xs:key>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="version" type="xs:decimal" />
</xs:complexType>
<xs:element name="project" type="projectType" />
</xs:schema>

projectCollection.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ProjectCollection"
targetNamespace="http://www.golds.co.uk/ProjectCollection" elementFormDefault="qualified"
xmlns="http://www.golds.co.uk/ProjectCollection"
xmlns:mstns="http://www.golds.co.uk/ProjectCollection"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:projectNS="http://www.golds.co.uk/Project"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:import namespace="http://www.golds.co.uk/Project"
schemaLocation="Project.xsd" />
<xs:element name="projectCollection" type="projectCollectionType"> <xs:key name="ProjectPrimaryKey" msdata:PrimaryKey="true"> <xs:selector xpath=".//mstns:project" />
<xs:field xpath="@id" />
</xs:key>
<xs:key name="ProjectNameVersionKey">
<xs:selector xpath=".//mstns:project" />
<xs:field xpath="@name" />
<xs:field xpath="@version" />
</xs:key>
</xs:element>
<xs:complexType name="projectCollectionType">
<xs:sequence>
<!-- Project Elements defined in Project.xsd -->
<xs:element name="project" type="projectNS:projectType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:schema>
project.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://www.golds.co.uk/Project" id="1" name="PM" version="1">
<projectDescription>Project Management</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
projectCollection.xml:

<?xml version="1.0" encoding="utf-8"?>
<projectCollection xmlns="http://www.golds.co.uk/ProjectCollection"> <project id="1" name="PM" version="1.0">
<projectDescription>Project Management</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
</projectMemberCollection>
</project>
<project id="2" name="PM" version="1.1">
<projectDescription>This is a description</projectDescription> <projectMemberCollection>
<projectMember name="GOLDS\PC" />
<projectMember name="GOLDS\IAM" />
</projectMemberCollection>
</project>
</projectCollection>

.

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dennis B. Hansen | last post by:
Hi all... I'm having some problems JAXB compiling som schemas, and was wondering if what i was trying to do is simply wrong... the problem seems to be with my import statements, and I've tried...
2
by: Olaf Meyer | last post by:
Apprentently xerces 2.6.0 (Java) does not validate against contraints specified in the schema (e.g. constraints specified via unique element). The validation works with the XML editor I'm using...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
5
by: Zombie | last post by:
Hi, Can I have 2 namespaces in the same XML schema? In the schema, I wish to declare elements such that some of them belong to one namespace and others belong to a second namespace. Is this...
3
by: Davide Bedin | last post by:
I have a "library" schema with the simple and complex types I commonly use in other schemas and then several other schemas, maybe created by other developers, that import/include the library...
8
by: Poonam | last post by:
Hi, Can some one please help me with (or point me to) a very simple but working code sample that shows how to import XML Schema. I have tried many samples out there on internet but nothing seems...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
10
by: gmocnik | last post by:
I am validating XML files on a server which has no internet access and the validadation in C# does not work. Schema with which I am validating has namespaces like:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.