Question about generation with xsd [message #1835669] |
Wed, 09 December 2020 15:28  |
Eclipse User |
|
|
|
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] |
Wed, 09 December 2020 23:19  |
Eclipse User |
|
|
|
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;
}
|
|
|
Powered by
FUDForum. Page generated in 0.05479 seconds