Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » PackageNotFoundExceptio: Package with uri 'null' not found
PackageNotFoundExceptio: Package with uri 'null' not found [message #415264] Sat, 08 December 2007 02:48 Go to next message
Eclipse UserFriend
Originally posted by: jjabson.yahoo.com

Hello,

I'm having the same problem as Chris and Oliver. I have read both threads
hoping to implement some of the suggestion from Ed Merks. Here is the code I
am having problems with:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
return root;
}

I've tried the following:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)

I've tried Eric's Solution:
Resource res = resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and I'm
not quite sure how to use the resourceSet.load method. I checked in the
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData = new new BasicExtendedMetaData(new
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things
working?

Thanks in advance,
Jerome
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415265 is a reply to message #415264] Sat, 08 December 2007 04:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jjabson.yahoo.com

Sorry I forgot to attach the Exception:

Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with
uri 'null' not found. (file:/C:/qs_dir/qs_xml_53.xml, 1, 30)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1247)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1336)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:970)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:953)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:684)

at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator. startElement(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$ContentDriver.scanRootElementHook(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$PrologDriver.next(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)

at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)

at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)

at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)

at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)

at javax.xml.parsers.SAXParser.parse(Unknown Source)

at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:179)

at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1354)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1155)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:256)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:271)

.... 4 more

java.lang.NullPointerException

at mezcalth.util.MibQsParser.processQsStmt(MibQsParser.java:103 )

at mezcalth.util.MibQsParser.main(MibQsParser.java:179)

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'null'
not found. (file:/C:/qs_dir/qs_xml_54.xml, 1, 30)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:316)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:275)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:398)

at mezcalth.util.MibQsParser.loadQsStmt(MibQsParser.java:157)

at mezcalth.util.MibQsParser.processQsStmt(MibQsParser.java:100 )

at mezcalth.util.MibQsParser.main(MibQsParser.java:179)

Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with
uri 'null' not found. (file:/C:/qs_dir/qs_xml_54.xml, 1, 30)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1247)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1336)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:970)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:953)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:684)

at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator. startElement(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$ContentDriver.scanRootElementHook(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDriver.next(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$PrologDriver.next(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl.next(Unknown
Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)

at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)

at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)

at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)

at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)

at javax.xml.parsers.SAXParser.parse(Unknown Source)

at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:179)

at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1354)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1155)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:256)

at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:271)

.... 4 more

Jerome

"Jerome (Jeff) Jabson" <jjabson@yahoo.com> wrote in message
news:fjd3jv$54p$2@build.eclipse.org...
> Hello,
>
> I'm having the same problem as Chris and Oliver. I have read both threads
> hoping to implement some of the suggestion from Ed Merks. Here is the code
> I am having problems with:
>
> try {
> URI fileURI = URI.createFileURI(xmlFile);
> ResourceSet resourceSet = new ResourceSetImpl();
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
> Ei2dResourceFactoryImpl());
> Resource res = resourceSet.getResource(fileURI, true);
> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
> return root;
> }
>
> I've tried the following:
>
> try {
> URI fileURI = URI.createFileURI(xmlFile);
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
> Ei2dResourceFactoryImpl());
> Resource res = resourceSet.getResource(fileURI, true);
> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
> return root;
> }
>
> not the error is:
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
> 'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
>
> I've tried Eric's Solution:
> Resource res = resourceSet.createResource(fileURI);
>
> You'll have to excuse my ignorance here, as I am new to using EMF and I'm
> not quite sure how to use the resourceSet.load method. I checked in the
> Ei2dResourceFactoryImpl class, and I don't see:
>
> public Ei2dResourceFacotryImpl () {
> super();
> extendedMetaData = new new BasicExtendedMetaData(new
> EPackageRegistryImpl(EPackage.Registry.INSTANCE));
> extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
> }
>
> Is there a way I can just add an equivalent to my class to get things
> working?
>
> Thanks in advance,
> Jerome
>
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415269 is a reply to message #415264] Sat, 08 December 2007 12:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090609080209080906010809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:
> Hello,
>
> I'm having the same problem as Chris and Oliver. I have read both threads
> hoping to implement some of the suggestion from Ed Merks. Here is the code I
> am having problems with:
>
> try {
> URI fileURI = URI.createFileURI(xmlFile);
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
> Ei2dResourceFactoryImpl());
> Resource res = resourceSet.getResource(fileURI, true);
> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
>
Wouldn't it be nicer to use the DocumentRoot interface instead of the
Impl class?
> return root;
> }
>
> I've tried the following:
>
> try {
> URI fileURI = URI.createFileURI(xmlFile);
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
> Ei2dResourceFactoryImpl());
>
Does your EidResourceFactoryImpl register the package in this way.
I.e., is it really a null namespace package with extended metadata on it
as for a schema with no target namespace:

XML Schema to Ecore Mapping
< http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEcoreMapping.pdf>

> Resource res = resourceSet.getResource(fileURI, true);
> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
> return root;
> }
>
> not the error is:
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
> 'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
>
It would help to see more of your model and the file instance.
> I've tried Eric's Solution:
> Resource res = resourceSet.createResource(fileURI);
>
> You'll have to excuse my ignorance here, as I am new to using EMF and I'm
> not quite sure how to use the resourceSet.load method. I checked in the
> Ei2dResourceFactoryImpl class, and I don't see:
>
> public Ei2dResourceFacotryImpl () {
> super();
> extendedMetaData = new new BasicExtendedMetaData(new
> EPackageRegistryImpl(EPackage.Registry.INSTANCE));
> extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
> }
>
> Is there a way I can just add an equivalent to my class to get things
> working?
>
It sounds like probably you don't really have a null namespace schema
(or a model annotated like one). How did you define your model? Can
you show the file you are trying to load?
> Thanks in advance,
> Jerome
>
>
>


