RE: Validating XML Document......

Subject: RE: Validating XML Document......
From: Shravan Gunda <con_sgunda@xxxxxxxxxxx>
Date: Mon, 27 Mar 2000 14:43:55 -0500
when i pass this xml file to DOMParser it should raise an exception saying
that FirstName is not there. But it is giving the result as valid document.
To validate the xml by applying DTD what i have to do ??

Thanks,
Shravan.

-----Original Message-----
From: sara.mitchell@xxxxxxxxx [mailto:sara.mitchell@xxxxxxxxx]
Sent: Monday, March 27, 2000 1:30 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: RE: Validating XML Document......


According to your example DTD, FirstName is already required as
is LastName. Required is shown in DTDs with either of these syntaxes: 

* no delimeter after the element name (to require a single instance), or,
* + delimeter after the element name (to require at LEAST 1 instance, but
  any number is valid)

Sara

> -----Original Message-----
> From: Shravan Gunda [mailto:con_sgunda@xxxxxxxxxxx]
> Sent: Monday, March 27, 2000 9:29 AM
> To: 'XSL-List@xxxxxxxxxxxxxxxx'
> Subject: Validating XML Document......
> 
> 
> Hi All,
> 
> 
> Here is my XML and DTD files.
> 
> XML :
> 
> 	<?xml version="1.0"?>
> 	<!DOCTYPE con_rloc_app SYSTEM "app.dtd">
> 	<application>
>    		<PersonalInfo>
> 			   <MIName>N</MIName>
> 			   <LastName>Achem</LastName>
> 			   <Salutation>Mr.</Salutation>
> 			   <E-mail>abc@xxxxxxx</E-mail>
> 			   <JobTitle>jobtitle</JobTitle>
> 		   </PersonalInfo>
> 	</application>
> 
> 
> DTD :
> 
> 	<!ELEMENT application (PersonalInfo)>
>         		<!ELEMENT PersonalInfo (FirstName, MIName?,
> LastName, Salutation?, E-mail?,JobTitle)>
>                 		<!ELEMENT FirstName (#PCDATA)>
> 		            <!ELEMENT MIName (#PCDATA)>
> 		            <!ELEMENT LastName (#PCDATA)>
>             		 <!ELEMENT Salutation (#PCDATA)>
> 		             <!ELEMENT E-mail (#PCDATA)>
> 		             <!ELEMENT JobTitle (#PCDATA)>
> 
> I am reading the xml file and passing it to DOMParser class. 
> It is giving
> the result as valid document.
> 
> My question here is , If i want make the FirstName as 
> mandatory field what i
> have to do in the dtd?
> If the xml fiels doesnot contain FirstName, the parser should 
> raise and
> exception.
> 
> here is my code in the java class :
> 
> str1 contains the xml file.
> 
> 		DOMParser xp = new DOMParser() ;
>                   xp.setErrorHandler(err);
>                   xp.parse(new InputSource(new StringReader(str1)));
> 
> Thanks,
> Shravan.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread