 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Werner Lehmann Guest
|
Posted: Sun Aug 27, 2006 6:07 am Post subject: XMLDocument can write well-formed but invalid XML |
|
|
Hi,
I have a problem with the XML saved by TXMLDocument (or more precisely,
the binding code generated from a schema). The XML output lists every
attribute defined in the schema, even if the attribute is optional and
has never been written to.
While this is superfluous and I want to prevent it from doing that, it
even makes the XML invalid against its schema for attributes of type
IDREF or IDREFS: these attributes cannot be empty, they must either be
omitted (if optional) or contain an existing ID.
What can I do about this? And is there a way that the parser/binding
supports the ID/IDREF types directly? With JAXB (Java XML binding)
attributes of type IDREF are direct references to the element with the
respective ID, not only strings...
Attribute default values are also problematic with these unwanted empty
attributes: if the attribute is present but empty it is completely
different from a missing attribute which has a default value in the schema.
Now that I am used to JAXB I can't help thinking there must be a better
XML binding framework out there, but I couldn't find one. The binding
wizard does not seem to be enhanced much since the D6 days...
Werner |
|
| Back to top |
|
 |
Werner Lehmann Guest
|
Posted: Tue Aug 29, 2006 2:57 am Post subject: Re: XMLDocument can write well-formed but invalid XML |
|
|
On 27.08.2006 03:07, Werner Lehmann wrote:
| Quote: | the binding code generated from a schema). The XML output lists every
attribute defined in the schema, even if the attribute is optional and
has never been written to.
|
Turns out that these attribute nodes were auto created (option
doNodeAutoCreate is active by default). The nodes were displayed in a
treeview which tried to read their values, which created them. So, this
behaviour seems to be in order.
Support for default values and ID/IDREF types could be improved though
because for the latter an empty attribute value makes no sense.
Werner |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|