Exemple #1
0
DOM_Node XMLDocument::getNode(DOM_Node currNode, char* path, DataTypeAttribute** dtAttributes)
{
	if (path == NULL)
		return NULL_DOM_Node;

	char* currName = currNode.getNodeName().transcode();

  if (strcmp(currName, path) == 0 && (dtAttributes == NULL || doAttributesMatch(currNode, dtAttributes))) {
    delete[] currName;
		return currNode;
  }
  delete[] currName;

	char* cp = strchr(path, '.');
	char pathName[256];
	if (cp == NULL)
		strcpy(pathName, path);
	else
	{
		strncpy(pathName, path, cp - path);
		pathName[cp - path] = '\0';
	}

	DOM_Node child = currNode.getFirstChild();
	while (child != NULL)
	{
		char* childName = child.getNodeName().transcode();
		if (child.getNodeType() != DOM_Node::ELEMENT_NODE)
		{
			child = child.getNextSibling();
      delete[] childName;
			continue;
		}

		if (strcmp(pathName, childName) == 0)
		{
      if (cp != NULL) {
        delete[] childName;
				return getNode(child, cp+1, dtAttributes);
      }

			if (dtAttributes != NULL)
			{
				if (!doAttributesMatch(child, dtAttributes))
				{
					child = child.getNextSibling();
          delete[] childName;
					continue;
				}
			}

      delete[] childName;
			return child;
		}

    delete[] childName;
		child = child.getNextSibling();
	}
 	return NULL_DOM_Node;
}
Exemple #2
0
//======================================================================
//======================================================================
bool XMLDocument::setValue(DOM_Node currNode, char* path, DataTypeAttribute** dtAttributes, char* value)
{
	if (mDoc == NULL)
		return false;

	if (path == NULL)
		return false;

	DOM_Node child = getNode(currNode, path, dtAttributes);
	if (child == NULL)
		return false;
	DOM_Node parent = child.getParentNode();
	if (parent == NULL)
		return false;

	DOM_Node grandChild = child.getFirstChild();
	short nType = DOM_Node::TEXT_NODE;
	if (grandChild != NULL)
	{
		nType = grandChild.getNodeType();
		if (nType != DOM_Node::TEXT_NODE && nType != DOM_Node::CDATA_SECTION_NODE)
			return false;
	}

	char* childName = child.getNodeName().transcode();
	DOM_NamedNodeMap nnodeMap = child.getAttributes();

	parent.removeChild(child);
	DOM_Element childElement = mDoc.createElement(childName);
  delete[] childName;
	for (unsigned int i = 0; i < nnodeMap.getLength(); i++)
	{
		DOM_Node attNode = nnodeMap.item(i);
		childElement.setAttribute(attNode.getNodeName(), attNode.getNodeValue());
	}

	if (nType == DOM_Node::TEXT_NODE)
	{
		DOM_Text childText = mDoc.createTextNode((value == NULL)?"":value);
		childElement.appendChild(childText);
	}
	else
	{
		DOM_CDATASection childCData = mDoc.createCDATASection((value == NULL)?"":value);
		childElement.appendChild(childCData);
	}
	parent.appendChild(childElement);

	return true;
}
EppResponseDataTransferContact * EppResponseDataTransferContact::fromXML( const DOM_Node& root )
{
	EppResponseDataTransferContact * res = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("contact:id") )
		{
			if( res == null )
			{
				DOMString id = EppUtil::getText(node);
				res = new EppResponseDataTransferContact(id);
			}
		}
		else if( res != null )
		{
			res->fromXMLCommon(node, name);
		}
	}

	return res;
}
Exemple #4
0
//======================================================================
//======================================================================
bool XMLDocument::doAttributesMatch(DOM_Node currNode, DataTypeAttribute** dtAttributes)
{
	DOM_NamedNodeMap nnodeMap = currNode.getAttributes();
	int len = nnodeMap.getLength();
	int a = 0;
	DataTypeAttribute* dtAttribute;
	while ((dtAttribute = (DataTypeAttribute*)dtAttributes[a++]) != (DataTypeAttribute*)NULL)
	{
		bool isFound = false;
		for (int i = 0; i < len && !isFound; i++)
		{
			DOM_Node attNode = nnodeMap.item(i);
      char* tmp = attNode.getNodeName().transcode();
      char* tmp1 = attNode.getNodeValue().transcode();
			if (strcmp(dtAttribute->getName(), tmp) == 0 &&
				strcmp(dtAttribute->getValue(), tmp1) == 0)
			{
				isFound = true;
			}
      delete[] tmp;
      delete[] tmp1;
		}
		if (!isFound)
			return false;
	}

	return true;
}
EppCommandCheckContact * EppCommandCheckContact::fromXML( const DOM_Node& root )
{
	EppCommandCheckContact * cmd = new EppCommandCheckContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("id") || name.equals("contact:id") )
		{
			DOMString id = EppUtil::getText(node);
			cmd->addId(id);
		}
	}

	return cmd;
}
EppCommandLogin * EppCommandLogin::fromXML( const DOM_Node& root )
{
	EppCommandLogin * cmd = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("svcs") )
		{
			EppServiceMenu * menu = EppServiceMenu::fromXML(node);
			if( menu != null )
			{
				cmd = new EppCommandLogin(*menu);
				delete menu;
				return cmd;
			}
		}
	}

	return null;
}
Exemple #7
0
//======================================================================
// CJM 4/17/03 ..Needed to update an attribute list... for ContentGuard
//======================================================================
bool XMLDocument::setAttributeList(char* path, DataTypeAttribute** dtAttributes)
{
	if (mDoc == NULL)
		return false;

	if (path == NULL)
		return false;

	DOM_Node child = getNode(mRootNode, path, NULL);
	char* value = getString(path);

	if (child == NULL)
		return false;

	short nType = child.getNodeType();

	DOM_Node parent = child.getParentNode();
	if (parent == NULL)
		return false;

	char* childName = child.getNodeName().transcode();
	DOM_NamedNodeMap nnodeMap = child.getAttributes();

	parent.removeChild(child);
	DOM_Element childElement = mDoc.createElement(childName);
  delete[] childName;

	int a = 0;
	DataTypeAttribute* dtAttribute;
	while ((dtAttribute = (DataTypeAttribute*)dtAttributes[a++]) != (DataTypeAttribute*)NULL)
	{

		childElement.setAttribute(dtAttribute->getName(), dtAttribute->getValue());
	}

	if (nType == DOM_Node::TEXT_NODE)
	{
		DOM_Text childText = mDoc.createTextNode((value == NULL)?"":value);
		childElement.appendChild(childText);
	}
	else
	{
		if (nType == DOM_Node::CDATA_SECTION_NODE)
		{
			DOM_CDATASection childCData = mDoc.createCDATASection((value == NULL)?"":value);
			childElement.appendChild(childCData);
		}
	}

	parent.appendChild(childElement);

	return true;

}
EppCommandInfoSvcsub * EppCommandInfoSvcsub::fromXML( const DOM_Node& root )
{
	EppCommandInfoSvcsub * cmd = null;
	EppAuthInfo * authInfo = null;
	DOMString userid = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("svcsub:id") )
		{
			DOMString id = EppUtil::getText(node);
			if( cmd == null )
			{
				cmd = new EppCommandInfoSvcsub(id);
			}
		}
