Thanks Dan, Here's the test output.
Here is the XML from XmlBeans: <?xml version="1.0" encoding="UTF-8"?> <Box xmlns="http://cisco.com/musebox/schemas/box"> <width>123</width> <height>123</height> </Box> Here is the message payload: <?xml version="1.0" encoding="UTF-8"?> <wsnp:MyMessage xmlns:wsnp="http://cisco.com/musebox/wsnp"> <width xmlns="http://cisco.com/musebox/schemas/box">123</width> <height xmlns="http://cisco.com/musebox/schemas/box">123</height> </wsnp:MyMessage> Here is another way of doing the same thing: <?xml version="1.0" encoding="UTF-8"?> <wsnp:MyMessage xmlns:wsnp="http://cisco.com/musebox/wsnp"> <width xmlns="http://cisco.com/musebox/schemas/box">123</width> <height xmlns="http://cisco.com/musebox/schemas/box">123</height> </wsnp:MyMessage> -----Original Message----- From: Daniel Jemiolo [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 08, 2006 10:14 AM To: [email protected] Subject: RE: xmlbeans and muse I'm guessing it's just a matter of DOM API usage, but for sanity checks, try running the following code and let me know what the output is: BoxDocument doc = BoxDocument.Factory.newInstance(); BoxType type = doc.addNewBoxType(); type.setWidth(100); type.setHeight(100); Document dom = (Document)doc.getDomNode(); Element boxElement = XmlUtils.getFirstElement(dom); System.out.println("Here is the XML from XmlBeans:\n"); System.out.println(XmlUtils.toString(boxElement)); QName name = new QName(NAMESPACE_URI, "MyMessage", PREFIX); Element payload = XmlUtils.createElement(name, boxElement); System.out.println("Here is the message payload:\n"); System.out.println(XmlUtils.toString(payload)); Element anotherTest = XmlUtils.createElement(name); XmlUtils.moveSubTree(boxElement, anotherTest); System.out.println("Here is another way of doing the same thing:\n"); System.out.println(XmlUtils.toString(anotherTest)); "Vinh Nguyen \(vinguye2\)" <[EMAIL PROTECTED]> wrote on 11/08/2006 04:59:53 AM: > I should also ask what type of objects are allowed to be passed in > notification messages? Just strings, or any Element object? I tried > the following code to translate my bean to an Element, but the > notification doesn't get sent out at all when creating the Element this > way. No errors are thrown either, so I can't figure out what is wrong > with the Element I'm using. This is even when I peek into the Element > by printing out it's namespaceURI, node name, etc., and it looks fine to > me. > > QName name = new QName(NAMESPACE_URI, "MyMessage", PREFIX); > Element payload = XmlUtils.createElement(name, > ((Document)doc.getDomNode()).getDocumentElement()); > > > > -----Original Message----- > From: Vinh Nguyen (vinguye2) > Sent: Wednesday, November 08, 2006 1:06 AM > To: [email protected] > Subject: xmlbeans and muse > > Hi all, > I'm using XmlBeans with Muse for working with custom object types. Can > anyone help with the following code? Basically, I'm trying to convert a > bean object to an xml Element object, which I can then pass to the > NotificationsProducer to send out notifications containing a custom > object. Then, later on the consumer side, I want to translate the xml > back to the bean. The problem is how to do the conversion to an > Element. I've tried several ways without success, or perhaps it's > because after seeing various xml output forms, I'm getting confused with > what the xml should look like in the console trace. Any help is > appreciated. Thanks! > -Vinh > > BoxDocument doc = BoxDocument.Factory.newInstance(); > BoxType type = doc.addNewBoxType(); > type.setWidth(100); > type.setHeight(100); > > Element payload = ... ? > > QName name = ... > NotificationProducer np = ... > np.publish(name, payload); > > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