--------------090609080209080906010809
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">
Jerome,<br>
<br>
Comments below.<br>
<br>
<br>
Jerome (Jeff) Jabson wrote:
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap="">Hello,

I'm having the same problem as Chris and Oliver. I have read both threads
hoping to implement some of the suggestion from Ed Merks. Here is the code I
am having problems with:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
</pre>
</blockquote>
Wouldn't it be nicer to use the DocumentRoot interface instead of the
Impl class?<br>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap=""> return root;
}

I've tried the following:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
</pre>
</blockquote>
Does your EidResourceFactoryImpl register the package in this way.&nbsp;
I.e., is it really a null namespace package with extended metadata on
it as for a schema with no target namespace:<br>
<blockquote><a
href=" http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEcoreMapping.pdf">XML
Schema to Ecore Mapping</a></blockquote>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap=""> Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
'ei2dImpl' not found. (<a class="moz-txt-link-freetext" href="file:/C:/qs_dir/qs_xml_26.xml">file:/C:/qs_dir/qs_xml_26.xml </a>, 1, 30)
</pre>
</blockquote>
It would help to see more of your model and the file instance.<br>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap="">
I've tried Eric's Solution:
Resource res = resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and I'm
not quite sure how to use the resourceSet.load method. I checked in the
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData = new new BasicExtendedMetaData(new
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things
working?
</pre>
</blockquote>
It sounds like probably you don't really have a null namespace schema
(or a model annotated like one).&nbsp; How did you define your model?&nbsp; Can
you show the file you are trying to load?<br>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap="">
Thanks in advance,
Jerome


</pre>
</blockquote>
<br>
</body>
</html>

--------------090609080209080906010809--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415292 is a reply to message #415269] Mon, 10 December 2007 18:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jjabson.yahoo.com

This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C83B1A.C856F670
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0014_01C83B1A.C856F670"


------=_NextPart_001_0014_01C83B1A.C856F670
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Sorry for the delay in response, as I'm trying to get a hold of the =
person that generated the Model being used.

Comments inline:
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fje1qg$tls$1@build.eclipse.org...
Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:=20
Hello,

I'm having the same problem as Chris and Oliver. I have read both =
threads=20
hoping to implement some of the suggestion from Ed Merks. Here is the =
code I=20
am having problems with:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
Wouldn't it be nicer to use the DocumentRoot interface instead of the =
Impl class?

Can you explain why using the DocumentRoot interface would be nicer?=20

return root;
}

I've tried the following:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, =
Ei2dPackage.eINSTANCE);
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Does your EidResourceFactoryImpl register the package in this way. =
I.e., is it really a null namespace package with extended metadata on it =
as for a schema with no target namespace:

No the Ei2dResourceFactoryImpl does not register it this way.

XML Schema to Ecore Mapping
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature=20
'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
It would help to see more of your model and the file instance.

At this time, I am unable to provide this information.

I've tried Eric's Solution:
Resource res =3D resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and =
I'm=20
not quite sure how to use the resourceSet.load method. I checked in the=20
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData =3D new new BasicExtendedMetaData(new=20
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things=20
working?
It sounds like probably you don't really have a null namespace schema =
(or a model annotated like one). How did you define your model? Can =
you show the file you are trying to load?

I have attached the file with I am trying to process.=20
Thanks for your help,
Jerome


Thanks in advance,
Jerome=20


=20

------=_NextPart_001_0014_01C83B1A.C856F670
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Sorry for the delay in =
response, as=20
I'm trying to get a hold of the person that generated the Model being=20
used.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Comments =
inline:</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fje1qg$tls$1@build.eclipse.org">news:fje1qg$tls$1@build.ecli=
pse.org</A>...</DIV>Jerome,<BR><BR>Comments=20
below.<BR><BR><BR>Jerome (Jeff) Jabson wrote:=20
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hello,

I'm having the same problem as Chris and Oliver. I have read both =
threads=20
hoping to implement some of the suggestion from Ed Merks. Here is the =
code I=20
am having problems with:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
</PRE></BLOCKQUOTE>
<DIV>Wouldn't it be nicer to use the DocumentRoot interface instead of =
the=20
Impl class?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Can you explain why =
using the=20
DocumentRoot interface would be nicer? </FONT><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> return root;
}

