Multilingual XML Parsing problem...Please Help !!
Hello Every One,
I have an application that is supposed to read the content from the XML file and display them on the screen. XML file generated by a Java Application, this XML corresponds to the Property Object in Java i.e. in java i am using PropertyFile object to load this XML. When i try to load that XML in my application using the following code i am unable to get the list of child nodes from it.
XMLPlatformUtils::Initialize();
DTDValidator * dtdValidator = NULL;
xercesc_2_6::XercesDOMParser *parser = NULL;
xercesc_2_6::AbstractDOMParser::ValSchemes valScheme = xercesc_2_6::AbstractDOMParser::Val_Auto;
dtdValidator =new DTDValidator();
parser =new XercesDOMParser(dtdValidator);
parser->setValidationScheme(valScheme);
CString szPath = m_szFileName;
parser->parse( T2A( (LPTSTR)szPath.GetBuffer(szPath.GetLength()) ) );
int nErrorCount = parser->getErrorCount();
xercesc_2_6::DOMDocument *pDocument = parser->getDocument();
if(pDocument == NULL)
{
delete parser;
XMLPlatformUtils::Terminate();
return;
}
//Properties
xercesc_2_6::DOMNode *nodeProperties = pDocument->getFirstChild();
if(nodeProperties == NULL)
{
delete parser;
XMLPlatformUtils::Terminate();
return;
}
//This should return TRUE but it giving me false.
bool bChild = nodeProperties->hasChildNodes();
Can any one please tell me where i am going wrongwhile parsing the following XML. The XML file is UNICODE format.
<?xml version="1.0" encoding="UTF-16"?>
<!DOCTYPE properties SYSTEM"http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>My XML File</comment>
<entry key="KEY2">京 喂</entry>
<entry key="KEY1">京 京 喂</entry>
<entry key="KEY5">京 京 喂</entry>
<entry key="KEY4">京 京</entry>
<entry key="KEY3">京 京 喂</entry>
</properties>
With Regards,
KS

