You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Pranav, Savkur" <Pr...@siemens.com> on 2006/10/09 10:58:05 UTC

xerces-c-2.7.0: getDocumentElement returns NULL

Hello,
	We tried using xerces-c 2.7 version.
I downloaded the same from the apache website.
	Now as we parse XML Files by giving file names as below:

			m_pDOMParser = new
XERCES_CPP_NAMESPACE::XercesDOMParser;
			m_pDOMParser->resetDocumentPool();	
			if (m_pDOMParser!=NULL)
			{
			TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() m_pDOMParser not null");
			if(TRUE == m_bLoadSchema)
			{
				TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() will be loading schema...");
				// Load the Schema document
				// First get the schema file path
				CString strSchemaFile;
				CString strSchemaFilePath;
				BOOL bFuncRet =
SPVRegAcc::GetXMLFilePath(strSchemaFilePath);
				strSchemaFile = strSchemaFilePath +
_T("\\config\\");
				if(FALSE == m_bDBPatching)
				{
					strSchemaFile +=
m_XMLSchemaName;
				}
				else
				{
					//MOD V5.1.62 get the dbpatch
schema
					strSchemaFile +=
_T("SPV_DBPatch_Schema.xsd");
					//MOD V5.1.62 changes end
				}
				TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() m_pDOMParser found schema");

				
	
m_pDOMParser->setExternalNoNamespaceSchemaLocation(strSchemaFile);
				//Get all errors
	
m_pDOMParser->setExitOnFirstFatalError(true);
				//All validation errors are fatal.
	
m_pDOMParser->setValidationConstraintFatal(true);
				//Set the validation scheme
	
m_pDOMParser->setValidationScheme(XERCES_CPP_NAMESPACE::XercesDOMParser:
:Val_Auto );
				//Set schema validation
	
m_pDOMParser->setValidationSchemaFullChecking(false);
				//Use namespaces and schema
				m_pDOMParser->setDoNamespaces(true);
				m_pDOMParser->setDoSchema(true);  
				//MOD001V5.2:to correct  DF1487 change
start
	
m_pDOMParser->setIncludeIgnorableWhitespace(false);
				//MOD001V5.2:to correct  DF1487 change
end
				TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() setDoSchema");
				
				m_pDOMParser->parse(m_XMLFileName);	
				
				TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() done with Parse");
	
				m_ppDOMDocument =
m_pDOMParser->getDocument(); 
				
				if(NULL != m_ppDOMDocument)
				{
					TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() got m_ppDOMDocument");
					//populate rootnode pointer
					m_ppRootDOMNode =
m_ppDOMDocument->getDocumentElement();  
					if(m_ppRootDOMNode)
					{
						TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() got m_ppRootDOMNode");		
					}
					else
					{
						TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() NULL m_ppRootDOMNode");		
						sifRetCode =
ERR_FAILURE;
						m_strErrorString =
_T("Exception During Parsing the input XML File.Please check if the XML
input conforms to the
schema");
				}
			}
			}
			else
			{
				TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() will not load schema");
			}
		}
The rootDOMNode returned by the getDocument method is null.
The parse method does not throw any exception.getDocument also returns a
valid pointer.

This part was working fine with Xerces 2.2
Can any1 please let me know if something more needs to be done to get
this working.

Thanks and regards,
Pranav


The new company Nokia Siemens Networks is expected to start operations by January 1, 2007, subject to customary regulatory approvals, the completion of standard closing conditions, and the agreement of a number of detailed implementation steps.

Disclaimer:
This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

Re: xerces-c-2.7.0: getDocumentElement returns NULL

Posted by David Bertoni <db...@apache.org>.
Pranav, Savkur wrote:
> Hello,
>         We tried using xerces-c 2.7 version.
> I downloaded the same from the apache website.
>         Now as we parse XML Files by giving file names as below:
>

...

> The rootDOMNode returned by the getDocument method is null.
> The parse method does not throw any exception.getDocument also returns a 
> valid pointer.
> 
> This part was working fine with Xerces 2.2
> Can any1 please let me know if something more needs to be done to get 
> this working.

You need to install an ErrorHandler instance and see if any errors are 
being reported.

Xerces-C 2.2 is quite old, and the behavior in 2.2 might be due to a bug 
that has since been fixed.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org