I've tried the following:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, =
Ei2dPackage.eINSTANCE);
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
</PRE></BLOCKQUOTE>
<DIV>Does your EidResourceFactoryImpl register the package in this =
way.&nbsp;=20
I.e., is it really a null namespace package with extended metadata on =
it as=20
for a schema with no target namespace:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>No the =
Ei2dResourceFactoryImpl does=20
not register it this way.</FONT><BR></DIV>
<BLOCKQUOTE><A=20
=
href=3D" http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEco=
reMapping.pdf">XML=20
Schema to Ecore Mapping</A></BLOCKQUOTE>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> Resource res =3D =
resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature=20
'ei2dImpl' not found. (<A class=3Dmoz-txt-link-freetext =
href=3D"file:/C:/qs_dir/qs_xml_26.xml">file:/C:/qs_dir/qs_xml_26.xml </A>,=
1, 30)
</PRE></BLOCKQUOTE>
<DIV>It would help to see more of your model and the file =
instance.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>At this time, I am =
unable to=20
provide this information.</FONT><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">I've tried Eric's Solution:
Resource res =3D resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and =
I'm=20
not quite sure how to use the resourceSet.load method. I checked in the=20
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData =3D new new BasicExtendedMetaData(new=20
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things=20
working?
</PRE></BLOCKQUOTE>
<DIV>It sounds like probably you don't really have a null namespace =
schema (or=20
a model annotated like one).&nbsp; How did you define your =
model?&nbsp; Can=20
you show the file you are trying to load?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have attached the =
file with I am=20
trying to process. </FONT></DIV><FONT face=3DArial color=3D#0000ff=20
size=3D2></FONT></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Thanks for your =
help,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Jerome</FONT></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Thanks in advance,
Jerome=20


</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_001_0014_01C83B1A.C856F670--

------=_NextPart_000_0013_01C83B1A.C856F670
Content-Type: text/xml;
name="qs_xml_26.xml"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="qs_xml_26.xml"

<ei2dImpl package=3D"BGP4-MIB">
<description>Autogenerated by QSG.</description>
<managedResourceDef>
<managedResource implements=3D"com.cisco.mezcal" =
name=3D"bgpPeerIdentifier">
<configData>
<description>The BGP Identifier of this entry's BGP
peer.</description>
<attribute name=3D"bgpPeerIdentifier" type=3D"string">
<description>The BGP Identifier of this entry's BGP
peer.</description>
<assert>
<description>String length constraint: =
</description>
<constraint>IpAddress</constraint>
</assert>
</attribute>
</configData>
</managedResource>
</managedResourceDef>
<configDataDef/>
<operationalDataDef/>
<eventReportDef/>
<typeDef>
<complexType name=3D"CLI command equivalent">
=
<description> mibname=3DbgpPeerIdentifier,,mibid=3D1.3.6.1.2.1.15.3.1.1,,m =
ib_targets=3D[(rank=3D1;;cmd_id=3D1234;;cmd_name=3Dneighbor =
advertisement-interval;;prop_id=3D234;;prop_name=3Dpeer-grou p-name;;descS=
core=3D0.57;;nameScore=3D0.45;;typeScore=3D0.9;;)(rank=3D2;; cmd_id=3D1234=
;;cmd_name=3Dneighbor peer-group =
(creating);;prop_id=3D234;;prop_name=3Dpeer-group-name;;desc Score=3D0.57;=
;nameScore=3D0.32;;typeScore=3D0.8;;)(rank=3D3;;cmd_id=3D123 4;;cmd_name=3D=
neighbor =
prefix-list;;prop_id=3D234;;prop_name=3Dpeer-group-name;;des cScore=3D0.57=
;;nameScore=3D0.32;;typeScore=3D0.8;;)(rank=3D4;;cmd_id=3D12 34;;cmd_name=3D=
neighbor =
distribute-list;;prop_id=3D234;;prop_name=3Dpeer-group-name; ;descScore=3D=
0.57;;nameScore=3D0.32;;typeScore=3D0.8;;)]</description>
<choice/>
</complexType>
</typeDef>
</ei2dImpl>

------=_NextPart_000_0013_01C83B1A.C856F670--
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415294 is a reply to message #415292] Mon, 10 December 2007 21:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050908010309070006010803
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:
> Hi Ed,
>
> Sorry for the delay in response, as I'm trying to get a hold of the
> person that generated the Model being used.
>
> Comments inline:
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote in
> message news:fje1qg$tls$1@build.eclipse.org...
> Jerome,
>
> Comments below.
>
>
> Jerome (Jeff) Jabson wrote:
>> Hello,
>>
>> I'm having the same problem as Chris and Oliver. I have read both threads
>> hoping to implement some of the suggestion from Ed Merks. Here is the code I
>> am having problems with:
>>
>> try {
>> URI fileURI = URI.createFileURI(xmlFile);
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
>> Ei2dResourceFactoryImpl());
>> Resource res = resourceSet.getResource(fileURI, true);
>> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
>>
> Wouldn't it be nicer to use the DocumentRoot interface instead of
> the Impl class?
>
> Can you explain why using the DocumentRoot interface would be nicer?
>
For each Impl class there is a corresponding interface where the later
is what your clients should be using directly. Although not
specifically an issue for a document root, EMF supports multiple
inheritance so you might have C and extends both A and B but CImpl will
only extend either AImpl or BImpl so assuming that B can always be cast
to BImpl is not a save assumption. You should treat model impl classes
as something you only access directly if you need to extend that class.
>
>> return root;
>> }
>>
>> I've tried the following:
>>
>> try {
>> URI fileURI = URI.createFileURI(xmlFile);
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
>> Ei2dResourceFactoryImpl());
>>
> Does your EidResourceFactoryImpl register the package in this
> way. I.e., is it really a null namespace package with extended
> metadata on it as for a schema with no target namespace:
>
> No the Ei2dResourceFactoryImpl does not register it this way.
>
That makes me things it's not really a null namespace package and so if
you register as if it is, you might find that global elements from that
package still want to be using the namespace of that package. That's
what it looks like to me.
>
> XML Schema to Ecore Mapping
> < http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEcoreMapping.pdf>
>
>> Resource res = resourceSet.getResource(fileURI, true);
>> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
>> return root;
>> }
>>
>> not the error is:
>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
>> 'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
>>
> It would help to see more of your model and the file instance.
>
> At this time, I am unable to provide this information.
>> I've tried Eric's Solution:
>> Resource res = resourceSet.createResource(fileURI);
>>
>> You'll have to excuse my ignorance here, as I am new to using EMF and I'm
>> not quite sure how to use the resourceSet.load method. I checked in the
>> Ei2dResourceFactoryImpl class, and I don't see:
>>
>> public Ei2dResourceFacotryImpl () {
>> super();
>> extendedMetaData = new new BasicExtendedMetaData(new
>> EPackageRegistryImpl(EPackage.Registry.INSTANCE));
>> extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
>> }
>>
>> Is there a way I can just add an equivalent to my class to get things
>> working?
>>
> It sounds like probably you don't really have a null namespace
> schema (or a model annotated like one). How did you define your
> model? Can you show the file you are trying to load?
>
> I have attached the file with I am trying to process.
>
> Thanks for your help,
> Jerome
>
>> Thanks in advance,
>> Jerome
>>
>>
>>
>


