Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Question about generation with xsd
Question about generation with xsd [message #1835669] Wed, 09 December 2020 20:28 Go to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 1
Registered: December 2020
Junior Member
Something came up with generated code.
I generated using a schema(s). These are well known schemas: JPA persistence_2_2.xsd and orm_2_2.xsd.

Q: is there a way to get EMF to do what I need?

I found a situation where, in the xsd, an element was defined as a string like this:
              <xsd:element name="jta-data-source" type="xsd:string" 
                           minOccurs="0">
                <xsd:annotation>
                  <xsd:documentation>

                    The container-specific name of the JTA datasource to use.

                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>

but EMF implemented it as an attribute. Therefore when I saved my model I got it like this:
  
<persistenceUnit jtaDataSource="data source here">


What I need it this:
	
<persistence-unit >
    <jta-data-source>data source here</jta-data-source>
</persistence-unit?
Re: Question about generation with xsd [message #1835673 is a reply to message #1835669] Thu, 10 December 2020 04:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31841
Registered: July 2009
Senior Member
Be sure that the resource factory you use to create the resource is the one that's generated. I.e., the one in *.xyz.util.XyzResourceFactoryImpl with a method like this:
  @Override
  public Resource createResource(URI uri)
  {
    XMLResource result = new XyzResourceImpl(uri);
    result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
    result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);

    result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);

    result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
    result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);

    result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
    return result;
  }


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Xcore] Standalone app generates EJavaObject types
Next Topic:XSLT transform (or serialize) a subtree of an EMF model
Goto Forum:
  


Current Time: Tue Apr 20 14:44:22 GMT 2021

Powered by FUDForum. Page generated in 0.01811 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top