Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Schemas

 
Trevor Green
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • 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).]
 
tom horwath
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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">

 
Ambrose Tati
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic