(new in Rev2.40)
MQXmlElement class manages XML data elements.
You can access XML data elements, text nodes and properties with multi-bytes characters in ANSI character code or wide characters in Unicode(UTF-16) through this class from plug-ins.
MQXmlElement MQXmlElement::AddChildElement(const char *name);
MQXmlElement MQXmlElement::AddChildElement(const wchar_t *name);
It adds a new XML element as a child node to this XML element.
BOOL MQXmlElement::RemoveChildElement(MQXmlElement child);
It deletes a child element.
MQXmlElement MQXmlElement::FirstChildElement(void);
MQXmlElement MQXmlElement::FirstChildElement(const char *name);
MQXmlElement MQXmlElement::FirstChildElement(const wchar_t *name);
It returns a top node in the child elements. And it returns a top node in the elements which element name is matched when you specified name.
It returns NULL if no child node exists or matched element name does not exist.
MQXmlElement MQXmlElement::NextChildElement(MQXmlElement child);
MQXmlElement MQXmlElement::NextChildElement(const char *name, MQXmlElement child);
MQXmlElement MQXmlElement::NextChildElement(const wchar_t *name, MQXmlElement child);
It returns a next child element. When name is specified, it returns the next child element which name matches. When a child element does not exist or it did not find matched name, it returns NULL.
You must call this function following FirstChildElement(). You can get all
the child elements by continue calling FirstChildElement() and NextChidlElement() until the return value is set to be
NULL.
Example All names and texts in all child nodes are written to the debug window in this sample. MQXmlElement child = elem->FirstChildElement(); while (child != NULL){ std::string name = child->GetName(); std::string text = child->GetText(); OutputDebugString("<%s>%s</%s>\n",name.c_str(),text.c_str(),name.c_str()); child = elem->NextChildElement(child); } |
MQXmlElement MQXmlElement::GetParentElement(void);
It gets a parent element.
std::string MQXmlElement::GetName(void);
std::wstring MQXmlElement::GetNameW(void);
It gets the element name.
std::string MQXmlElement::GetText(void);
std::wstring MQXmlElement::GetTextW(void);
BOOL MQXmlElement::GetText(std::string& result_str);
BOOL MQXmlElement::GetTextW(std::wstring& result_str);
It gets a value of a text node contained in the XML element.
std::string MQXmlElement::GetAttribute(const char *name);
std::wstring MQXmlElement::GetAttribute(const wchar_t *name);
BOOL MQXmlElement::GetAttribute(const char *name, std::string& result_str);
BOOL MQXmlElement::GetAttribute(const wchar_t *name, std::wstring& result_str);
It gets a value of the specified attribute contained in the XML element.
void MQXmlElement::SetText(const char *text);
void MQXmlElement::SetText(const wchar_t *text);
It adds a text node to the XML element.
void MQXmlElement::SetAttribute(const char *name, const char *value);
void MQXmlElement::SetAttribute(const wchar_t *name, const wchar_t *value);
It adds an attribute to the XML element.