Next in thread →
Next in month →
Re: [relax-ng] Conversion of comments between the compact and the XMLsyntax
> I have noticed that trang is converting comments between both syntaxes
> nicely except when they happen in a text only pattern.
Currently, Trang's object model treats a parameter as simply a string rather
than as a mixture of strings and comments. I'm not sure it's worth changing
this. Nonetheless I can certainly do better than the current behaviour.
> For example:
>
> <element name="born">
> <data type="date">
> <param name="minInclusive">1900-01-01</param>
> <param name="maxInclusive">2099-12-31</param>
> <param name="pattern">
> <!-- We don't want timezones in our dates. -->
> [0-9]{4}-[0-9]{2}-[0-9]{2}
> </param>
> </data>
> </element>
>
> gives:
>
> element born {
> xsd:date {
> minInclusive = "1900-01-01"
> maxInclusive = "2099-12-31"
> pattern =
> "\x{a}" ~
> " \x{a}" ~
> " [0-9]{4}-[0-9]{2}-[0-9]{2}\x{a}" ~
> " "
> }
> }
>
> (the comment is trashed)
I've fixed it to give:
element born {
xsd:date {
minInclusive = "1900-01-01"
maxInclusive = "2099-12-31"
# We don't want timezones in our dates.
pattern =
"\x{a}" ~
" \x{a}" ~
" [0-9]{4}-[0-9]{2}-[0-9]{2}\x{a}" ~
" "
}
}
> and
>
> element born {
> xsd:date {
> minInclusive = "1900-01-01"
> maxInclusive = "2099-12-31"
> pattern =
> # We don't want timezones in our dates.
> "[0-9]{4}-[0-9]{2}-[0-9]{2}\x{a}"
> }
> }
>
> gives:
>
> <element name="born">
> <data type="date">
> <param name="minInclusive">1900-01-01</param>
> <param name="maxInclusive">2099-12-31</param>
> <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}
> </param>
> </data>
> <!-- We don't want timezones in our dates. -->
> </element>
> <optional>
>
> (the location of the comment has been changed).
I've fixed it to give:
<element name="born">
<data type="date">
<param name="minInclusive">1900-01-01</param>
<param name="maxInclusive">2099-12-31</param>
<!-- We don't want timezones in our dates. -->
<param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}
</param>
</data>
</element>
<optional>
Is this OK?
James
Next in thread →
Next in month →