--------------050908010309070006010803
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">
Jerome,<br>
<br>
Comments below.<br>
<br>
<br>
Jerome (Jeff) Jabson wrote:
<blockquote cite="mid:fjk1tp$v25$2@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2900.2873" name="GENERATOR">
<style></style>
<div><font color="#0000ff" face="Arial" size="2">Hi Ed,</font></div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">Sorry for the delay
in response, as I'm trying to get a hold of the person that generated
the Model being used.</font></div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">Comments inline:</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a moz-do-not-send="true"
href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt; wrote in
message <a moz-do-not-send="true"
href="news:fje1qg$tls$1@build.eclipse.org">news:fje1qg$tls$1@build.eclipse.org</a>...</div>
Jerome,<br>
<br>
Comments below.<br>
<br>
<br>
Jerome (Jeff) Jabson wrote:
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap="">Hello,

I'm having the same problem as Chris and Oliver. I have read both threads
hoping to implement some of the suggestion from Ed Merks. Here is the code I
am having problems with:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
</pre>
</blockquote>
<div>Wouldn't it be nicer to use the DocumentRoot interface instead
of the Impl class?</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">Can you explain
why using the DocumentRoot interface would be nicer? </font><br>
</div>
</blockquote>
</blockquote>
For each Impl class there is a corresponding interface where the later
is what your clients should be using directly.&nbsp; Although not
specifically an issue for a document root, EMF supports multiple
inheritance so you might have C and extends both A and B but CImpl will
only extend either AImpl or BImpl so assuming that B can always be cast
to BImpl is not a save assumption.&nbsp; You should treat model impl classes
as something you only access directly if you need to extend that class.<br>
<blockquote cite="mid:fjk1tp$v25$2@build.eclipse.org" type="cite">
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap=""> return root;
}

I've tried the following:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
</pre>
</blockquote>
<div>Does your EidResourceFactoryImpl register the package in this
way.&nbsp; I.e., is it really a null namespace package with extended
metadata on it as for a schema with no target namespace:</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">No the
Ei2dResourceFactoryImpl does not register it this way.</font><br>
</div>
</blockquote>
</blockquote>
That makes me things it's not really a null namespace package and so if
you register as if it is, you might find that global elements from that
package still want to be using the namespace of that package.&nbsp; That's
what it looks like to me.<br>
<blockquote cite="mid:fjk1tp$v25$2@build.eclipse.org" type="cite">
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<blockquote><a moz-do-not-send="true"
href=" http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEcoreMapping.pdf">XML
Schema to Ecore Mapping</a></blockquote>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap=""> Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
'ei2dImpl' not found. (<a moz-do-not-send="true"
class="moz-txt-link-freetext" href="file:/C:/qs_dir/qs_xml_26.xml">file:/C:/qs_dir/qs_xml_26.xml </a>, 1, 30)
</pre>
</blockquote>
<div>It would help to see more of your model and the file instance.</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">At this time, I am
unable to provide this information.</font><br>
</div>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap="">I've tried Eric's Solution:
Resource res = resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and I'm
not quite sure how to use the resourceSet.load method. I checked in the
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData = new new BasicExtendedMetaData(new
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things
working?
</pre>
</blockquote>
<div>It sounds like probably you don't really have a null namespace
schema (or a model annotated like one).&nbsp; How did you define your
model?&nbsp; Can you show the file you are trying to load?</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">I have attached
the file with I am trying to process. </font></div>
</blockquote>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div><font color="#0000ff" face="Arial" size="2">Thanks for your
help,</font></div>
<div><font color="#0000ff" face="Arial" size="2">Jerome</font></div>
<div><br>
</div>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org" type="cite">
<pre wrap="">Thanks in advance,
Jerome


</pre>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------050908010309070006010803--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415297 is a reply to message #415294] Tue, 11 December 2007 01:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jjabson.yahoo.com

This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C83B52.2E535770
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Comments inline:
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fjkbmc$l9a$1@build.eclipse.org...
Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:=20
Hi Ed,

Sorry for the delay in response, as I'm trying to get a hold of the =
person that generated the Model being used.

Comments inline:
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fje1qg$tls$1@build.eclipse.org...
Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:=20
Hello,

I'm having the same problem as Chris and Oliver. I have read both =
threads=20
hoping to implement some of the suggestion from Ed Merks. Here is the =
code I=20
am having problems with:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
Wouldn't it be nicer to use the DocumentRoot interface instead of the =
Impl class?

Can you explain why using the DocumentRoot interface would be =
nicer?=20

For each Impl class there is a corresponding interface where the later =
is what your clients should be using directly. Although not =
specifically an issue for a document root, EMF supports multiple =
inheritance so you might have C and extends both A and B but CImpl will =
only extend either AImpl or BImpl so assuming that B can always be cast =
to BImpl is not a save assumption. You should treat model impl classes =
as something you only access directly if you need to extend that class.

Thanks for the explanation.

return root;
}

I've tried the following:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, =
Ei2dPackage.eINSTANCE);
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Does your EidResourceFactoryImpl register the package in this way. =
I.e., is it really a null namespace package with extended metadata on it =
as for a schema with no target namespace:

No the Ei2dResourceFactoryImpl does not register it this way.

That makes me things it's not really a null namespace package and so =
if you register as if it is, you might find that global elements from =
that package still want to be using the namespace of that package. =
That's what it looks like to me.

I'm not quite sure what you mean. Can you give me an example?

Thanks,
Jerome
XML Schema to Ecore Mapping
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature=20
'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
It would help to see more of your model and the file instance.

At this time, I am unable to provide this information.

