473,287 Members | 1,580 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,287 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 2459
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:...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.