You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Juny Fan <Ju...@axent.com> on 2000/12/01 00:20:45 UTC

Define required attribute in schema.

I am using xerces 1.2.2
I want to define an attribute must occure in an elment  in my schama file.
so I do something like this 
....
	<attribute name="id" type="string" minOccurs="1"/> for the element
Policy.

when I validate a xml file having Policy element without giving id attribute

<Policy
    description="Detects all status messages generated by Intruder Alert."
    name="ITA Status" revision="970777837" structure="2">

I did not get any warning or error from xerces XMLParser. Can anyone help
here?

Thanks,
Juny Fan	
	 

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

Re: Define required attribute in schema.

Posted by Eric Ye <er...@locus.apache.org>.
That's a "old fashion way" to prescribe a required attribute , the "up to
date" approach should be:
 <attribute name="id" type="string" use="required" />

_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Juny Fan" <Ju...@axent.com>
To: <xe...@xml.apache.org>
Sent: Thursday, November 30, 2000 3:20 PM
Subject: Define required attribute in schema.


> I am using xerces 1.2.2
> I want to define an attribute must occure in an elment  in my schama file.
> so I do something like this
> ....
> <attribute name="id" type="string" minOccurs="1"/> for the element
> Policy.
>
> when I validate a xml file having Policy element without giving id
attribute
>
> <Policy
>     description="Detects all status messages generated by Intruder Alert."
>     name="ITA Status" revision="970777837" structure="2">
>
> I did not get any warning or error from xerces XMLParser. Can anyone help
> here?
>
> Thanks,
> Juny Fan
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>