473,499 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

substitution groups problem.

2 New Member
Hi all,
I am new to xml/xsd world. I want to know the differences between complex type and element being abstract and if both can be declared so, in case of substitution goups.Also can xsi:type usuage allowes in instance doucments in case of substitution goups.
I tried using abstarct complex type/element with substitution groups and I attached the code below.

In XX1.xsd which is imported and a reference to complex abstract type is made in YY1.xsd. But the instance document validation of ZZ1.xsd fails when YY1.xsd is imported to ZZ1.xsd and when the complex type is referenced. XMLSpy and Xerces give the same error as follows:This file is not valid. Unexpected element'signatureString' in element author. Expected signatureString,signatureText.

Please let me know what is wrong with the code and any help in this regard at the earliest is highly appeciated.

The code of each xsd file is as follows:
Expand|Select|Wrap|Line Numbers
  1. ********************************************************************
  2. XX1.XSD:
  3. ********************************************************************
  4. <?xml version="1.0" encoding="ISO-8859-1"?>
  5. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:PARTICIPATION="Participation" targetNamespace="Participation">
  6. <!-- ================================================= -->
  7. <!-- Package: Participation -->
  8. <!-- ================================================= -->
  9. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  10. <!-- Class: <<ST>> SignatureString -->
  11. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  12. <xs:element name="signatureString" type="PARTICIPATION:SignatureString" substitutionGroup="PARTICIPATION:signatureText"/>
  13. <xs:complexType name="SignatureString">
  14. <xs:complexContent>
  15. <xs:extension base="PARTICIPATION:SignatureText">
  16. <xs:attribute name="value" type="xs:string" use="required"/>
  17. </xs:extension>
  18. </xs:complexContent>
  19. </xs:complexType>
  20. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  21. <!-- Class: SignatureText -->
  22. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  23. <xs:element name="signatureText" type="PARTICIPATION:SignatureText" abstract="true"/>
  24. <xs:complexType name="SignatureText" abstract="true"/>
  25. </xs:schema>
  26. ***********************************************************************
  27. YY1.xsd:
  28. ***********************************************************************
  29. <?xml version="1.0" encoding="ISO-8859-1"?>
  30. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:CM3202="Common3202" xmlns:PARTICIPATION="Participation" targetNamespace="Common3202">
  31. <xs:import namespace="Participation" schemaLocation="Datatypes3203/RDT/Participation.xsd"/>
  32. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  33. <!-- Class: <<Participation>> PractitionerParticipation -->
  34. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  35. <xs:element name="practitionerParticipation" type="CM3202:PractitionerParticipation" abstract="true"/>
  36. <xs:complexType name="PractitionerParticipation" abstract="true">
  37. <xs:sequence>
  38. <!--xs:element name="signatureText" type="PARTICIPATION:SignatureText" minOccurs="0"/-->
  39. <xs:element ref="PARTICIPATION:signatureText"/>
  40. </xs:sequence>
  41. </xs:complexType>
  42. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  43. <!-- Class: <<Participation>> Author -->
  44. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  45. <xs:element name="author" type="CM3202:Author" substitutionGroup="CM3202:practitionerParticipation"/>
  46. <xs:complexType name="Author">
  47. <xs:complexContent>
  48. <xs:extension base="CM3202:PractitionerParticipation"/>
  49. </xs:complexContent>
  50. </xs:complexType>
  51.  
  52. </xs:schema>
  53. ********************************************************************
  54. ZZ1.xsd
  55. *******************************************************************
  56. <?xml version="1.0" encoding="ISO-8859-1"?>
  57. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:VS3203="VitalSigns3203" xmlns:CM3202="Common3202" targetNamespace="VitalSigns3203">
  58. <xs:import namespace="Common3202" schemaLocation="Common3202.xsd"/>
  59. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  60. <!-- Class: <<Observation>> VitalSignsObservationEvent -->
  61. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  62. <xs:element name="vitalSignsObservationEvent" type="VS3203:VitalSignsObservationEvent"/>
  63. <xs:complexType name="VitalSignsObservationEvent">
  64. <xs:sequence>
  65. <xs:element name="author" type="CM3202:Author" minOccurs="0">
  66. </xs:element>
  67. </xs:sequence>
  68. </xs:complexType>
  69. </xs:schema>
  70.  
Nov 12 '05 #1
1 2366
kollareddy
2 New Member
Hi all,

More info. regarding this problem: The error occurs when each xsd has a different namespace and thus has problem with imports.
It works fine when all the xsds are in the same namespace and when include statement is used.
But I want to avoid name collisions by using different namespaces.
Thus any input in this regard is highly appreciated.

Thanks in advance.
Nov 17 '05 #2

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

Similar topics

6
1942
by: Paddy | last post by:
Hi, I got tripped up on the way eval works with respect to modules and so wrote a test. It seems that a function carries around knowledge of the globals() present when it was defined. (The...
2
1990
by: John Carron | last post by:
Hi All, I have written a simple schema (see below) that uses substitution groups. I don't know if this the correct usage because I'm fairly new to xml schema. The structure is as follows: ...
0
1148
by: John Carron | last post by:
Hi All, I have written a simple schema (see below) that uses substitution groups. I don't know if this the correct usage because I'm fairly new to xml schema. The structure is as follows: ...
1
438
by: KERLOG | last post by:
Hello, I found that in "glibc" there is a function to perform variable substitution. It start with $. By digging inside the code of "glibc" I can't find how it's done. Has someone already...
14
2041
by: Malcolm | last post by:
Hi, I have the following which fails with "disagreement in number of macro arguments" when compiling with Imagecraft ICCAVR. Has anyone got any ideas - its not vital but would make the code a...
4
6897
by: Don | last post by:
I think "macro substitution" is the correct term for what I want to do, but, to be sure, here is a description of what I'd like to know is possible: I want to be able to create a create an object...
18
4577
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
2
1261
by: Steve | last post by:
Hi, I'm currently teaching myself about XML schems at the same time as specifying the XML document for a project I've been given to write. (I'm new to the XML world, so progress is a little slow...
7
6602
by: MtiPaulo | last post by:
I know FoxPro has excellent macro substitution but I am trying to find through MS Access. Wondering if MS Access has Macro Substitution? I will give you my basic example. In FoxPro Language...
0
7131
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
7007
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
7220
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...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.