SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 17th, 2003, 07:37 AM
raybiez's Avatar
raybiez raybiez is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: Midrand, South Africa
Posts: 154 raybiez User rank is Lance Corporal (50 - 100 Reputation Level)raybiez User rank is Lance Corporal (50 - 100 Reputation Level)raybiez User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 15 h 1 m 56 sec
Reputation Power: 8
Send a message via MSN to raybiez
Question Creating a DTD

I'm working on a DTD for an EDI message in XML. But some of the element definitions confuse me.

I know that the following...

<!ELEMENT ElementName (#PCDATA)>

means that the Element with the name ElementName cannot be empty ans should contain parsed character data (text).

I also know that the following...

<!ELEMENT ElementName EMPTY>

meanse that the element with the name ElementName may be empty and omitting from the XML document.

Anyone can rectify me on this if I'm wrong (I'm a newbie to XML).

But the parts that confuse me is...

<!ELEMENT ElementName ANY>

and

<!ELEMENT ElementName %;>

Can anyone explain this to me and the other XML Schema newbies?
__________________
Neil Craig
Software Developer
SourceCode Techonolgy Holdings Inc
South Africa

Reply With Quote
  #2  
Old February 17th, 2003, 02:24 PM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 8
Re: Creating a DTD

Quote:
Originally posted by raybiez
I also know that the following...

<!ELEMENT ElementName EMPTY>

meanse that the element with the name ElementName may be empty and omitting from the XML document.

I'm not sure what you mean. An EMPTY declaration means the element must be empty. That is, your DTD above means that the element must appear as <ElementName /> or <ElementName></ElementName>.
Quote:
Originally posted by raybiez
But the parts that confuse me is...

<!ELEMENT ElementName ANY>

and

<!ELEMENT ElementName %;>

Elements declared with the ANY keyword, can literally contain anything. They can be empty, contain PCDATA, or other elements. There is no restriction.

When you encounter a %xxx; sequence, that's an entity. Entities must be previously defined in the DTD. For example,
Code:
<!ENTITY % COMMONITEMS "b|i|u|br">
<!ELEMENT p (%COMMONITEMS;)*>

Is the same as saying,
Code:
<!ELEMENT p (b|i|u|br)*>

Entities are useful when you have groups of similar elements/attributes/whatever, that are commonly shared between multiple elements.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Creating a DTD


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway