I thought about the nillable attributes, but I don't have any control of the incoming XML instance.
Benson. -----Original Message----- From: Beyer,Nathan [mailto:[EMAIL PROTECTED] Sent: Thursday, June 20, 2002 10:46 AM To: '[EMAIL PROTECTED]' Subject: RE: Allow emptyTag for optional fields This question would probably be better asked on the W3C's xmlschema-dev list. Using a minOccurs restricts an elements cardinality, not it's content. An empty element is an element making an occurrence. The type declares the content's limitations, so when you using anything besides a basic string, an empty element is usually invalid. What you may want to try is using the nillable attribute, like this: <xsd:element name="Age" type"xsd:positiveInteger" nillable="true"/> And then send the XML as this: <Age xsd:nil="true"/> You'll have to check on the nillable syntax to see exactly how it's done. -----Original Message----- From: Benson Cheng [mailto:[EMAIL PROTECTED] Sent: Thursday, June 20, 2002 12:37 PM To: [EMAIL PROTECTED] Subject: Allow emptyTag for optional fields I have a schema question, how can I write the schema that allows emptyTag for optional fields, for example: Schema: <xsd:element name="Partner"> <xsd:sequence> <xsd:element name="Name" type="xsd:string"/> <xsd:element name="Age" type="xsd:positiveInteger" minOccurs="0"/> </xsd:sequence> </xsd:element> XML-1: <Partner> <Name>MyName</Name> </Partner> XML-2: <Partner> <Name>MyName2</Name> <Age/> </Partner> For the second XML, the Xerces throws a error like "Value '' is not a integer", my question is how can I change the schema so it can allow both XML, I know I can change the type of "Age" to xsd:string and use the regular expression "[0-9]{1,}", but I am wonder is there way to keep the xsd:positiveInteger type and also allow the empty tag the same time? Thanks Benson. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. ---------------------------------------- -- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
