Jump to content

Datetime Or "..."


sybren

Recommended Posts

Hi folks,I want to have an element that either contains a dateTime or the literal string "...". Is there any way to specify this in Schema?The element in question is the creationTimestamp element as below:

	 <complexType name="persistedEntity">		  <sequence>			  <element name="editedBy" type="string" minOccurs="0" />			  <element name="creationTimestamp" type="dateTime" minOccurs="0" />			  <element name="status" type="syringe:entityStatus" minOccurs="0" />		  </sequence>	  </complexType>	<complexType name="role">		<complexContent>			<extension base="syringe:mnemonizedPersistedEntity">				<sequence>					<element name="name" type="string" />					<element name="builtIn" type="boolean" minOccurs="0" />				</sequence>			</extension>		</complexContent>	</complexType>

I would like to be able to use it as such:

			<role>				<editedBy>SYSTEM</editedBy>				<creationTimestamp>...</creationTimestamp>				<status>NORMAL</status>				<mnemonic>ADMIN</mnemonic>				<name>ADMIN</name>				<builtIn>true</builtIn>			</role>

The "..." is for testing purposes, a way to say "I don't care what dateTime is here", whereas the actual dateTime is used in any other case.Cheers,Sybren

Link to comment
Share on other sites

Instead of specifying xsd:dateTime on type, create a custom type that would be a union of xsd:dateTime, and your own type that defines "..." as a valid enumeration value.Particularly:

<xsd:element name="creationTimestamp" minOccurs="0" type="dateTimeExtended" /><xsd:simpleType name="dateTimeExtended">	<xsd:union memberTypes="xsd:dateTime dots"/></xsd:simpleType><xsd:simpleType name="dots">	<xsd:restriction base="xsd:string">		<xsd:enumeration value="..." />	</xsd:restriction></xsd:simpleType>

BTW, sorry for being so late in answering, but I only just now saw this topic.

Link to comment
Share on other sites

Instead of specifying xsd:dateTime on type, create a custom type that would be a union of xsd:dateTime, and your own type that defines "..." as a valid enumeration value.
Thank you, this is very useful and exactly what I hoped for :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...