Solved

[XML] Delphi 7 XML Data Binding is flawed?

Posted on 2003-11-19
4
1,463 Views
Last Modified: 2013-11-19
Okay, I wonder if there are more problems with the XML Data Binding wizard than the ones I found. I found that:
1) Adding child nodes to a sequence node will not add them in the order that is required by the sequence.
2) Boolean values are written as 'True' or 'False' while XML is case-sensitive and expects them to be 'true' or 'false'.
3) DateTime fields are not written in the XML-specific format.

About that first issue... If I have this schema-declaration:

  <xs:complexType name="NamedItem">
    <xs:sequence>
      <xs:element name="Name" minOccurs="0" type="xs:string"/>
      <xs:element name="Description" minOccurs="0" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

Now, in Delphi. If I create a node of type NamedItem and add a description before the name, the XML file will look like this:
<NamedItem><Description>adescription</Description><Name>aname</Name><NamedItem>
However, the schema specified that they should be a sequence so I expected Delphi to put these nodes in the right order!

So far, the issues I've found are things I can accept for now. I realise these errors might require me to work around them if I want to output an xml file that validates according to my schema. But I wonder if there are even more problems with Delphi's implementation of XML.

My problem: I have an xml schema and I need to generate/read/write an xml file and make sure it is valid according to this schema. A simple solution is to modify the sourcecode that is generated by the XML data Binding wizard and I just have to make sure I insert elements in the right order. But I wonder if I can expect even more problems.

And no, I don't want or need any alternative XML components, no matter how good they are, how fast they are or how free they are.

Points will be divided if more than one person mentions possible problems that haven't been mentioned before.
0
Comment
Question by:Wim ten Brink
  • 2
4 Comments
 
LVL 5

Expert Comment

by:DeerBear
Comment Utility
Hi,

I don't own D7, but to my experience a hotspot is entities' handling( &egrave;&lt;&gt; etc ) which may
well be flawed and if I was you I'd investigate in that direction.

HTH,

Andrew
0
 
LVL 1

Accepted Solution

by:
Chopinke earned 500 total points
Comment Utility
As for 2) and 3)  visit:

http://bdn.borland.com/article/0,1410,28514,00.html

Charlie
0
 
LVL 17

Author Comment

by:Wim ten Brink
Comment Utility
Good link, Charlie! :-)
However, it is SOAP related and all I need to do is read/write configuration files containing all kinds of information. I have schemas for these files and must make sure that whatever I write will be validated (e.g. by using XMLSpy) according to these schemas. The biggest thing I actually need to rewrite is the XML Data Binding wizard since this thing generated a flawed sourcefile.

Andrew,
I use the IXMLDocument/TXMLDocument component to access the xml data and haven't noticed many problems with values in entities. It recognizes &lt; and &gt; but &egrave; is invalid. But this is correct since XML doesn't recognise this character reference. Only &amp; &lt; &gt; &quot; &apos; are recognized, which is correct. Other references are just invalid. (Well, unicode chartacters can be referenced by using &#xxx; where xxx is the numeric code for the character. Thus &#0169; will put the © character in the entity. But there's no real need to reference unicode since an XML file can handle unicode files quite well.
0
 
LVL 17

Author Comment

by:Wim ten Brink
Comment Utility
Points and A-Grade awarded for the useful link. I hoped someone else might have added something useful to this Q so I would have to split the points but no... No one else added anything. The link explains the weaknesses of Delphi's SOAP implementation and gave me enough leads to discover some other flaws.

Thanks again!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now