2 #include "TypeConversions.hxx"
3 #include "XMLCORBAConv.hxx"
4 #include "CORBAXMLConv.hxx"
5 #include "CORBAPorts.hxx"
6 #include "TypeCode.hxx"
8 #include <libxml/parser.h>
13 #include "YacsTrace.hxx"
15 using namespace YACS::ENGINE;
18 XmlCorba::XmlCorba(InputCorbaPort* p)
19 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
23 void XmlCorba::put(const void *data) throw(ConversionException)
25 DEBTRACE((const char *)data);
26 put((const char *)data);
29 //!Convert a XML (char *) to CORBA::Any and push it in the proxy port
31 * \param data : Xml::char *
33 void XmlCorba::put(const char *data) throw(ConversionException)
40 doc = xmlParseMemory(data, strlen(data));
44 msg << "Problem in conversion: XML Document not parsed successfully ";
45 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
46 throw ConversionException(msg.str());
48 cur = xmlDocGetRootElement(doc);
53 msg << "Problem in conversion: empty XML Document";
54 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
55 throw ConversionException(msg.str());
59 if ((!xmlStrcmp(cur->name, (const xmlChar *)"value")))
63 a=convertXmlCorba(edGetType(),doc,cur);
65 catch(ConversionException)
72 msg << "Problem in conversion: kind= " << edGetType()->kind() ;
73 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
74 throw ConversionException(msg.str());
84 msg << "Problem in conversion: incorrect XML value";
85 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
86 throw ConversionException(msg.str());
91 _port->setStringRef(data);
92 //delete Any that has been allocated by convertXmlCorba