Details
Description
I am a user of Tuscany SDO C++ , but I entercounter a problem when I use it.
my problem's description:
this is my xml schema: in file msg.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:rcmq="RCMQ" targetNamespace="RCMQ">
<xsd:element name="rcmqMsg" type="rcmq:RCMQMessage"/>
<xsd:complexType name="RCMQMessage">
<xsd:sequence>
<xsd:element name="messageID" type="xsd:string"/>
<xsd:element name="correlationID" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="wy" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>
my code:
#include <commonj/sdo/SDO.h>
using namespace commonj::sdo;
using namespace std;
void main()
{ DataFactoryPtr mdg = DataFactory::getDataFactory(); XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg); const char* m=myXSDHelper->defineFile("msg.xsd"); TypeList tl = mdg->getTypes(); char* xsdStr=myXSDHelper->generate(tl,"RCMQ"); cout<<xsdStr; }the result of running:
<xsd:schema xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml" xmlns:tns="RCMQ" targetNamespace="RCMQ" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="rCMQMessage" type="RCMQMessage"/>
<xsd:complexType name="RCMQMessage">
<xsd:sequence>
<xsd:element name="messageID" type="xsd:String" minOccurs="0"/>
<xsd:element name="correlationID" type="xsd:String" minOccurs="0"/>
<xsd:element name="wy" type="xsd:String"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
I find the result is not consistent with the former schema, the attribute in former schema becomes element in new schema. In fact , they should be consistent.
I download Tuscany SDO C++ M3 Source Release for Windows, which is the newest version at present.
I think there is a little bug in the sourcecode, and I find out it and rectify this error, and resolve the problem.
my way to solve:
rectify in the file : SDOSchemaSAX2Parser.cpp
// ============================================================================
// startAttribute
// ============================================================================
void SDOSchemaSAX2Parser::startAttribute(
const SDOXMLString& localname,
const SDOXMLString& prefix,
const SDOXMLString& URI,
const SAX2Namespaces& namespaces,
const SAX2Attributes& attributes)
Your Project of SDO C++ is very good and perfect, athough it has some little problems. I hope you can pay attention to my problem and resolve it , my rectification is just a reference.