Is the code you appended being called multiple times within the same process? You
cannot call
XMLPlatformUtils::Initialize(); again after XMLPlatformUtils::Terminate(); within the
same
process. See http://xml.apache.org/xerces-c/faq-parse.html#faq-25 for further detail.
Tinny
Jordan C N Chong wrote:
> hi all,
>
> I tried to use the DOMParse to parse the same XML document in the same
> session, but always ends up memory leak problem... and the whole application
> just crashed. I found that the problem happens at the "DOMParser parser;".
> The following codes is the snipplet of my codes... Please help. I am quite
> frustrated here. Thanks. Wish you all the best. (I am using VC6 and
> Xerces-C).
>
> ...
> DOM_Document doc;
> DOM_Element root;
> DOM_Node node;
> DOM_NodeList list;
>
> // Parse the license with XML4C
> XMLPlatformUtils::Initialize();
> DOMParser parser;
> parser.parse(path);
>
> doc = parser.getDocument();
> root = doc.getDocumentElement();
>
> // Read the rights that is stated in the license
> list = root.getElementsByTagName("RIGHTSGROUP");
> for (unsigned int i=0; i<list.getLength(); i++) {
> node = list.item(i);
>
> if (node.getNodeType() == DOM_Node.ELEMENT_NODE) {
> list = ((DOM_Element &)
>node).getElementsByTagName("RIGHTSLIST");
>
> for (unsigned int j=0; j<list.getLength(); j++) {
> node = list.item(j);
>
> if (node.getNodeType() == DOM_Node.ELEMENT_NODE) {
> list = node.getChildNodes();
>
> for (unsigned int k=0; k<list.getLength();
>k++) {
> node = list.item(k);
>
> // Check whether the View is allowed
> if
>(node.getNodeName().equals("VIEW")) {
> View = true;
> }
>
> // Check whether the Print is allowed
> if
>(node.getNodeName().equals("PRINT")) {
> Print = true;
> }
>
> // Check whether the Export is
>allowed
> if
>(node.getNodeName().equals("EXPORT")) {
> Export = true;
> }
> }
> }
> }
> }
> }
> parser.reset();
> XMLPlatformUtils::Terminate();
> }
>
> Best regards,
> --------------------------------------------
> Jordan Cheun Ngen, Chong
> Room 4067
> Distributed and Embeded Systems Group
> Centre for Telematics and Information Technology
> University of Twente
> Faculty Informatica
> 7522 NB Enschede
> The Netherlands
> --------------------------------------------
> Office Phone: +31 53 4894655
> Web site: http://www.cs.utwente.nl/~chong
> Email Add.: [EMAIL PROTECTED]
> ============================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]