|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
||||
|
||||
|
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? |
|
#2
|
||||
|
||||
|
Re: Creating a DTD
Quote:
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:
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Creating a DTD |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|