← Prev in month ← Prev in thread

Validation of missing elements in xml:

From
Sudheshna Iyer <>
To
Date
2006-04-03T14:59:14Z
ID
<>
Thread
Validation of missing elements in xml:
Team,

I have the simple following xml and dtd:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Person SYSTEM "Person.dtd">
<Person>
	<name>aaa</name>
	<email></email>
</Person>

DTD:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT Person (name, email)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT name (#PCDATA)>

As per the DTD,  please note that "name"and "email" elements are required 
and if I validate the above with xmlspy
xml is valid and wellformed.

But I want to catch the empty element scenario. for eg, if I remove the 
value of the "name" element from person.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Person SYSTEM "Person.dtd">
<Person>
	<name></name> -----> see this.
	<email></email>
</Person>

and validate the xml through xmlspy, xml is still valid and wellformed.

How do I catch these empty element problems through DTD? or is it possible 
through xsd? What is that I need to include
in dtd or xsd to validate empty elements in dtd or xsd?

Thanks for your help.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
← Prev in month ← Prev in thread