venta: (Default)
[personal profile] venta
I'm writing My First XML Schema... it's for a very simple family of XML documents which someone else has defined by saying "yes, well, it's all fairly self-explanatory".

(He's right, it is, though documenting that is actually quite hard.)

However, there is an elephantelement whose value is an ASN.1 GeneralizedTime. How do I express in the schema that that should be the case ?

I can do:

<element name="partyTime" type="xsd:dateTime" minOccurs="0"/>

... but that's not the same thing. How do I refer to ASN.1 entities from inside an XML schema ? ASN.1 does provide a method to encode GeneralizedTime objects into xsd:dateTime format, but I can't see how that's useful.

Or do I just call a GeneralizedTime a string and have done with it?

Date: 2008-09-10 09:01 pm (UTC)
From: [identity profile] leathellin.livejournal.com

If it is basically a specification schema then i'd leave it as a basic string field and document the schema with lots of nice xs:documentation elements. If you think that users might want the schema to provide some basic validation to give them an idea how they're doing then add the pattern to narrow things down a bit.

If the consuming application ever gets defined or data validity is causing problems then a tighter schema can always be issued.

Note: this only works if the documentation of the schema is nice and clear about the restrictions actually in place on that field. It all goes horribly wrong when the receiving authority starts allowing "variants" and "common errors" and then discovers it can't tighten the validation back up again. Bitter experience :-)

Thank you

Date: 2008-09-10 09:22 pm (UTC)
From: [identity profile] venta.livejournal.com
OK, that sounds like a low-effort professional approach :)

I'll have a look tomorrow at the PDF you linked to - it looked like it might take me a while to wade through it, so I figure I'll do it on work's time not my own.

(Tomorrow's other problem is to work out why efforts on my part to validate an example file against the schema fail with mysterious error messages :)

Profile

venta: (Default)
venta

December 2025

S M T W T F S
 123456
78910111213
14151617181920
212223 24252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 27th, 2025 02:49 am
Powered by Dreamwidth Studios