I've tried Eric's Solution:
Resource res =3D resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and =
I'm=20
not quite sure how to use the resourceSet.load method. I checked in the=20
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData =3D new new BasicExtendedMetaData(new=20
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things=20
working?
It sounds like probably you don't really have a null namespace schema =
(or a model annotated like one). How did you define your model? Can =
you show the file you are trying to load?

I have attached the file with I am trying to process.=20
Thanks for your help,
Jerome


Thanks in advance,
Jerome=20


=20



------=_NextPart_000_0007_01C83B52.2E535770
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Comments inline:</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fjkbmc$l9a$1@build.eclipse.org">news:fjkbmc$l9a$1@build.ecli=
pse.org</A>...</DIV>Jerome,<BR><BR>Comments=20
below.<BR><BR><BR>Jerome (Jeff) Jabson wrote:=20
<BLOCKQUOTE cite=3Dmid:fjk1tp$v25$2@build.eclipse.org type=3D"cite">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<STYLE></STYLE>

<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hi Ed,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Sorry for the delay =
in response,=20
as I'm trying to get a hold of the person that generated the Model =
being=20
used.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Comments =
inline:</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A href=3D"mailto:merks@ca.ibm.com"=20
moz-do-not-send=3D"true">merks@ca.ibm.com</A>&gt; wrote in message =
<A=20
href=3D"news:fje1qg$tls$1@build.eclipse.org"=20
=
moz-do-not-send=3D"true">news:fje1qg$tls$1@build.eclipse.org</A>...</DIV>=
Jerome,<BR><BR>Comments=20
below.<BR><BR><BR>Jerome (Jeff) Jabson wrote:=20
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hello,

I'm having the same problem as Chris and Oliver. I have read both =
threads=20
hoping to implement some of the suggestion from Ed Merks. Here is the =
code I=20
am having problems with:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
</PRE></BLOCKQUOTE>
<DIV>Wouldn't it be nicer to use the DocumentRoot interface =
instead of the=20
Impl class?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Can you explain =
why using the=20
DocumentRoot interface would be nicer?=20
</FONT><BR></DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV>For each Impl class there is a corresponding interface where the =
later is=20
what your clients should be using directly.&nbsp; Although not =
specifically an=20
issue for a document root, EMF supports multiple inheritance so you =
might have=20
C and extends both A and B but CImpl will only extend either AImpl or =
BImpl so=20
assuming that B can always be cast to BImpl is not a save =
assumption.&nbsp;=20
You should treat model impl classes as something you only access =
directly if=20
you need to extend that class.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for the =
explanation.</FONT><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjk1tp$v25$2@build.eclipse.org type=3D"cite">
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> return root;
}

I've tried the following:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, =
Ei2dPackage.eINSTANCE);
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
</PRE></BLOCKQUOTE>
<DIV>Does your EidResourceFactoryImpl register the package in this =

way.&nbsp; I.e., is it really a null namespace package with =
extended=20
metadata on it as for a schema with no target namespace:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>No the =
Ei2dResourceFactoryImpl=20
does not register it this =
way.</FONT><BR></DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV>That makes me things it's not really a null namespace package and =
so if=20
you register as if it is, you might find that global elements from =
that=20
package still want to be using the namespace of that package.&nbsp; =
That's=20
what it looks like to me.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm not quite sure what you mean. Can =
you give me=20
an example?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,<BR>Jerome</FONT></DIV>
<BLOCKQUOTE cite=3Dmid:fjk1tp$v25$2@build.eclipse.org type=3D"cite">
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<BLOCKQUOTE><A=20
=
href=3D" http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEco=
reMapping.pdf"=20
moz-do-not-send=3D"true">XML Schema to Ecore =
Mapping</A></BLOCKQUOTE>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> Resource res =3D =
resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature=20
'ei2dImpl' not found. (<A class=3Dmoz-txt-link-freetext =
href=3D"file:/C:/qs_dir/qs_xml_26.xml" =
moz-do-not-send=3D"true">file:/C:/qs_dir/qs_xml_26.xml</A >, 1, 30)
</PRE></BLOCKQUOTE>
<DIV>It would help to see more of your model and the file =
instance.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>At this time, I =
am unable to=20
provide this information.</FONT><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">I've tried Eric's Solution:
Resource res =3D resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and =
I'm=20
not quite sure how to use the resourceSet.load method. I checked in the=20
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData =3D new new BasicExtendedMetaData(new=20
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things=20
working?
</PRE></BLOCKQUOTE>
<DIV>It sounds like probably you don't really have a null =
namespace schema=20
(or a model annotated like one).&nbsp; How did you define your=20
model?&nbsp; Can you show the file you are trying to load?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have attached =
the file with I=20
am trying to process. </FONT></DIV></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Thanks for your=20
help,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff =
size=3D2>Jerome</FONT></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Thanks in advance,
Jerome=20


=
</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BLOCKQUOTE><BR></BLOCKQUOTE ></BODY>=
</HTML>

------=_NextPart_000_0007_01C83B52.2E535770--
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415298 is a reply to message #415297] Tue, 11 December 2007 06:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000201080208030102090908
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jerome,

If you generate a model for a schema without a target namespace you'll
see that the EPackage's extended meta data EAnnotation has a
"qualified"->"false" mapping. It sounds like this is missing. from
your model.


Jerome (Jeff) Jabson wrote:
> Hi Ed,
>
> Comments inline:
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote in
> message news:fjkbmc$l9a$1@build.eclipse.org...
> Jerome,
>
> Comments below.
>
>
> Jerome (Jeff) Jabson wrote:
>> Hi Ed,
>>
>> Sorry for the delay in response, as I'm trying to get a hold of
>> the person that generated the Model being used.
>>
>> Comments inline:
>>
>> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote
>> in message news:fje1qg$tls$1@build.eclipse.org...
>> Jerome,
>>
>> Comments below.
>>
>>
>> Jerome (Jeff) Jabson wrote:
>>> Hello,
>>>
>>> I'm having the same problem as Chris and Oliver. I have read both threads
>>> hoping to implement some of the suggestion from Ed Merks. Here is the code I
>>> am having problems with:
>>>
>>> try {
>>> URI fileURI = URI.createFileURI(xmlFile);
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
>>> Ei2dResourceFactoryImpl());
>>> Resource res = resourceSet.getResource(fileURI, true);
>>> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
>>>
>> Wouldn't it be nicer to use the DocumentRoot interface
>> instead of the Impl class?
>>
>> Can you explain why using the DocumentRoot interface would be
>> nicer?
>>
> For each Impl class there is a corresponding interface where the
> later is what your clients should be using directly. Although not
> specifically an issue for a document root, EMF supports multiple
> inheritance so you might have C and extends both A and B but CImpl
> will only extend either AImpl or BImpl so assuming that B can
> always be cast to BImpl is not a save assumption. You should
> treat model impl classes as something you only access directly if
> you need to extend that class.
>
> Thanks for the explanation.
>>
>>> return root;
>>> }
>>>
>>> I've tried the following:
>>>
>>> try {
>>> URI fileURI = URI.createFileURI(xmlFile);
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
>>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
>>> (Resource.Factory.Registry.DEFAULT_EXTENSION, new
>>> Ei2dResourceFactoryImpl());
>>>
>> Does your EidResourceFactoryImpl register the package in this
>> way. I.e., is it really a null namespace package with
>> extended metadata on it as for a schema with no target namespace:
>>
>> No the Ei2dResourceFactoryImpl does not register it this way.
>>
> That makes me things it's not really a null namespace package and
> so if you register as if it is, you might find that global
> elements from that package still want to be using the namespace of
> that package. That's what it looks like to me.
>
> I'm not quite sure what you mean. Can you give me an example?
>
> Thanks,
> Jerome
>>
>> XML Schema to Ecore Mapping
>> < http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEcoreMapping.pdf>
>>
>>> Resource res = resourceSet.getResource(fileURI, true);
>>> DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
>>> return root;
>>> }
>>>
>>> not the error is:
>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
>>> 'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
>>>
>> It would help to see more of your model and the file instance.
>>
>> At this time, I am unable to provide this information.
>>> I've tried Eric's Solution:
>>> Resource res = resourceSet.createResource(fileURI);
>>>
>>> You'll have to excuse my ignorance here, as I am new to using EMF and I'm
>>> not quite sure how to use the resourceSet.load method. I checked in the
>>> Ei2dResourceFactoryImpl class, and I don't see:
>>>
>>> public Ei2dResourceFacotryImpl () {
>>> super();
>>> extendedMetaData = new new BasicExtendedMetaData(new
>>> EPackageRegistryImpl(EPackage.Registry.INSTANCE));
>>> extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
>>> }
>>>
>>> Is there a way I can just add an equivalent to my class to get things
>>> working?
>>>
>> It sounds like probably you don't really have a null
>> namespace schema (or a model annotated like one). How did
>> you define your model? Can you show the file you are trying
>> to load?
>>
>> I have attached the file with I am trying to process.
>>
>> Thanks for your help,
>> Jerome
>>
>>> Thanks in advance,
>>> Jerome
>>>
>>>
>>>
>>
>


