[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Validating XML Document......

Subject: RE: Validating XML Document......
From: "Medina, Edward" <emedina@xxxxxxx>
Date: Mon, 27 Mar 2000 14:16:31 -0500
miname
I'm not entirely sure what you are trying to do, but

You can use attributes to require a certain entry

for example

<!ELEMENT FirstName (#PCDATA)>
<!ATTLIST FirstName attributename	CDATA  #REQUIRED>


In the XML this would look like

<FirstName  attributename="Carl">
Carl
</FirstName>

This makes the name part of the metadata, and therefore you 
would not even need an Element for FirstName, instead you could have
the attributes of Element to hold all the personal information.  This is
a benefit, because you can you a Database to populate your metadata
according to
the logon information using LDAP.  But that is something else entirely.

Eddy

-----Original Message-----
From: Shravan Gunda [mailto:con_sgunda@xxxxxxxxxxx]
Sent: Monday, March 27, 2000 12:29 PM
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.