• 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 Schemas

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few questions about XML Schemas:
1) How do you declare a schema in your xml document? (ie schema equivalent to <!DOCTYPE parent_node SYSTEM "file_name"> ) Are they always internal?
2) How do you use the <choice> element tag?

If you could help me with some of these answers, I'd be grateful.
[This message has been edited by Trevor Green (edited July 26, 2001).]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Internal schema is within your xml document
<?xml version "1.0"?>
<!DOCTYPE parent_node[
]
External schema you make document with .dtd extension
<?xml version "1.0"?>
<!DOCTYPE parent_node SYSTEM " URL goes here "/nameoffile.dtd">
To declare a public external DTD:
<?xml version "1.0"?>
<!DOCTYPE parent_node PUBLIC"-//author goes here//DTD name of schema goes here//EN (if it is in english)//" " URL goes here "/nameoffile.dtd">

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,
I think Tom got confused between DTDs and XML Schema.
You need something similar to this in your instance document:
For simplicity I did not use name spaces.

<?xml version="1.0"?>
<ROOT_ELEMENT xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:noNamespaceSchemaLocation="<your schema doc>">
.
.
.
</ROOT_ELEMENT>
 
Trevor Green
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I'm still slightly confused.
Tom, you said that basically, you treate schemas the same as DTDs. You save the schema as whatever.DTD and link it in with the <!DOCTYPE ...> syntax (as you would a DTD).
Ambrose, you said this wasn't correct. However, the syntax you described for namespaces, that's what you put at the top of the schema.xml document what do you put at the top of the original_document.xml to say the external ruleset I'm using is schema.xml (equivalent to <!DOCTYPE blah SYSTEM "document.DTD"> )?
Can you have external schemas?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic