Adding extensions to the entry

View: New views
3 Messages — Rating Filter:   Alert me  

Adding extensions to the entry

by Zeenat Lainwala :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to add an extension to an entry. The extension itself is an
anonymous complex type with the following serialized form
<xns:rootElement xmlns:xns="http://www.test.com">
        <xns:elementA>valueA</xns:elementA>
        <xns:elementB>valueB<xns:elementB>
</xns:rootElement>

I tried the following code but it didn't work.
Element rootElement = atomFactory.newElement(new QName(
"http://www.test.com", "rootElement"));
Element elementA = atomFactory.newElement(new QName("http://www.test.com",
"elementA"));
Element elementB = atomFactory.newElement(new QName("http://www.test.com",
"elementB"));
elementA.setParentElement(rootElement);
elementB.setParentElement(rootElement);
entry.addExtension(rootElement);

The parent of elementA and elementB is set to rootElement but elementA and
elementB
are not set as the children of rootElement. Is this a bug?

Is there any other way to achieve this?

Thanks,
Zeenat
IBM Websphere Process Server
650 645 8159, T/L:337 8159
Cell: 650 483 4022
lainwala@...

Re: Adding extensions to the entry

by David Calavera :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nop, it's not a bug, there is other way to do that. You should use nested
elements, look at the code:

ExtensibleElement root = entry.addExtension(new QName("http://www.test.com",
"rootElement"));
root.addSimpleExtension(new QName("http://www.test.com", "elementA"),
"valueA");
root.addSimpleExtension(new QName("http://www.test.com", "elementB"),
"valueB");



On Tue, Jul 22, 2008 at 3:45 AM, Zeenat Lainwala <lainwala@...>
wrote:

> I am trying to add an extension to an entry. The extension itself is an
> anonymous complex type with the following serialized form
> <xns:rootElement xmlns:xns="http://www.test.com">
>        <xns:elementA>valueA</xns:elementA>
>        <xns:elementB>valueB<xns:elementB>
> </xns:rootElement>
>
> I tried the following code but it didn't work.
> Element rootElement = atomFactory.newElement(new QName(
> "http://www.test.com", "rootElement"));
> Element elementA = atomFactory.newElement(new QName("http://www.test.com",
> "elementA"));
> Element elementB = atomFactory.newElement(new QName("http://www.test.com",
> "elementB"));
> elementA.setParentElement(rootElement);
> elementB.setParentElement(rootElement);
> entry.addExtension(rootElement);
>
> The parent of elementA and elementB is set to rootElement but elementA and
> elementB
> are not set as the children of rootElement. Is this a bug?
>
> Is there any other way to achieve this?
>
> Thanks,
> Zeenat
> IBM Websphere Process Server
> 650 645 8159, T/L:337 8159
> Cell: 650 483 4022
> lainwala@...




--
David Calavera
http://www.thinkincode.net

Re: Adding extensions to the entry

by Zeenat Lainwala :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for the response.


Zeenat




"David Calavera" <david.calavera@...>
07/22/2008 12:07 AM
Please respond to
abdera-user@...


To
abdera-user@...
cc

Subject
Re: Adding extensions to the entry






Nop, it's not a bug, there is other way to do that. You should use nested
elements, look at the code:

ExtensibleElement root = entry.addExtension(new QName("http://www.test.com
",
"rootElement"));
root.addSimpleExtension(new QName("http://www.test.com", "elementA"),
"valueA");
root.addSimpleExtension(new QName("http://www.test.com", "elementB"),
"valueB");



On Tue, Jul 22, 2008 at 3:45 AM, Zeenat Lainwala <lainwala@...>
wrote:

> I am trying to add an extension to an entry. The extension itself is an
> anonymous complex type with the following serialized form
> <xns:rootElement xmlns:xns="http://www.test.com">
>        <xns:elementA>valueA</xns:elementA>
>        <xns:elementB>valueB<xns:elementB>
> </xns:rootElement>
>
> I tried the following code but it didn't work.
> Element rootElement = atomFactory.newElement(new QName(
> "http://www.test.com", "rootElement"));
> Element elementA = atomFactory.newElement(new QName("http://www.test.com
",
> "elementA"));
> Element elementB = atomFactory.newElement(new QName("http://www.test.com
",
> "elementB"));
> elementA.setParentElement(rootElement);
> elementB.setParentElement(rootElement);
> entry.addExtension(rootElement);
>
> The parent of elementA and elementB is set to rootElement but elementA
and

> elementB
> are not set as the children of rootElement. Is this a bug?
>
> Is there any other way to achieve this?
>
> Thanks,
> Zeenat
> IBM Websphere Process Server
> 650 645 8159, T/L:337 8159
> Cell: 650 483 4022
> lainwala@...




--
David Calavera
http://www.thinkincode.net

LightInTheBox - Buy quality products at wholesale price