Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - DTDs and XML: another "not well formed" question >Thread Next - Re: DTDs and XML: another "not well formed" question Re: DTDs and XML: another "not well formed" questionTo: NULL Date: 7/1/2007 5:47:00 PM In article <1183310598.504725.29160@n...>, seven.reeds <seven.reeds@g...> wrote: ><!ELEMENT article (title, image*, text+)> ><!ELEMENT title (#PCDATA)> ><!ELEMENT image (src, width?, height?, link?)> > <!ATTLIST src CDATA #REQUIRED> > <!ATTLIST link CDATA #IMPLIED> > <!ATTLIST width PCDATA #IMPLIED> > <!ATTLIST height PCDATA #IMPLIED> Are src, link, width and height subelements or attributes? You've listed them as child elements in the content model, and then declared them as attributes. You seem to be using attributes, so declare image as <!ELEMENT image EMPTY> And you've declared width and height as PCDATA which doesn't mean anything; presumably you meant CDATA. ><!ELEMENT text (#CDATA)> And here you've declared the content of text to be #CDATA, presumably you meant #PCDATA. >A sample xml doc looks like > ><?xml version="1.0" ?> ><!DOCTYPE article SYSTEM "http://www.itg.uiuc.edu/publications/news/ >news.dtd"> ><article> > <title> Applied Physics Letters Features ITG Image on Cover </title> > <image link="http://scitation.aip.org/dbt/dbt.jsp? >KEY=APPLAB&Volume=90&Issue=21" All your ampersands need to be replaced with & > src="/images/apl_cover-130.jpg" /> > <text> The cover for the <a href="http://scitation.aip.org/dbt/ >dbt.jsp?KEY=APPLAB&Volume=90&Issue=21">May Your dtd doesn't say anything about <text> being allowed to contain <a> elements. You'll need to change the declaration of text and add a declaration for a. >My XML parser chokes on the first "&" (ampersand) in the "link" >attribute of the "image" tag. I know that being "well-formed" means >the amps should be "quoted" but I thought that the "CDATA bits in the >DTD meant that *ALL* characters are accepted in this context. A CDATA marked section in text, such as <![CDATA[hello & goodbye]]> has that effect. In attributes (whether declared as CDATA or something else) you have to quote ampersands. There's no way around it. The CDATA/PCDATA terminology is certainly confusing. -- Richard -- "Consideration shall be given to the need for as many as 32 characters in some alphabets" - X3.4, 1963. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
