Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » NullPointerException in XMLSaveImpl.saveDataTypeMany
NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423245] Thu, 25 September 2008 12:36 Go to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
This error comes up when I run the XYZExample test code, disguised as/copied to a UnitTest in maven. (ie outside the eclipse editor).
It runs fine from within eclipse/junit. I figured it must have something to do with
http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
does it?

The error is

java.lang.NullPointerException
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)

Code:

MyModel1Package.eINSTANCE.eClass();
MyModel2Package.eINSTANCE.eClass();

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
("ext1", new MyModel1ResourceFactoryImpl());
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION,
new MyModel2ResourceFactoryImpl());

Resource resource = resourceSet.createResource(URI.createURI("http:///My.model.uri"));
DocumentRoot documentRoot = MyModel2Factory.eINSTANCE.createDocumentRoot();

// ---- Removing the next two lines makes it work from maven too.
ActivitiesType root = MyModel2Factory.eINSTANCE.createActivitiesType();
documentRoot.setActivities(root);

resource.getContents().add(documentRoot);
resource.save(System.out, null);

Many thanks,
Ronaldo

Ed Merks wrote:
> Ronaldo,
>
> Comments below.
>
> Ronaldo wrote:
>> Hi Ed,
>>
>> Thanks for the quick answer. Yes, I have 2 models in 2 different
>> eclipse projects.
>> They both use a null target namespace, in order to eliminate the
>> prefixes in the xml.
> :-(
>
> XML documents with at least a namespace for the root element are
> generally more consumable because they identify their schema...
>>
>> I was just wondering what (which setting) causes the code
>>
>> result.getDefaultSaveOptions().put(
>> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
> A null target namespace schema produces an annotation on the EPackage to
> indicate the package is not qualified.
>>
>> to be generated. (as opposed to
>>
>> result.getDefaultSaveOptions().put(
>> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
> This package doesn't have such an annotation.
>
> Note that you can't have two different packages that both want to be the
> one for the null namespace both working at the same time.
>> )
>>
>> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423246 is a reply to message #423245] Thu, 25 September 2008 13:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ronaldo wrote:
> This error comes up when I run the XYZExample test code, disguised
> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
> It runs fine from within eclipse/junit. I figured it must have
> something to do with
> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>
> does it?
>
> The error is
>
> java.lang.NullPointerException
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>
It's dying because the data type doesn't have a containing package and
hence we get a null pointer exception trying to get the factory for that
package?

EDataType d = (EDataType)f.getEType();
EPackage ePackage = d.getEPackage();
EFactory fac = ePackage.getEFactoryInstance();
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>
>
> Code:
>
> MyModel1Package.eINSTANCE.eClass();
> MyModel2Package.eINSTANCE.eClass();
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> ("ext1", new MyModel1ResourceFactoryImpl());
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> (Resource.Factory.Registry.DEFAULT_EXTENSION,
> new MyModel2ResourceFactoryImpl());
>
> Resource resource =
> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
> DocumentRoot documentRoot =
> MyModel2Factory.eINSTANCE.createDocumentRoot();
>
> // ---- Removing the next two lines makes it work from maven too.
> ActivitiesType root = MyModel2Factory.eINSTANCE.createActivitiesType();
> documentRoot.setActivities(root);
>
> resource.getContents().add(documentRoot);
> resource.save(System.out, null);
This looks much like the generated XyzExample you get when you invoke
"Generate Test Code". Does that have the same problem?
>
> Many thanks,
> Ronaldo
>
> Ed Merks wrote:
> > Ronaldo,
> >
> > Comments below.
> >
> > Ronaldo wrote:
> >> Hi Ed,
> >>
> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
> >> eclipse projects.
> >> They both use a null target namespace, in order to eliminate the
> >> prefixes in the xml.
> > :-(
> >
> > XML documents with at least a namespace for the root element are
> > generally more consumable because they identify their schema...
> >>
> >> I was just wondering what (which setting) causes the code
> >>
> >> result.getDefaultSaveOptions().put(
> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
> > A null target namespace schema produces an annotation on the
> EPackage to
> > indicate the package is not qualified.
> >>
> >> to be generated. (as opposed to
> >>
> >> result.getDefaultSaveOptions().put(
> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
> > This package doesn't have such an annotation.
> >
> > Note that you can't have two different packages that both want to be
> the
> > one for the null namespace both working at the same time.
> >> )
> >>
> >> Ronaldo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423248 is a reply to message #423246] Thu, 25 September 2008 13:55 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
Hi Ed,

I guess you're saying I'm messing around with a null namespace :0
Point is, it has worked and somehow I changed something and it doesn't work any more.
I feel I'm losing control ...

Anyway, I'll step back, and use proper namespaces ;)

My package is now only annotated with @model kind="package". (Unqualified is removed)
The generated XYZExample now generates

<?xml version="1.0" encoding="UTF-8"?>
<Activities/>

So the question is, which piece of code is responsible for hiding the namespace prefix?

I'd expect something like
<?xml version="1.0" encoding="UTF-8"?>
<prefix:Activities xmlns:prefix="yadiyadi" />

Fun part is, after unloading the created and saved resource,
I reload it using the same resourceSet. But then, I get the famous "Package with uri null not found" message...
because the prefix is missing...

Ronaldo



>
>
> Ronaldo wrote:
>> This error comes up when I run the XYZExample test code, disguised
>> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
>> It runs fine from within eclipse/junit. I figured it must have
>> something to do with
>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>
>> does it?
>>
>> The error is
>>
>> java.lang.NullPointerException
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>
> It's dying because the data type doesn't have a containing package and
> hence we get a null pointer exception trying to get the factory for that
> package?
>
> EDataType d = (EDataType)f.getEType();
> EPackage ePackage = d.getEPackage();
> EFactory fac = ePackage.getEFactoryInstance();
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>
>>
>> Code:
>>
>> MyModel1Package.eINSTANCE.eClass();
>> MyModel2Package.eINSTANCE.eClass();
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>> ("ext1", new MyModel1ResourceFactoryImpl());
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>> new MyModel2ResourceFactoryImpl());
>>
>> Resource resource =
>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>> DocumentRoot documentRoot =
>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>
>> // ---- Removing the next two lines makes it work from maven too.
>> ActivitiesType root = MyModel2Factory.eINSTANCE.createActivitiesType();
>> documentRoot.setActivities(root);
>>
>> resource.getContents().add(documentRoot);
>> resource.save(System.out, null);
> This looks much like the generated XyzExample you get when you invoke
> "Generate Test Code". Does that have the same problem?
>>
>> Many thanks,
>> Ronaldo
>>
>> Ed Merks wrote:
>> > Ronaldo,
>> >
>> > Comments below.
>> >
>> > Ronaldo wrote:
>> >> Hi Ed,
>> >>
>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>> >> eclipse projects.
>> >> They both use a null target namespace, in order to eliminate the
>> >> prefixes in the xml.
>> > :-(
>> >
>> > XML documents with at least a namespace for the root element are
>> > generally more consumable because they identify their schema...
>> >>
>> >> I was just wondering what (which setting) causes the code
>> >>
>> >> result.getDefaultSaveOptions().put(
>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>> > A null target namespace schema produces an annotation on the
>> EPackage to
>> > indicate the package is not qualified.
>> >>
>> >> to be generated. (as opposed to
>> >>
>> >> result.getDefaultSaveOptions().put(
>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>> > This package doesn't have such an annotation.
>> >
>> > Note that you can't have two different packages that both want to be
>> the
>> > one for the null namespace both working at the same time.
>> >> )
>> >>
>> >> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423251 is a reply to message #423248] Thu, 25 September 2008 14:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ronaldo,

Comments below.

Ronaldo wrote:
> Hi Ed,
>
> I guess you're saying I'm messing around with a null namespace :0
> Point is, it has worked and somehow I changed something and it doesn't
> work any more.
> I feel I'm losing control ...
Something worked, but only you know what...
>
> Anyway, I'll step back, and use proper namespaces ;)
>
> My package is now only annotated with @model kind="package".
> (Unqualified is removed)
You've relaoaded the model?
> The generated XYZExample now generates
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Activities/>
>
> So the question is, which piece of code is responsible for hiding the
> namespace prefix?
And has the resource factory been regenerated so it's using "TRUE"? It
doesn't look that way...
>
> I'd expect something like
> <?xml version="1.0" encoding="UTF-8"?>
> <prefix:Activities xmlns:prefix="yadiyadi" />
Me too. What's the nsURI of your EPackage?
>
> Fun part is, after unloading the created and saved resource,
> I reload it using the same resourceSet. But then, I get the famous
> "Package with uri null not found" message...
> because the prefix is missing...
Something's is a little screwed up for sure... What does the resource
factory look like?
>
> Ronaldo
>
>
>
>>
>>
>> Ronaldo wrote:
>>> This error comes up when I run the XYZExample test code, disguised
>>> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
>>> It runs fine from within eclipse/junit. I figured it must have
>>> something to do with
>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>
>>> does it?
>>>
>>> The error is
>>>
>>> java.lang.NullPointerException
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>
>> It's dying because the data type doesn't have a containing package
>> and hence we get a null pointer exception trying to get the factory
>> for that package?
>>
>> EDataType d = (EDataType)f.getEType();
>> EPackage ePackage = d.getEPackage();
>> EFactory fac = ePackage.getEFactoryInstance();
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>
>>>
>>> Code:
>>>
>>> MyModel1Package.eINSTANCE.eClass();
>>> MyModel2Package.eINSTANCE.eClass();
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>> new MyModel2ResourceFactoryImpl());
>>>
>>> Resource resource =
>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>> DocumentRoot documentRoot =
>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>
>>> // ---- Removing the next two lines makes it work from maven too.
>>> ActivitiesType root = MyModel2Factory.eINSTANCE.createActivitiesType();
>>> documentRoot.setActivities(root);
>>>
>>> resource.getContents().add(documentRoot);
>>> resource.save(System.out, null);
>> This looks much like the generated XyzExample you get when you invoke
>> "Generate Test Code". Does that have the same problem?
>>>
>>> Many thanks,
>>> Ronaldo
>>>
>>> Ed Merks wrote:
>>> > Ronaldo,
>>> >
>>> > Comments below.
>>> >
>>> > Ronaldo wrote:
>>> >> Hi Ed,
>>> >>
>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>> >> eclipse projects.
>>> >> They both use a null target namespace, in order to eliminate the
>>> >> prefixes in the xml.
>>> > :-(
>>> >
>>> > XML documents with at least a namespace for the root element are
>>> > generally more consumable because they identify their schema...
>>> >>
>>> >> I was just wondering what (which setting) causes the code
>>> >>
>>> >> result.getDefaultSaveOptions().put(
>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>> > A null target namespace schema produces an annotation on the
>>> EPackage to
>>> > indicate the package is not qualified.
>>> >>
>>> >> to be generated. (as opposed to
>>> >>
>>> >> result.getDefaultSaveOptions().put(
>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>> > This package doesn't have such an annotation.
>>> >
>>> > Note that you can't have two different packages that both want to
>>> be the
>>> > one for the null namespace both working at the same time.
>>> >> )
>>> >>
>>> >> Ronaldo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423257 is a reply to message #423251] Thu, 25 September 2008 14:41 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
I have something that might be noteworthy:
Somehow, I noticed that my genmodel consists of 4 models:

Xpdl1 - Deprecated xpdl format
Xpdl2 - Current xpdl format
Ecore - (Icon contains a little arrow/referenced?)
XMLType - (Icon contains a little arrow/referenced?)

The util package also contains an Xpdl2XMLProcessor class:

public class Xpdl2XMLProcessor extends XMLProcessor {
public Xpdl2XMLProcessor() {
super((EPackage.Registry.INSTANCE));
Xpdl2Package.eINSTANCE.eClass();
}

@Override
protected Map<String, Resource.Factory> getRegistrations() {
if (registrations == null) {
super.getRegistrations();
registrations.put(XML_EXTENSION, new Xpdl2ResourceFactoryImpl());
registrations.put(STAR_EXTENSION, new Xpdl2ResourceFactoryImpl());
}
return registrations;
}
}

which seems a little odd. I hadn't noticed this before.

Here's the EPackage source:

public interface Xpdl2Package extends EPackage {
String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
String eNS_PREFIX = "xpdl2";
Xpdl2Package eINSTANCE = org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
}


And the resourceFactory source:

public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
/**
* @generated
*/
public Xpdl2ResourceFactoryImpl() {
super();
}
/**
* @generated
*/
public Resource createResourceGen(URI uri) {
XMLResource result = new Xpdl2ResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA, Boolean.TRUE);

result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION, Boolean.TRUE);

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

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

@Override
public Resource createResource(URI uri) {
XMLResource result = (XMLResource)createResourceGen(uri);
result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG, "UTF-8");
result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG, "UTF-8");
//
// // Where do we turn this off in the genmodel? What is the name of the option?
// result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION, Boolean.TRUE);
//
// result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING, Boolean.TRUE);
// result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING, Boolean.TRUE);
//
//result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE, Boolean.TRUE);
// result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA, Boolean.TRUE);
// result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED, Boolean.TRUE);
//
return result;
}

} //Xpdl2ResourceFactoryImpl

I hope this helps.
Ronaldo

Ed Merks wrote:
> Ronaldo,
>
> Comments below.
>
> Ronaldo wrote:
>> Hi Ed,
>>
>> I guess you're saying I'm messing around with a null namespace :0
>> Point is, it has worked and somehow I changed something and it doesn't
>> work any more.
>> I feel I'm losing control ...
> Something worked, but only you know what...
>>
>> Anyway, I'll step back, and use proper namespaces ;)
>>
>> My package is now only annotated with @model kind="package".
>> (Unqualified is removed)
> You've relaoaded the model?
>> The generated XYZExample now generates
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Activities/>
>>
>> So the question is, which piece of code is responsible for hiding the
>> namespace prefix?
> And has the resource factory been regenerated so it's using "TRUE"? It
> doesn't look that way...
>>
>> I'd expect something like
>> <?xml version="1.0" encoding="UTF-8"?>
>> <prefix:Activities xmlns:prefix="yadiyadi" />
> Me too. What's the nsURI of your EPackage?
>>
>> Fun part is, after unloading the created and saved resource,
>> I reload it using the same resourceSet. But then, I get the famous
>> "Package with uri null not found" message...
>> because the prefix is missing...
> Something's is a little screwed up for sure... What does the resource
> factory look like?
>>
>> Ronaldo
>>
>>
>>
>>>
>>>
>>> Ronaldo wrote:
>>>> This error comes up when I run the XYZExample test code, disguised
>>>> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
>>>> It runs fine from within eclipse/junit. I figured it must have
>>>> something to do with
>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>
>>>> does it?
>>>>
>>>> The error is
>>>>
>>>> java.lang.NullPointerException
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>
>>> It's dying because the data type doesn't have a containing package
>>> and hence we get a null pointer exception trying to get the factory
>>> for that package?
>>>
>>> EDataType d = (EDataType)f.getEType();
>>> EPackage ePackage = d.getEPackage();
>>> EFactory fac = ePackage.getEFactoryInstance();
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>
>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>
>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>
>>>>
>>>> Code:
>>>>
>>>> MyModel1Package.eINSTANCE.eClass();
>>>> MyModel2Package.eINSTANCE.eClass();
>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>> new MyModel2ResourceFactoryImpl());
>>>>
>>>> Resource resource =
>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>> DocumentRoot documentRoot =
>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>
>>>> // ---- Removing the next two lines makes it work from maven too.
>>>> ActivitiesType root = MyModel2Factory.eINSTANCE.createActivitiesType();
>>>> documentRoot.setActivities(root);
>>>>
>>>> resource.getContents().add(documentRoot);
>>>> resource.save(System.out, null);
>>> This looks much like the generated XyzExample you get when you invoke
>>> "Generate Test Code". Does that have the same problem?
>>>>
>>>> Many thanks,
>>>> Ronaldo
>>>>
>>>> Ed Merks wrote:
>>>> > Ronaldo,
>>>> >
>>>> > Comments below.
>>>> >
>>>> > Ronaldo wrote:
>>>> >> Hi Ed,
>>>> >>
>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>> >> eclipse projects.
>>>> >> They both use a null target namespace, in order to eliminate the
>>>> >> prefixes in the xml.
>>>> > :-(
>>>> >
>>>> > XML documents with at least a namespace for the root element are
>>>> > generally more consumable because they identify their schema...
>>>> >>
>>>> >> I was just wondering what (which setting) causes the code
>>>> >>
>>>> >> result.getDefaultSaveOptions().put(
>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>> > A null target namespace schema produces an annotation on the
>>>> EPackage to
>>>> > indicate the package is not qualified.
>>>> >>
>>>> >> to be generated. (as opposed to
>>>> >>
>>>> >> result.getDefaultSaveOptions().put(
>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>> > This package doesn't have such an annotation.
>>>> >
>>>> > Note that you can't have two different packages that both want to
>>>> be the
>>>> > one for the null namespace both working at the same time.
>>>> >> )
>>>> >>
>>>> >> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423258 is a reply to message #423257] Thu, 25 September 2008 14:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ronaldo,

What EAnnotations does the "activities" feature of the DocumentRoot have
on it?


Ronaldo wrote:
> I have something that might be noteworthy:
> Somehow, I noticed that my genmodel consists of 4 models:
>
> Xpdl1 - Deprecated xpdl format
> Xpdl2 - Current xpdl format
> Ecore - (Icon contains a little arrow/referenced?)
> XMLType - (Icon contains a little arrow/referenced?)
>
> The util package also contains an Xpdl2XMLProcessor class:
>
> public class Xpdl2XMLProcessor extends XMLProcessor {
> public Xpdl2XMLProcessor() {
> super((EPackage.Registry.INSTANCE));
> Xpdl2Package.eINSTANCE.eClass();
> }
>
> @Override
> protected Map<String, Resource.Factory> getRegistrations() {
> if (registrations == null) {
> super.getRegistrations();
> registrations.put(XML_EXTENSION, new
> Xpdl2ResourceFactoryImpl());
> registrations.put(STAR_EXTENSION, new
> Xpdl2ResourceFactoryImpl());
> }
> return registrations;
> }
> }
>
> which seems a little odd. I hadn't noticed this before.
>
> Here's the EPackage source:
>
> public interface Xpdl2Package extends EPackage {
> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
> String eNS_PREFIX = "xpdl2";
> Xpdl2Package eINSTANCE =
> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
> }
>
>
> And the resourceFactory source:
>
> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
> /**
> * @generated
> */
> public Xpdl2ResourceFactoryImpl() {
> super();
> }
> /**
> * @generated
> */
> public Resource createResourceGen(URI uri) {
> XMLResource result = new Xpdl2ResourceImpl(uri);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
> Boolean.TRUE);
> return result;
> }
>
> @Override
> public Resource createResource(URI uri) {
> XMLResource result = (XMLResource)createResourceGen(uri);
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG, "UTF-8");
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG, "UTF-8");
> //
> // // Where do we turn this off in the genmodel? What is the
> name of the option?
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
> //
> //
> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
> Boolean.TRUE);
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
> Boolean.TRUE);
> //
>
> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
> Boolean.TRUE);
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
> Boolean.TRUE);
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
> Boolean.TRUE);
> //
> return result;
> }
>
> } //Xpdl2ResourceFactoryImpl
>
> I hope this helps.
> Ronaldo
>
> Ed Merks wrote:
>> Ronaldo,
>>
>> Comments below.
>>
>> Ronaldo wrote:
>>> Hi Ed,
>>>
>>> I guess you're saying I'm messing around with a null namespace :0
>>> Point is, it has worked and somehow I changed something and it
>>> doesn't work any more.
>>> I feel I'm losing control ...
>> Something worked, but only you know what...
>>>
>>> Anyway, I'll step back, and use proper namespaces ;)
>>>
>>> My package is now only annotated with @model kind="package".
>>> (Unqualified is removed)
>> You've relaoaded the model?
>>> The generated XYZExample now generates
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <Activities/>
>>>
>>> So the question is, which piece of code is responsible for hiding
>>> the namespace prefix?
>> And has the resource factory been regenerated so it's using "TRUE"?
>> It doesn't look that way...
>>>
>>> I'd expect something like
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>> Me too. What's the nsURI of your EPackage?
>>>
>>> Fun part is, after unloading the created and saved resource,
>>> I reload it using the same resourceSet. But then, I get the famous
>>> "Package with uri null not found" message...
>>> because the prefix is missing...
>> Something's is a little screwed up for sure... What does the resource
>> factory look like?
>>>
>>> Ronaldo
>>>
>>>
>>>
>>>>
>>>>
>>>> Ronaldo wrote:
>>>>> This error comes up when I run the XYZExample test code, disguised
>>>>> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>> something to do with
>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>
>>>>> does it?
>>>>>
>>>>> The error is
>>>>>
>>>>> java.lang.NullPointerException
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>
>>>> It's dying because the data type doesn't have a containing package
>>>> and hence we get a null pointer exception trying to get the factory
>>>> for that package?
>>>>
>>>> EDataType d = (EDataType)f.getEType();
>>>> EPackage ePackage = d.getEPackage();
>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>
>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>
>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>
>>>>>
>>>>> Code:
>>>>>
>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>
>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>
>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>> new MyModel2ResourceFactoryImpl());
>>>>>
>>>>> Resource resource =
>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>> DocumentRoot documentRoot =
>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>
>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>> ActivitiesType root =
>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>> documentRoot.setActivities(root);
>>>>>
>>>>> resource.getContents().add(documentRoot);
>>>>> resource.save(System.out, null);
>>>> This looks much like the generated XyzExample you get when you
>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>
>>>>> Many thanks,
>>>>> Ronaldo
>>>>>
>>>>> Ed Merks wrote:
>>>>> > Ronaldo,
>>>>> >
>>>>> > Comments below.
>>>>> >
>>>>> > Ronaldo wrote:
>>>>> >> Hi Ed,
>>>>> >>
>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>>> >> eclipse projects.
>>>>> >> They both use a null target namespace, in order to eliminate the
>>>>> >> prefixes in the xml.
>>>>> > :-(
>>>>> >
>>>>> > XML documents with at least a namespace for the root element are
>>>>> > generally more consumable because they identify their schema...
>>>>> >>
>>>>> >> I was just wondering what (which setting) causes the code
>>>>> >>
>>>>> >> result.getDefaultSaveOptions().put(
>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>> > A null target namespace schema produces an annotation on the
>>>>> EPackage to
>>>>> > indicate the package is not qualified.
>>>>> >>
>>>>> >> to be generated. (as opposed to
>>>>> >>
>>>>> >> result.getDefaultSaveOptions().put(
>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>> > This package doesn't have such an annotation.
>>>>> >
>>>>> > Note that you can't have two different packages that both want
>>>>> to be the
>>>>> > one for the null namespace both working at the same time.
>>>>> >> )
>>>>> >>
>>>>> >> Ronaldo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423259 is a reply to message #423257] Thu, 25 September 2008 14:58 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
And another observation:

I get:
<?xml version="1.0" encoding="UTF-8"?>
<xpdl2:Package xmlns:xpdl2="http://www.wfmc.org/2008/XPDL2.1" Id="1"/>

When adding the PackageType (a model element) directly to the resource.getContents(),
as in:

Resource resource = xpdl2ResourceSet.createResource(uri);
PackageType packageType = xpdl2Factory.createPackageType();
resource.getContents().add(packageType);


Before I used:
Resource resource = xpdl2ResourceSet.createResource(uri);
DocumentRoot documentRoot = xpdl2Factory.createDocumentRoot();
PackageType packageType = xpdl2Factory.createPackageType();
documentRoot.setPackage(packageType);
resource.getContents().add(documentRoot);

Ronaldo


Ronaldo wrote:
> I have something that might be noteworthy:
> Somehow, I noticed that my genmodel consists of 4 models:
>
> Xpdl1 - Deprecated xpdl format
> Xpdl2 - Current xpdl format
> Ecore - (Icon contains a little arrow/referenced?)
> XMLType - (Icon contains a little arrow/referenced?)
>
> The util package also contains an Xpdl2XMLProcessor class:
>
> public class Xpdl2XMLProcessor extends XMLProcessor {
> public Xpdl2XMLProcessor() {
> super((EPackage.Registry.INSTANCE));
> Xpdl2Package.eINSTANCE.eClass();
> }
>
> @Override
> protected Map<String, Resource.Factory> getRegistrations() {
> if (registrations == null) {
> super.getRegistrations();
> registrations.put(XML_EXTENSION, new
> Xpdl2ResourceFactoryImpl());
> registrations.put(STAR_EXTENSION, new
> Xpdl2ResourceFactoryImpl());
> }
> return registrations;
> }
> }
>
> which seems a little odd. I hadn't noticed this before.
>
> Here's the EPackage source:
>
> public interface Xpdl2Package extends EPackage {
> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
> String eNS_PREFIX = "xpdl2";
> Xpdl2Package eINSTANCE =
> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
> }
>
>
> And the resourceFactory source:
>
> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
> /**
> * @generated
> */
> public Xpdl2ResourceFactoryImpl() {
> super();
> }
> /**
> * @generated
> */
> public Resource createResourceGen(URI uri) {
> XMLResource result = new Xpdl2ResourceImpl(uri);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
> Boolean.TRUE);
> return result;
> }
>
> @Override
> public Resource createResource(URI uri) {
> XMLResource result = (XMLResource)createResourceGen(uri);
> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
> "UTF-8");
> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
> "UTF-8");
> //
> // // Where do we turn this off in the genmodel? What is the name
> of the option?
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
> //
> //
> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
> Boolean.TRUE);
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
> Boolean.TRUE);
> //
>
> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
> Boolean.TRUE);
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
> Boolean.TRUE);
> //
> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
> Boolean.TRUE);
> //
> return result;
> }
>
> } //Xpdl2ResourceFactoryImpl
>
> I hope this helps.
> Ronaldo
>
> Ed Merks wrote:
>> Ronaldo,
>>
>> Comments below.
>>
>> Ronaldo wrote:
>>> Hi Ed,
>>>
>>> I guess you're saying I'm messing around with a null namespace :0
>>> Point is, it has worked and somehow I changed something and it
>>> doesn't work any more.
>>> I feel I'm losing control ...
>> Something worked, but only you know what...
>>>
>>> Anyway, I'll step back, and use proper namespaces ;)
>>>
>>> My package is now only annotated with @model kind="package".
>>> (Unqualified is removed)
>> You've relaoaded the model?
>>> The generated XYZExample now generates
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <Activities/>
>>>
>>> So the question is, which piece of code is responsible for hiding the
>>> namespace prefix?
>> And has the resource factory been regenerated so it's using "TRUE"?
>> It doesn't look that way...
>>>
>>> I'd expect something like
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>> Me too. What's the nsURI of your EPackage?
>>>
>>> Fun part is, after unloading the created and saved resource,
>>> I reload it using the same resourceSet. But then, I get the famous
>>> "Package with uri null not found" message...
>>> because the prefix is missing...
>> Something's is a little screwed up for sure... What does the resource
>> factory look like?
>>>
>>> Ronaldo
>>>
>>>
>>>
>>>>
>>>>
>>>> Ronaldo wrote:
>>>>> This error comes up when I run the XYZExample test code, disguised
>>>>> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>> something to do with
>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>
>>>>> does it?
>>>>>
>>>>> The error is
>>>>>
>>>>> java.lang.NullPointerException
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>
>>>> It's dying because the data type doesn't have a containing package
>>>> and hence we get a null pointer exception trying to get the factory
>>>> for that package?
>>>>
>>>> EDataType d = (EDataType)f.getEType();
>>>> EPackage ePackage = d.getEPackage();
>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>
>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>
>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>
>>>>>
>>>>> Code:
>>>>>
>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>
>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>
>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>> new MyModel2ResourceFactoryImpl());
>>>>>
>>>>> Resource resource =
>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>> DocumentRoot documentRoot =
>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>
>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>> ActivitiesType root =
>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>> documentRoot.setActivities(root);
>>>>>
>>>>> resource.getContents().add(documentRoot);
>>>>> resource.save(System.out, null);
>>>> This looks much like the generated XyzExample you get when you
>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>
>>>>> Many thanks,
>>>>> Ronaldo
>>>>>
>>>>> Ed Merks wrote:
>>>>> > Ronaldo,
>>>>> >
>>>>> > Comments below.
>>>>> >
>>>>> > Ronaldo wrote:
>>>>> >> Hi Ed,
>>>>> >>
>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>>> >> eclipse projects.
>>>>> >> They both use a null target namespace, in order to eliminate the
>>>>> >> prefixes in the xml.
>>>>> > :-(
>>>>> >
>>>>> > XML documents with at least a namespace for the root element are
>>>>> > generally more consumable because they identify their schema...
>>>>> >>
>>>>> >> I was just wondering what (which setting) causes the code
>>>>> >>
>>>>> >> result.getDefaultSaveOptions().put(
>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>> > A null target namespace schema produces an annotation on the
>>>>> EPackage to
>>>>> > indicate the package is not qualified.
>>>>> >>
>>>>> >> to be generated. (as opposed to
>>>>> >>
>>>>> >> result.getDefaultSaveOptions().put(
>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>> > This package doesn't have such an annotation.
>>>>> >
>>>>> > Note that you can't have two different packages that both want to
>>>>> be the
>>>>> > one for the null namespace both working at the same time.
>>>>> >> )
>>>>> >>
>>>>> >> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423261 is a reply to message #423258] Thu, 25 September 2008 15:07 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
This is the generated code for the getActivities method in the DocumentRoot interface.

* @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
* extendedMetaData="kind='element' name='Activities'"
* @generated
*/
ActivitiesType getActivities();



Ed Merks wrote:
> Ronaldo,
>
> What EAnnotations does the "activities" feature of the DocumentRoot have
> on it?
>
>
> Ronaldo wrote:
>> I have something that might be noteworthy:
>> Somehow, I noticed that my genmodel consists of 4 models:
>>
>> Xpdl1 - Deprecated xpdl format
>> Xpdl2 - Current xpdl format
>> Ecore - (Icon contains a little arrow/referenced?)
>> XMLType - (Icon contains a little arrow/referenced?)
>>
>> The util package also contains an Xpdl2XMLProcessor class:
>>
>> public class Xpdl2XMLProcessor extends XMLProcessor {
>> public Xpdl2XMLProcessor() {
>> super((EPackage.Registry.INSTANCE));
>> Xpdl2Package.eINSTANCE.eClass();
>> }
>>
>> @Override
>> protected Map<String, Resource.Factory> getRegistrations() {
>> if (registrations == null) {
>> super.getRegistrations();
>> registrations.put(XML_EXTENSION, new
>> Xpdl2ResourceFactoryImpl());
>> registrations.put(STAR_EXTENSION, new
>> Xpdl2ResourceFactoryImpl());
>> }
>> return registrations;
>> }
>> }
>>
>> which seems a little odd. I hadn't noticed this before.
>>
>> Here's the EPackage source:
>>
>> public interface Xpdl2Package extends EPackage {
>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>> String eNS_PREFIX = "xpdl2";
>> Xpdl2Package eINSTANCE =
>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>> }
>>
>>
>> And the resourceFactory source:
>>
>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>> /**
>> * @generated
>> */
>> public Xpdl2ResourceFactoryImpl() {
>> super();
>> }
>> /**
>> * @generated
>> */
>> public Resource createResourceGen(URI uri) {
>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>> Boolean.TRUE);
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>> Boolean.TRUE);
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>> Boolean.TRUE);
>> return result;
>> }
>> @Override
>> public Resource createResource(URI uri) {
>> XMLResource result = (XMLResource)createResourceGen(uri);
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG, "UTF-8");
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG, "UTF-8");
>> // // // Where do we turn this off in the genmodel? What
>> is the name of the option?
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>> Boolean.TRUE);
>> // //
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>> Boolean.TRUE);
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>> Boolean.TRUE);
>> //
>>
>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>> Boolean.TRUE);
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>> Boolean.TRUE);
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>> Boolean.TRUE);
>> // return result;
>> }
>>
>> } //Xpdl2ResourceFactoryImpl
>>
>> I hope this helps.
>> Ronaldo
>>
>> Ed Merks wrote:
>>> Ronaldo,
>>>
>>> Comments below.
>>>
>>> Ronaldo wrote:
>>>> Hi Ed,
>>>>
>>>> I guess you're saying I'm messing around with a null namespace :0
>>>> Point is, it has worked and somehow I changed something and it
>>>> doesn't work any more.
>>>> I feel I'm losing control ...
>>> Something worked, but only you know what...
>>>>
>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>
>>>> My package is now only annotated with @model kind="package".
>>>> (Unqualified is removed)
>>> You've relaoaded the model?
>>>> The generated XYZExample now generates
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <Activities/>
>>>>
>>>> So the question is, which piece of code is responsible for hiding
>>>> the namespace prefix?
>>> And has the resource factory been regenerated so it's using "TRUE"?
>>> It doesn't look that way...
>>>>
>>>> I'd expect something like
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>> Me too. What's the nsURI of your EPackage?
>>>>
>>>> Fun part is, after unloading the created and saved resource,
>>>> I reload it using the same resourceSet. But then, I get the famous
>>>> "Package with uri null not found" message...
>>>> because the prefix is missing...
>>> Something's is a little screwed up for sure... What does the resource
>>> factory look like?
>>>>
>>>> Ronaldo
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>> Ronaldo wrote:
>>>>>> This error comes up when I run the XYZExample test code, disguised
>>>>>> as/copied to a UnitTest in maven. (ie outside the eclipse editor).
>>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>>> something to do with
>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>
>>>>>> does it?
>>>>>>
>>>>>> The error is
>>>>>>
>>>>>> java.lang.NullPointerException
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>
>>>>> It's dying because the data type doesn't have a containing package
>>>>> and hence we get a null pointer exception trying to get the factory
>>>>> for that package?
>>>>>
>>>>> EDataType d = (EDataType)f.getEType();
>>>>> EPackage ePackage = d.getEPackage();
>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>
>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>
>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>
>>>>>>
>>>>>> Code:
>>>>>>
>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>
>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>
>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>
>>>>>> Resource resource =
>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>> DocumentRoot documentRoot =
>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>
>>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>>> ActivitiesType root =
>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>> documentRoot.setActivities(root);
>>>>>>
>>>>>> resource.getContents().add(documentRoot);
>>>>>> resource.save(System.out, null);
>>>>> This looks much like the generated XyzExample you get when you
>>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>>
>>>>>> Many thanks,
>>>>>> Ronaldo
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>> > Ronaldo,
>>>>>> >
>>>>>> > Comments below.
>>>>>> >
>>>>>> > Ronaldo wrote:
>>>>>> >> Hi Ed,
>>>>>> >>
>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>>>> >> eclipse projects.
>>>>>> >> They both use a null target namespace, in order to eliminate the
>>>>>> >> prefixes in the xml.
>>>>>> > :-(
>>>>>> >
>>>>>> > XML documents with at least a namespace for the root element are
>>>>>> > generally more consumable because they identify their schema...
>>>>>> >>
>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>> >>
>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>>> > A null target namespace schema produces an annotation on the
>>>>>> EPackage to
>>>>>> > indicate the package is not qualified.
>>>>>> >>
>>>>>> >> to be generated. (as opposed to
>>>>>> >>
>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>> > This package doesn't have such an annotation.
>>>>>> >
>>>>>> > Note that you can't have two different packages that both want
>>>>>> to be the
>>>>>> > one for the null namespace both working at the same time.
>>>>>> >> )
>>>>>> >>
>>>>>> >> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423262 is a reply to message #423261] Thu, 25 September 2008 15:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000904030009000904070908
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Ronaldo,

For the library mode it looks like this:

* @model containment="true" upper="-2" transient="true"
volatile="true" derived="true"
* extendedMetaData="kind='element' name='library'*
namespace='##targetNamespace'"*

I assume these models originated from a schema. Do that schema have a
target namespace?


Ronaldo wrote:
>
> This is the generated code for the getActivities method in the
> DocumentRoot interface.
>
> * @model containment="true" upper="-2" transient="true"
> volatile="true" derived="true"
> * extendedMetaData="kind='element' name='Activities'"
> * @generated
> */
> ActivitiesType getActivities();
>
>
>
> Ed Merks wrote:
>> Ronaldo,
>>
>> What EAnnotations does the "activities" feature of the DocumentRoot
>> have on it?
>>
>>
>> Ronaldo wrote:
>>> I have something that might be noteworthy:
>>> Somehow, I noticed that my genmodel consists of 4 models:
>>>
>>> Xpdl1 - Deprecated xpdl format
>>> Xpdl2 - Current xpdl format
>>> Ecore - (Icon contains a little arrow/referenced?)
>>> XMLType - (Icon contains a little arrow/referenced?)
>>>
>>> The util package also contains an Xpdl2XMLProcessor class:
>>>
>>> public class Xpdl2XMLProcessor extends XMLProcessor {
>>> public Xpdl2XMLProcessor() {
>>> super((EPackage.Registry.INSTANCE));
>>> Xpdl2Package.eINSTANCE.eClass();
>>> }
>>>
>>> @Override
>>> protected Map<String, Resource.Factory> getRegistrations() {
>>> if (registrations == null) {
>>> super.getRegistrations();
>>> registrations.put(XML_EXTENSION, new
>>> Xpdl2ResourceFactoryImpl());
>>> registrations.put(STAR_EXTENSION, new
>>> Xpdl2ResourceFactoryImpl());
>>> }
>>> return registrations;
>>> }
>>> }
>>>
>>> which seems a little odd. I hadn't noticed this before.
>>>
>>> Here's the EPackage source:
>>>
>>> public interface Xpdl2Package extends EPackage {
>>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>>> String eNS_PREFIX = "xpdl2";
>>> Xpdl2Package eINSTANCE =
>>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>>> }
>>>
>>>
>>> And the resourceFactory source:
>>>
>>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>>> /**
>>> * @generated
>>> */
>>> public Xpdl2ResourceFactoryImpl() {
>>> super();
>>> }
>>> /**
>>> * @generated
>>> */
>>> public Resource createResourceGen(URI uri) {
>>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>> Boolean.TRUE);
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>> Boolean.TRUE);
>>>
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>> Boolean.TRUE);
>>>
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>> Boolean.TRUE);
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>> Boolean.TRUE);
>>>
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>> Boolean.TRUE);
>>> return result;
>>> }
>>> @Override
>>> public Resource createResource(URI uri) {
>>> XMLResource result = (XMLResource)createResourceGen(uri);
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
>>> "UTF-8");
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
>>> "UTF-8");
>>> // // // Where do we turn this off in the genmodel?
>>> What is the name of the option?
>>> //
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>> Boolean.TRUE);
>>> // //
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>> Boolean.TRUE);
>>> //
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>> Boolean.TRUE);
>>> //
>>>
>>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>>> Boolean.TRUE);
>>> //
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>>> Boolean.TRUE);
>>> //
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>>> Boolean.TRUE);
>>> // return result;
>>> }
>>>
>>> } //Xpdl2ResourceFactoryImpl
>>>
>>> I hope this helps.
>>> Ronaldo
>>>
>>> Ed Merks wrote:
>>>> Ronaldo,
>>>>
>>>> Comments below.
>>>>
>>>> Ronaldo wrote:
>>>>> Hi Ed,
>>>>>
>>>>> I guess you're saying I'm messing around with a null namespace :0
>>>>> Point is, it has worked and somehow I changed something and it
>>>>> doesn't work any more.
>>>>> I feel I'm losing control ...
>>>> Something worked, but only you know what...
>>>>>
>>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>>
>>>>> My package is now only annotated with @model kind="package".
>>>>> (Unqualified is removed)
>>>> You've relaoaded the model?
>>>>> The generated XYZExample now generates
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <Activities/>
>>>>>
>>>>> So the question is, which piece of code is responsible for hiding
>>>>> the namespace prefix?
>>>> And has the resource factory been regenerated so it's using
>>>> "TRUE"? It doesn't look that way...
>>>>>
>>>>> I'd expect something like
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>>> Me too. What's the nsURI of your EPackage?
>>>>>
>>>>> Fun part is, after unloading the created and saved resource,
>>>>> I reload it using the same resourceSet. But then, I get the famous
>>>>> "Package with uri null not found" message...
>>>>> because the prefix is missing...
>>>> Something's is a little screwed up for sure... What does the
>>>> resource factory look like?
>>>>>
>>>>> Ronaldo
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>> Ronaldo wrote:
>>>>>>> This error comes up when I run the XYZExample test code,
>>>>>>> disguised as/copied to a UnitTest in maven. (ie outside the
>>>>>>> eclipse editor).
>>>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>>>> something to do with
>>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>>
>>>>>>> does it?
>>>>>>>
>>>>>>> The error is
>>>>>>>
>>>>>>> java.lang.NullPointerException
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>>
>>>>>> It's dying because the data type doesn't have a containing
>>>>>> package and hence we get a null pointer exception trying to get
>>>>>> the factory for that package?
>>>>>>
>>>>>> EDataType d = (EDataType)f.getEType();
>>>>>> EPackage ePackage = d.getEPackage();
>>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>>
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>>
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>>
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>>>
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>
>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>>
>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>>
>>>>>>>
>>>>>>> Code:
>>>>>>>
>>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>
>>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>
>>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>>
>>>>>>> Resource resource =
>>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>>> DocumentRoot documentRoot =
>>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>>
>>>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>>>> ActivitiesType root =
>>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>>> documentRoot.setActivities(root);
>>>>>>>
>>>>>>> resource.getContents().add(documentRoot);
>>>>>>> resource.save(System.out, null);
>>>>>> This looks much like the generated XyzExample you get when you
>>>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>>>
>>>>>>> Many thanks,
>>>>>>> Ronaldo
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>> > Ronaldo,
>>>>>>> >
>>>>>>> > Comments below.
>>>>>>> >
>>>>>>> > Ronaldo wrote:
>>>>>>> >> Hi Ed,
>>>>>>> >>
>>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>>>>> >> eclipse projects.
>>>>>>> >> They both use a null target namespace, in order to eliminate the
>>>>>>> >> prefixes in the xml.
>>>>>>> > :-(
>>>>>>> >
>>>>>>> > XML documents with at least a namespace for the root element are
>>>>>>> > generally more consumable because they identify their schema...
>>>>>>> >>
>>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>>> >>
>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>>>> > A null target namespace schema produces an annotation on the
>>>>>>> EPackage to
>>>>>>> > indicate the package is not qualified.
>>>>>>> >>
>>>>>>> >> to be generated. (as opposed to
>>>>>>> >>
>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>>> > This package doesn't have such an annotation.
>>>>>>> >
>>>>>>> > Note that you can't have two different packages that both want
>>>>>>> to be the
>>>>>>> > one for the null namespace both working at the same time.
>>>>>>> >> )
>>>>>>> >>
>>>>>>> >> Ronaldo

--------------000904030009000904070908
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ronaldo,<br>
<br>
For the library mode it looks like this:<br>
<blockquote>&nbsp;&nbsp; * @model containment="true" upper="-2" transient="true"
volatile="true" derived="true"<br>
&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; extendedMetaData="kind='element' name='library'<b>
namespace='##targetNamespace'"</b><br>
</blockquote>
I assume these models originated from a schema.&nbsp; Do that schema have a
target namespace?<br>
<br>
<br>
Ronaldo wrote:
<blockquote cite="mid:gbg9ga$r4s$1@build.eclipse.org" type="cite"><br>
This is the generated code for the getActivities method in the
DocumentRoot interface.
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; * @model containment="true" upper="-2" transient="true"
volatile="true" derived="true"
<br>
&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; extendedMetaData="kind='element' name='Activities'"
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @generated
<br>
&nbsp;&nbsp;&nbsp;&nbsp; */
<br>
&nbsp;&nbsp;&nbsp;&nbsp;ActivitiesType getActivities();
<br>
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Ronaldo,
<br>
<br>
What EAnnotations does the "activities" feature of the DocumentRoot
have on it?
<br>
<br>
<br>
Ronaldo wrote:
<br>
<blockquote type="cite">I have something that might be noteworthy:
<br>
Somehow, I noticed that my genmodel consists of 4 models:
<br>
<br>
Xpdl1 - Deprecated xpdl format
<br>
Xpdl2 - Current xpdl format
<br>
Ecore - (Icon contains a little arrow/referenced?)
<br>
XMLType - (Icon contains a little arrow/referenced?)
<br>
<br>
The util package also contains an Xpdl2XMLProcessor class:
<br>
<br>
public class Xpdl2XMLProcessor extends XMLProcessor {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; public Xpdl2XMLProcessor() {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; super((EPackage.Registry.INSTANCE));
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Xpdl2Package.eINSTANCE.eClass();
<br>
&nbsp;&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; @Override
<br>
&nbsp;&nbsp;&nbsp; protected Map&lt;String, Resource.Factory&gt; getRegistrations() {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (registrations == null) {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super.getRegistrations();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; registrations.put(XML_EXTENSION, new
Xpdl2ResourceFactoryImpl());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; registrations.put(STAR_EXTENSION, new
Xpdl2ResourceFactoryImpl());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return registrations;
<br>
&nbsp;&nbsp;&nbsp; }
<br>
}
<br>
<br>
which seems a little odd. I hadn't noticed this before.
<br>
<br>
Here's the EPackage source:
<br>
<br>
public interface Xpdl2Package extends EPackage {
<br>
&nbsp; String eNS_URI = <a class="moz-txt-link-rfc2396E" href="http://www.wfmc.org/2008/XPDL2.1">"http://www.wfmc.org/2008/XPDL2.1"</a>;
<br>
&nbsp; String eNS_PREFIX = "xpdl2";
<br>
&nbsp; Xpdl2Package eINSTANCE =
org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
<br>
}
<br>
<br>
<br>
And the resourceFactory source:
<br>
<br>
public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; /**
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @generated
<br>
&nbsp;&nbsp;&nbsp;&nbsp; */
<br>
&nbsp;&nbsp;&nbsp; public Xpdl2ResourceFactoryImpl() {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; super();
<br>
&nbsp;&nbsp;&nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; /**
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @generated
<br>
&nbsp;&nbsp;&nbsp;&nbsp; */
<br>
&nbsp;&nbsp;&nbsp; public Resource createResourceGen(URI uri) {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; XMLResource result = new Xpdl2ResourceImpl(uri);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return result;
<br>
&nbsp;&nbsp;&nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; @Override
<br>
&nbsp;&nbsp;&nbsp; public Resource createResource(URI uri) {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; XMLResource result = (XMLResource)createResourceGen(uri);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
"UTF-8");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
"UTF-8");
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp; // Where do we turn this off in the genmodel? What
is the name of the option?
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
Boolean.TRUE);
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
Boolean.TRUE);
<br>
//
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
//result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
Boolean.TRUE);
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
Boolean.TRUE);
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
Boolean.TRUE);
<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; return result;
<br>
&nbsp;&nbsp;&nbsp; }
<br>
<br>
} //Xpdl2ResourceFactoryImpl
<br>
<br>
I hope this helps.
<br>
Ronaldo
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Ronaldo,
<br>
<br>
Comments below.
<br>
<br>
Ronaldo wrote:
<br>
<blockquote type="cite">Hi Ed,
<br>
<br>
I guess you're saying I'm messing around with a null namespace :0
<br>
Point is, it has worked and somehow I changed something and it doesn't
work any more.
<br>
I feel I'm losing control ...
<br>
</blockquote>
Something worked, but only you know what...
<br>
<blockquote type="cite"><br>
Anyway, I'll step back, and use proper namespaces ;)
<br>
<br>
My package is now only annotated with @model kind="package".
(Unqualified is removed)
<br>
</blockquote>
You've relaoaded the model?
<br>
<blockquote type="cite">The generated XYZExample now generates
<br>
<br>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>
&lt;Activities/&gt;
<br>
<br>
So the question is, which piece of code is responsible for hiding the
namespace prefix?
<br>
</blockquote>
And has the resource factory been regenerated so it's using "TRUE"?&nbsp;&nbsp;
It doesn't look that way...
<br>
<blockquote type="cite"><br>
I'd expect something like
<br>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>
&lt;prefix:Activities xmlns:prefix="yadiyadi" /&gt;
<br>
</blockquote>
Me too.&nbsp; What's the nsURI of your EPackage?
<br>
<blockquote type="cite"><br>
Fun part is, after unloading the created and saved resource,
<br>
I reload it using the same resourceSet. But then, I get the famous
"Package with uri null not found" message...
<br>
because the prefix is missing...
<br>
</blockquote>
Something's is a little screwed up for sure... What does the resource
factory look like?
<br>
<blockquote type="cite"><br>
Ronaldo
<br>
<br>
<br>
<br>
<blockquote type="cite"><br>
<br>
Ronaldo wrote:
<br>
<blockquote type="cite">This error comes up when I run the
XYZExample test code, disguised as/copied to a UnitTest in maven. (ie
outside the eclipse editor).
<br>
It runs fine from within eclipse/junit. I figured it must have
something to do with
<br>
&nbsp;<a class="moz-txt-link-freetext" href=" http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F"> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F</a>,
<br>
does it?
<br>
<br>
The error is
<br>
<br>
java.lang.NullPointerException
<br>
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
<br>
</blockquote>
It's dying because the data type doesn't have a containing package and
hence we get a null pointer exception trying to get the factory for
that package?
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EDataType d = (EDataType)f.getEType();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EPackage ePackage = d.getEPackage();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EFactory fac = ePackage.getEFactoryInstance();
<br>
<blockquote type="cite"> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
<br>
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
<br>
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
<br>
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
<br>
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
<br>
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
<br>
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
<br>
<br>
Code:
<br>
<br>
MyModel1Package.eINSTANCE.eClass();
<br>
MyModel2Package.eINSTANCE.eClass();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ResourceSet resourceSet = new ResourceSetImpl();
<br>
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
<br>
&nbsp; ("ext1", new MyModel1ResourceFactoryImpl());
<br>
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
<br>
&nbsp; (Resource.Factory.Registry.DEFAULT_EXTENSION,
<br>
&nbsp;&nbsp;&nbsp; new MyModel2ResourceFactoryImpl());
<br>
<br>
Resource resource =
resourceSet.createResource(URI.createURI(<a class="moz-txt-link-rfc2396E" href="http:///My.model.uri">"http:///My.model.uri"</a>));
<br>
DocumentRoot documentRoot =
MyModel2Factory.eINSTANCE.createDocumentRoot();
<br>
<br>
// ---- Removing the next two lines makes it work from maven too.
<br>
ActivitiesType root = MyModel2Factory.eINSTANCE.createActivitiesType();
<br>
documentRoot.setActivities(root);
<br>
<br>
resource.getContents().add(documentRoot);
<br>
resource.save(System.out, null);
<br>
</blockquote>
This looks much like the generated XyzExample you get when you invoke
"Generate Test Code".&nbsp; Does that have the same problem?
<br>
<blockquote type="cite"><br>
Many thanks,
<br>
Ronaldo
<br>
<br>
Ed Merks wrote:
<br>
&gt; Ronaldo,
<br>
&gt;
<br>
&gt; Comments below.
<br>
&gt;
<br>
&gt; Ronaldo wrote:
<br>
&gt;&gt; Hi Ed,
<br>
&gt;&gt;
<br>
&gt;&gt; Thanks for the quick answer. Yes, I have 2 models in 2
different
<br>
&gt;&gt; eclipse&nbsp; projects.
<br>
&gt;&gt; They both use a null target namespace, in order to eliminate
the
<br>
&gt;&gt; prefixes in the xml.
<br>
&gt; :-(
<br>
&gt;
<br>
&gt; XML documents with at least a namespace for the root element are
<br>
&gt; generally more consumable because they identify their&nbsp; schema...
<br>
&gt;&gt;
<br>
&gt;&gt; I was just wondering what (which setting) causes the code
<br>
&gt;&gt;
<br>
&gt;&gt; result.getDefaultSaveOptions().put(
<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
<br>
&gt; A null target namespace schema produces an annotation on the
EPackage to
<br>
&gt; indicate the package is not qualified.
<br>
&gt;&gt;
<br>
&gt;&gt; to be generated. (as opposed to
<br>
&gt;&gt;
<br>
&gt;&gt; result.getDefaultSaveOptions().put(
<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp; XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
<br>
&gt; This package doesn't have such an annotation.
<br>
&gt;
<br>
&gt; Note that you can't have two different packages that both want to
be the
<br>
&gt; one for the null namespace both working at the same time.
<br>
&gt;&gt; )
<br>
&gt;&gt;
<br>
&gt;&gt; Ronaldo
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>

--------------000904030009000904070908--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423263 is a reply to message #423259] Thu, 25 September 2008 15:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ronaldo,

Class names are always qualified but element and attributes may or may
not be depending on things like elementForm/elementFormDefault...

If you just set the target namespace on the schema and reloaded that
schema, everything would be more consistent than messing with the Ecore
or the @model stuff...


Ronaldo wrote:
> And another observation:
>
> I get:
> <?xml version="1.0" encoding="UTF-8"?>
> <xpdl2:Package xmlns:xpdl2="http://www.wfmc.org/2008/XPDL2.1" Id="1"/>
>
> When adding the PackageType (a model element) directly to the
> resource.getContents(),
> as in:
>
> Resource resource = xpdl2ResourceSet.createResource(uri);
> PackageType packageType = xpdl2Factory.createPackageType();
> resource.getContents().add(packageType);
>
>
> Before I used:
> Resource resource = xpdl2ResourceSet.createResource(uri);
> DocumentRoot documentRoot = xpdl2Factory.createDocumentRoot();
> PackageType packageType = xpdl2Factory.createPackageType();
> documentRoot.setPackage(packageType);
> resource.getContents().add(documentRoot);
>
> Ronaldo
>
>
> Ronaldo wrote:
>> I have something that might be noteworthy:
>> Somehow, I noticed that my genmodel consists of 4 models:
>>
>> Xpdl1 - Deprecated xpdl format
>> Xpdl2 - Current xpdl format
>> Ecore - (Icon contains a little arrow/referenced?)
>> XMLType - (Icon contains a little arrow/referenced?)
>>
>> The util package also contains an Xpdl2XMLProcessor class:
>>
>> public class Xpdl2XMLProcessor extends XMLProcessor {
>> public Xpdl2XMLProcessor() {
>> super((EPackage.Registry.INSTANCE));
>> Xpdl2Package.eINSTANCE.eClass();
>> }
>>
>> @Override
>> protected Map<String, Resource.Factory> getRegistrations() {
>> if (registrations == null) {
>> super.getRegistrations();
>> registrations.put(XML_EXTENSION, new
>> Xpdl2ResourceFactoryImpl());
>> registrations.put(STAR_EXTENSION, new
>> Xpdl2ResourceFactoryImpl());
>> }
>> return registrations;
>> }
>> }
>>
>> which seems a little odd. I hadn't noticed this before.
>>
>> Here's the EPackage source:
>>
>> public interface Xpdl2Package extends EPackage {
>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>> String eNS_PREFIX = "xpdl2";
>> Xpdl2Package eINSTANCE =
>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>> }
>>
>>
>> And the resourceFactory source:
>>
>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>> /**
>> * @generated
>> */
>> public Xpdl2ResourceFactoryImpl() {
>> super();
>> }
>> /**
>> * @generated
>> */
>> public Resource createResourceGen(URI uri) {
>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>> Boolean.TRUE);
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>> Boolean.TRUE);
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>> Boolean.TRUE);
>> return result;
>> }
>> @Override
>> public Resource createResource(URI uri) {
>> XMLResource result = (XMLResource)createResourceGen(uri);
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
>> "UTF-8");
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
>> "UTF-8");
>> // // // Where do we turn this off in the genmodel? What
>> is the name of the option?
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>> Boolean.TRUE);
>> // //
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>> Boolean.TRUE);
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>> Boolean.TRUE);
>> //
>>
>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>> Boolean.TRUE);
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>> Boolean.TRUE);
>> //
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>> Boolean.TRUE);
>> // return result;
>> }
>>
>> } //Xpdl2ResourceFactoryImpl
>>
>> I hope this helps.
>> Ronaldo
>>
>> Ed Merks wrote:
>>> Ronaldo,
>>>
>>> Comments below.
>>>
>>> Ronaldo wrote:
>>>> Hi Ed,
>>>>
>>>> I guess you're saying I'm messing around with a null namespace :0
>>>> Point is, it has worked and somehow I changed something and it
>>>> doesn't work any more.
>>>> I feel I'm losing control ...
>>> Something worked, but only you know what...
>>>>
>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>
>>>> My package is now only annotated with @model kind="package".
>>>> (Unqualified is removed)
>>> You've relaoaded the model?
>>>> The generated XYZExample now generates
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <Activities/>
>>>>
>>>> So the question is, which piece of code is responsible for hiding
>>>> the namespace prefix?
>>> And has the resource factory been regenerated so it's using
>>> "TRUE"? It doesn't look that way...
>>>>
>>>> I'd expect something like
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>> Me too. What's the nsURI of your EPackage?
>>>>
>>>> Fun part is, after unloading the created and saved resource,
>>>> I reload it using the same resourceSet. But then, I get the famous
>>>> "Package with uri null not found" message...
>>>> because the prefix is missing...
>>> Something's is a little screwed up for sure... What does the
>>> resource factory look like?
>>>>
>>>> Ronaldo
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>> Ronaldo wrote:
>>>>>> This error comes up when I run the XYZExample test code,
>>>>>> disguised as/copied to a UnitTest in maven. (ie outside the
>>>>>> eclipse editor).
>>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>>> something to do with
>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>
>>>>>> does it?
>>>>>>
>>>>>> The error is
>>>>>>
>>>>>> java.lang.NullPointerException
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>
>>>>> It's dying because the data type doesn't have a containing package
>>>>> and hence we get a null pointer exception trying to get the
>>>>> factory for that package?
>>>>>
>>>>> EDataType d = (EDataType)f.getEType();
>>>>> EPackage ePackage = d.getEPackage();
>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>>
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>
>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>
>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>
>>>>>>
>>>>>> Code:
>>>>>>
>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>
>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>
>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>
>>>>>> Resource resource =
>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>> DocumentRoot documentRoot =
>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>
>>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>>> ActivitiesType root =
>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>> documentRoot.setActivities(root);
>>>>>>
>>>>>> resource.getContents().add(documentRoot);
>>>>>> resource.save(System.out, null);
>>>>> This looks much like the generated XyzExample you get when you
>>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>>
>>>>>> Many thanks,
>>>>>> Ronaldo
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>> > Ronaldo,
>>>>>> >
>>>>>> > Comments below.
>>>>>> >
>>>>>> > Ronaldo wrote:
>>>>>> >> Hi Ed,
>>>>>> >>
>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>>>> >> eclipse projects.
>>>>>> >> They both use a null target namespace, in order to eliminate the
>>>>>> >> prefixes in the xml.
>>>>>> > :-(
>>>>>> >
>>>>>> > XML documents with at least a namespace for the root element are
>>>>>> > generally more consumable because they identify their schema...
>>>>>> >>
>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>> >>
>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>>> > A null target namespace schema produces an annotation on the
>>>>>> EPackage to
>>>>>> > indicate the package is not qualified.
>>>>>> >>
>>>>>> >> to be generated. (as opposed to
>>>>>> >>
>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>> > This package doesn't have such an annotation.
>>>>>> >
>>>>>> > Note that you can't have two different packages that both want
>>>>>> to be the
>>>>>> > one for the null namespace both working at the same time.
>>>>>> >> )
>>>>>> >>
>>>>>> >> Ronaldo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423284 is a reply to message #423262] Fri, 26 September 2008 09:31 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
Nope most elements didn't have a target namespace... I guess I'll have to add them manually to every element.

A little background might be usefull:
I started out with the xpdl2.1 XSD (http://www.wfmc.org/standards/bpmnxpdl_31.xsd) and created a model and generated java from that.
However, I have little experience with XSD's and decided it might be easier to reload from java annotations from that point on.

That might explain why I do have a DocumentRoot generated, a thing I don't have when generating the model from java annotations directly.
When it all seemed to work, I read posts like http://www.eclipsezone.com/eclipse/forums/t91748.html to eliminate the prefixes.
(Well I guess I misinterpreted them).

I also noted that all my interfaces are now annotated with a name='*_._type' in the extended metadata annotation.
I'd swear this was not the case earlier on.
I'm not sure if this is good or bad, as I read that this should be ok when using a DocumentRoot... (?)
( http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6745.html)
But, as I'm not modifing the xsd but the java annotations instead and reloading the genmodel from these java annotations, do I still need that
(old?) documentroot?
I created a new testproject from java and indeed no documentroot was generated.

That would also explain why adding an element directly to the resource.getContents() did serialize ok,
while using an (old?) documentroot did not serialize ok.

I assumed that starting with an xsd, would create the same model as when you're starting from java...
But the documentroot thing shows that's not the case?

Ronaldo


Ed Merks wrote:
> Ronaldo,
>
> For the library mode it looks like this:
>
> * @model containment="true" upper="-2" transient="true"
> volatile="true" derived="true"
> * extendedMetaData="kind='element' name='library'*
> namespace='##targetNamespace'"*
>
> I assume these models originated from a schema. Do that schema have a
> target namespace?
>
>
> Ronaldo wrote:
>>
>> This is the generated code for the getActivities method in the
>> DocumentRoot interface.
>>
>> * @model containment="true" upper="-2" transient="true"
>> volatile="true" derived="true"
>> * extendedMetaData="kind='element' name='Activities'"
>> * @generated
>> */
>> ActivitiesType getActivities();
>>
>>
>>
>> Ed Merks wrote:
>>> Ronaldo,
>>>
>>> What EAnnotations does the "activities" feature of the DocumentRoot
>>> have on it?
>>>
>>>
>>> Ronaldo wrote:
>>>> I have something that might be noteworthy:
>>>> Somehow, I noticed that my genmodel consists of 4 models:
>>>>
>>>> Xpdl1 - Deprecated xpdl format
>>>> Xpdl2 - Current xpdl format
>>>> Ecore - (Icon contains a little arrow/referenced?)
>>>> XMLType - (Icon contains a little arrow/referenced?)
>>>>
>>>> The util package also contains an Xpdl2XMLProcessor class:
>>>>
>>>> public class Xpdl2XMLProcessor extends XMLProcessor {
>>>> public Xpdl2XMLProcessor() {
>>>> super((EPackage.Registry.INSTANCE));
>>>> Xpdl2Package.eINSTANCE.eClass();
>>>> }
>>>>
>>>> @Override
>>>> protected Map<String, Resource.Factory> getRegistrations() {
>>>> if (registrations == null) {
>>>> super.getRegistrations();
>>>> registrations.put(XML_EXTENSION, new
>>>> Xpdl2ResourceFactoryImpl());
>>>> registrations.put(STAR_EXTENSION, new
>>>> Xpdl2ResourceFactoryImpl());
>>>> }
>>>> return registrations;
>>>> }
>>>> }
>>>>
>>>> which seems a little odd. I hadn't noticed this before.
>>>>
>>>> Here's the EPackage source:
>>>>
>>>> public interface Xpdl2Package extends EPackage {
>>>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>>>> String eNS_PREFIX = "xpdl2";
>>>> Xpdl2Package eINSTANCE =
>>>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>>>> }
>>>>
>>>>
>>>> And the resourceFactory source:
>>>>
>>>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>>>> /**
>>>> * @generated
>>>> */
>>>> public Xpdl2ResourceFactoryImpl() {
>>>> super();
>>>> }
>>>> /**
>>>> * @generated
>>>> */
>>>> public Resource createResourceGen(URI uri) {
>>>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>> Boolean.TRUE);
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>> Boolean.TRUE);
>>>>
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>> Boolean.TRUE);
>>>>
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>> Boolean.TRUE);
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>> Boolean.TRUE);
>>>>
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>>> Boolean.TRUE);
>>>> return result;
>>>> }
>>>> @Override
>>>> public Resource createResource(URI uri) {
>>>> XMLResource result = (XMLResource)createResourceGen(uri);
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
>>>> "UTF-8");
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
>>>> "UTF-8");
>>>> // // // Where do we turn this off in the genmodel?
>>>> What is the name of the option?
>>>> //
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>> Boolean.TRUE);
>>>> // //
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>> Boolean.TRUE);
>>>> //
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>> Boolean.TRUE);
>>>> //
>>>>
>>>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>>>> Boolean.TRUE);
>>>> //
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>>>> Boolean.TRUE);
>>>> //
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>>>> Boolean.TRUE);
>>>> // return result;
>>>> }
>>>>
>>>> } //Xpdl2ResourceFactoryImpl
>>>>
>>>> I hope this helps.
>>>> Ronaldo
>>>>
>>>> Ed Merks wrote:
>>>>> Ronaldo,
>>>>>
>>>>> Comments below.
>>>>>
>>>>> Ronaldo wrote:
>>>>>> Hi Ed,
>>>>>>
>>>>>> I guess you're saying I'm messing around with a null namespace :0
>>>>>> Point is, it has worked and somehow I changed something and it
>>>>>> doesn't work any more.
>>>>>> I feel I'm losing control ...
>>>>> Something worked, but only you know what...
>>>>>>
>>>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>>>
>>>>>> My package is now only annotated with @model kind="package".
>>>>>> (Unqualified is removed)
>>>>> You've relaoaded the model?
>>>>>> The generated XYZExample now generates
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <Activities/>
>>>>>>
>>>>>> So the question is, which piece of code is responsible for hiding
>>>>>> the namespace prefix?
>>>>> And has the resource factory been regenerated so it's using
>>>>> "TRUE"? It doesn't look that way...
>>>>>>
>>>>>> I'd expect something like
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>>>> Me too. What's the nsURI of your EPackage?
>>>>>>
>>>>>> Fun part is, after unloading the created and saved resource,
>>>>>> I reload it using the same resourceSet. But then, I get the famous
>>>>>> "Package with uri null not found" message...
>>>>>> because the prefix is missing...
>>>>> Something's is a little screwed up for sure... What does the
>>>>> resource factory look like?
>>>>>>
>>>>>> Ronaldo
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Ronaldo wrote:
>>>>>>>> This error comes up when I run the XYZExample test code,
>>>>>>>> disguised as/copied to a UnitTest in maven. (ie outside the
>>>>>>>> eclipse editor).
>>>>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>>>>> something to do with
>>>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>>>
>>>>>>>> does it?
>>>>>>>>
>>>>>>>> The error is
>>>>>>>>
>>>>>>>> java.lang.NullPointerException
>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>>>
>>>>>>> It's dying because the data type doesn't have a containing
>>>>>>> package and hence we get a null pointer exception trying to get
>>>>>>> the factory for that package?
>>>>>>>
>>>>>>> EDataType d = (EDataType)f.getEType();
>>>>>>> EPackage ePackage = d.getEPackage();
>>>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>>>
>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>>>
>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>>>
>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>>>>
>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>>
>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>>>
>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>>>
>>>>>>>>
>>>>>>>> Code:
>>>>>>>>
>>>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>
>>>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>
>>>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>>>
>>>>>>>> Resource resource =
>>>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>>>> DocumentRoot documentRoot =
>>>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>>>
>>>>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>>>>> ActivitiesType root =
>>>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>>>> documentRoot.setActivities(root);
>>>>>>>>
>>>>>>>> resource.getContents().add(documentRoot);
>>>>>>>> resource.save(System.out, null);
>>>>>>> This looks much like the generated XyzExample you get when you
>>>>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>>>>
>>>>>>>> Many thanks,
>>>>>>>> Ronaldo
>>>>>>>>
>>>>>>>> Ed Merks wrote:
>>>>>>>> > Ronaldo,
>>>>>>>> >
>>>>>>>> > Comments below.
>>>>>>>> >
>>>>>>>> > Ronaldo wrote:
>>>>>>>> >> Hi Ed,
>>>>>>>> >>
>>>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2 different
>>>>>>>> >> eclipse projects.
>>>>>>>> >> They both use a null target namespace, in order to eliminate the
>>>>>>>> >> prefixes in the xml.
>>>>>>>> > :-(
>>>>>>>> >
>>>>>>>> > XML documents with at least a namespace for the root element are
>>>>>>>> > generally more consumable because they identify their schema...
>>>>>>>> >>
>>>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>>>> >>
>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>>>>> > A null target namespace schema produces an annotation on the
>>>>>>>> EPackage to
>>>>>>>> > indicate the package is not qualified.
>>>>>>>> >>
>>>>>>>> >> to be generated. (as opposed to
>>>>>>>> >>
>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>>>> > This package doesn't have such an annotation.
>>>>>>>> >
>>>>>>>> > Note that you can't have two different packages that both want
>>>>>>>> to be the
>>>>>>>> > one for the null namespace both working at the same time.
>>>>>>>> >> )
>>>>>>>> >>
>>>>>>>> >> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423291 is a reply to message #423284] Fri, 26 September 2008 11:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ronaldo,

Comments below.

Ronaldo wrote:
> Nope most elements didn't have a target namespace... I guess I'll have
> to add them manually to every element.
>
> A little background might be usefull:
> I started out with the xpdl2.1 XSD
> (http://www.wfmc.org/standards/bpmnxpdl_31.xsd) and created a model
> and generated java from that.
That one had a target namespace.
> However, I have little experience with XSD's and decided it might be
> easier to reload from java annotations from that point on.
Did you know you can export your Ecore to XSD? Keep in mind though that
XSD -> Ecore -> XSD is not a round trip because XSD -> Ecore is slightly
lossy. But Ecore -> XSD -> Ecore is supposed to be a round trip because
we generate all the necessary ecore:* annotations to make it roundtrip.
Using this mechanism, you could discover what you needed to change in
the original XSD to produce the desired Ecore...
>
> That might explain why I do have a DocumentRoot generated, a thing I
> don't have when generating the model from java annotations directly.
We, given sufficient annotations of the right form, you'll get the same
thing. The Ecore -> Java with @model -> Ecore is supposed to be a round
trip after all...
> When it all seemed to work, I read posts like
> http://www.eclipsezone.com/eclipse/forums/t91748.html to eliminate the
> prefixes.
> (Well I guess I misinterpreted them).
A better way to have eliminated the prefixes is to use
DocumentRoot.getXMLNSPrefixMap().put("", XyzPackage.eNS_URI). This way
you end up with an xmlns="<nsURI>" in the document and all elements will
be implicitly qualified by this namespace. Of course attributes will
still need explicit qualification, so I'm not sure you'd be totally
happy with the result. But given that I assume you want the
serialization to conform to the schema and the schema requires qualified
local elements and attributes, I don't think you have all that much choice.
>
> I also noted that all my interfaces are now annotated with a
> name='*_._type' in the extended metadata annotation.
This comes from anonymous type definitions.
> I'd swear this was not the case earlier on.
> I'm not sure if this is good or bad, as I read that this should be ok
> when using a DocumentRoot... (?)
> ( http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6745.html)
An anonymous type can never be used in an xsi:type. Sometimes that fact
can be used to deduce a more appropriate element name...
> But, as I'm not modifing the xsd but the java annotations instead and
> reloading the genmodel from these java annotations, do I still need
> that (old?) documentroot?
The document root determines the appropriate element name at the root of
the document. Without a document root, the name of the type will be
used as the root element name, but that's not going to conform to the
schema since a schema will always specify a global element to use for
the root.
> I created a new testproject from java and indeed no documentroot was
> generated.
Not sure about that. The DocumentRoot interface has @model on it, so I
assume you'd have to delete that for it to just disappear...
>
>
> That would also explain why adding an element directly to the
> resource.getContents() did serialize ok,
> while using an (old?) documentroot did not serialize ok.
If you're okay with a serialization that doesn't conform to the schema
then it's okay. The document root serialization issue was a result of
inconsistent annotations (annotations that would never have been
produced from a real schema).
>
> I assumed that starting with an xsd, would create the same model as
> when you're starting from java...
Given the corresponding annotations, yes.
> But the documentroot thing shows that's not the case?
I'm sure you've left out a little detail. After all, you've already
mentioned reloading the model from the @model changes and that didn't
make the DocumentRoot disappear... When reading the newsgroups for a
long time you start to learn that people leave out tiny but little
important details. :-P
>
>
> Ronaldo
>
>
> Ed Merks wrote:
>> Ronaldo,
>>
>> For the library mode it looks like this:
>>
>> * @model containment="true" upper="-2" transient="true"
>> volatile="true" derived="true"
>> * extendedMetaData="kind='element' name='library'*
>> namespace='##targetNamespace'"*
>>
>> I assume these models originated from a schema. Do that schema have
>> a target namespace?
>>
>>
>> Ronaldo wrote:
>>>
>>> This is the generated code for the getActivities method in the
>>> DocumentRoot interface.
>>>
>>> * @model containment="true" upper="-2" transient="true"
>>> volatile="true" derived="true"
>>> * extendedMetaData="kind='element' name='Activities'"
>>> * @generated
>>> */
>>> ActivitiesType getActivities();
>>>
>>>
>>>
>>> Ed Merks wrote:
>>>> Ronaldo,
>>>>
>>>> What EAnnotations does the "activities" feature of the DocumentRoot
>>>> have on it?
>>>>
>>>>
>>>> Ronaldo wrote:
>>>>> I have something that might be noteworthy:
>>>>> Somehow, I noticed that my genmodel consists of 4 models:
>>>>>
>>>>> Xpdl1 - Deprecated xpdl format
>>>>> Xpdl2 - Current xpdl format
>>>>> Ecore - (Icon contains a little arrow/referenced?)
>>>>> XMLType - (Icon contains a little arrow/referenced?)
>>>>>
>>>>> The util package also contains an Xpdl2XMLProcessor class:
>>>>>
>>>>> public class Xpdl2XMLProcessor extends XMLProcessor {
>>>>> public Xpdl2XMLProcessor() {
>>>>> super((EPackage.Registry.INSTANCE));
>>>>> Xpdl2Package.eINSTANCE.eClass();
>>>>> }
>>>>>
>>>>> @Override
>>>>> protected Map<String, Resource.Factory> getRegistrations() {
>>>>> if (registrations == null) {
>>>>> super.getRegistrations();
>>>>> registrations.put(XML_EXTENSION, new
>>>>> Xpdl2ResourceFactoryImpl());
>>>>> registrations.put(STAR_EXTENSION, new
>>>>> Xpdl2ResourceFactoryImpl());
>>>>> }
>>>>> return registrations;
>>>>> }
>>>>> }
>>>>>
>>>>> which seems a little odd. I hadn't noticed this before.
>>>>>
>>>>> Here's the EPackage source:
>>>>>
>>>>> public interface Xpdl2Package extends EPackage {
>>>>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>>>>> String eNS_PREFIX = "xpdl2";
>>>>> Xpdl2Package eINSTANCE =
>>>>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>>>>> }
>>>>>
>>>>>
>>>>> And the resourceFactory source:
>>>>>
>>>>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>>>>> /**
>>>>> * @generated
>>>>> */
>>>>> public Xpdl2ResourceFactoryImpl() {
>>>>> super();
>>>>> }
>>>>> /**
>>>>> * @generated
>>>>> */
>>>>> public Resource createResourceGen(URI uri) {
>>>>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>>>>
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>>> Boolean.TRUE);
>>>>>
>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>>> Boolean.TRUE);
>>>>>
>>>>>
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>>> Boolean.TRUE);
>>>>>
>>>>>
>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>>> Boolean.TRUE);
>>>>>
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>>> Boolean.TRUE);
>>>>>
>>>>>
>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>>>> Boolean.TRUE);
>>>>> return result;
>>>>> }
>>>>> @Override
>>>>> public Resource createResource(URI uri) {
>>>>> XMLResource result = (XMLResource)createResourceGen(uri);
>>>>>
>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
>>>>> "UTF-8");
>>>>>
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
>>>>> "UTF-8");
>>>>> // // // Where do we turn this off in the genmodel?
>>>>> What is the name of the option?
>>>>> //
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>>> Boolean.TRUE);
>>>>> // //
>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>>> Boolean.TRUE);
>>>>> //
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>>> Boolean.TRUE);
>>>>> //
>>>>>
>>>>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>>>>> Boolean.TRUE);
>>>>> //
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>>>>> Boolean.TRUE);
>>>>> //
>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>>>>> Boolean.TRUE);
>>>>> // return result;
>>>>> }
>>>>>
>>>>> } //Xpdl2ResourceFactoryImpl
>>>>>
>>>>> I hope this helps.
>>>>> Ronaldo
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Ronaldo,
>>>>>>
>>>>>> Comments below.
>>>>>>
>>>>>> Ronaldo wrote:
>>>>>>> Hi Ed,
>>>>>>>
>>>>>>> I guess you're saying I'm messing around with a null namespace :0
>>>>>>> Point is, it has worked and somehow I changed something and it
>>>>>>> doesn't work any more.
>>>>>>> I feel I'm losing control ...
>>>>>> Something worked, but only you know what...
>>>>>>>
>>>>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>>>>
>>>>>>> My package is now only annotated with @model kind="package".
>>>>>>> (Unqualified is removed)
>>>>>> You've relaoaded the model?
>>>>>>> The generated XYZExample now generates
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <Activities/>
>>>>>>>
>>>>>>> So the question is, which piece of code is responsible for
>>>>>>> hiding the namespace prefix?
>>>>>> And has the resource factory been regenerated so it's using
>>>>>> "TRUE"? It doesn't look that way...
>>>>>>>
>>>>>>> I'd expect something like
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>>>>> Me too. What's the nsURI of your EPackage?
>>>>>>>
>>>>>>> Fun part is, after unloading the created and saved resource,
>>>>>>> I reload it using the same resourceSet. But then, I get the
>>>>>>> famous "Package with uri null not found" message...
>>>>>>> because the prefix is missing...
>>>>>> Something's is a little screwed up for sure... What does the
>>>>>> resource factory look like?
>>>>>>>
>>>>>>> Ronaldo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Ronaldo wrote:
>>>>>>>>> This error comes up when I run the XYZExample test code,
>>>>>>>>> disguised as/copied to a UnitTest in maven. (ie outside the
>>>>>>>>> eclipse editor).
>>>>>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>>>>>> something to do with
>>>>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>>>>
>>>>>>>>> does it?
>>>>>>>>>
>>>>>>>>> The error is
>>>>>>>>>
>>>>>>>>> java.lang.NullPointerException
>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>>>>
>>>>>>>> It's dying because the data type doesn't have a containing
>>>>>>>> package and hence we get a null pointer exception trying to get
>>>>>>>> the factory for that package?
>>>>>>>>
>>>>>>>> EDataType d = (EDataType)f.getEType();
>>>>>>>> EPackage ePackage = d.getEPackage();
>>>>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>>>>
>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>>>>
>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>>>>
>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>>>>>
>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>>>
>>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>>>>
>>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Code:
>>>>>>>>>
>>>>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>>
>>>>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>>
>>>>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>>>>
>>>>>>>>> Resource resource =
>>>>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>>>>>
>>>>>>>>> DocumentRoot documentRoot =
>>>>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>>>>
>>>>>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>>>>>> ActivitiesType root =
>>>>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>>>>> documentRoot.setActivities(root);
>>>>>>>>>
>>>>>>>>> resource.getContents().add(documentRoot);
>>>>>>>>> resource.save(System.out, null);
>>>>>>>> This looks much like the generated XyzExample you get when you
>>>>>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>>>>>
>>>>>>>>> Many thanks,
>>>>>>>>> Ronaldo
>>>>>>>>>
>>>>>>>>> Ed Merks wrote:
>>>>>>>>> > Ronaldo,
>>>>>>>>> >
>>>>>>>>> > Comments below.
>>>>>>>>> >
>>>>>>>>> > Ronaldo wrote:
>>>>>>>>> >> Hi Ed,
>>>>>>>>> >>
>>>>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2
>>>>>>>>> different
>>>>>>>>> >> eclipse projects.
>>>>>>>>> >> They both use a null target namespace, in order to
>>>>>>>>> eliminate the
>>>>>>>>> >> prefixes in the xml.
>>>>>>>>> > :-(
>>>>>>>>> >
>>>>>>>>> > XML documents with at least a namespace for the root element
>>>>>>>>> are
>>>>>>>>> > generally more consumable because they identify their
>>>>>>>>> schema...
>>>>>>>>> >>
>>>>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>>>>> >>
>>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>>>>>> > A null target namespace schema produces an annotation on the
>>>>>>>>> EPackage to
>>>>>>>>> > indicate the package is not qualified.
>>>>>>>>> >>
>>>>>>>>> >> to be generated. (as opposed to
>>>>>>>>> >>
>>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>>>>> > This package doesn't have such an annotation.
>>>>>>>>> >
>>>>>>>>> > Note that you can't have two different packages that both
>>>>>>>>> want to be the
>>>>>>>>> > one for the null namespace both working at the same time.
>>>>>>>>> >> )
>>>>>>>>> >>
>>>>>>>>> >> Ronaldo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423294 is a reply to message #423291] Fri, 26 September 2008 12:04 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
Hi Ed,

Thanks for the extensive answers. Yes, I'm sure I've left out something, if I only knew what...
I decided to take a step back, create a new project and reload the xsd again.
Then, step by step I'll try to find the solution.

Unfortunately, importing the xsd (http://www.wfmc.org/standards/bpmnxpdl_31.xsd) shows errors, see attachment.
I cannot tell if the xsd is not ok or if there's an error somewhere in emf.

Ronaldo

Ed Merks wrote:
> Ronaldo,
>
> Comments below.
>
> Ronaldo wrote:
>> Nope most elements didn't have a target namespace... I guess I'll have
>> to add them manually to every element.
>>
>> A little background might be usefull:
>> I started out with the xpdl2.1 XSD
>> (http://www.wfmc.org/standards/bpmnxpdl_31.xsd) and created a model
>> and generated java from that.
> That one had a target namespace.
>> However, I have little experience with XSD's and decided it might be
>> easier to reload from java annotations from that point on.
> Did you know you can export your Ecore to XSD? Keep in mind though that
> XSD -> Ecore -> XSD is not a round trip because XSD -> Ecore is slightly
> lossy. But Ecore -> XSD -> Ecore is supposed to be a round trip because
> we generate all the necessary ecore:* annotations to make it roundtrip.
> Using this mechanism, you could discover what you needed to change in
> the original XSD to produce the desired Ecore...
>>
>> That might explain why I do have a DocumentRoot generated, a thing I
>> don't have when generating the model from java annotations directly.
> We, given sufficient annotations of the right form, you'll get the same
> thing. The Ecore -> Java with @model -> Ecore is supposed to be a round
> trip after all...
>> When it all seemed to work, I read posts like
>> http://www.eclipsezone.com/eclipse/forums/t91748.html to eliminate the
>> prefixes.
>> (Well I guess I misinterpreted them).
> A better way to have eliminated the prefixes is to use
> DocumentRoot.getXMLNSPrefixMap().put("", XyzPackage.eNS_URI). This way
> you end up with an xmlns="<nsURI>" in the document and all elements will
> be implicitly qualified by this namespace. Of course attributes will
> still need explicit qualification, so I'm not sure you'd be totally
> happy with the result. But given that I assume you want the
> serialization to conform to the schema and the schema requires qualified
> local elements and attributes, I don't think you have all that much choice.
>>
>> I also noted that all my interfaces are now annotated with a
>> name='*_._type' in the extended metadata annotation.
> This comes from anonymous type definitions.
>> I'd swear this was not the case earlier on.
>> I'm not sure if this is good or bad, as I read that this should be ok
>> when using a DocumentRoot... (?)
>> ( http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6745.html)
> An anonymous type can never be used in an xsi:type. Sometimes that fact
> can be used to deduce a more appropriate element name...
>> But, as I'm not modifing the xsd but the java annotations instead and
>> reloading the genmodel from these java annotations, do I still need
>> that (old?) documentroot?
> The document root determines the appropriate element name at the root of
> the document. Without a document root, the name of the type will be
> used as the root element name, but that's not going to conform to the
> schema since a schema will always specify a global element to use for
> the root.
>> I created a new testproject from java and indeed no documentroot was
>> generated.
> Not sure about that. The DocumentRoot interface has @model on it, so I
> assume you'd have to delete that for it to just disappear...
>>
>>
>> That would also explain why adding an element directly to the
>> resource.getContents() did serialize ok,
>> while using an (old?) documentroot did not serialize ok.
> If you're okay with a serialization that doesn't conform to the schema
> then it's okay. The document root serialization issue was a result of
> inconsistent annotations (annotations that would never have been
> produced from a real schema).
>>
>> I assumed that starting with an xsd, would create the same model as
>> when you're starting from java...
> Given the corresponding annotations, yes.
>> But the documentroot thing shows that's not the case?
> I'm sure you've left out a little detail. After all, you've already
> mentioned reloading the model from the @model changes and that didn't
> make the DocumentRoot disappear... When reading the newsgroups for a
> long time you start to learn that people leave out tiny but little
> important details. :-P
>>
>>
>> Ronaldo
>>
>>
>> Ed Merks wrote:
>>> Ronaldo,
>>>
>>> For the library mode it looks like this:
>>>
>>> * @model containment="true" upper="-2" transient="true"
>>> volatile="true" derived="true"
>>> * extendedMetaData="kind='element' name='library'*
>>> namespace='##targetNamespace'"*
>>>
>>> I assume these models originated from a schema. Do that schema have
>>> a target namespace?
>>>
>>>
>>> Ronaldo wrote:
>>>>
>>>> This is the generated code for the getActivities method in the
>>>> DocumentRoot interface.
>>>>
>>>> * @model containment="true" upper="-2" transient="true"
>>>> volatile="true" derived="true"
>>>> * extendedMetaData="kind='element' name='Activities'"
>>>> * @generated
>>>> */
>>>> ActivitiesType getActivities();
>>>>
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>> Ronaldo,
>>>>>
>>>>> What EAnnotations does the "activities" feature of the DocumentRoot
>>>>> have on it?
>>>>>
>>>>>
>>>>> Ronaldo wrote:
>>>>>> I have something that might be noteworthy:
>>>>>> Somehow, I noticed that my genmodel consists of 4 models:
>>>>>>
>>>>>> Xpdl1 - Deprecated xpdl format
>>>>>> Xpdl2 - Current xpdl format
>>>>>> Ecore - (Icon contains a little arrow/referenced?)
>>>>>> XMLType - (Icon contains a little arrow/referenced?)
>>>>>>
>>>>>> The util package also contains an Xpdl2XMLProcessor class:
>>>>>>
>>>>>> public class Xpdl2XMLProcessor extends XMLProcessor {
>>>>>> public Xpdl2XMLProcessor() {
>>>>>> super((EPackage.Registry.INSTANCE));
>>>>>> Xpdl2Package.eINSTANCE.eClass();
>>>>>> }
>>>>>>
>>>>>> @Override
>>>>>> protected Map<String, Resource.Factory> getRegistrations() {
>>>>>> if (registrations == null) {
>>>>>> super.getRegistrations();
>>>>>> registrations.put(XML_EXTENSION, new
>>>>>> Xpdl2ResourceFactoryImpl());
>>>>>> registrations.put(STAR_EXTENSION, new
>>>>>> Xpdl2ResourceFactoryImpl());
>>>>>> }
>>>>>> return registrations;
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> which seems a little odd. I hadn't noticed this before.
>>>>>>
>>>>>> Here's the EPackage source:
>>>>>>
>>>>>> public interface Xpdl2Package extends EPackage {
>>>>>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>>>>>> String eNS_PREFIX = "xpdl2";
>>>>>> Xpdl2Package eINSTANCE =
>>>>>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>>>>>> }
>>>>>>
>>>>>>
>>>>>> And the resourceFactory source:
>>>>>>
>>>>>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>>>>>> /**
>>>>>> * @generated
>>>>>> */
>>>>>> public Xpdl2ResourceFactoryImpl() {
>>>>>> super();
>>>>>> }
>>>>>> /**
>>>>>> * @generated
>>>>>> */
>>>>>> public Resource createResourceGen(URI uri) {
>>>>>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>>>>>
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>>>> Boolean.TRUE);
>>>>>>
>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>>>> Boolean.TRUE);
>>>>>>
>>>>>>
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>>>> Boolean.TRUE);
>>>>>>
>>>>>>
>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>>>> Boolean.TRUE);
>>>>>>
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>>>> Boolean.TRUE);
>>>>>>
>>>>>>
>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>>>>> Boolean.TRUE);
>>>>>> return result;
>>>>>> }
>>>>>> @Override
>>>>>> public Resource createResource(URI uri) {
>>>>>> XMLResource result = (XMLResource)createResourceGen(uri);
>>>>>>
>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
>>>>>> "UTF-8");
>>>>>>
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
>>>>>> "UTF-8");
>>>>>> // // // Where do we turn this off in the genmodel?
>>>>>> What is the name of the option?
>>>>>> //
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>>>> Boolean.TRUE);
>>>>>> // //
>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>>>> Boolean.TRUE);
>>>>>> //
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>>>> Boolean.TRUE);
>>>>>> //
>>>>>>
>>>>>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>>>>>> Boolean.TRUE);
>>>>>> //
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>>>>>> Boolean.TRUE);
>>>>>> //
>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>>>>>> Boolean.TRUE);
>>>>>> // return result;
>>>>>> }
>>>>>>
>>>>>> } //Xpdl2ResourceFactoryImpl
>>>>>>
>>>>>> I hope this helps.
>>>>>> Ronaldo
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Ronaldo,
>>>>>>>
>>>>>>> Comments below.
>>>>>>>
>>>>>>> Ronaldo wrote:
>>>>>>>> Hi Ed,
>>>>>>>>
>>>>>>>> I guess you're saying I'm messing around with a null namespace :0
>>>>>>>> Point is, it has worked and somehow I changed something and it
>>>>>>>> doesn't work any more.
>>>>>>>> I feel I'm losing control ...
>>>>>>> Something worked, but only you know what...
>>>>>>>>
>>>>>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>>>>>
>>>>>>>> My package is now only annotated with @model kind="package".
>>>>>>>> (Unqualified is removed)
>>>>>>> You've relaoaded the model?
>>>>>>>> The generated XYZExample now generates
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <Activities/>
>>>>>>>>
>>>>>>>> So the question is, which piece of code is responsible for
>>>>>>>> hiding the namespace prefix?
>>>>>>> And has the resource factory been regenerated so it's using
>>>>>>> "TRUE"? It doesn't look that way...
>>>>>>>>
>>>>>>>> I'd expect something like
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>>>>>> Me too. What's the nsURI of your EPackage?
>>>>>>>>
>>>>>>>> Fun part is, after unloading the created and saved resource,
>>>>>>>> I reload it using the same resourceSet. But then, I get the
>>>>>>>> famous "Package with uri null not found" message...
>>>>>>>> because the prefix is missing...
>>>>>>> Something's is a little screwed up for sure... What does the
>>>>>>> resource factory look like?
>>>>>>>>
>>>>>>>> Ronaldo
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Ronaldo wrote:
>>>>>>>>>> This error comes up when I run the XYZExample test code,
>>>>>>>>>> disguised as/copied to a UnitTest in maven. (ie outside the
>>>>>>>>>> eclipse editor).
>>>>>>>>>> It runs fine from within eclipse/junit. I figured it must have
>>>>>>>>>> something to do with
>>>>>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>>>>>
>>>>>>>>>> does it?
>>>>>>>>>>
>>>>>>>>>> The error is
>>>>>>>>>>
>>>>>>>>>> java.lang.NullPointerException
>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>>>>>
>>>>>>>>> It's dying because the data type doesn't have a containing
>>>>>>>>> package and hence we get a null pointer exception trying to get
>>>>>>>>> the factory for that package?
>>>>>>>>>
>>>>>>>>> EDataType d = (EDataType)f.getEType();
>>>>>>>>> EPackage ePackage = d.getEPackage();
>>>>>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>>>>>
>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>>>>>
>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>>>>>
>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>>>>>>
>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>>>>
>>>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>>>>>
>>>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Code:
>>>>>>>>>>
>>>>>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>>>
>>>>>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>>>
>>>>>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>>>>>
>>>>>>>>>> Resource resource =
>>>>>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>>>>>>
>>>>>>>>>> DocumentRoot documentRoot =
>>>>>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>>>>>
>>>>>>>>>> // ---- Removing the next two lines makes it work from maven too.
>>>>>>>>>> ActivitiesType root =
>>>>>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>>>>>> documentRoot.setActivities(root);
>>>>>>>>>>
>>>>>>>>>> resource.getContents().add(documentRoot);
>>>>>>>>>> resource.save(System.out, null);
>>>>>>>>> This looks much like the generated XyzExample you get when you
>>>>>>>>> invoke "Generate Test Code". Does that have the same problem?
>>>>>>>>>>
>>>>>>>>>> Many thanks,
>>>>>>>>>> Ronaldo
>>>>>>>>>>
>>>>>>>>>> Ed Merks wrote:
>>>>>>>>>> > Ronaldo,
>>>>>>>>>> >
>>>>>>>>>> > Comments below.
>>>>>>>>>> >
>>>>>>>>>> > Ronaldo wrote:
>>>>>>>>>> >> Hi Ed,
>>>>>>>>>> >>
>>>>>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2
>>>>>>>>>> different
>>>>>>>>>> >> eclipse projects.
>>>>>>>>>> >> They both use a null target namespace, in order to
>>>>>>>>>> eliminate the
>>>>>>>>>> >> prefixes in the xml.
>>>>>>>>>> > :-(
>>>>>>>>>> >
>>>>>>>>>> > XML documents with at least a namespace for the root element
>>>>>>>>>> are
>>>>>>>>>> > generally more consumable because they identify their
>>>>>>>>>> schema...
>>>>>>>>>> >>
>>>>>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>>>>>> >>
>>>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
>>>>>>>>>> > A null target namespace schema produces an annotation on the
>>>>>>>>>> EPackage to
>>>>>>>>>> > indicate the package is not qualified.
>>>>>>>>>> >>
>>>>>>>>>> >> to be generated. (as opposed to
>>>>>>>>>> >>
>>>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>>>>>> > This package doesn't have such an annotation.
>>>>>>>>>> >
>>>>>>>>>> > Note that you can't have two different packages that both
>>>>>>>>>> want to be the
>>>>>>>>>> > one for the null namespace both working at the same time.
>>>>>>>>>> >> )
>>>>>>>>>> >>
>>>>>>>>>> >> Ronaldo
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423295 is a reply to message #423294] Fri, 26 September 2008 12:05 Go to previous messageGo to next message
ronald Mising name is currently offline ronald Mising nameFriend
Messages: 52
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------070609020400030306050403
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The attachments...

--------------070609020400030306050403
Content-Type: image/png;
name="xsd-import-error.PNG"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="xsd-import-error.PNG"

iVBORw0KGgoAAAANSUhEUgAABPsAAAD6CAIAAABYldXWAAAAAXNSR0IArs4c 6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgA ABdwnLpRPAAA
YQFJREFUeF7tnQecXUXZh8/dTTZLE5TPSBBCkSZFCYLUAIrUEFoIEGoAEYgQ JGABC8WPT8GK
gAVEqSrSREFQhCBSQktCCwkmpO5mUwhJSIFAuN/cPZvDydT33LK79+yzv/lt bs6dMzPv877z
zvzv3Lu3cPEvp0ZRdMXZm6rf6qdw6NhCoVE9KL7Xp/T/xkJ8PWpqLj3u0xj1 aozeX6l+Fxob
iyuL0fsfRA0NUUMUfdBRMXpf/YcfCEAAAvVIoJT9+IEABCBQfwQKK+pvzIwY AhCAQDG99VKP
V66G5N34fyq/NUUr3o+a2gXnioaoqVfpWvR+qbzXLld7F6OoV3vlXtF7xejd tvl/bvqwKaV4
V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oGv8aUFiWqc9q1Vw9Zv05adqao9EtGgiRBu85k2tF613V1N+V6bv srrDb2N6wGXf
7g8nq8Dz+MuMB422Ga4u7Enc+k3zuElzSnrY6bnm96zJRzIeM+pckeCPumBK oQIEIAABCEAA
AhCAQL4JdCje/jdFUb9xEsXbctk3J/Tr17rRRov7939fvbe5f/+i0q6DBz/X 2rpklah9du7c
W7/97Untp7tXXnDBnc89l8hd9WDB4Yers9/pa631+jrrjF177cfXXluJ3p83 NZ3/tTNnz3ol
37ixrqsImKq+q0ZSo35zb2CNuNEsBCAAAQhAAAIQgEC+CWRWvG8cd9QrH//4 NHXMu8EGizfc
cOmGG779kY/Mi6KXDjpo/Pz5yUnvhAULHr7iirt/8IMnp0z5IKV3Zxx22EtR 9N/evSetvfbL
a6317JprPrrmmv9aa63bm5oOOfCLY59/JN+4sa6TCeT+ADD3BnZywNAdBCAA AQhAAAIQgEDO
CGRWvC99/nPqk7evfexj09dff876689ff/3Za689LYomR9EL++zz0ty5y1bp W6V+306f7RaL
k/fb71mljdXZb1PTy2uuOba5+anm5of79Lm/uflvTU2f23qLv9xzc874Yg4E IAABCEAAAhCA
AAQgAAEIdBWBzIp3zMYbPbPeeuM/8pHXP/KR6euuO2Pddaep9yc3Nk5ofw/z c1/84qtz5ry3
utBVZ7zvFotvHHzwU1H0vBLGhcK4pqZxffo809T0n969H+zd++6mpof69Nnu k/1uvfm6rgJB
vxCAAAQgAAEIQAACEIAABCCQMwKZFe/odddVn7x9Zq21xq+11sS11pq8zjqT mptfbWxUJ7el
w9soevKgA1rfVQr3wx916jt2jz2U3H0uip6JomcbG5/t3VuVJ3r3frRXr7/2 6nVH797/6N17
q4999LfX/zRnfDEHAhCAAAQgAAEIQAACEIAABLqKQHbFu/FG/1xjjcebm59t bh7f3PzKGmu8
0qfPS42N49vl7uNRdM9VV81dvlzp3Q/af9QDJX/HXHPNf6JoTBQp3ftUofBU r15PKrnb2Pj3
hoa7GhpubWy8p6lp8/XW/c2vftxVIOgXAh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CEAAAhCAAAQgAIGcEUDxongh AAEIQAACEIAA
BCAAAQhAIJ8EOhTvxuJvJ8qZ4sccCEAAAhCAAAQgAAEIQAACEMgrARRvPl/J yGu8YhcEIAAB
CEAAAhCAAAQgAAE5ARQvihcCEIAABCAAAQhAAAIQgAAE8kkAxZtPv8pf86Am BCAAAQhAAAIQ
gAAEIACBvBJA8aJ4IQABCEAAAhCAAAQgAAEIQCCfBFC8+fRrXl+hwS4IQAAC EIAABCAAAQhA
AAJyArri/dhRLX1HLGgeOqXP4XNrWkodUyAAAQhAAAIQgAAEIAABCEAAArUj MHBytMOjUfLt
ROsc+Pp6R09d8+BJvb4wsaYl2ntKzYuyjeInsPfkqNZl4JSotiUHXq41IjXX au1opnMoDnOQ
8XJgQm1zUe0ncmn8oUirgwqdAKrGlGqeUdX4a02pxog6Iw5BFHRirRHVfndR 84nQCUm19l6o
+XTrBBNq3cXkaNfx0fb/ivrfGkV974n639Rebl71IP5v/RZlSE1L/ZJZNXL1 Uke9l06Iz1oj
qm2Utk+BHJhQa0dvrCjVstR6/B2pu6YZr/aN19QFndN4rR3dCVZ0QkaqeRf1 vzqDKDyVap2R
chBF9W9CZ2S8WlOqdaDSvoSA8vKtpf3wJ2+Iov/5TbT+jykQgAAEIAABCEAA AhCAAAQgAIG8
ESjyAwEIQAACEIAABCAAAQhAAAIQyCOBKI9GYRMEIAABCEAAAhCAAAQgAAEI QKD4//iCJVlg
rs0PAAAAAElFTkSuQmCC
--------------070609020400030306050403--
Re: NullPointerException in XMLSaveImpl.saveDataTypeMany [message #423297 is a reply to message #423294] Fri, 26 September 2008 12:43 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ronaldo,

Comments below.

Ronaldo wrote:
> Hi Ed,
>
> Thanks for the extensive answers. Yes, I'm sure I've left out
> something, if I only knew what...
> I decided to take a step back, create a new project and reload the xsd
> again.
> Then, step by step I'll try to find the solution.
>
> Unfortunately, importing the xsd
> (http://www.wfmc.org/standards/bpmnxpdl_31.xsd) shows errors, see
> attachment.
> I cannot tell if the xsd is not ok or if there's an error somewhere in
> emf.
The XML Schema for schemas has a regular expression for validating that
XPaths are well formed and that regular expression doesn't allow
spaces. This schema has spaces in their regular expressions though.
You can just ignore these errors since key/keyref and unique are ignored
in XSD -> Ecore mapping.
>
> Ronaldo
>
> Ed Merks wrote:
>> Ronaldo,
>>
>> Comments below.
>>
>> Ronaldo wrote:
>>> Nope most elements didn't have a target namespace... I guess I'll
>>> have to add them manually to every element.
>>>
>>> A little background might be usefull:
>>> I started out with the xpdl2.1 XSD
>>> (http://www.wfmc.org/standards/bpmnxpdl_31.xsd) and created a model
>>> and generated java from that.
>> That one had a target namespace.
>>> However, I have little experience with XSD's and decided it might be
>>> easier to reload from java annotations from that point on.
>> Did you know you can export your Ecore to XSD? Keep in mind though
>> that XSD -> Ecore -> XSD is not a round trip because XSD -> Ecore is
>> slightly lossy. But Ecore -> XSD -> Ecore is supposed to be a round
>> trip because we generate all the necessary ecore:* annotations to
>> make it roundtrip. Using this mechanism, you could discover what you
>> needed to change in the original XSD to produce the desired Ecore...
>>>
>>> That might explain why I do have a DocumentRoot generated, a thing I
>>> don't have when generating the model from java annotations directly.
>> We, given sufficient annotations of the right form, you'll get the
>> same thing. The Ecore -> Java with @model -> Ecore is supposed to be
>> a round trip after all...
>>> When it all seemed to work, I read posts like
>>> http://www.eclipsezone.com/eclipse/forums/t91748.html to eliminate
>>> the prefixes.
>>> (Well I guess I misinterpreted them).
>> A better way to have eliminated the prefixes is to use
>> DocumentRoot.getXMLNSPrefixMap().put("", XyzPackage.eNS_URI). This
>> way you end up with an xmlns="<nsURI>" in the document and all
>> elements will be implicitly qualified by this namespace. Of course
>> attributes will still need explicit qualification, so I'm not sure
>> you'd be totally happy with the result. But given that I assume you
>> want the serialization to conform to the schema and the schema
>> requires qualified local elements and attributes, I don't think you
>> have all that much choice.
>>>
>>> I also noted that all my interfaces are now annotated with a
>>> name='*_._type' in the extended metadata annotation.
>> This comes from anonymous type definitions.
>>> I'd swear this was not the case earlier on.
>>> I'm not sure if this is good or bad, as I read that this should be
>>> ok when using a DocumentRoot... (?)
>>> ( http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6745.html)
>> An anonymous type can never be used in an xsi:type. Sometimes that
>> fact can be used to deduce a more appropriate element name...
>>> But, as I'm not modifing the xsd but the java annotations instead
>>> and reloading the genmodel from these java annotations, do I still
>>> need that (old?) documentroot?
>> The document root determines the appropriate element name at the root
>> of the document. Without a document root, the name of the type will
>> be used as the root element name, but that's not going to conform to
>> the schema since a schema will always specify a global element to use
>> for the root.
>>> I created a new testproject from java and indeed no documentroot was
>>> generated.
>> Not sure about that. The DocumentRoot interface has @model on it, so
>> I assume you'd have to delete that for it to just disappear...
>>>
>>>
>>> That would also explain why adding an element directly to the
>>> resource.getContents() did serialize ok,
>>> while using an (old?) documentroot did not serialize ok.
>> If you're okay with a serialization that doesn't conform to the
>> schema then it's okay. The document root serialization issue was a
>> result of inconsistent annotations (annotations that would never have
>> been produced from a real schema).
>>>
>>> I assumed that starting with an xsd, would create the same model as
>>> when you're starting from java...
>> Given the corresponding annotations, yes.
>>> But the documentroot thing shows that's not the case?
>> I'm sure you've left out a little detail. After all, you've already
>> mentioned reloading the model from the @model changes and that didn't
>> make the DocumentRoot disappear... When reading the newsgroups for a
>> long time you start to learn that people leave out tiny but little
>> important details. :-P
>>>
>>>
>>> Ronaldo
>>>
>>>
>>> Ed Merks wrote:
>>>> Ronaldo,
>>>>
>>>> For the library mode it looks like this:
>>>>
>>>> * @model containment="true" upper="-2" transient="true"
>>>> volatile="true" derived="true"
>>>> * extendedMetaData="kind='element' name='library'*
>>>> namespace='##targetNamespace'"*
>>>>
>>>> I assume these models originated from a schema. Do that schema
>>>> have a target namespace?
>>>>
>>>>
>>>> Ronaldo wrote:
>>>>>
>>>>> This is the generated code for the getActivities method in the
>>>>> DocumentRoot interface.
>>>>>
>>>>> * @model containment="true" upper="-2" transient="true"
>>>>> volatile="true" derived="true"
>>>>> * extendedMetaData="kind='element' name='Activities'"
>>>>> * @generated
>>>>> */
>>>>> ActivitiesType getActivities();
>>>>>
>>>>>
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Ronaldo,
>>>>>>
>>>>>> What EAnnotations does the "activities" feature of the
>>>>>> DocumentRoot have on it?
>>>>>>
>>>>>>
>>>>>> Ronaldo wrote:
>>>>>>> I have something that might be noteworthy:
>>>>>>> Somehow, I noticed that my genmodel consists of 4 models:
>>>>>>>
>>>>>>> Xpdl1 - Deprecated xpdl format
>>>>>>> Xpdl2 - Current xpdl format
>>>>>>> Ecore - (Icon contains a little arrow/referenced?)
>>>>>>> XMLType - (Icon contains a little arrow/referenced?)
>>>>>>>
>>>>>>> The util package also contains an Xpdl2XMLProcessor class:
>>>>>>>
>>>>>>> public class Xpdl2XMLProcessor extends XMLProcessor {
>>>>>>> public Xpdl2XMLProcessor() {
>>>>>>> super((EPackage.Registry.INSTANCE));
>>>>>>> Xpdl2Package.eINSTANCE.eClass();
>>>>>>> }
>>>>>>>
>>>>>>> @Override
>>>>>>> protected Map<String, Resource.Factory> getRegistrations() {
>>>>>>> if (registrations == null) {
>>>>>>> super.getRegistrations();
>>>>>>> registrations.put(XML_EXTENSION, new
>>>>>>> Xpdl2ResourceFactoryImpl());
>>>>>>> registrations.put(STAR_EXTENSION, new
>>>>>>> Xpdl2ResourceFactoryImpl());
>>>>>>> }
>>>>>>> return registrations;
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> which seems a little odd. I hadn't noticed this before.
>>>>>>>
>>>>>>> Here's the EPackage source:
>>>>>>>
>>>>>>> public interface Xpdl2Package extends EPackage {
>>>>>>> String eNS_URI = "http://www.wfmc.org/2008/XPDL2.1";
>>>>>>> String eNS_PREFIX = "xpdl2";
>>>>>>> Xpdl2Package eINSTANCE =
>>>>>>> org.wfmc.xpdl21.xpdl2.impl.Xpdl2PackageImpl.init();
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> And the resourceFactory source:
>>>>>>>
>>>>>>> public class Xpdl2ResourceFactoryImpl extends ResourceFactoryImpl {
>>>>>>> /**
>>>>>>> * @generated
>>>>>>> */
>>>>>>> public Xpdl2ResourceFactoryImpl() {
>>>>>>> super();
>>>>>>> }
>>>>>>> /**
>>>>>>> * @generated
>>>>>>> */
>>>>>>> public Resource createResourceGen(URI uri) {
>>>>>>> XMLResource result = new Xpdl2ResourceImpl(uri);
>>>>>>>
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>>>>> Boolean.TRUE);
>>>>>>>
>>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>>>>> Boolean.TRUE);
>>>>>>>
>>>>>>>
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>>>>> Boolean.TRUE);
>>>>>>>
>>>>>>>
>>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>>>>> Boolean.TRUE);
>>>>>>>
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>>>>> Boolean.TRUE);
>>>>>>>
>>>>>>>
>>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>>>>>> Boolean.TRUE);
>>>>>>> return result;
>>>>>>> }
>>>>>>> @Override
>>>>>>> public Resource createResource(URI uri) {
>>>>>>> XMLResource result = (XMLResource)createResourceGen(uri);
>>>>>>>
>>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODI NG,
>>>>>>> "UTF-8");
>>>>>>>
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODI NG,
>>>>>>> "UTF-8");
>>>>>>> // // // Where do we turn this off in the genmodel?
>>>>>>> What is the name of the option?
>>>>>>> //
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>>>>> Boolean.TRUE);
>>>>>>> // //
>>>>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>>>>> Boolean.TRUE);
>>>>>>> //
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_LAX_FE ATURE_PROCESSING,
>>>>>>> Boolean.TRUE);
>>>>>>> //
>>>>>>>
>>>>>>> //result.getDefaultSaveOptions().put(XMLResource.OPTION_SKIP _ESCAPE,
>>>>>>> Boolean.TRUE);
>>>>>>> //
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_ESCAPE _USING_CDATA,
>>>>>>> Boolean.TRUE);
>>>>>>> //
>>>>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_FORMAT TED,
>>>>>>> Boolean.TRUE);
>>>>>>> // return result;
>>>>>>> }
>>>>>>>
>>>>>>> } //Xpdl2ResourceFactoryImpl
>>>>>>>
>>>>>>> I hope this helps.
>>>>>>> Ronaldo
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>> Ronaldo,
>>>>>>>>
>>>>>>>> Comments below.
>>>>>>>>
>>>>>>>> Ronaldo wrote:
>>>>>>>>> Hi Ed,
>>>>>>>>>
>>>>>>>>> I guess you're saying I'm messing around with a null namespace :0
>>>>>>>>> Point is, it has worked and somehow I changed something and it
>>>>>>>>> doesn't work any more.
>>>>>>>>> I feel I'm losing control ...
>>>>>>>> Something worked, but only you know what...
>>>>>>>>>
>>>>>>>>> Anyway, I'll step back, and use proper namespaces ;)
>>>>>>>>>
>>>>>>>>> My package is now only annotated with @model kind="package".
>>>>>>>>> (Unqualified is removed)
>>>>>>>> You've relaoaded the model?
>>>>>>>>> The generated XYZExample now generates
>>>>>>>>>
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>> <Activities/>
>>>>>>>>>
>>>>>>>>> So the question is, which piece of code is responsible for
>>>>>>>>> hiding the namespace prefix?
>>>>>>>> And has the resource factory been regenerated so it's using
>>>>>>>> "TRUE"? It doesn't look that way...
>>>>>>>>>
>>>>>>>>> I'd expect something like
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>> <prefix:Activities xmlns:prefix="yadiyadi" />
>>>>>>>> Me too. What's the nsURI of your EPackage?
>>>>>>>>>
>>>>>>>>> Fun part is, after unloading the created and saved resource,
>>>>>>>>> I reload it using the same resourceSet. But then, I get the
>>>>>>>>> famous "Package with uri null not found" message...
>>>>>>>>> because the prefix is missing...
>>>>>>>> Something's is a little screwed up for sure... What does the
>>>>>>>> resource factory look like?
>>>>>>>>>
>>>>>>>>> Ronaldo
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Ronaldo wrote:
>>>>>>>>>>> This error comes up when I run the XYZExample test code,
>>>>>>>>>>> disguised as/copied to a UnitTest in maven. (ie outside the
>>>>>>>>>>> eclipse editor).
>>>>>>>>>>> It runs fine from within eclipse/junit. I figured it must
>>>>>>>>>>> have something to do with
>>>>>>>>>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F,
>>>>>>>>>>>
>>>>>>>>>>> does it?
>>>>>>>>>>>
>>>>>>>>>>> The error is
>>>>>>>>>>>
>>>>>>>>>>> java.lang.NullPointerException
>>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeMany( XMLSaveImpl.java:1742)
>>>>>>>>>>>
>>>>>>>>>> It's dying because the data type doesn't have a containing
>>>>>>>>>> package and hence we get a null pointer exception trying to
>>>>>>>>>> get the factory for that package?
>>>>>>>>>>
>>>>>>>>>> EDataType d = (EDataType)f.getEType();
>>>>>>>>>> EPackage ePackage = d.getEPackage();
>>>>>>>>>> EFactory fac = ePackage.getEFactoryInstance();
>>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1485)
>>>>>>>>>>>
>>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:678)
>>>>>>>>>>>
>>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:588)
>>>>>>>>>>>
>>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
>>>>>>>>>>>
>>>>>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>>>>>
>>>>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>>>>>>>>>>>
>>>>>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:986)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Code:
>>>>>>>>>>>
>>>>>>>>>>> MyModel1Package.eINSTANCE.eClass();
>>>>>>>>>>> MyModel2Package.eINSTANCE.eClass();
>>>>>>>>>>> ResourceSet resourceSet = new ResourceSetImpl();
>>>>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>>>>
>>>>>>>>>>> ("ext1", new MyModel1ResourceFactoryImpl());
>>>>>>>>>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>>>>>>>>>>
>>>>>>>>>>> (Resource.Factory.Registry.DEFAULT_EXTENSION,
>>>>>>>>>>> new MyModel2ResourceFactoryImpl());
>>>>>>>>>>>
>>>>>>>>>>> Resource resource =
>>>>>>>>>>> resourceSet.createResource(URI.createURI("http:///My.model.uri"));
>>>>>>>>>>>
>>>>>>>>>>> DocumentRoot documentRoot =
>>>>>>>>>>> MyModel2Factory.eINSTANCE.createDocumentRoot();
>>>>>>>>>>>
>>>>>>>>>>> // ---- Removing the next two lines makes it work from maven
>>>>>>>>>>> too.
>>>>>>>>>>> ActivitiesType root =
>>>>>>>>>>> MyModel2Factory.eINSTANCE.createActivitiesType();
>>>>>>>>>>> documentRoot.setActivities(root);
>>>>>>>>>>>
>>>>>>>>>>> resource.getContents().add(documentRoot);
>>>>>>>>>>> resource.save(System.out, null);
>>>>>>>>>> This looks much like the generated XyzExample you get when
>>>>>>>>>> you invoke "Generate Test Code". Does that have the same
>>>>>>>>>> problem?
>>>>>>>>>>>
>>>>>>>>>>> Many thanks,
>>>>>>>>>>> Ronaldo
>>>>>>>>>>>
>>>>>>>>>>> Ed Merks wrote:
>>>>>>>>>>> > Ronaldo,
>>>>>>>>>>> >
>>>>>>>>>>> > Comments below.
>>>>>>>>>>> >
>>>>>>>>>>> > Ronaldo wrote:
>>>>>>>>>>> >> Hi Ed,
>>>>>>>>>>> >>
>>>>>>>>>>> >> Thanks for the quick answer. Yes, I have 2 models in 2
>>>>>>>>>>> different
>>>>>>>>>>> >> eclipse projects.
>>>>>>>>>>> >> They both use a null target namespace, in order to
>>>>>>>>>>> eliminate the
>>>>>>>>>>> >> prefixes in the xml.
>>>>>>>>>>> > :-(
>>>>>>>>>>> >
>>>>>>>>>>> > XML documents with at least a namespace for the root
>>>>>>>>>>> element are
>>>>>>>>>>> > generally more consumable because they identify their
>>>>>>>>>>> schema...
>>>>>>>>>>> >>
>>>>>>>>>>> >> I was just wondering what (which setting) causes the code
>>>>>>>>>>> >>
>>>>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA,
>>>>>>>>>>> extendedMetaData);
>>>>>>>>>>> > A null target namespace schema produces an annotation on
>>>>>>>>>>> the EPackage to
>>>>>>>>>>> > indicate the package is not qualified.
>>>>>>>>>>> >>
>>>>>>>>>>> >> to be generated. (as opposed to
>>>>>>>>>>> >>
>>>>>>>>>>> >> result.getDefaultSaveOptions().put(
>>>>>>>>>>> >> XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
>>>>>>>>>>> > This package doesn't have such an annotation.
>>>>>>>>>>> >
>>>>>>>>>>> > Note that you can't have two different packages that both
>>>>>>>>>>> want to be the
>>>>>>>>>>> > one for the null namespace both working at the same time.
>>>>>>>>>>> >> )
>>>>>>>>>>> >>
>>>>>>>>>>> >> Ronaldo


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Teneo] 2 Configuration Questions
Next Topic:XML schema round-trip loosing min-exclusive... tags?
Goto Forum:
  


Current Time: Wed Apr 24 22:52:28 GMT 2024

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

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

Back to the top