Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1564
  • Last Modified:

[XML] Delphi 7 XML Data Binding is flawed?

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
Wim ten Brink
Asked:
Wim ten Brink
  • 2
1 Solution
 
DeerBearCommented:
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
 
ChopinkeCommented:
As for 2) and 3)  visit:

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

Charlie
0
 
Wim ten BrinkAuthor Commented:
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
 
Wim ten BrinkAuthor Commented:
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 Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now