|
|
Re: Obtaining an (unmanaged?) XMLModel for a IStorage (JarEntryFile) [message #66365 is a reply to message #66061] |
Wed, 19 January 2005 15:50 |
|
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 |
David Williams 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 |
Geoff Longman 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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03978 seconds