Dear all friends, I would like to know can we, restrict content(i mean length,values etc....) of an XML element using XML DTD's. Also how to restrict the length of an ATTRIBUTE. for EX: <?xml version="1.0" encoding="UTF-8"?> <TEST> <JAVARANCH>XML</JAVARANCH> <TYPE desc='xml'>FORUM</TYPE> </TEST> I want a DTD to validate the above xml as 1) element JAVARANCH should contain only XML as value. 2) the attribut desc , should contain value with only 3 chars maximum. Thanx in advance bye mohan
If I understand your question correctly, you can't use a DTD for this. Various projects are experimenting with "XML Schema" - a sort of DTD replacement that can impose restrictions on XML content. www.w3.org is a good place to start. Bill ------------------ author of:
I know you can specify a value for an elemen and make it "final" by desginating the value "fixed". I don't know if you can restrict the length of an attribute value. Bill's link was comprehensive and in depth. Excellent site! Thanks Bill.
Mohan, Please read the JavaRanch Name Policy and re-register using a name that complies with the rules. Thanks for your cooperation. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform