473,396 Members | 1,886 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,396 software developers and data experts.

Two schemas one object

Does anyone have a recommendation for handling a case where (at least) two schemas define an class with only slight variation, as to the best way to handle so I can combine to one class?
For example. schema 1
<xs:schema
targetNamespace="http://www.xyz.com/PROTO1#"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cpl="http://www.xyz.com/PROTOCP1#"
xmlns:am="http://www.xyz.com/PROTO1#"
elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:import namespace="http://www.xyz.com/PROTOCP1#"
schemaLocation="PROTO1.xsd"/>

<xs:element name="AssetMap" type="am:AssetMapType"/>
<xs:complexType name="AssetMapType">
<xs:sequence>
<xs:element name="Id" type="cpl:UUID"/>
<xs:element name="AnnotationText" type="xs:string" minOccurs="0"/>
<xs:element name="VolumeCount" type="xs:positiveInteger"/>
<xs:element name="IssueDate" type="xs:dateTime"/>
<xs:element name="Issuer" type="xs:string"/>
<xs:element name="Creator" type="xs:string"/>
</xs:sequence>
</xs:complexType>
/xs:element>
</xs:schema>
Schema#2
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="http://www.xzz.org/schemas/429" xmlns:am="http://www.xzz.org/schemas/429"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="UUID">
<xs:restriction base="xs:anyURI">
<xs:pattern value="urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AssetMapType">
<xs:sequence>
<xs:element name="Id" type="am:UUID" />
<xs:element name="AnnotationText" type="xs:string" minOccurs="0" />
<xs:element name="Creator" type="xs:string" />
<xs:element name="VolumeCount" type="xs:positiveInteger" />
<xs:element name="IssueDate" type="xs:dateTime" />
<xs:element name="Issuer" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="AssetMap" type="am:AssetMapType" />
</xs:schema>
Notice elements are not in the same order. I would like to crate a single class to be used for both schemas (if possible) This would be using .net 2.0 using the XMLSerializer. (language is not important)

Can you specify two different namespaces based on some condition?
Other ideas?
Thanks
Jan 28 '08 #1
0 968

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: anonymous | last post by:
When I use the schema collection to apply many schemas to one XML instance document, I get an error if I do not qualify every element with the appropriate namespace. Both the W3C site and this...
2
by: John Jenkins | last post by:
Hi, I have a lot of schemas to load into a schema collection. I load them in by reading each one into a XMLTextReader from disk and add them into a schema collection. I have a couple of issues to...
1
by: SideByEach | last post by:
I have a schema that references a child schema via a "xs:import" node. In that child schema it references several other grand children schemas. Is there an object in the VS 2K5 suite which will...
6
by: Dennis Gearon | last post by:
This post is as much about getting some questions answered as leaving the following definitions in the archives for the next person. After a quick perview of the web, I came up with the...
0
by: Suresh | last post by:
Hello All, I have a schema which refers, imports other schemas( via Absolute Path as well as relative to current XSD location). How do I import the whole XSD as one schema. (Currently I donot...
0
by: vihrao | last post by:
I am designing wsdl that uses multiple schemas. I can do this in two ways: 1) use multiple schema imports in one wsdl or 2) use multiple schema imports in to one common schema and then import a...
5
by: Donal McWeeney | last post by:
Hi, Using .Net 2.0 what is the best way to determine the list of schemas used by a XmlDocument. Thanks Donal
0
by: mgoold2002 | last post by:
Hello. I'm new to using XML/HTML. I am trying to learn to validate xml sample docs against schemas. I have an XML and Schema file (.xsd) saved to my desktop. Below is my sample code, which is...
3
by: annecarterfredi | last post by:
what is the command to list all existing schemas in a database? Is there any command to list all the schemas under a instance as database.schema ?? Please let me know. Thanks, A Carter
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.