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)

Here's the code I used (sBatch is the XML in a string):
Document document;
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
ByteArrayInputStream stream=new ByteArrayInputStream(sBatch.getBytes());
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(stream);
Element root = document.getDocumentElement();

org.apache.axis.message.MessageElement xbatch = new org.apache.axis.message.MessageElement(root);
UpdateListItemsUpdates obj = new UpdateListItemsUpdates(xbatch);

----

If I want to create the tree manually as I wrote below, how can I add the root element and the attributes to it, can I see an example of that?

org.apache.axis.message.MessageElement[] xbatch = new
org.apache.axis.message.MessageElement[3];
xbatch[0] = new org.apache.axis.message.MessageElement(new
javax.xml.namespace.QName("Title"),"Last Name");
xbatch[1] = new org.apache.axis.message.MessageElement(new
javax.xml.namespace.QName("FirstName"),"First Name");
xbatch[2] = new org.apache.axis.message.MessageElement(new
javax.xml.namespace.QName("Email"),"Email");

Thank again!


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


On Wed, 2006-05-31 at 11:26 -0400, Mona Yazbeck wrote:
Hello

I started parsing my XML to DOM, but then, even if I create a new message
element with the root of the DOM, I will get an error, because it seems like I really need a MessageElement as an array since the contructor of my other
method is:

public UpdateListItemsUpdates(org.apache.axis.message.MessageElement []
_any) {
           this._any = _any;
}

So then, how can I put my XML file in an array of MessageElement?

<Method ID='1' Cmd='New'>
    <Field Name='Title'>Nom</Field>
    <Field Name='FirstName'>Prenom</Field>
    <Field Name='Email'>[EMAIL PROTECTED]</Field>
</Method>

I tried this way:

 org.apache.axis.message.MessageElement[] xbatch = new
org.apache.axis.message.MessageElement[3];
 xbatch[0] = new org.apache.axis.message.MessageElement(new
javax.xml.namespace.QName("Title"),"Last Name");
 xbatch[1] = new org.apache.axis.message.MessageElement(new
javax.xml.namespace.QName("FirstName"),"First Name");
 xbatch[2] = new org.apache.axis.message.MessageElement(new
javax.xml.namespace.QName("Email"),"Email");

but I don't know how to put the root element in this kind of structure...
I was more thinking of parsing the XML in a string, using a
DocumentBuilder, which yields a document with a single root Element (the
Method element), you wrap that one in a MessageElement with

me = new MessageElement(root);

and use that one as the parameter updateListItems().

of course you can construct the DOM tree manually as you intended to do
above, but then create the root message element, add the child elements
to it and don't forget about the attributes...

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