Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » parsing w/ doctype's unresolved server id
parsing w/ doctype's unresolved server id [message #488519] Tue, 29 September 2009 05:19 Go to next message
John J. Franey is currently offline John J. FraneyFriend
Messages: 31
Registered: July 2009
Member
My model is translated to xsd from dtd using trang. I don't control the
dtd; it comes from a jsr (240). I don't control the content of the xml
files I'd like the model editor to operate on and some contain DOCTYPE
directive as required by the jsr. I don't control the server the dtd is
SUPPOSED to be loaded into; its not. The DOCTYPE's server id does not
resolve.

Because the DOCTYPE server id does not resolve, two things are failing:

1) content type identification

2) ResourceSet.getResource(uri to file, ...) in createModel.

Do I have control over emf's parser to work around Doctype?


I can't see any control of parser features for the content type
identification parsing (as per debugging session).



I see that I can set parser features in the call to getResource by
setting the ResourceSet's load options (getLoadOptions).

When I set parser feature for getResource to:
" http://apache.org/xml/features/nonvalidating/load-external-d td", false
and:
"http://xml.org/sax/features/validation", false

I get the exception 'PackageNotFoundException: Package with uri 'null'
not found'.

Any thoughts or hints?

Thanks,
John
Re: parsing w/ doctype's unresolved server id [message #488524 is a reply to message #488519] Tue, 29 September 2009 06:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070403020302010204000104
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

John,

Probably you could specialize the XMLHandler's

public InputSource resolveEntity(String publicId, String systemId)
throws SAXException

Maybe those options would work if you used OPTION_USE_DEPRECATED_METHODS
with false; read the Javadoc.


John J. Franey wrote:
> My model is translated to xsd from dtd using trang. I don't control the
> dtd; it comes from a jsr (240). I don't control the content of the xml
> files I'd like the model editor to operate on and some contain DOCTYPE
> directive as required by the jsr. I don't control the server the dtd is
> SUPPOSED to be loaded into; its not. The DOCTYPE's server id does not
> resolve.
>
> Because the DOCTYPE server id does not resolve, two things are failing:
>
> 1) content type identification
>
> 2) ResourceSet.getResource(uri to file, ...) in createModel.
>
> Do I have control over emf's parser to work around Doctype?
>
>
> I can't see any control of parser features for the content type
> identification parsing (as per debugging session).
>
>
>
> I see that I can set parser features in the call to getResource by
> setting the ResourceSet's load options (getLoadOptions).
>
> When I set parser feature for getResource to:
> " http://apache.org/xml/features/nonvalidating/load-external-d td", false
> and:
> "http://xml.org/sax/features/validation", false
>
> I get the exception 'PackageNotFoundException: Package with uri 'null'
> not found'.
>
> Any thoughts or hints?
>
> Thanks,
> John
>
>
>
>

--------------070403020302010204000104
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
John,<br>
<br>
Probably you could specialize the XMLHandler's<br>
<blockquote> public InputSource resolveEntity(String publicId, String
systemId) throws SAXException<br>
</blockquote>
Maybe those options would work if you used
OPTION_USE_DEPRECATED_METHODS with false; read the Javadoc.<br>
<br>
<br>
John J. Franey wrote:
<blockquote cite="mid:h9s5d2$vee$1@build.eclipse.org" type="cite">
<pre wrap="">My model is translated to xsd from dtd using trang. I don't control the
dtd; it comes from a jsr (240). I don't control the content of the xml
files I'd like the model editor to operate on and some contain DOCTYPE
directive as required by the jsr. I don't control the server the dtd is
SUPPOSED to be loaded into; its not. The DOCTYPE's server id does not
resolve.

Because the DOCTYPE server id does not resolve, two things are failing:

1) content type identification

2) ResourceSet.getResource(uri to file, ...) in createModel.

Do I have control over emf's parser to work around Doctype?


I can't see any control of parser features for the content type
identification parsing (as per debugging session).



I see that I can set parser features in the call to getResource by
setting the ResourceSet's load options (getLoadOptions).

When I set parser feature for getResource to:
<a class="moz-txt-link-rfc2396E" href=" http://apache.org/xml/features/nonvalidating/load-external-d td">" http://apache.org/xml/features/nonvalidating/load-external-d td"</a>, false
and:
<a class="moz-txt-link-rfc2396E" href="http://xml.org/sax/features/validation">"http://xml.org/sax/features/validation"</a>, false

I get the exception 'PackageNotFoundException: Package with uri 'null'
not found'.

Any thoughts or hints?

Thanks,
John



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

--------------070403020302010204000104--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: parsing w/ doctype's unresolved server id [message #488925 is a reply to message #488524] Wed, 30 September 2009 17:37 Go to previous message
John J. Franey is currently offline John J. FraneyFriend
Messages: 31
Registered: July 2009
Member
On Tue, 29 Sep 2009 08:33:38 +0200, Ed Merks wrote:

> John,
>
> Probably you could specialize the XMLHandler's
>
> public InputSource resolveEntity(String publicId, String systemId)
> throws SAXException
>

Thank you.

I did indeed. After importing the dtd into my plugin, my handler
replaces the file's systemId with a an uri like:
'platform:...plugin.../..". Thanks for the hint.


> Maybe those options would work if you used OPTION_USE_DEPRECATED_METHODS
> with false; read the Javadoc.
>
>
> John J. Franey wrote:
>> My model is translated to xsd from dtd using trang. I don't control
>> the dtd; it comes from a jsr (240). I don't control the content of the
>> xml files I'd like the model editor to operate on and some contain
>> DOCTYPE directive as required by the jsr. I don't control the server
>> the dtd is SUPPOSED to be loaded into; its not. The DOCTYPE's server
>> id does not resolve.
>>
>> Because the DOCTYPE server id does not resolve, two things are failing:
>>
>> 1) content type identification
>>
>> 2) ResourceSet.getResource(uri to file, ...) in createModel.
>>
>> Do I have control over emf's parser to work around Doctype?
>>
>>
>> I can't see any control of parser features for the content type
>> identification parsing (as per debugging session).
>>
>>
Previous Topic:.xslt from .ecore2ecore, is it posible?
Next Topic:[Teneo] DuplicateMappingException
Goto Forum:
  


Current Time: Thu Apr 25 23:11:29 GMT 2024

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

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

Back to the top