Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[emf-dev] Generate ecore model with "_" in type name


Hello,

I'm creating a new EMF project and loading a .xsd file containing complex data types. My type names contain an "_" as seen below.

<xsd:complexType name="my_Type">
        <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="1"
                name="arg1" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="1"
                name="arg2" type="xsd:string"/>
        </xsd:sequence>
 </xsd:complexType>

The generated model strips the "_" out of the type name. I was wondering what the reason was disallowing "_" in type names and if there was any to work around this issue?

Steps to reproduce: I'm using Eclipse 3.1 and EMF 2.1

1. New > Project > Eclipse Modeling Framework > EMF Project
2. On second page of wizard select XML Schema
3. On next page select a .xsd file containing the above complexType.
4. Generated model will show type name as myType instead of my_Type.

I'm pretty sure the "_" is removed in XSDEcoreBuilder in the validName method. It calls parseName passing a "_" as the delimiter.

protected String validName(String name, boolean isUpperCase)
  {
    List parsedName = parseName(name, '_');
.
.
.

Thanks for any information.

Chris Jaun


Back to the top