|
|
Re: loading XML without namepace declaration [message #430566 is a reply to message #430556] |
Wed, 27 May 2009 14:43 |
Henrik Rentz-Reichert Messages: 261 Registered: July 2009 |
Senior Member |
|
|
Thanks Ed,
I already did it that way.
I also solved the problem described in my previous post. I just
registered my package in the ResourceSet's PackageRegistry with the null
namespace (since I now the right package from the file extension).
But when I save my model again, I get
<?xml version="1.0" encoding="UTF-8"?>
<ComponentMain xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:_1="http://www.w3.org/2000/09/xmldsig#" schemaVersion="6.0.0.0"
toolVersion="V6.0.0">
The third party tool issues a schema validation error when trying to
load my saved file.
When I omit the XMI stuff
<?xml version="1.0" encoding="UTF-8"?>
<ComponentMain xmlns:_1="http://www.w3.org/2000/09/xmldsig#"
schemaVersion="6.0.0.0" toolVersion="V6.0.0">
everything works fine.
Is there a way to get rid of the XMI namespace?
Thanks,
Henrik
Ed Merks wrote:
> Henrik,
>
> Comments below.
>
> Henrik Rentz-Reichert wrote:
>> Hi,
>>
>> I have a set of XML files exported by a tool with names like
>> example.a.model
>> example.b.model
>> example.c.model
>>
>> Each of them has its own XML schema (schema_a.xsd, schema_b.xsd, ...).
>>
>> The beginning e.g. looks like
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ComponentMain xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:noNamespaceSchemaLocation="path/to/schema_a.xsd"
>> toolVersion="V6.0.0" schemaVersion="5.2.1.0">
>>
>> I can successfully deal with those files (create a EMF model and load
>> them).
>>
>> The new version of the tool now omits the schema declaration in the
>> header:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ComponentMain toolVersion="V6.0.0" schemaVersion="6.0.0.0">
>>
>> This means I can only rely on the filename to distinguish the package.
>>
>> Is there a way to handle this?
>>
> Given they are all no-namespace schemas, you could import them all at
> once (specify all three location URIs in the wizard) so that EMF creates
> a single EPackage from the composition of them.
>
> Failing that, you could define EMF content types based on the name of
> the root element.
>> Regards,
>> Henrik
>>
|
|
|
Re: loading XML without namepace declaration [message #430568 is a reply to message #430566] |
Wed, 27 May 2009 15:03 |
Ed Merks Messages: 33145 Registered: July 2009 |
Senior Member |
|
|
Henrik,
Be sure to use an XMLResourceImpl not an XMIResourceImpl for saving.
(It sounds like you aren't using the generated XyzResourceFactoryImpl.)
Henrik Rentz-Reichert wrote:
> Thanks Ed,
>
> I already did it that way.
>
> I also solved the problem described in my previous post. I just
> registered my package in the ResourceSet's PackageRegistry with the null
> namespace (since I now the right package from the file extension).
>
> But when I save my model again, I get
> <?xml version="1.0" encoding="UTF-8"?>
> <ComponentMain xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:_1="http://www.w3.org/2000/09/xmldsig#" schemaVersion="6.0.0.0"
> toolVersion="V6.0.0">
>
> The third party tool issues a schema validation error when trying to
> load my saved file.
>
> When I omit the XMI stuff
> <?xml version="1.0" encoding="UTF-8"?>
> <ComponentMain xmlns:_1="http://www.w3.org/2000/09/xmldsig#"
> schemaVersion="6.0.0.0" toolVersion="V6.0.0">
>
> everything works fine.
>
> Is there a way to get rid of the XMI namespace?
>
> Thanks,
> Henrik
>
> Ed Merks wrote:
>
>> Henrik,
>>
>> Comments below.
>>
>> Henrik Rentz-Reichert wrote:
>>
>>> Hi,
>>>
>>> I have a set of XML files exported by a tool with names like
>>> example.a.model
>>> example.b.model
>>> example.c.model
>>>
>>> Each of them has its own XML schema (schema_a.xsd, schema_b.xsd, ...).
>>>
>>> The beginning e.g. looks like
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <ComponentMain xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:noNamespaceSchemaLocation="path/to/schema_a.xsd"
>>> toolVersion="V6.0.0" schemaVersion="5.2.1.0">
>>>
>>> I can successfully deal with those files (create a EMF model and load
>>> them).
>>>
>>> The new version of the tool now omits the schema declaration in the
>>> header:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <ComponentMain toolVersion="V6.0.0" schemaVersion="6.0.0.0">
>>>
>>> This means I can only rely on the filename to distinguish the package.
>>>
>>> Is there a way to handle this?
>>>
>>>
>> Given they are all no-namespace schemas, you could import them all at
>> once (specify all three location URIs in the wizard) so that EMF creates
>> a single EPackage from the composition of them.
>>
>> Failing that, you could define EMF content types based on the name of
>> the root element.
>>
>>> Regards,
>>> Henrik
>>>
>>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: loading XML without namepace declaration [message #430575 is a reply to message #430568] |
Wed, 27 May 2009 15:42 |
Henrik Rentz-Reichert Messages: 261 Registered: July 2009 |
Senior Member |
|
|
yes, thanks, now it works as desired
Ed Merks wrote:
> Henrik,
>
> Be sure to use an XMLResourceImpl not an XMIResourceImpl for saving.
> (It sounds like you aren't using the generated XyzResourceFactoryImpl.)
>
>
> Henrik Rentz-Reichert wrote:
>> Thanks Ed,
>>
>> I already did it that way.
>>
>> I also solved the problem described in my previous post. I just
>> registered my package in the ResourceSet's PackageRegistry with the null
>> namespace (since I now the right package from the file extension).
>>
>> But when I save my model again, I get
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ComponentMain xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:_1="http://www.w3.org/2000/09/xmldsig#" schemaVersion="6.0.0.0"
>> toolVersion="V6.0.0">
>>
>> The third party tool issues a schema validation error when trying to
>> load my saved file.
>>
>> When I omit the XMI stuff
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ComponentMain xmlns:_1="http://www.w3.org/2000/09/xmldsig#"
>> schemaVersion="6.0.0.0" toolVersion="V6.0.0">
>>
>> everything works fine.
>>
>> Is there a way to get rid of the XMI namespace?
>>
>> Thanks,
>> Henrik
>>
>> Ed Merks wrote:
>>
>>> Henrik,
>>>
>>> Comments below.
>>>
>>> Henrik Rentz-Reichert wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a set of XML files exported by a tool with names like
>>>> example.a.model
>>>> example.b.model
>>>> example.c.model
>>>>
>>>> Each of them has its own XML schema (schema_a.xsd, schema_b.xsd, ...).
>>>>
>>>> The beginning e.g. looks like
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <ComponentMain xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:noNamespaceSchemaLocation="path/to/schema_a.xsd"
>>>> toolVersion="V6.0.0" schemaVersion="5.2.1.0">
>>>>
>>>> I can successfully deal with those files (create a EMF model and load
>>>> them).
>>>>
>>>> The new version of the tool now omits the schema declaration in the
>>>> header:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <ComponentMain toolVersion="V6.0.0" schemaVersion="6.0.0.0">
>>>>
>>>> This means I can only rely on the filename to distinguish the package.
>>>>
>>>> Is there a way to handle this?
>>>>
>>> Given they are all no-namespace schemas, you could import them all at
>>> once (specify all three location URIs in the wizard) so that EMF creates
>>> a single EPackage from the composition of them.
>>>
>>> Failing that, you could define EMF content types based on the name of
>>> the root element.
>>>
>>>> Regards,
>>>> Henrik
>>>>
|
|
|
Powered by
FUDForum. Page generated in 0.04369 seconds