<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I don't grasp exactly what you're trying to do, but if you need a
program that generates XML documents that conform to a schema for which
date values are relative to today, I agree having the harness write the
older date seems to make sense.<br>
<br>
If generateDS doesn't fully support all the XML Schema date types, you
could do that using PyXB with a program like this:<br>
<br>
<tt> import schema<br>
import pyxb.binding.datatypes as xsd<br>
import datetime<br>
<br>
delta = xsd.duration('P3D')<br>
<br>
s = schema.instance()<br>
s.setElt(datetime.date.today() - delta)<br>
print s.toxml()</tt><br>
<br>
with output:<br>
<br>
<tt><?xml version="1.0"
?><instance><elt>2009-07-06</elt></instance><br>
</tt><br>
assuming the schema is:<br>
<br>
<tt><?xml version="1.0" encoding="UTF-8"?><br>
<xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>><br>
<xs:element name="instance" type="structure"/><br>
<xs:complexType name="structure"><br>
<xs:sequence><br>
<xs:element name="elt" minOccurs="0" type="xs:date"/><br>
</xs:sequence><br>
</xs:complexType><br>
</xs:schema></tt><br>
<br>
PyXB (see <a class="moz-txt-link-freetext" href="http://pyxb.sourceforge.net">http://pyxb.sourceforge.net</a>) is definitely beta software, but
it's coming along nicely. It makes a strong effort to validate the
data written into the binding instances (in fact, a weakness is that
you can't stop it from trying to validate). It can also handle very
complex schemas, such as those from OpenGIS.<br>
<br>
If you really need to change the type of an element in a complex type
at runtime, it could be done by generating a customized binding (though
you'd have to modify the runtime support class
pyxb.binding.basis.element to allow this particular kind of
customization).<br>
<br>
Peter<br>
<br>
Tennis Smith wrote:
<blockquote
cite="mid:e84cff280907091206o8a45927gbd70f42b17e4b2fd@mail.gmail.com"
type="cite">Hi,<br>
<br>
I'm looking for some guidence in handling a testing issue. I'm new to
XML/XSLT, so please bear with me.<br>
<br>
First,
a little background. My charter is to generate XML test messages to
make sure we process them correctly. These messages are validated
against a schema. I'm using generateDS to generate the test messages.
This ensures the xml is correct.<br>
<br>
Everything works great except for one problem that keeps cropping
up. Some elements cannot be defined easily ahead of time when
generating the final test document. <br>
<br>
For example, a field of
type "xs:date" will have to be modifed because tests are based on a
relative date, not an absolute one. That is, dates in tests are based
on things like "3 days before today". <br>
<br>
Therefore, I'd like to figure out some way to change certain fields
like date so that I can pass a string and _still validate_ it against
the schema. Using the example, "-3" would be passed in the date field
so that the test harness will recognize it as "today - 3 days". <br>
<br>
Put another way, the goal is to make this:<br>
<i> <xs:element maxOccurs="1" minOccurs="0" name="date"
type="xs:date"/></i><br>
...<span style="color: rgb(51, 51, 255);">behave</span> like this:<br>
<i><xs:element maxOccurs="1" minOccurs="0" name="date" type="<span
style="color: rgb(204, 0, 0);">xs:string</span>"/></i><br>
<br>
Naturally, I can edit and copy/paste into a completely new schema
file. But I was hoping someone could tell me if I can do some kind of
XSLT or whatever to get the same effect.<br>
<br>
Thanks,<br>
<font color="#888888"><br>
</font>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
XML-SIG maillist - <a class="moz-txt-link-abbreviated" href="mailto:XML-SIG@python.org">XML-SIG@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/xml-sig">http://mail.python.org/mailman/listinfo/xml-sig</a>
</pre>
</blockquote>
<br>
</body>
</html>