Home » Modeling » EMF » Mapping XSD to XML element vs. attribute
|
Re: Mapping XSD to XML element vs. attribute [message #417015 is a reply to message #417008] |
Fri, 22 February 2008 19:03 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Uwe,
Comments below.
Uwe Voigt wrote:
> Hi,
>
> the schema appended below maps to a Java type 'Operation1' and
> 'VariableTestInput' with String attribute 'name' created with the
> SDO Generator of Websphere Integration Developer.
I didn't think WID supported generated SDOs. Interesting...
>
> If I create XML using the XMLResourceFactoryImpl out of instances of
> these types, this generates an element 'input' with the attribute 'name'.
You need to use a resource implementation configured with the correct
options. Here's how resources for XML-based models are normally
configured by their generated factory:
public Resource createResource(URI uri)
{
XMLResource result = new LibraryResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);
return result;
}
If your model has a generated XyzResourceFactoryImpl, you should be
using that to create your resource...
>
> But that doesn't match xml which has been created using the Generate
> XML from Schema function out of WID.
> How can I achieve that an element 'input' is created which has a child
> element name instead of an attribue?
>
> Thanks!
>
>
> <xsd:schema
> targetNamespace="http://VariableAccessTest/process/TestProcessInterface"
> xmlns:bons1="http://VariableAccessTest/data"
> xmlns:tns="http://VariableAccessTest/process/TestProcessInterface"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:import namespace="http://VariableAccessTest/data"
> schemaLocation="../VariableAccessTest/data/VariableTestInput.xsd "/>
>
> <xsd:element name="operation1">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="input1" nillable="true"
> type="bons1:VariableTestInput"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
>
> with the VariableTestInput.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://VariableAccessTest/data">
> <xsd:complexType name="VariableTestInput">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Mapping XSD to XML element vs. attribute [message #417018 is a reply to message #417015] |
Fri, 22 February 2008 20:42 |
Uwe Voigt Messages: 10 Registered: July 2009 |
Junior Member |
|
|
Thanks Ed, that helped.
> I didn't think WID supported generated SDOs. Interesting...
Yes it does, but WPS doesn't. Unfortunately.
Ed Merks wrote:
> Uwe,
>
> Comments below.
>
> Uwe Voigt wrote:
>> Hi,
>>
>> the schema appended below maps to a Java type 'Operation1' and
>> 'VariableTestInput' with String attribute 'name' created with the
>> SDO Generator of Websphere Integration Developer.
> I didn't think WID supported generated SDOs. Interesting...
>>
>> If I create XML using the XMLResourceFactoryImpl out of instances of
>> these types, this generates an element 'input' with the attribute 'name'.
> You need to use a resource implementation configured with the correct
> options. Here's how resources for XML-based models are normally
> configured by their generated factory:
>
> public Resource createResource(URI uri)
> {
> XMLResource result = new LibraryResourceImpl(uri);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
> Boolean.TRUE);
> return result;
> }
>
> If your model has a generated XyzResourceFactoryImpl, you should be
> using that to create your resource...
>>
>> But that doesn't match xml which has been created using the Generate
>> XML from Schema function out of WID.
>> How can I achieve that an element 'input' is created which has a child
>> element name instead of an attribue?
>>
>> Thanks!
>>
>>
>> <xsd:schema
>> targetNamespace="http://VariableAccessTest/process/TestProcessInterface"
>> xmlns:bons1="http://VariableAccessTest/data"
>> xmlns:tns="http://VariableAccessTest/process/TestProcessInterface"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>
>> <xsd:import namespace="http://VariableAccessTest/data"
>> schemaLocation="../VariableAccessTest/data/VariableTestInput.xsd "/>
>>
>> <xsd:element name="operation1">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element name="input1" nillable="true"
>> type="bons1:VariableTestInput"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> </xsd:schema>
>>
>>
>> with the VariableTestInput.xsd
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> targetNamespace="http://VariableAccessTest/data">
>> <xsd:complexType name="VariableTestInput">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:schema>
>>
>>
|
|
|
Re: Mapping XSD to XML element vs. attribute [message #417019 is a reply to message #417015] |
Fri, 22 February 2008 22:27 |
Uwe Voigt Messages: 10 Registered: July 2009 |
Junior Member |
|
|
I got still a problem with that stuff, your suggestion is alright,
but the tooling I work with does not accept what I am providing to it ;)
the "createExtendedMetaDataAnnotations" method in the "xxxPackageImpl"
that is generated by the WID-SDO-generator (surely EMF-based tooling)
has an annotation entry:
addAnnotation
(operation1TypeEClass,
source,
new String[]
{
"name", "operation1_._type",
"kind", "elementOnly"
});
the interesting part is the "operation1_._type" which leads to exactly
that element in the XML output of the ***ResourceImpl.
This one is not accepted by (why not say it here) WPS at runtime.
If I change the entry to:
addAnnotation
(operation1TypeEClass,
source,
new String[]
{
"name", "operation1",//"operation1_._type",
"kind", "elementOnly"
});
(not that "operation1_._type" has been replaced by "operation1"),
then it is accepted and works.
Ed, if you get an idea here I would really appreciate!
Have a nice weekend.
Ed Merks wrote:
> Uwe,
>
> Comments below.
>
> Uwe Voigt wrote:
>> Hi,
>>
>> the schema appended below maps to a Java type 'Operation1' and
>> 'VariableTestInput' with String attribute 'name' created with the
>> SDO Generator of Websphere Integration Developer.
> I didn't think WID supported generated SDOs. Interesting...
>>
>> If I create XML using the XMLResourceFactoryImpl out of instances of
>> these types, this generates an element 'input' with the attribute 'name'.
> You need to use a resource implementation configured with the correct
> options. Here's how resources for XML-based models are normally
> configured by their generated factory:
>
> public Resource createResource(URI uri)
> {
> XMLResource result = new LibraryResourceImpl(uri);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
> Boolean.TRUE);
> return result;
> }
>
> If your model has a generated XyzResourceFactoryImpl, you should be
> using that to create your resource...
>>
>> But that doesn't match xml which has been created using the Generate
>> XML from Schema function out of WID.
>> How can I achieve that an element 'input' is created which has a child
>> element name instead of an attribue?
>>
>> Thanks!
>>
>>
>> <xsd:schema
>> targetNamespace="http://VariableAccessTest/process/TestProcessInterface"
>> xmlns:bons1="http://VariableAccessTest/data"
>> xmlns:tns="http://VariableAccessTest/process/TestProcessInterface"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>
>> <xsd:import namespace="http://VariableAccessTest/data"
>> schemaLocation="../VariableAccessTest/data/VariableTestInput.xsd "/>
>>
>> <xsd:element name="operation1">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element name="input1" nillable="true"
>> type="bons1:VariableTestInput"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> </xsd:schema>
>>
>>
>> with the VariableTestInput.xsd
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> targetNamespace="http://VariableAccessTest/data">
>> <xsd:complexType name="VariableTestInput">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:schema>
>>
>>
|
|
|
Re: Mapping XSD to XML element vs. attribute [message #417020 is a reply to message #417019] |
Fri, 22 February 2008 22:36 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Uwe,
WPS makes all kinds of changes to the base code we ship as well as
overriding a lot of it in derived classes...
What EMF generates for that anonymous type should work properly. What
exactly ends up not working? Note that an instance of such an anonymous
type can only be used as a child of the one element where the type is
defined...
Uwe Voigt wrote:
> I got still a problem with that stuff, your suggestion is alright,
> but the tooling I work with does not accept what I am providing to it ;)
>
> the "createExtendedMetaDataAnnotations" method in the "xxxPackageImpl"
> that is generated by the WID-SDO-generator (surely EMF-based tooling)
> has an annotation entry:
>
> addAnnotation
> (operation1TypeEClass,
> source,
> new String[]
> {
> "name", "operation1_._type",
> "kind", "elementOnly"
> });
>
>
> the interesting part is the "operation1_._type" which leads to exactly
> that element in the XML output of the ***ResourceImpl.
> This one is not accepted by (why not say it here) WPS at runtime.
> If I change the entry to:
> addAnnotation
> (operation1TypeEClass,
> source,
> new String[]
> {
> "name", "operation1",//"operation1_._type",
> "kind", "elementOnly"
> });
> (not that "operation1_._type" has been replaced by "operation1"),
>
> then it is accepted and works.
>
>
> Ed, if you get an idea here I would really appreciate!
>
> Have a nice weekend.
>
>
> Ed Merks wrote:
>> Uwe,
>>
>> Comments below.
>>
>> Uwe Voigt wrote:
>>> Hi,
>>>
>>> the schema appended below maps to a Java type 'Operation1' and
>>> 'VariableTestInput' with String attribute 'name' created with the
>>> SDO Generator of Websphere Integration Developer.
>> I didn't think WID supported generated SDOs. Interesting...
>>>
>>> If I create XML using the XMLResourceFactoryImpl out of instances of
>>> these types, this generates an element 'input' with the attribute
>>> 'name'.
>> You need to use a resource implementation configured with the correct
>> options. Here's how resources for XML-based models are normally
>> configured by their generated factory:
>>
>> public Resource createResource(URI uri)
>> {
>> XMLResource result = new LibraryResourceImpl(uri);
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>> Boolean.TRUE);
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>> Boolean.TRUE);
>>
>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>> Boolean.TRUE);
>>
>>
>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>> Boolean.TRUE);
>> return result;
>> }
>>
>> If your model has a generated XyzResourceFactoryImpl, you should be
>> using that to create your resource...
>>>
>>> But that doesn't match xml which has been created using the Generate
>>> XML from Schema function out of WID.
>>> How can I achieve that an element 'input' is created which has a
>>> child element name instead of an attribue?
>>>
>>> Thanks!
>>>
>>>
>>> <xsd:schema
>>> targetNamespace="http://VariableAccessTest/process/TestProcessInterface"
>>> xmlns:bons1="http://VariableAccessTest/data"
>>> xmlns:tns="http://VariableAccessTest/process/TestProcessInterface"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>
>>> <xsd:import namespace="http://VariableAccessTest/data"
>>> schemaLocation="../VariableAccessTest/data/VariableTestInput.xsd "/>
>>>
>>> <xsd:element name="operation1">
>>> <xsd:complexType>
>>> <xsd:sequence>
>>> <xsd:element name="input1" nillable="true"
>>> type="bons1:VariableTestInput"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> </xsd:element>
>>> </xsd:schema>
>>>
>>>
>>> with the VariableTestInput.xsd
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>> targetNamespace="http://VariableAccessTest/data">
>>> <xsd:complexType name="VariableTestInput">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> </xsd:schema>
>>>
>>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Mapping XSD to XML element vs. attribute [message #417021 is a reply to message #417020] |
Fri, 22 February 2008 23:05 |
Uwe Voigt Messages: 10 Registered: July 2009 |
Junior Member |
|
|
MMhh, I thought I could restrict that all to a core thematics which is EMF-related, but...
Originally this all is *very* WPS-related: I want to call a generic WPS-webservice
which expects any-typed arguments once in a while.
These arguments are application defined, XSDs actracted from WSDL or provided as-is.
Now the problem is that WPS-runtime rejects (which means they execute something like
isInstanceOf on the types) these SDO-generated XML-bound types.
I know that it is too much to expect an answer here to what they might have done (wrong?)
in WPS.
Only thought that I have missed something basically.
Thanks again.
Ed Merks wrote:
> Uwe,
>
> WPS makes all kinds of changes to the base code we ship as well as
> overriding a lot of it in derived classes...
> What EMF generates for that anonymous type should work properly. What
> exactly ends up not working? Note that an instance of such an anonymous
> type can only be used as a child of the one element where the type is
> defined...
>
> Uwe Voigt wrote:
>> I got still a problem with that stuff, your suggestion is alright,
>> but the tooling I work with does not accept what I am providing to it ;)
>>
>> the "createExtendedMetaDataAnnotations" method in the "xxxPackageImpl"
>> that is generated by the WID-SDO-generator (surely EMF-based tooling)
>> has an annotation entry:
>>
>> addAnnotation
>> (operation1TypeEClass,
>> source,
>> new String[]
>> {
>> "name", "operation1_._type",
>> "kind", "elementOnly"
>> });
>>
>> the interesting part is the "operation1_._type" which leads to exactly
>> that element in the XML output of the ***ResourceImpl.
>> This one is not accepted by (why not say it here) WPS at runtime.
>> If I change the entry to:
>> addAnnotation
>> (operation1TypeEClass,
>> source,
>> new String[]
>> {
>> "name", "operation1",//"operation1_._type",
>> "kind", "elementOnly"
>> }); (not that "operation1_._type" has been replaced by
>> "operation1"),
>>
>> then it is accepted and works.
>>
>>
>> Ed, if you get an idea here I would really appreciate!
>>
>> Have a nice weekend.
>>
>>
>> Ed Merks wrote:
>>> Uwe,
>>>
>>> Comments below.
>>>
>>> Uwe Voigt wrote:
>>>> Hi,
>>>>
>>>> the schema appended below maps to a Java type 'Operation1' and
>>>> 'VariableTestInput' with String attribute 'name' created with the
>>>> SDO Generator of Websphere Integration Developer.
>>> I didn't think WID supported generated SDOs. Interesting...
>>>>
>>>> If I create XML using the XMLResourceFactoryImpl out of instances of
>>>> these types, this generates an element 'input' with the attribute
>>>> 'name'.
>>> You need to use a resource implementation configured with the correct
>>> options. Here's how resources for XML-based models are normally
>>> configured by their generated factory:
>>>
>>> public Resource createResource(URI uri)
>>> {
>>> XMLResource result = new LibraryResourceImpl(uri);
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>> Boolean.TRUE);
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>> Boolean.TRUE);
>>>
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>> Boolean.TRUE);
>>>
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>> Boolean.TRUE);
>>>
>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>> Boolean.TRUE);
>>>
>>>
>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>> Boolean.TRUE);
>>> return result;
>>> }
>>>
>>> If your model has a generated XyzResourceFactoryImpl, you should be
>>> using that to create your resource...
>>>>
>>>> But that doesn't match xml which has been created using the Generate
>>>> XML from Schema function out of WID.
>>>> How can I achieve that an element 'input' is created which has a
>>>> child element name instead of an attribue?
>>>>
>>>> Thanks!
>>>>
>>>>
>>>> <xsd:schema
>>>> targetNamespace="http://VariableAccessTest/process/TestProcessInterface"
>>>> xmlns:bons1="http://VariableAccessTest/data"
>>>> xmlns:tns="http://VariableAccessTest/process/TestProcessInterface"
>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>>
>>>> <xsd:import namespace="http://VariableAccessTest/data"
>>>> schemaLocation="../VariableAccessTest/data/VariableTestInput.xsd "/>
>>>>
>>>> <xsd:element name="operation1">
>>>> <xsd:complexType>
>>>> <xsd:sequence>
>>>> <xsd:element name="input1" nillable="true"
>>>> type="bons1:VariableTestInput"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> </xsd:element>
>>>> </xsd:schema>
>>>>
>>>>
>>>> with the VariableTestInput.xsd
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>> targetNamespace="http://VariableAccessTest/data">
>>>> <xsd:complexType name="VariableTestInput">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> </xsd:schema>
>>>>
>>>>
|
|
|
Re: Mapping XSD to XML element vs. attribute [message #417026 is a reply to message #417021] |
Sat, 23 February 2008 11:40 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Uwe,
Comments below.
Uwe Voigt wrote:
> MMhh, I thought I could restrict that all to a core thematics which is
> EMF-related, but...
> Originally this all is *very* WPS-related: I want to call a generic
> WPS-webservice
> which expects any-typed arguments once in a while.
An object constructed according to an anonymous type can't be serialized
using an xsi:type because there is no way to refer to the type. Perhaps
WPS was trying to work around this intrinsic XML Schema limitation, but
it can't do that in a way that actually conforms to the schema.
> These arguments are application defined, XSDs actracted from WSDL or
> provided as-is.
> Now the problem is that WPS-runtime rejects (which means they execute
> something like isInstanceOf on the types) these SDO-generated
> XML-bound types.
Yes, I believe they like to assume that the implementation classes
derive from their base class implementation. This is achievable by
settings the root implements class and the root implements interface, so
I'm not sure why that option was never pursued. There seems to be some
fundamental dislike of generated APIs..
>
> I know that it is too much to expect an answer here to what they might
> have done (wrong?) in WPS.
I'm not actually sure what blocks support for generated APIs. Perhaps
the framework just makes assumptions about implementation classes that
shouldn't. It's a little frustrating that basic and extremely useful
things like generated APIs that ought to work don't...
> Only thought that I have missed something basically.
You seem to have a pretty good grasp on the situation...
>
> Thanks again.
>
> Ed Merks wrote:
>> Uwe,
>>
>> WPS makes all kinds of changes to the base code we ship as well as
>> overriding a lot of it in derived classes...
>> What EMF generates for that anonymous type should work properly.
>> What exactly ends up not working? Note that an instance of such an
>> anonymous type can only be used as a child of the one element where
>> the type is defined...
>>
>> Uwe Voigt wrote:
>>> I got still a problem with that stuff, your suggestion is alright,
>>> but the tooling I work with does not accept what I am providing to
>>> it ;)
>>>
>>> the "createExtendedMetaDataAnnotations" method in the "xxxPackageImpl"
>>> that is generated by the WID-SDO-generator (surely EMF-based tooling)
>>> has an annotation entry:
>>>
>>> addAnnotation
>>> (operation1TypeEClass,
>>> source,
>>> new String[]
>>> {
>>> "name", "operation1_._type",
>>> "kind", "elementOnly"
>>> });
>>> the interesting part is the "operation1_._type" which leads to exactly
>>> that element in the XML output of the ***ResourceImpl.
>>> This one is not accepted by (why not say it here) WPS at runtime.
>>> If I change the entry to:
>>> addAnnotation
>>> (operation1TypeEClass,
>>> source,
>>> new String[]
>>> {
>>> "name", "operation1",//"operation1_._type",
>>> "kind", "elementOnly"
>>> }); (not that "operation1_._type" has been replaced by
>>> "operation1"),
>>>
>>> then it is accepted and works.
>>>
>>>
>>> Ed, if you get an idea here I would really appreciate!
>>>
>>> Have a nice weekend.
>>>
>>>
>>> Ed Merks wrote:
>>>> Uwe,
>>>>
>>>> Comments below.
>>>>
>>>> Uwe Voigt wrote:
>>>>> Hi,
>>>>>
>>>>> the schema appended below maps to a Java type 'Operation1' and
>>>>> 'VariableTestInput' with String attribute 'name' created with the
>>>>> SDO Generator of Websphere Integration Developer.
>>>> I didn't think WID supported generated SDOs. Interesting...
>>>>>
>>>>> If I create XML using the XMLResourceFactoryImpl out of instances
>>>>> of these types, this generates an element 'input' with the
>>>>> attribute 'name'.
>>>> You need to use a resource implementation configured with the
>>>> correct options. Here's how resources for XML-based models are
>>>> normally configured by their generated factory:
>>>>
>>>> public Resource createResource(URI uri)
>>>> {
>>>> XMLResource result = new LibraryResourceImpl(uri);
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>> Boolean.TRUE);
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
>>>> Boolean.TRUE);
>>>>
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
>>>> Boolean.TRUE);
>>>>
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>> Boolean.TRUE);
>>>>
>>>> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
>>>> Boolean.TRUE);
>>>>
>>>>
>>>> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
>>>> Boolean.TRUE);
>>>> return result;
>>>> }
>>>>
>>>> If your model has a generated XyzResourceFactoryImpl, you should be
>>>> using that to create your resource...
>>>>>
>>>>> But that doesn't match xml which has been created using the
>>>>> Generate XML from Schema function out of WID.
>>>>> How can I achieve that an element 'input' is created which has a
>>>>> child element name instead of an attribue?
>>>>>
>>>>> Thanks!
>>>>>
>>>>>
>>>>> <xsd:schema
>>>>> targetNamespace="http://VariableAccessTest/process/TestProcessInterface"
>>>>> xmlns:bons1="http://VariableAccessTest/data"
>>>>> xmlns:tns="http://VariableAccessTest/process/TestProcessInterface"
>>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>>>
>>>>> <xsd:import namespace="http://VariableAccessTest/data"
>>>>> schemaLocation="../VariableAccessTest/data/VariableTestInput.xsd "/>
>>>>>
>>>>> <xsd:element name="operation1">
>>>>> <xsd:complexType>
>>>>> <xsd:sequence>
>>>>> <xsd:element name="input1" nillable="true"
>>>>> type="bons1:VariableTestInput"/>
>>>>> </xsd:sequence>
>>>>> </xsd:complexType>
>>>>> </xsd:element>
>>>>> </xsd:schema>
>>>>>
>>>>>
>>>>> with the VariableTestInput.xsd
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>>> targetNamespace="http://VariableAccessTest/data">
>>>>> <xsd:complexType name="VariableTestInput">
>>>>> <xsd:sequence>
>>>>> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
>>>>> </xsd:sequence>
>>>>> </xsd:complexType>
>>>>> </xsd:schema>
>>>>>
>>>>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Thu Apr 25 06:15:05 GMT 2024
Powered by FUDForum. Page generated in 0.03637 seconds
|