//		if( name.equals("userid") )
		if( name.equals("userid") || name.equals("svcsub:userid") )
		{
			userid = EppUtil::getText(node);
		}
//		else if( name.equals("authInfo") )
		else if( name.equals("authInfo") || name.equals("svcsub:authInfo") )
		{
			if( authInfo == null )
			{
				authInfo = EppAuthInfo::fromXML(node);
			}
		}
	}
	if( cmd != null )
	{
		cmd->authInfo = authInfo;
		cmd->userid = userid;
	}
	else if( authInfo != null )
	{
		delete authInfo;
	}

	return cmd;
}
EppContact * EppContact::fromXML( const DOM_Node& root )
{
	EppContact * contact = new EppContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 8).equals("contact:") )
		{
			name = name.substringData(8, name.length() - 8);
		}
		if( name.equals("id") )
		{
			contact->id = EppUtil::getText(node);
		}
		else if( name.equals("ascii") )
		{
			contact->ascii = EppContactData::fromXML(node);
		}
		else if( name.equals("i15d") )
		{
			contact->i15d = EppContactData::fromXML(node);
		}
		else if( name.equals("voice") )
		{
			contact->voice = EppE164::fromXML(node);
		}
		else if( name.equals("fax") )
		{
			contact->fax = EppE164::fromXML(node);
		}
		else if( name.equals("email") )
		{
			contact->email = EppUtil::getText(node);
		}
		else
		{
			contact->fromXMLCommon(node, name);
		}
	}

	return contact;
}
Exemple #10
0
DOM_Node XMLDocument::clone(DOM_Node currNode)
{
	switch (currNode.getNodeType())
	{
		case DOM_Node::ELEMENT_NODE:
		{
			DOM_Element elem = mDoc.createElement(currNode.getNodeName());
			DOM_NamedNodeMap nnodeMap = currNode.getAttributes();
			for (unsigned int i = 0; i < nnodeMap.getLength(); i++)
			{
				DOM_Node attNode = nnodeMap.item(i);
				elem.setAttribute(attNode.getNodeName(), attNode.getNodeValue());
			}
			DOM_Node child = currNode.getFirstChild();
			while (child != NULL)
			{
				DOM_Node cNode = clone(child);
				if (cNode != NULL)
					elem.appendChild(cNode);
				child = child.getNextSibling();
			}
			return (DOM_Node)elem;
		}
		case DOM_Node::TEXT_NODE:
		{
			DOM_Text childText = mDoc.createTextNode(currNode.getNodeValue());
			return (DOM_Node)childText;
		}
		case DOM_Node::CDATA_SECTION_NODE:
		{
			DOM_CDATASection childCData = mDoc.createCDATASection(currNode.getNodeValue());
			return (DOM_Node)childCData;
		}
		default:
		{
			return NULL_DOM_Node;
		}
	}
}
EppCommandRenew * EppCommandRenew::fromXML( const DOM_Node& root )
{
	DOMString command = root.getLocalName();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString prefix = node.getPrefix();
		DOMString name = node.getLocalName();
/*
		if( (prefix == null) || (name == null) )
		{
			continue;
		}
		if( name.equals(command) )
		{
			if( prefix.equals("domain") )
			{
				return EppCommandRenewDomain.fromXML(node);
			}
			else if( prefix.equals("svcsub") )
			{
				return EppCommandRenewSvcsub.fromXML(node);
			}
		}
*/
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name.equals("domain:renew") )
		{
			return EppCommandRenewDomain::fromXML(node);
		}
		else if( name.equals("svcsub:renew") )
		{
			return EppCommandRenewSvcsub::fromXML(node);
		}
	}

	return null;
}
EppHost * EppHost::fromXML( const DOM_Node& root )
{
	EppHost * host = new EppHost();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 5).equals("host:") )
		{
			name = name.substringData(5, name.length() - 5);
		}
		if( name.equals("name") )
		{
			host->setName(EppUtil::getText(node));
		}
		else if( name.equals("addr") )
		{
			EppIpAddress * ip = EppIpAddress::fromXML(node);
			if ( ip != null )
			{
				host->addAddress(*ip);
				delete ip;
			}
		}
		else
		{
			host->fromXMLCommon(node, name);
		}
	}

   	return host;
}
EppResponseDataCreateDomain * EppResponseDataCreateDomain::fromXML( const DOM_Node& root )
{
	DOMString roid = null;
	DOMString domain = null;
	time_t exDate = 0;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("roid") )
		if( name.equals("roid") || name.equals("domain:roid") )
		{
			roid = EppUtil::getText(node);
		}
