Click to See Complete Forum and Search --> : XML DTD ;HELP!!


Eric Zenkner
September 21st, 2000, 08:01 AM
Hei!
I have a problem to write the DTD section to a new
XML file. I'm using MS VC++ and the DOM-Interface.
When i try to get an MSXML::IXMLDOMDocumentType invoked I use pDoc->get_doctype(&pDocumentType);
and it returns NULL. Can you send me some code
in c++ or VB?

Thank you!

charlass
September 25th, 2000, 02:07 AM
Hmm... it's hard to give you a hint without knowing the details.
But you could use this code to detect the error reason. I'm posting this because I had a hard time to detect this and maybe I'm not the only one ;)


HRESULT hr = pDoc->any_function...


pErrorInfo->comErrorCode = hr;
::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, (DWORD)pErrorInfo->comErrorCode,
MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT),
pErrorInfo->comErrorText, CCNT(pErrorInfo->comErrorText), 0);

if( pDoc)
{
MSXML::IXMLDOMParseError *pParseError;
if( pDoc->get_parseError( &pParseError) == S_OK)
{
pParseError->get_reason ( &pErrorInfo->xmlErrorReason);
pParseError->get_errorCode ( &pErrorInfo->xmlErrorCode);
pParseError->get_line ( &pErrorInfo->xmlErrorLineNumber);
pParseError->get_linepos ( &pErrorInfo->xmlErrorLinePos);
pParseError->get_filepos ( &pErrorInfo->xmlErrorFilePos);
pParseError->get_srcText ( &pErrorInfo->xmlSourceString);
pParseError->get_url ( &pErrorInfo->xmlUrl);

COM_RELEASE(pParseError);
}
}

Eric Zenkner
September 25th, 2000, 02:34 AM
Thanks for your help. I found it very useful for XML development. I solved(?) the problem I had during the weekend. I seems that the DOM standard version currently implemented (level 1.0) does not support the creation of DTD's per code. So I have to use an template or SAX 2.0. I chose the template option as I don't know much about SAX.