--------------000201080208030102090908
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">
Jerome,<br>
<br>
If you generate a model for a schema without a target namespace you'll
see that the EPackage's extended meta data EAnnotation has a
"qualified"-&gt;"false" mapping.&nbsp;&nbsp; It sounds like this is missing. from
your model.<br>
<br>
<br>
Jerome (Jeff) Jabson wrote:
<blockquote cite="mid:fjkp5b$gdi$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2900.2873" name="GENERATOR">
<div><font face="Arial" size="2">Hi Ed,</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Comments inline:</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a moz-do-not-send="true"
href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt; wrote in
message <a moz-do-not-send="true"
href="news:fjkbmc$l9a$1@build.eclipse.org">news:fjkbmc$l9a$1@build.eclipse.org</a>...</div>
Jerome,<br>
<br>
Comments below.<br>
<br>
<br>
Jerome (Jeff) Jabson wrote:
<blockquote cite="mid:fjk1tp$v25$2@build.eclipse.org" type="cite">
<meta content="MSHTML 6.00.2900.2873" name="GENERATOR">
<style></style>
<div><font color="#0000ff" face="Arial" size="2">Hi Ed,</font></div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">Sorry for the
delay in response, as I'm trying to get a hold of the person that
generated the Model being used.</font></div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">Comments inline:</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com"
moz-do-not-send="true">merks@ca.ibm.com</a>&gt; wrote in message <a
href="news:fje1qg$tls$1@build.eclipse.org" moz-do-not-send="true">news:fje1qg$tls$1@build.eclipse.org</a>...</div>
Jerome,<br>
<br>
Comments below.<br>
<br>
<br>
Jerome (Jeff) Jabson wrote:
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org"
type="cite">
<pre wrap="">Hello,

I'm having the same problem as Chris and Oliver. I have read both threads
hoping to implement some of the suggestion from Ed Merks. Here is the code I
am having problems with:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
</pre>
</blockquote>
<div>Wouldn't it be nicer to use the DocumentRoot interface
instead of the Impl class?</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">Can you
explain why using the DocumentRoot interface would be nicer? </font><br>
</div>
</blockquote>
</blockquote>
<div>For each Impl class there is a corresponding interface where
the later is what your clients should be using directly.&nbsp; Although not
specifically an issue for a document root, EMF supports multiple
inheritance so you might have C and extends both A and B but CImpl will
only extend either AImpl or BImpl so assuming that B can always be cast
to BImpl is not a save assumption.&nbsp; You should treat model impl classes
as something you only access directly if you need to extend that class.</div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Thanks for the explanation.</font><br>
</div>
<blockquote cite="mid:fjk1tp$v25$2@build.eclipse.org" type="cite">
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org"
type="cite">
<pre wrap=""> return root;
}

I've tried the following:

