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
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
0
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:
Dear Bill, But can i restrict , the length of the attribute in the tag using DTD, if so how ?? Thanx in advance.. mohan
Cameron Park
Ranch Hand
Joined: Apr 06, 2001
Posts: 371
posted
0
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.
Jane Griscti
Ranch Hand
Joined: Aug 30, 2000
Posts: 3141
posted
0
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