//		else if( name.equals("name") )
		else if( name.equals("name") || name.equals("domain:name") )
		{
			domain = EppUtil::getText(node);
		}
//		else if( name.equals("exDate") )
		else if( name.equals("exDate") || name.equals("domain:exDate") )
		{
			exDate = EppUtil::getDate(node);
		}
	}

	return new EppResponseDataCreateDomain(domain, roid, exDate);
}
// ---------------------------------------------------------------------------
//  ostream << DOM_Node
//
//  Stream out a DOM node, and, recursively, all of its children. This
//  function is the heart of writing a DOM tree out as XML source. Give it
//  a document node and it will do the whole thing.
// ---------------------------------------------------------------------------
ostream& operator<<(ostream& target, DOM_Node& toWrite)
{
    // Get the name and value out for convenience
    DOMString   nodeName = toWrite.getNodeName();
    DOMString   nodeValue = toWrite.getNodeValue();
    unsigned long lent = nodeValue.length();

    switch (toWrite.getNodeType())
    {
        case DOM_Node::TEXT_NODE:
        {
            gFormatter->formatBuf(nodeValue.rawBuffer(),
                                  lent, XMLFormatter::CharEscapes);
            break;
        }


        case DOM_Node::PROCESSING_INSTRUCTION_NODE :
        {
            *gFormatter << XMLFormatter::NoEscapes << gStartPI  << nodeName;
            if (lent > 0)
            {
                *gFormatter << chSpace << nodeValue;
            }
            *gFormatter << XMLFormatter::NoEscapes << gEndPI;
            break;
        }


        case DOM_Node::DOCUMENT_NODE :
        {

            DOM_Node child = toWrite.getFirstChild();
            while( child != 0)
            {
                target << child;
                // add linefeed in requested output encoding
                *gFormatter << chLF;
                target << flush;
                child = child.getNextSibling();
            }
            break;
        }


        case DOM_Node::ELEMENT_NODE :
        {
            // The name has to be representable without any escapes
            *gFormatter  << XMLFormatter::NoEscapes
                         << chOpenAngle << nodeName;

            // Output the element start tag.

            // Output any attributes on this element
            DOM_NamedNodeMap attributes = toWrite.getAttributes();
            int attrCount = attributes.getLength();
            for (int i = 0; i < attrCount; i++)
            {
                DOM_Node  attribute = attributes.item(i);

                //
                //  Again the name has to be completely representable. But the
                //  attribute can have refs and requires the attribute style
                //  escaping.
                //
                *gFormatter  << XMLFormatter::NoEscapes
                             << chSpace << attribute.getNodeName()
                             << chEqual << chDoubleQuote
                             << XMLFormatter::AttrEscapes
                             << attribute.getNodeValue()
                             << XMLFormatter::NoEscapes
                             << chDoubleQuote;
            }

            //
            //  Test for the presence of children, which includes both
            //  text content and nested elements.
            //
            DOM_Node child = toWrite.getFirstChild();
            if (child != 0)
            {
                // There are children. Close start-tag, and output children.
                // No escapes are legal here
                *gFormatter << XMLFormatter::NoEscapes << chCloseAngle;

                while( child != 0)
                {
                    target << child;
                    child = child.getNextSibling();
                }

                //
                // Done with children.  Output the end tag.
                //
                *gFormatter << XMLFormatter::NoEscapes << gEndElement
                            << nodeName << chCloseAngle;
            }
            else
            {
                //
                //  There were no children. Output the short form close of
                //  the element start tag, making it an empty-element tag.
                //
                *gFormatter << XMLFormatter::NoEscapes << chForwardSlash << chCloseAngle;
            }
            break;
        }


        case DOM_Node::ENTITY_REFERENCE_NODE:
            {
                DOM_Node child;
#if 0
                for (child = toWrite.getFirstChild();
                child != 0;
                child = child.getNextSibling())
                {
                    target << child;
                }
#else
                //
                // Instead of printing the refernece tree
                // we'd output the actual text as it appeared in the xml file.
                // This would be the case when -e option was chosen
                //
                    *gFormatter << XMLFormatter::NoEscapes << chAmpersand
                        << nodeName << chSemiColon;
#endif
                break;
            }


        case DOM_Node::CDATA_SECTION_NODE:
            {
            *gFormatter << XMLFormatter::NoEscapes << gStartCDATA
                        << nodeValue << gEndCDATA;
            break;
        }


        case DOM_Node::COMMENT_NODE:
        {
            *gFormatter << XMLFormatter::NoEscapes << gStartComment
                        << nodeValue << gEndComment;
            break;
        }


        case DOM_Node::DOCUMENT_TYPE_NODE:
        {
            DOM_DocumentType doctype = (DOM_DocumentType &)toWrite;;

            *gFormatter << XMLFormatter::NoEscapes  << gStartDoctype
                        << nodeName;

            DOMString id = doctype.getPublicId();
            if (id != 0)
            {
                *gFormatter << XMLFormatter::NoEscapes << chSpace << gPublic
                    << id << chDoubleQuote;
                id = doctype.getSystemId();
                if (id != 0)
                {
                    *gFormatter << XMLFormatter::NoEscapes << chSpace
                       << chDoubleQuote << id << chDoubleQuote;
                }
            }
            else
            {
                id = doctype.getSystemId();
                if (id != 0)
                {
                    *gFormatter << XMLFormatter::NoEscapes << chSpace << gSystem
                        << id << chDoubleQuote;
                }
            }

            id = doctype.getInternalSubset();
            if (id !=0)
                *gFormatter << XMLFormatter::NoEscapes << chOpenSquare
                            << id << chCloseSquare;

            *gFormatter << XMLFormatter::NoEscapes << chCloseAngle;
            break;
        }


        case DOM_Node::ENTITY_NODE:
        {
            *gFormatter << XMLFormatter::NoEscapes << gStartEntity
                        << nodeName;

            DOMString id = ((DOM_Entity &)toWrite).getPublicId();
            if (id != 0)
                *gFormatter << XMLFormatter::NoEscapes << gPublic
                            << id << chDoubleQuote;

            id = ((DOM_Entity &)toWrite).getSystemId();
            if (id != 0)
                *gFormatter << XMLFormatter::NoEscapes << gSystem
                            << id << chDoubleQuote;

            id = ((DOM_Entity &)toWrite).getNotationName();
            if (id != 0)
                *gFormatter << XMLFormatter::NoEscapes << gNotation
                            << id << chDoubleQuote;

            *gFormatter << XMLFormatter::NoEscapes << chCloseAngle << chLF;

            break;
        }


        case DOM_Node::XML_DECL_NODE:
        {
            DOMString  str;

            *gFormatter << gXMLDecl1 << ((DOM_XMLDecl &)toWrite).getVersion();

            *gFormatter << gXMLDecl2 << gEncodingName;

            str = ((DOM_XMLDecl &)toWrite).getStandalone();
            if (str != 0)
                *gFormatter << gXMLDecl3 << str;

            *gFormatter << gXMLDecl4;

            break;
        }


        default:
            cerr << "Unrecognized node type = "
                 << (long)toWrite.getNodeType() << endl;
    }
    return target;
}
EppCommand * EppCommand::fromXML( const DOM_Node& root )
{
	unsigned int i;
	EppCommand * cmd = null;
	DOM_Node command;
	bool found = false;

	DOM_NodeList list = root.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("command") )
		{
			command = node;
			found = true;
			break;
		}
	}

	if( found == false )
	{
		return null;
	}

	list = command.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("login") )
		{
			cmd = EppCommandLogin::fromXML(node);
		}
		else if( name.equals("logout") )
		{
			cmd = EppCommandLogout::fromXML(node);
		}
		else if( name.equals("poll") )
		{
			cmd = EppCommandPoll::fromXML(node);
		}
		else if( name.equals("create") )
		{
			cmd = EppCommandCreate::fromXML(node);
		}
		else if( name.equals("delete") )
		{
			cmd = EppCommandDelete::fromXML(node);
		}
		else if( name.equals("info") )
		{
			cmd = EppCommandInfo::fromXML(node);
		}
		else if( name.equals("check") )
		{
			cmd = EppCommandCheck::fromXML(node);
		}
		else if( name.equals("renew") )
		{
			cmd = EppCommandRenew::fromXML(node);
		}
		else if( name.equals("transfer") )
		{
			cmd = EppCommandTransfer::fromXML(node);
		}
		else if( name.equals("update") )
		{
			cmd = EppCommandUpdate::fromXML(node);
		}
		/*
		 * other commands
		 */
		if( cmd != null )
		{
			break;
		}
	}
	if( cmd == null )
	{
		return null;
	}
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("creds") )
		{
			if( cmd->creds == null )
			{
				cmd->creds = EppCreds::fromXML(node);
			}
		}
		else if( name.equals("unspec") )
		{
			if( cmd->unspec == null )
			{
				cmd->unspec = EppUnspec::fromXML(node);
			}
		}
		else if( name.equals("clTRID") )
		{
			cmd->clTRID = EppUtil::getText(node);
		}
	}

	return cmd;
}
Exemple #16
0
char* XMLDocument::encode(DOM_Node currNode)
{
	string result = "";

	if (currNode == NULL)
		return strclone((char*)result.c_str());

	switch (currNode.getNodeType())
	{
		case DOM_Node::ELEMENT_NODE:
		{
      char* tmp = currNode.getNodeName().transcode();
			result += (string)"<" + (string)tmp;
      delete[] tmp;
			DOM_NamedNodeMap nnodeMap = currNode.getAttributes();
			for (unsigned int i = 0; i < nnodeMap.getLength(); i++)
			{
				DOM_Node attNode = nnodeMap.item(i);
        tmp = attNode.getNodeName().transcode();
        char* tmp1 = attNode.getNodeValue().transcode();
				result += (string)" " + (string)tmp + (string)"=\"" + (string)tmp1 + (string)"\"";
        delete[] tmp;
        delete[] tmp1;
			}
			result += (string)">";
			DOM_Node child = currNode.getFirstChild();
			while (child != NULL)
			{
				char *childStr = encode(child);
				result += childStr;
				delete[] childStr;
				child = child.getNextSibling();
			}
      tmp = currNode.getNodeName().transcode();
			result += (string)"</" + (string)tmp + ">";
      delete[] tmp;

			return strclone((char*)result.c_str());
		}
		case DOM_Node::TEXT_NODE:
		case DOM_Node::CDATA_SECTION_NODE:
		{
			static char reservedChars[] = "<>&'\"";
			char *str = currNode.getNodeValue().transcode();
			bool bSpecialChars = false;
			int len = strlen(str);
			for (int i = 0; i < len; i++)
			{
				if (strchr(reservedChars, str[i]) != NULL)
				{
					bSpecialChars = true;
					break;
				}
			}
			if (bSpecialChars == false)
				result += (string)str;
			else
				result += (string)"<![CDATA[" + (string)str + (string)"]]>";
      delete[] str;
			return strclone((char*)result.c_str());
		}
		default:
		{
			return strclone((char*)result.c_str());
		}
	}
}
EppGreeting * EppGreeting::fromXML( const DOM_Node &root )
{
	unsigned int i;
	EppGreeting * greeting = null;
	DOM_NodeList list = root.getChildNodes();
	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("greeting") )
		{
			greeting = new EppGreeting();
			list = node.getChildNodes();
			break;
		}
	}

	if( greeting == null )
	{
		return null;
	}

	for( i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("svID") )
		{
			greeting->svID = EppUtil::getText(node);
		}
		else if( name.equals("svDate") )
		{
			greeting->svDate = EppUtil::getDate(node);
		}
		else if( name.equals("svcMenu") )
		{
			if( greeting->svcMenu != null )
			{
				delete greeting->svcMenu;
			}
			greeting->svcMenu = EppServiceMenu::fromXML(node);
		}
	}

	return greeting;
}
Components::ConfigValues*
Properties::getConfigValues()
{
	char* fileName = strdup( descriptor_.c_str() );
	parser_->parse( fileName );
	document_ = parser_->getDocument();
	DOM_Element property = document_.getDocumentElement();
	
	Components::ConfigValues* config = new Components::ConfigValues();
	int len = 0;
	DOM_Node child = property.getFirstChild();
    while( child != 0)
    {
		// simple
		if( ( child.getNodeType() == DOM_Node::ELEMENT_NODE ) &&
			( child.getNodeName().equals( "simple" ) ) )
		{
			DOM_NodeList nodeList;
			DOM_Element simple = ( DOM_Element& )child;
			std::string type = simple.getAttribute( "type" ).transcode();
			std::string name = simple.getAttribute( "name" ).transcode();

			nodeList = simple.getElementsByTagName( "value" );
			DOM_Element value = ( const DOM_Element& )nodeList.item( 0 );

			CORBA::Any any;
			std::string val = value.getFirstChild().getNodeValue().transcode();
			
			if( type == "boolean" )
			{
				CORBA::Boolean v;
				if( val == "true" )
				{
					v = true;
				}
				else
				{
					v = false;
				}
				any <<= CORBA::Any::from_boolean( v );
			}

			if( type == "char" )
			{
				CORBA::Char v = val[0];
				any <<= CORBA::Any::from_char( v );
			}

			if( type == "double" )
			{
				CORBA::Double v = atof( val.c_str() );
				any <<= v;
			}

			if( type == "float" )
			{
				CORBA::Float v = atof( val.c_str() );
				any <<= v;
			}

			if( type == "short" )
			{
				CORBA::Short v = atoi( val.c_str() );
				any <<= v;
			}

			if( type == "long" )
			{
				CORBA::Long v = atol( val.c_str() );
				any <<= v;
			}

			if( type == "objref" )
			{
				// TODO
			}

			if( type == "octet" )
			{
				CORBA::Octet v = val[0];
				any <<= CORBA::Any::from_octet( v );
			}

			if( type == "string" )
			{
				any <<= val.c_str();
			}

			if( type == "ulong" )
			{
				CORBA::ULong v = atol( val.c_str() );
				any <<= v;
			}

			if( type == "ushort" )
			{
				CORBA::UShort v = atol( val.c_str() );
				any <<= v;
			}

			// new config entry
			config->length( ++len );
			( *config )[len - 1] = new ConfigValue_impl( CORBA::string_dup( name.c_str() ), any );
		}

		// sequence
		if( ( child.getNodeType() == DOM_Node::ELEMENT_NODE ) &&
			( child.getNodeName().equals( "sequence" ) ) )
		{
		}

		// struct
		if( ( child.getNodeType() == DOM_Node::ELEMENT_NODE ) &&
			( child.getNodeName().equals( "struct" ) ) )
		{
		}

		// value
		if( ( child.getNodeType() == DOM_Node::ELEMENT_NODE ) &&
			( child.getNodeName().equals( "valuetype" ) ) )
		{
		}

		// next element
		child = child.getNextSibling();
	}

	return config;
}