try {
URI fileURI = URI.createFileURI(xmlFile);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, Ei2dPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new
Ei2dResourceFactoryImpl());
</pre>
</blockquote>
<div>Does your EidResourceFactoryImpl register the package in
this way.&nbsp; I.e., is it really a null namespace package with extended
metadata on it as for a schema with no target namespace:</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">No the
Ei2dResourceFactoryImpl does not register it this way.</font><br>
</div>
</blockquote>
</blockquote>
<div>That makes me things it's not really a null namespace package
and so if you register as if it is, you might find that global elements
from that package still want to be using the namespace of that
package.&nbsp; That's what it looks like to me.</div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">I'm not quite sure what you mean.
Can you give me an example?</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Thanks,<br>
Jerome</font></div>
<blockquote cite="mid:fjk1tp$v25$2@build.eclipse.org" type="cite">
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<blockquote><a
href=" http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEcoreMapping.pdf"
moz-do-not-send="true">XML Schema to Ecore Mapping</a></blockquote>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org"
type="cite">
<pre wrap=""> Resource res = resourceSet.getResource(fileURI, true);
DocumentRootImpl root = (DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
'ei2dImpl' not found. (<a class="moz-txt-link-freetext"
href="file:/C:/qs_dir/qs_xml_26.xml" moz-do-not-send="true">file:/C:/qs_dir/qs_xml_26.xml</a>, 1, 30)
</pre>
</blockquote>
<div>It would help to see more of your model and the file
instance.</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">At this time,
I am unable to provide this information.</font><br>
</div>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org"
type="cite">
<pre wrap="">I've tried Eric's Solution:
Resource res = resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and I'm
not quite sure how to use the resourceSet.load method. I checked in the
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData = new new BasicExtendedMetaData(new
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things
working?
</pre>
</blockquote>
<div>It sounds like probably you don't really have a null
namespace schema (or a model annotated like one).&nbsp; How did you define
your model?&nbsp; Can you show the file you are trying to load?</div>
<div>&nbsp;</div>
<div><font color="#0000ff" face="Arial" size="2">I have
attached the file with I am trying to process. </font></div>
</blockquote>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div><font color="#0000ff" face="Arial" size="2">Thanks for
your help,</font></div>
<div><font color="#0000ff" face="Arial" size="2">Jerome</font></div>
<div><br>
</div>
<blockquote cite="mid:fjd3jv$54p$2@build.eclipse.org"
type="cite">
<pre wrap="">Thanks in advance,
Jerome


</pre>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------000201080208030102090908--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: PackageNotFoundExceptio: Package with uri 'null' not found [message #415305 is a reply to message #415298] Tue, 11 December 2007 16:41 Go to previous message
Eclipse UserFriend
Originally posted by: jjabson.yahoo.com

This is a multi-part message in MIME format.

------=_NextPart_000_000D_01C83BD1.A48F5680
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Thanks very much! That did the trick!

Jerome
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fjlaq1$kne$1@build.eclipse.org...
Jerome,

If you generate a model for a schema without a target namespace you'll =
see that the EPackage's extended meta data EAnnotation has a =
"qualified"->"false" mapping. It sounds like this is missing. from =
your model.


Jerome (Jeff) Jabson wrote:=20
Hi Ed,

Comments inline:
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fjkbmc$l9a$1@build.eclipse.org...
Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:=20
Hi Ed,

Sorry for the delay in response, as I'm trying to get a hold of =
the person that generated the Model being used.

Comments inline:
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fje1qg$tls$1@build.eclipse.org...
Jerome,

Comments below.


Jerome (Jeff) Jabson wrote:=20
Hello,

I'm having the same problem as Chris and Oliver. I have read both =
threads=20
hoping to implement some of the suggestion from Ed Merks. Here is the =
code I=20
am having problems with:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
Wouldn't it be nicer to use the DocumentRoot interface instead of the =
Impl class?

Can you explain why using the DocumentRoot interface would be =
nicer?=20

For each Impl class there is a corresponding interface where the =
later is what your clients should be using directly. Although not =
specifically an issue for a document root, EMF supports multiple =
inheritance so you might have C and extends both A and B but CImpl will =
only extend either AImpl or BImpl so assuming that B can always be cast =
to BImpl is not a save assumption. You should treat model impl classes =
as something you only access directly if you need to extend that class.

Thanks for the explanation.

return root;
}

I've tried the following:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, =
Ei2dPackage.eINSTANCE);
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Does your EidResourceFactoryImpl register the package in this way. =
I.e., is it really a null namespace package with extended metadata on it =
as for a schema with no target namespace:

No the Ei2dResourceFactoryImpl does not register it this way.

That makes me things it's not really a null namespace package and =
so if you register as if it is, you might find that global elements from =
that package still want to be using the namespace of that package. =
That's what it looks like to me.

I'm not quite sure what you mean. Can you give me an example?

Thanks,
Jerome
XML Schema to Ecore Mapping
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature=20
'ei2dImpl' not found. (file:/C:/qs_dir/qs_xml_26.xml, 1, 30)
It would help to see more of your model and the file instance.

At this time, I am unable to provide this information.

I've tried Eric's Solution:
Resource res =3D resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and =
I'm=20
not quite sure how to use the resourceSet.load method. I checked in the=20
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData =3D new new BasicExtendedMetaData(new=20
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things=20
working?
It sounds like probably you don't really have a null namespace schema =
(or a model annotated like one). How did you define your model? Can =
you show the file you are trying to load?

I have attached the file with I am trying to process.=20
Thanks for your help,
Jerome


Thanks in advance,
Jerome=20


=20





------=_NextPart_000_000D_01C83BD1.A48F5680
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks very much! That did the =
trick!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Jerome</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fjlaq1$kne$1@build.eclipse.org">news:fjlaq1$kne$1@build.ecli=
pse.org</A>...</DIV>Jerome,<BR><BR>If=20
you generate a model for a schema without a target namespace you'll =
see that=20
the EPackage's extended meta data EAnnotation has a =
"qualified"-&gt;"false"=20
mapping.&nbsp;&nbsp; It sounds like this is missing. from your=20
model.<BR><BR><BR>Jerome (Jeff) Jabson wrote:=20
<BLOCKQUOTE cite=3Dmid:fjkp5b$gdi$1@build.eclipse.org type=3D"cite">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Comments inline:</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A href=3D"mailto:merks@ca.ibm.com"=20
moz-do-not-send=3D"true">merks@ca.ibm.com</A>&gt; wrote in message =
<A=20
href=3D"news:fjkbmc$l9a$1@build.eclipse.org"=20
=
moz-do-not-send=3D"true">news:fjkbmc$l9a$1@build.eclipse.org</A>...</DIV>=
Jerome,<BR><BR>Comments=20
below.<BR><BR><BR>Jerome (Jeff) Jabson wrote:=20
<BLOCKQUOTE cite=3Dmid:fjk1tp$v25$2@build.eclipse.org =
type=3D"cite">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<STYLE></STYLE>

<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hi =
Ed,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Sorry for the =
delay in=20
response, as I'm trying to get a hold of the person that =
generated the=20
Model being used.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Comments =
inline:</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A href=3D"mailto:merks@ca.ibm.com"=20
moz-do-not-send=3D"true">merks@ca.ibm.com</A>&gt; wrote in =
message <A=20
href=3D"news:fje1qg$tls$1@build.eclipse.org"=20
=
moz-do-not-send=3D"true">news:fje1qg$tls$1@build.eclipse.org</A>...</DIV>=
Jerome,<BR><BR>Comments=20
below.<BR><BR><BR>Jerome (Jeff) Jabson wrote:=20
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hello,

I'm having the same problem as Chris and Oliver. I have read both =
threads=20
hoping to implement some of the suggestion from Ed Merks. Here is the =
code I=20
am having problems with:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
Resource res =3D resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
</PRE></BLOCKQUOTE>
<DIV>Wouldn't it be nicer to use the DocumentRoot interface =
instead of=20
the Impl class?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Can you =
explain why using=20
the DocumentRoot interface would be nicer?=20
</FONT><BR></DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV>For each Impl class there is a corresponding interface where =
the=20
later is what your clients should be using directly.&nbsp; =
Although not=20
specifically an issue for a document root, EMF supports multiple=20
inheritance so you might have C and extends both A and B but CImpl =
will=20
only extend either AImpl or BImpl so assuming that B can always be =
cast to=20
BImpl is not a save assumption.&nbsp; You should treat model impl =
classes=20
as something you only access directly if you need to extend that=20
class.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for the =
explanation.</FONT><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjk1tp$v25$2@build.eclipse.org =
type=3D"cite">
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> return root;
}

I've tried the following:

try {
URI fileURI =3D URI.createFileURI(xmlFile);
ResourceSet resourceSet =3D new ResourceSetImpl();
resourceSet.getPackageRegistry().put(null, =
Ei2dPackage.eINSTANCE);
=
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, new=20
Ei2dResourceFactoryImpl());
</PRE></BLOCKQUOTE>
<DIV>Does your EidResourceFactoryImpl register the package in =
this=20
way.&nbsp; I.e., is it really a null namespace package with =
extended=20
metadata on it as for a schema with no target namespace:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>No the=20
Ei2dResourceFactoryImpl does not register it this=20
way.</FONT><BR></DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV>That makes me things it's not really a null namespace package =
and so=20
if you register as if it is, you might find that global elements =
from that=20
package still want to be using the namespace of that =
package.&nbsp; That's=20
what it looks like to me.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm not quite sure what you mean. =
Can you=20
give me an example?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,<BR>Jerome</FONT></DIV>
<BLOCKQUOTE cite=3Dmid:fjk1tp$v25$2@build.eclipse.org =
type=3D"cite">
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<BLOCKQUOTE><A=20
=
href=3D" http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchema ToEco=
reMapping.pdf"=20
moz-do-not-send=3D"true">XML Schema to Ecore =
Mapping</A></BLOCKQUOTE>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> Resource res =3D =
resourceSet.getResource(fileURI, true);
DocumentRootImpl root =3D =
(DocumentRootImpl)res.getContents().get(0);
return root;
}

