RE: space attrbiute in XML-2-Object binding?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: space attrbiute in XML-2-Object binding?

Kogan, Tamara
Hi Risto,

When you are talking about the xml:space attribute do you mean the
constraining facet "whiteSpace"?
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#rf-whi
teSpace

If so the facet should be handled in the same way as the enumeration
facet.
It has not being implemented yet but there is an AR
49295: "Problem with simple type validation (case 373974)"
which will be scheduled for 75.

You can try to add support for this facet by yourself and it should be
relatively easy.
It should be added new binding element that describes the string
attribute:
<xsd:whiteSpace value="preserve"/>
Then uncomment "whiteSpaces" in
RestrictionMarshaler>>validationAttributes
And implement SimpleObjectMarshaler>>whiteSpacesValidate: aValue

Let me know if I answered your question,
Tamara Kogan
Smalltalk Development
Cincom Systems

> -----Original Message-----
> From: Risto Pohjonen [mailto:[hidden email]]
> Sent: Friday, March 31, 2006 3:47 AM
> To: [hidden email]
> Subject: xml:space attrbiute in XML-2-Object binding?
>
>
> Dear list,
>
> Has anyone made an XML-to-object binding that defines xml:space
> attribute (that defines how whitespaces are handled) to be used in XML
> documents? I tried the following two ways to include this attribute in
> schema:
>
> <object name="text" smalltalkClass="MyText">
>   <attribute name="xml:space" aspect="xmlSpace" ref="xsd:string" />
> </object>
>
> or
>
> <object name="text" smalltalkClass="MyText">
>   <attribute aspect="xmlSpace" ref="xml:space " />
> </object>
>
> Both of these failed when loading the binding because the qualifier
> "xml" was not found among defined namespaces. Furthermore, defining
such
> namespace by oneself is - obviously - not allowed either.
>
> So, any ideas how to include this attribute?
>
>
> With best regards,
>
> Risto Pohjonen
> MetaCase

Reply | Threaded
Open this post in threaded view
|

RE: space attrbiute in XML-2-Object binding?

Risto Pohjonen-2
Hi,

>When you are talking about the xml:space attribute do you mean the
>constraining facet "whiteSpace"?

The problem relates implementing SVG to GF/ST bridge. SVG specs states
that SVG <text> elements define their whitespace handling by including
the xml:space attribute (the default being xml:space="default"), ie.
something like this:

<text xml:space="preserve">
  Yaddayadda

  foo foo
</text>

So, it is not a constraint set on schema level but a real user
attribute.

Investigating xml:space issue a bit further after my original question,
I learned that there is some built-in support for it. It is possible to
include xml:space attribute in an SVG document and unmarshall it (of
course). However, if I associate it with an incorrect value (eh, I
misspelled 'default' as 'defualt'), this error will be noticed by VW as
the values for reserved attributes xml:space and xml:lang are checked
during parsing (see XMLParser>>checkReservedAttributes:type:value:). My
next thought was that ok, VW probably knows how to handle the
whitespaces according to these directives as it seems to recognize them.
But this seems not to be the case.

When unmarshaling the <text> element, the xml:space attribute is
present, but as it is not defined in schema, there is no marshaler for
it and therefore it gets neglected. It could be possible to slip in a
RelationMarshaler for this into the binding before unmarshaling SVG
document, but this sounds a bit too much of a hack to me. Any better
ideas are welcomed :-)


With best regards,

Risto Pohjonen
MetaCase