Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-2326

attribute in xml schema becomes element when g enetate xsd from SDO

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Cpp-M3
    • Cpp-M3
    • C++ SDO
    • None
    • Tuscany SDO C++ M3 Source Release for Windows
    • Patch Available

    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)

      { 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wywy Yang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: