2 #include "TypeConversions.hxx"
3 #include "XMLNeutralConv.hxx"
5 #include <libxml/parser.h>
11 #include "YacsTrace.hxx"
13 using namespace YACS::ENGINE;
16 XmlNeutral::XmlNeutral(InputPort* p)
17 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
21 void XmlNeutral::put(const void *data) throw(ConversionException)
23 DEBTRACE(" XmlNeutral::put(const void *data)");
24 put((const char *)data);
27 //!Convert received XML (char *) value to Neutral (Any *) value and send it to proxy port
29 * \param data : Xml::char *
32 void XmlNeutral::put(const char *data) throw(ConversionException)
34 DEBTRACE("XmlNeutral::put " << data);
37 YACS::ENGINE::Any *ob=NULL;
39 doc = xmlParseMemory(data, strlen(data));
43 msg << "Problem in conversion: XML Document not parsed successfully ";
44 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
45 throw ConversionException(msg.str());
47 cur = xmlDocGetRootElement(doc);
52 msg << "Problem in conversion: empty XML Document";
53 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
54 throw ConversionException(msg.str());
58 if ((!xmlStrcmp(cur->name, (const xmlChar *)"value")))
60 ob=convertXmlNeutral(edGetType(),doc,cur);
69 msg << "Problem in conversion: incorrect XML value";
70 msg << " (" << __FILE__ << ":" << __LINE__ << ")";
71 throw ConversionException(msg.str());