• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Schema - doubt..

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is a lab given in Rogers ppt on XML schema. Its lab no. 6.
Current XSD contains the following.

XML source file structure is:

The question is to separate the <description> and <warranty> element in the XSD to a new type called "appliance" and then use that to derive (by extension) another new type called "juicerappliance". Finally declare the <juicer> element to be of type "juicerappliance".
Now, the problem I having is
how do we use "derive by extension" for elements that are present in the middle of the sequence. The answer given in the lab also seems to be not working fine. I have seen examples where "derive by extension" is used to extend the type by appending elements to it..but not in the middle of the sequence.
If you have Rogers's labs, you can try lab 6 to see if it works for you in XMLSPY and let me know. I am trying to see if I am doing something wrong. Please help.
Thanks,
Hari.
[ February 09, 2003: Message edited by: Hariharan Raman ]
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was going through the lab6 and I really don’t see any problem. I may be wrong but let me try to explain.


Lab 6. Using Derived Types
Modify the schema that you created in Lab 5.
Create a type called appliance. Define appliance to contain declarations for description and warranty. Create a type called juiceAppliance, which is derived from appliance (by extension). Make juicer of type juiceAppliance. As always, validate the instance document against your schema.
Note: You will need to rearrange the contents of each juicer
in the instance document!


lab is asking you to do following tasks:
#1

Define appliance to contain declarations for description and warranty.

Answer

#2

Create a type called juiceAppliance, which is derived from appliance (by extension).

Answer

Since in the original Schema file we had following elements.

Since we have seperated the “description” and “warranty” element in “appliance” type, that is why “juiceAppliance” have rest of the elements.
#3

Make juicer of type juiceAppliance.

Answer


#4

Note: You will need to rearrange the contents of each juicer
in the instance document!

Answer

I guess every thing is clear. Event I tried to validate the file and it is fine in “xerces-2-2_0”.

I would advise you to, not to use XMLSpy. It would give you very hard time and all sort of problem.


Let me know If I can help you.
thnaks
[ February 10, 2003: Message edited by: Vivek Saxena ]
 
Hariharan Raman
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Vivek..! I got everything right except for the last one - change in the instance document.. It works fine now..!
Hari.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic