[xsd-users] Help me: Borland C++ Builder 2007 compiled program has
unwanted prefix and all property values are missing.
James Mei
jxmei3 at gmail.com
Sun Oct 11 10:23:12 EDT 2009
Hi
I have gone through the "Hello world" xsd tutorial with Borland C++ builder
2007. Everything works fine. I then proceed with generating more files from
other xsd.
..\xsd cxx-tree --generate-serialization --namespace-map
http://www.codesynthesis.com/xsd/SCL=SC_SCL *.xsd
The main program, which just parse the xml file and save it to another:
int main (int argc, char* argv[])
{
try
{
using namespace SC_SCL;
auto_ptr<SCL> h (SCL_ (argv[1], xml_schema::flags::dont_validate));
ofstream outfile(argv[2], ios::out);
SCL_(outfile, *h);
}
catch (const xml_schema::exception& e)
{
cerr << e << endl;
return 1;
}
}
During compilation, it prompts the follow error:
[BCC32 Error] SCL.cxx(273): E2093 'operator!' not implemented in type
'xsd::cxx::tree::optional<tCommunication>' for arguments of the same type
on the following line:
if (n.name () == "Communication" && n.namespace_ () == "
http://www.codesynthesis.com/xsd/SCL")
{
::std::auto_ptr< Communication_type > r (
Communication_traits::create (i, f, this));
if (!this->Communication_)
//<------------------------- error line
{
this->Communication_.set (r);
continue;
}
}
I changed the above line to
if (this->Communication_==NULL)
//<------------------------- changed
{
this->Communication_.set (r);
continue;
}
The program compiles and run. However, there are 2 unexpected results.
//Input XML file
<?xml version="1.0" encoding="utf-8"?>
<SCL xmlns="http://www.codesynthesis.com/xsd/SCL" xsi:schemaLocation="
http://www.codesynthesis.com/xsd/SCL SCL.xsd">
<Header id="SEL"/>
<Communication>
<SubNetwork name="NONE">
<ConnectedAP iedName="SEL_421" apName="P1">
<Address>
<P type="OSI-AP-Title">1,1,1,999,1</P>
<P type="OSI-AE-Qualifier">12</P>
<P type="OSI-PSEL">00000001</P>
<P type="OSI-SSEL">0001</P>
<P type="OSI-TSEL">0001</P>
<P type="IP">209.254.235.118</P>
</Address>
........
//Output XML file
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<p1:SCL xmlns:p1="http://www.codesynthesis.com/xsd/SCL">
<p1:Header id="" nameStructure="" revision=""/>
<p1:Communication>
<p1:SubNetwork name="">
<p1:ConnectedAP apName="" iedName="">
<p1:Address>
<p1:P type=""/>
<p1:P type=""/>
<p1:P type=""/>
<p1:P type=""/>
<p1:P type=""/>
<p1:P type=""/>
</p1:Address>
.............
Unexpected result 1: All the tags has an "p1:" prefix.
Unexpected result 2: It has no problem reading all the element names, but
all the properties are missing.
My questions
1. Did I do something wrong on modifying the line (if
(!this->Communication_) ) to cause this result ?
2. I recompiled the whole program and xerces-c-3.0.1 using MingW, the
unexpected result 2 is gone (all the property values appeared) but the
unexpected result 1 ("p1") still remains.
May I know how can I correct the above two problems ?
Best regards
James
More information about the xsd-users
mailing list