Groups | Blog | Home
all groups > dotnet xml > february 2005 >

dotnet xml : Schema to validate a Value Element of Type 'DateTime'


Paul Cheevers
2/11/2005 2:09:48 PM
Hi,

I've been trying to write some schema to validate the Value element of an Eq
element but to no avail. If the Value Element is off type DateTime then the
node should be able to contain text (the actual date string) or the <Today
/> element.

I can write schema to validate either one off the options seperately but
cannot write it in a way which allows either one off the options.

Hope that makes since, any help would be greatly appreciated.
I've included some sample XML of what I'm trying to validate below.

Cheers,
Paul

<And>
<Eq>
<FieldRef Name="DueDate" />
<Value Type="DateTime">
<Today />
</Value>
</Eq>
<Eq>
<FieldRef Name="DueDate" />
<Value Type="DateTime">11/11/05</Value>
</Eq>
</And>


Zafar Abbas [MSFT]
2/11/2005 5:17:43 PM
You can not restrict the content of the element based on the value of one
the attributes of that element, in XmlSchema. You are trying to use an
element of mixed content (both text and element content) and if so, you can
not restrict the text value in the element to a data type.



[quoted text, click to view]

Paul Cheevers
2/24/2005 3:41:02 PM
Hi Zabar,

Thanks for the reply. I'm not really trying to restrict the content based on
the value of the attribute. I just want schema that will allow text or an
element type for the Value node.

I'm finding this really annoying as this CAML is supported by Microsoft and
is documented in MSDN but I can't find any schema which will validate it.

Any further help would be greatly appreciated,
Cheers,
Paul

[quoted text, click to view]

AddThis Social Bookmark Button