Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile)
Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66061] Wed, 19 January 2005 07:22 Go to next message
Geoff Longman is currently offline Geoff LongmanFriend
Messages: 49
Registered: July 2009
Member
How can one do this? In a previous message I noted that it was useful
for me to obtain w3c Documents from XMLModels.

I have a need to do the same on XML files stored in jar files. These
would be JDT JarEntryFiles hiding behind the IStorage iface. Since
these are readonly and never change I assume that such models would be
unmanaged.

But IModelManager is geared towards source found in IFiles. Any ideas?

Geoff
Re: Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66346 is a reply to message #66061] Wed, 19 January 2005 16:43 Go to previous messageGo to next message
Geoff Longman is currently offline Geoff LongmanFriend
Messages: 49
Registered: July 2009
Member
Geoff Longman wrote:
> How can one do this? In a previous message I noted that it was useful
> for me to obtain w3c Documents from XMLModels.
>
> I have a need to do the same on XML files stored in jar files. These
> would be JDT JarEntryFiles hiding behind the IStorage iface. Since
> these are readonly and never change I assume that such models would be
> unmanaged.
>
> But IModelManager is geared towards source found in IFiles. Any ideas?
>
> Geoff

Ok. so I've looked at the way StorageModelProvider does this. But, being
a document provider, this class depends on IEditorInput's. This is fine
for editors and is it's intended purpose.

However, the work I'm doing is working with models in the context of a
project builder and thus has nothing to do with editors or thier input
objects.

Does it make sense to add a feature request to add api for obtaining
models based on IStorage's from the model manager? Or, am I missing an
easier way to do this?

Geoff
Re: Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66365 is a reply to message #66061] Wed, 19 January 2005 15:50 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4507
Registered: July 2009
Senior Member

Geoff Longman wrote:
> How can one do this? In a previous message I noted that it was useful
> for me to obtain w3c Documents from XMLModels.
>
> I have a need to do the same on XML files stored in jar files. These
> would be JDT JarEntryFiles hiding behind the IStorage iface. Since
> these are readonly and never change I assume that such models would be
> unmanaged.
>
> But IModelManager is geared towards source found in IFiles. Any ideas?

Whether a model is "managed" or not is actually a separate issue
from whether you intend to modify its contents or not. In this
situation your best bet is to use the managed model APIs that don't
directly require an IFile, such as
IModelManager.getModelForRead(String, InputStream, URIResolver):

IStructuredModel model =
StructuredModelManager.getModelManager().getModelForRead(uni queID,
inputStream, null);
model.setBaseLocation(path);

This method and its corresponding edit method are deprecated since
the third parameter may go away. There are API methods for creating
truly unmanaged models, but there is no support for setting their
contents using the correct encoding.

And remember to always release your models when you're done with them.

--
- Nitin


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66387 is a reply to message #66346] Wed, 19 January 2005 16:43 Go to previous messageGo to next message
David Williams is currently offline David WilliamsFriend
Messages: 722
Registered: July 2009
Senior Member
> However, the work I'm doing is working with models in the context of a
> project builder and thus has nothing to do with editors or thier input
> objects.
>
> Does it make sense to add a feature request to add api for obtaining
> models based on IStorage's from the model manager? Or, am I missing an
> easier way to do this?
>

A feature request is always good, since even if we don't implement, or implement exactly as requested,
we'd have better "data" on how people are thinking of using it, and could attempt to
satisfy.

I'd also be interested in more details of how/why you are using the model. As you discovered,
it creates a DOM model regardless of if valid or well-formed ... it really is for editing DOM's, where
the DOM would be expected to be illformed at various points. So ... just curious, what
features or aspects do you find benificial in your "project builder" context?

Thanks.
Re: Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66403 is a reply to message #66387] Wed, 19 January 2005 19:43 Go to previous messageGo to next message
Geoff Longman is currently offline Geoff LongmanFriend
Messages: 49
Registered: July 2009
Member
David Williams wrote:
>
>> However, the work I'm doing is working with models in the context of a
>> project builder and thus has nothing to do with editors or thier input
>> objects.
>>
>> Does it make sense to add a feature request to add api for obtaining
>> models based on IStorage's from the model manager? Or, am I missing an
>> easier way to do this?
>>
>
> A feature request is always good, since even if we don't implement, or
> implement exactly as requested,
> we'd have better "data" on how people are thinking of using it, and
> could attempt to
> satisfy.
>
> I'd also be interested in more details of how/why you are using the
> model. As you discovered,
> it creates a DOM model regardless of if valid or well-formed ... it
> really is for editing DOM's, where
> the DOM would be expected to be illformed at various points. So ... just
> curious, what
> features or aspects do you find benificial in your "project builder"
> context?

Easy, the document offsets for the artifacts in the file (tag name.
attribute value etc). I'm creating markers when I encounter errors and
the line:column offsets obtained from XML parsers are less than ideal
for this task. I spent a lot of time hacking the Xerces parser to get
good offset info but it's a hack for sure.

If wtp and sse can give me a dom interface *plus* the added extra info I
need then I'm quite happy to discard my old hacks! Besides, then I don't
have to maintain my hacks anymore ;-)

My stuff was depending on other open source projects for custom DOM
validation, XML parsing, and structured documents. WTP seems to give me
all that and more.

Geoff

>
> Thanks.
Re: Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66424 is a reply to message #66365] Wed, 19 January 2005 19:55 Go to previous message
Geoff Longman is currently offline Geoff LongmanFriend
Messages: 49
Registered: July 2009
Member
> Whether a model is "managed" or not is actually a separate issue from
> whether you intend to modify its contents or not. In this situation
> your best bet is to use the managed model APIs that don't directly
> require an IFile, such as IModelManager.getModelForRead(String,
> InputStream, URIResolver):
>
> IStructuredModel model =
> StructuredModelManager.getModelManager().getModelForRead(uni queID,
> inputStream, null);
> model.setBaseLocation(path);


Noted. thanks. I have no need to modify the contents (indeed how would
one modify a readonly IStorage).

Geoff


>
> This method and its corresponding edit method are deprecated since the
> third parameter may go away. There are API methods for creating truly
> unmanaged models, but there is no support for setting their contents
> using the correct encoding.
>
> And remember to always release your models when you're done with them.
>
Previous Topic:Question about structured models and validation
Next Topic:An internal error occurred during: "Updating JSP Index".
Goto Forum:
  


Current Time: Sat Dec 21 14:31:33 GMT 2024

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

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

Back to the top