not the error is:
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature=20
'ei2dImpl' not found. (<A class=3Dmoz-txt-link-freetext =
href=3D"file:/C:/qs_dir/qs_xml_26.xml" =
moz-do-not-send=3D"true">file:/C:/qs_dir/qs_xml_26.xml</A >, 1, 30)
</PRE></BLOCKQUOTE>
<DIV>It would help to see more of your model and the file=20
instance.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>At this time, =
I am unable=20
to provide this information.</FONT><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">I've tried Eric's Solution:
Resource res =3D resourceSet.createResource(fileURI);

You'll have to excuse my ignorance here, as I am new to using EMF and =
I'm=20
not quite sure how to use the resourceSet.load method. I checked in the=20
Ei2dResourceFactoryImpl class, and I don't see:

public Ei2dResourceFacotryImpl () {
super();
extendedMetaData =3D new new BasicExtendedMetaData(new=20
EPackageRegistryImpl(EPackage.Registry.INSTANCE));
extendedMetaData.putPackage(null, Ei2dPackage.eINSTANCE);
}

Is there a way I can just add an equivalent to my class to get things=20
working?
</PRE></BLOCKQUOTE>
<DIV>It sounds like probably you don't really have a null =
namespace=20
schema (or a model annotated like one).&nbsp; How did you =
define your=20
model?&nbsp; Can you show the file you are trying to =
load?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have =
attached the file=20
with I am trying to process. </FONT></DIV></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Thanks for =
your=20
help,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff =
size=3D2>Jerome</FONT></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE cite=3Dmid:fjd3jv$54p$2@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Thanks in advance,
Jerome=20


=
</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BLOCKQUOTE><BR></BLOCKQUOTE ></BLOCK=
QUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_000D_01C83BD1.A48F5680--
Previous Topic:extending EMF model classes..
Next Topic:Updates to the wiki
Goto Forum:
  


Current Time: Tue Apr 30 12:36:02 GMT 2024

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

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

Back to the top