Thanks! But one more question, I have to put this in the message element:

<Batch OnError="Return">
   <Method ID="1" Cmd="New">
       <Field Name="Title">nom</Field>
       <Field Name="FirstName">FirstName</Field>
       <Field Name="Email">[EMAIL PROTECTED]</Field>
   </Method>
</Batch>

I wrote this, but I know I got a mistake somewhere... I don't think it output the right XML. (I am trying to use getAsString() to see the output, without success)

MessageElement me[] = new MessageElement[1];
me[0] = new MessageElement (new QName(namespaceUri, "Batch"));
me[0].addAttribute(namespaceUri, "OnError", "Return");
MessageElement method = (MessageElement)me[0].addChildElement("Method");
method.addAttribute(namespaceUri, "ID", "1");
method.addAttribute(namespaceUri, "Cmd", "New");
MessageElement title = (MessageElement)method.addChildElement("Title");
title.addTextNode("Nom");
MessageElement firstname = (MessageElement)method.addChildElement("FirstName");
firstname.addTextNode("First Name");
MessageElement email = (MessageElement)method.addChildElement("Email");
email.addTextNode("[EMAIL PROTECTED]");

Thank you so much.

Mona


----- Message d'origine ----- De : "Jaka Mocnik" <[EMAIL PROTECTED]>
À : <[email protected]>
Envoyé : 31 mai 2006 14:16
Objet : Re: Help on creating a MessageElement


On Wed, 2006-05-31 at 13:50 -0400, Mona Yazbeck wrote:
Hi Jaka,

I get a compilation error when trying to call my constructor with the root
element. I guess it's because the constructor is waiting for a
MessageElement[] (an array).
        cannot resolve symbol
        symbol: constructor
UpdateListItemsUpdates(org.apache.axis.message.MessageElement)
ok, I completely misunderstood you before.

so you want to have a MessageElement[] array that represents the
children of the Method element you decribe in your original post?
simple:

MessageElement me[] = new MessageElement[3];

now for each me[0..2] create a new MessageElement:

me[i] = new MessageElement(new QName(namespaceUri, elementName));

add appropriate attributes:

me[i].addAttribute(namespaceUri, attributeName, attributeValue);

finally, add text content of the element:

me[i].addTextNode(contentOfTheElement);

I believe this will create the appropriate MessageElements...

regards,
 jaKa

--
email: [EMAIL PROTECTED]
w3:    http://fish.homeunix.org/people/jaka



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to