IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Element Requires Further Child Elements Options · View
jeet
Posted: Wednesday, November 25, 2015 7:47:46 PM
Rank: Newbie

Joined: 11/25/2015
Posts: 1
Location: Germany
So I was designing an XML file based on a certain DTD. The logic is thus:

Category >> Books(can have many entries) >>Author[required], Price[required], Description, Image)

Here is the DTD generated:

Quote:
<!ELEMENT CATAGORY (PRODUCT+)>
<!ELEMENT PRODUCT
(NAME,PRICE,DESCRIPTION*,PICTURE*)>
<!ATTLIST PRODUCT
NAME CDATA #REQUIRED
PRICE CDATA #REQUIRED
DESCRIPTION CDATA #IMPLIED
PICTURE CDATA #IMPLIED
CATEGORY (BOOKS|GADGETS|OTHERS) "BOOKS"
AUTHOR CDATA #REQUIRED
ISBN CDATA #IMPLIED
INVENTORY (InStock|Backordered|Discontinued) "InStock">


However, I am unable to write a valid XML. I wrote thus:

Quote:
<CATAGORY>
<PRODUCT NAME="XML BOOK" AUTHOR="XML GENIUS" CATEGORY="BOOKS" DESCRIPTION="BRILLIANT XML BOOK." INVENTORY="InStock" ISBN="653725327" PRICE="36.99" PICTURE=""/>
<PRODUCT NAME="XML MASTERS" AUTHOR="XML TEACHER" CATEGORY="BOOKS" DESCRIPTION="" INVENTORY="InStock" ISBN="" PICTURE="" PRICE="23.99"/>
</CATAGORY>


I get the following error from XML SPY. Any help is appreciated.

Quote:
Content model of element <PRODUCT> requires further child elements.
Error location: CATAGORY / PRODUCT
Details
VC: Element Valid (2): Content model of element <PRODUCT> requires further child elements.


P.S. I am absolutely new to XML and DTDs so my apologies.
island
Posted: Thursday, November 26, 2015 9:52:32 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
with the xml file open, select Generate DTD/Schema in the DTD/Schema menu. This will generate the appropriate dtd or xsd from your xml file.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.