XML Binding


2005-02-09 01:55:31 AM
cppbuilder2
Hopefully this is the right place for this.
I'm using the XML Binding wizard in BCB6 and have a DTD from which I'm
binding. I have a line in the DTD like this:
<!ELEMENT Setting (Description, Name, Value, AcceptableValues?)>
Which means, zero or one AcceptableValues children are acceptable to the
Setting node.
My particular xml file that I'm using validates no problems and it has
some nodes with AcceptableValues children and some without.
The problem is, when I update the XML file through my program, it adds
an <AcceptableValues/>tag to the Setting nodes that do not have
AcceptableValues children.
Am I missing something? This seems to be an error in the XML engine, but
I'm not sure.
The other thing is, that I was under the impression that the XML parser
would validate against a DTD, but after this happens, I restart my
program and it doesn't complain about the fact that an AcceptableValues
node without children is illegal, per this line in my DTD:
<!ELEMENT AcceptableValues (Value+)>
The only thing that seems a little off is that the node Value exists in
two different places in my DTD as child nodes of two different elements.
I don't think this is an issue because in both cases the Value element
relies on one definition:
<!ELEMENT Value (#PCDATA)>
Anybody got any ideas?
thanks in advance,
tim