[ https://issues.apache.org/jira/browse/TUSCANY-2326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yang Wang resolved TUSCANY-2326. -------------------------------- Resolution: Fixed 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) { LOGINFO_1( INFO,"SchemaParser:startAttribute:%s",(const char*)localname); if (!bInSchema) return; PropertyDefinitionImpl thisProperty; thisProperty.isElement = false; thisProperty.isContainment = false; // this is my rectification. setName(attributes, thisProperty.name, thisProperty.localname); thisProperty.namespaceURI = schemaInfo.getTargetNamespaceURI(); setType(thisProperty, attributes, namespaces); setCurrentProperty(thisProperty); } > attribute in xml schema becomes element when g enetate xsd from SDO > --------------------------------------------------------------------- > > Key: TUSCANY-2326 > URL: https://issues.apache.org/jira/browse/TUSCANY-2326 > Project: Tuscany > Issue Type: Bug > Components: C++ SDO > Affects Versions: Cpp-M3 > Environment: Tuscany SDO C++ M3 Source Release for Windows > Reporter: Yang Wang > Fix For: Cpp-M3 > > > 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) > { > LOGINFO_1( INFO,"SchemaParser:startAttribute:%s",(const > char*)localname); > if (!bInSchema) return; > PropertyDefinitionImpl thisProperty; > > thisProperty.isElement = false; > thisProperty.isContainment = false; // this is my rectification. > I add this statement. > > > setName(attributes, > thisProperty.name, > thisProperty.localname); > thisProperty.namespaceURI = schemaInfo.getTargetNamespaceURI(); > setType(thisProperty, attributes, namespaces); > > setCurrentProperty(thisProperty); > } > 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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.