I am wasting way too much time integrating my app with the xerces parser. To add to my 
woes, I am facing compiler different compiler errors for different projects that use 
the same xerces code... :-) Can someone help me fix these errors the easy way ?

I am trying..

DOMNode *n // it is a valid domnode.

// the following statement fails. error is "2440: 'static_cast' : cannot convert from 
'class xercesc_2_2::DOMNode *' to 'class xercesc_2_2::DOMElement *' Types pointed to 
are unrelated; conversion requires reinterpret_cast, C-style cast or function-style 
cast"

DOMElement *de = static_cast<DOMElement *>(n);

// this fails too, error is "C2027: use of undefined type 'DOMElement'"
DOMElement *de = reinterpret_cast<DOMElement *>(n);

>From the class diagrams, I believe that DOMNode inherits from DOMElement, and others..

So, where am I screwing up and whats the best fix ?

I have the libs and includes and straight...

-Vinayak.

> -----Original Message-----
> From: "Andreï V. FOMITCHEV" [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 11:04 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Problem with accentuated letters
> 
> 
> Neil Graham wrote:
> 
> >Hi Andrei,
> >  
> >
> >>Curiously, when I use Xerces DOMParser for parse a XML 
> file, I can save
> >>it or print it with DOMWriter, the accentuated characters are quite
> >>present but if I reach the nodes, I don't have any more accents.
> >>    
> >>
> >
> >Good; so the parser is evidently doing the right thing.  That is, the
> >information must be available to the parser if it's capable 
> of serializing
> >it correctly.  So the question becomes:  how are you 
> "reaching" the nodes
> >and, as importantly, how are you displaying the result?
> >  
> >
> //parse problem
> //it is necessary to add to what follows the management of 
> the exceptions
> XercesDOMParser * parser = new XercesDOMParser;
> parser->parse(xml_file_name);
> XMLCh * tempStr [100];
> DOMDocument * document = parser->getDocument();
> XMLString::transcode("*", (XMLCh *) tempStr, 99);
> DOMNodeList * laListe = document->getElementsByTagName((const 
> XMLCh*)tempStr);
> DOMNode * noeud_courant;
> for(XMLSize_t i = 0; i < laListe->getLength(); i++)
> {
>        noeud_courant = laListe->item(i);
>        //on ne peut pas utiliser tempStr car la taille du 
> contenu peur 
> être superieur à 99
>        char * une_fuite_de_memoire_colmate = 
> XMLString::transcode(noeud_courant->getNodeName());
>        String nom_courant (une_fuite_de_memoire_colmate);
>        delete [] une_fuite_de_memoire_colmate;
>        String * contenu_courant = XML::getTextContent(noeud_courant);
>        //I lost the contents
> }
> /*!
>     return "char*" of the text content of the node node
> */
> String * XML::getTextContent(DOMNode * node)
> {
>   String * res = new String("");
>  
>   DOMNodeList * laListe = node->getChildNodes();
>   DOMNode * noeud_courant;
>   for(XMLSize_t i = 0; i < laListe->getLength(); i++)
>      {
>        noeud_courant = laListe->item(i);
>        // NodeType
>        switch(/*(DOMNode::NodeType)*/noeud_courant->getNodeType())
>      {
>      case DOMNode::ELEMENT_NODE:
>        {
>          printf("ELEMENT_NODE ");
>          String * tampon = getTextContent(noeud_courant);
>          *res += *tampon;
>          delete tampon;
>          break;
>        }
>      case DOMNode::ATTRIBUTE_NODE:
>        //pas de contenu texte ...
>        break;
>      case DOMNode::TEXT_NODE:
>        {
>          char * tampon = 
> XMLString::transcode(noeud_courant->getNodeValue());
>          printf("tampon = '%s'\n", tampon);
>          if(tampon != NULL)
>            *res += String(tampon);
>          delete [] tampon;
>          break;
>        }
>      case DOMNode::CDATA_SECTION_NODE:
>      case DOMNode::ENTITY_REFERENCE_NODE:
>      case DOMNode::ENTITY_NODE:
>      case DOMNode::PROCESSING_INSTRUCTION_NODE:
>      case DOMNode::COMMENT_NODE:
>      case DOMNode::DOCUMENT_NODE:
>      case DOMNode::DOCUMENT_TYPE_NODE:
>      case DOMNode::DOCUMENT_FRAGMENT_NODE:
>      case DOMNode::NOTATION_NODE:
>      default :
>        printf("oups. %d node\n", noeud_courant->getNodeType());
>        break;
>      }
>      }
>   return res;
> }
> Do I have errors in the code?
> 
> -- 
> Andreï V. FOMITCHEV               [Quand faut-il arrêter 
> l'informatique]
> Software R&D Engineer    [Lorsque, dans un kilo, on trouve 
> 1024 grammes]
> Odixion, FRANCE
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to