BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

XMLDocument can write well-formed but invalid XML

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML
View previous topic :: View next topic  
Author Message
Werner Lehmann
Guest





PostPosted: Sun Aug 27, 2006 6:07 am    Post subject: XMLDocument can write well-formed but invalid XML Reply with quote



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





PostPosted: Tue Aug 29, 2006 2:57 am    Post subject: Re: XMLDocument can write well-formed but invalid XML Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.