[xsd-users] ifc

giuseppe ferrari giuseppe500 at yahoo.it
Fri Jan 21 09:16:29 EST 2011


hy,i'm try to understand the ifc(BIM model) and related xsd.
When i create the c++ ifc files from the xsd i'm set the parameter 
--generate-polymorphic, And i have this
code in xsd:

<xs:import 
namespace="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" 
schemaLocation="ex.xsd">
    </xs:import>
    <xs:element substitutionGroup="ex:uos" name="uos" type="ifc:uos">
    </xs:element>
    <xs:complexType name="uos">
        <xs:complexContent>
            <xs:extension  base="ex:uos">
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="ex:Entity">
                    </xs:element>
                </xs:choice>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

<xs:element substitutionGroup="ifc:IfcCompositeCurve" name="Ifc2DCompositeCurve" 
nillable="true" type="ifc:Ifc2DCompositeCurve">
    </xs:element>
    <xs:complexType name="Ifc2DCompositeCurve">
        <xs:complexContent>
            <xs:extension base="ifc:IfcCompositeCurve">
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:element substitutionGroup="ifc:IfcControl" name="IfcActionRequest" 
nillable="true" type="ifc:IfcActionRequest">
    </xs:element>
    <xs:complexType name="IfcActionRequest">
        <xs:complexContent>
            <xs:extension base="ifc:IfcControl">
                <xs:sequence>
                    <xs:element name="RequestID" type="ifc:IfcIdentifier">
                    </xs:element>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:element substitutionGroup="ifc:IfcObject" name="IfcActor" 
nillable="true" type="ifc:IfcActor">
    </xs:element>
    <xs:complexType name="IfcActor">
        <xs:complexContent>
            <xs:extension base="ifc:IfcObject">
                <xs:sequence>
                    <xs:element name="TheActor">
                        <xs:complexType>
                            <xs:group ref="ifc:IfcActorSelect">
                            </xs:group>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

this is the logic of the xsd :
A uos tag that contains entities , all entities inherit from ifc:Entity -
2 uos class ex:uos and ifc::uos , only the ifc::uos contains entities , but how 
casting or extract the entities?

The code for parsing(deserialize).xml files work correctly, thanks for your 
advice on the namespaces.
int main(int argc, char* argv[])
{
    try
    {
    
         auto_ptr<ex::iso_10303_28> h 
(common::iso_10303_28_("c:\\esempioifcxml.xml"));
        string str = h->uos().id();
        
        
    }
    catch (const xml_schema::exception& e)
    {

My problem is that i have two uos classes: one in the ifc namespace and one in 
the ex namespace.
I'm trying , but I  could not casting from ex::uos to  ifc::uos.
This  is a problem because the ifc::uos has a Entity property that contains  all 
the ifc classes , and these are the classes that i would use.
Why is not possible to cast the two type?
i tried with dynamic_cast but i have no success.
I read about substitutionGroup, but I did not understand and i didn't  reach my 
objective.
And all the xsd file is based on Entity class and polyformism. 

I'm sorry , for  these question , but i can't find a book on xsd at store, can 
you advice me a good book?better if from amazon 



Thanks and by



      


More information about the xsd-users mailing list