Hello,
MSXML Version used : MSXML3.0
Language used: VC6.0
Platform: Windows 2000
Am trying to parse a DTD file to create a tree like hierarchical structure
based on certain business rules.
For this we are using ISAXXMLReader . The problem is that when I try to set
the property http://xml.org/sax/properties/lexical-handler , it is
unsuccessful. Also I am using the parseURL method to directly parse the .dtd
file so the call is pRdr->parseURL(L"SAX2Print.dtd"); In all the examples
I have seen the method being used with Xml files and DTD files get parsed
when a !DOCTYPE processing instruction is encountered. I am not sure is this
could be creating a problem
Ultimately I want to be able to get the ElementDecl, AttributeDecl.. etc:
events from the SAXReader. Currently a,m unable to generate these events,.
Following is the subset of the code, that sets the properties and initiates
the parse
MyContent * pMc = new MyContent();
hr = pRdr->putContentHandler(pMc);
VARIANT_BOOL boolvalue = -1;
hr =
pRdr->putFeature(L"http://xml.org/sax/features/external-general-entities",bo
olvalue);
hr =
pRdr->putFeature(L"http://xml.org/sax/features/external-parameter-entities",
boolvalue);
SAXLexicalHandler * lh = new SAXLexicalHandler();
hr=
pRdr->putProperty(L"http://xml.org/sax/properties/lexical-handler",_variant_
t(new SAXLexicalHandler()));
SAXDeclHandlerImpl * dh = new SAXDeclHandlerImpl();
hr=
pRdr->putProperty(L"http://xml.org/sax/properties/declaration-handler",_vari
ant_t(new SAXDeclHandlerImpl()));
pRdr->parseURL(L"SAX2Print.dtd");
Thanks,
Maansi
vv