Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » How to retrieve the xml encoding from the schema
How to retrieve the xml encoding from the schema [message #72976] Wed, 05 September 2007 15:07 Go to next message
Eclipse UserFriend
Originally posted by: nospam.nospam.com

Hi all,

I need to get the XML encoding from the loaded Schema, we set XSD_TRACK_LOCATION to true prior to parsing i.e.

ResourceSet resourceSet = new ResourceSetImpl();

resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
Boolean.TRUE);
// parse the doc..
XSDResourceImpl xsdResource = (XSDResourceImpl) resourceSet
.getResource(schemaURI,true);

XSDSchema x = xsdResource.getSchema();

However, the following always returns null
String encoding = x.getDocument().getXMLEncoding();

Does anyone know how to get the xml encoding from the schema ?

Many thanks in advance

Tony
Re: How to retrieve the xml encoding from the schema [message #73004 is a reply to message #72976] Wed, 05 September 2007 15:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Tony,

The encoding will be put into the
XSDResourceImpl.getDefaultSaveOptions() map via the XSD_ENCODING option
as the key.


TG wrote:
> Hi all,
>
> I need to get the XML encoding from the loaded Schema, we set
> XSD_TRACK_LOCATION to true prior to parsing i.e.
>
> ResourceSet resourceSet = new ResourceSetImpl();
>
> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
>
> Boolean.TRUE);
> // parse the doc..
> XSDResourceImpl xsdResource = (XSDResourceImpl) resourceSet
> .getResource(schemaURI,true);
>
> XSDSchema x = xsdResource.getSchema();
>
> However, the following always returns null
> String encoding = x.getDocument().getXMLEncoding();
>
> Does anyone know how to get the xml encoding from the schema ?
>
> Many thanks in advance
>
> Tony
Re: How to retrieve the xml encoding from the schema [message #73020 is a reply to message #73004] Wed, 05 September 2007 18:35 Go to previous message
Eclipse UserFriend
Originally posted by: nospam.ibm.com

Thanks for the quick response Ed.

Does the trick nicely

Ed Merks wrote:
> Tony,
>
> The encoding will be put into the
> XSDResourceImpl.getDefaultSaveOptions() map via the XSD_ENCODING option
> as the key.
>
>
> TG wrote:
>> Hi all,
>>
>> I need to get the XML encoding from the loaded Schema, we set
>> XSD_TRACK_LOCATION to true prior to parsing i.e.
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>>
>> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
>>
>> Boolean.TRUE);
>> // parse the doc..
>> XSDResourceImpl xsdResource = (XSDResourceImpl) resourceSet
>> .getResource(schemaURI,true);
>> XSDSchema x = xsdResource.getSchema();
>>
>> However, the following always returns null
>> String encoding = x.getDocument().getXMLEncoding();
>>
>> Does anyone know how to get the xml encoding from the schema ?
>>
>> Many thanks in advance
>>
>> Tony
Re: How to retrieve the xml encoding from the schema [message #602596 is a reply to message #72976] Wed, 05 September 2007 15:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Tony,

The encoding will be put into the
XSDResourceImpl.getDefaultSaveOptions() map via the XSD_ENCODING option
as the key.


TG wrote:
> Hi all,
>
> I need to get the XML encoding from the loaded Schema, we set
> XSD_TRACK_LOCATION to true prior to parsing i.e.
>
> ResourceSet resourceSet = new ResourceSetImpl();
>
> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
>
> Boolean.TRUE);
> // parse the doc..
> XSDResourceImpl xsdResource = (XSDResourceImpl) resourceSet
> .getResource(schemaURI,true);
>
> XSDSchema x = xsdResource.getSchema();
>
> However, the following always returns null
> String encoding = x.getDocument().getXMLEncoding();
>
> Does anyone know how to get the xml encoding from the schema ?
>
> Many thanks in advance
>
> Tony


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to retrieve the xml encoding from the schema [message #602604 is a reply to message #73004] Wed, 05 September 2007 18:35 Go to previous message
TG is currently offline TGFriend
Messages: 3
Registered: July 2009
Junior Member
Thanks for the quick response Ed.

Does the trick nicely

Ed Merks wrote:
> Tony,
>
> The encoding will be put into the
> XSDResourceImpl.getDefaultSaveOptions() map via the XSD_ENCODING option
> as the key.
>
>
> TG wrote:
>> Hi all,
>>
>> I need to get the XML encoding from the loaded Schema, we set
>> XSD_TRACK_LOCATION to true prior to parsing i.e.
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>>
>> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
>>
>> Boolean.TRUE);
>> // parse the doc..
>> XSDResourceImpl xsdResource = (XSDResourceImpl) resourceSet
>> .getResource(schemaURI,true);
>> XSDSchema x = xsdResource.getSchema();
>>
>> However, the following always returns null
>> String encoding = x.getDocument().getXMLEncoding();
>>
>> Does anyone know how to get the xml encoding from the schema ?
>>
>> Many thanks in advance
>>
>> Tony
Previous Topic:How to retrieve the xml encoding from the schema
Next Topic:idrefs and holders
Goto Forum:
  


Current Time: Thu Apr 25 01:47:27 GMT 2024

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

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

Back to the top