Be sure you delete those strings that you get back from
XMLString::transcode(), or else you've got a memory leak.

Dave



                                                                                       
          
                    "Keno"                                                             
          
                    <keno@coretechnol        To:     <[EMAIL PROTECTED]>, 
"Icewing"    
                    ogies.com>               <[EMAIL PROTECTED]>                    
          
                                             cc:     (bcc: David N Bertoni/CAM/Lotus)  
          
                    07/21/2001 10:08         Subject:     Re: Saving Xerces C SAX2 
parser        
                    AM                       attributes                                
          
                    Please respond to                                                  
          
                    xerces-c-dev                                                       
          
                                                                                       
          
                                                                                       
          



Hey Icewing, I had to do something similar for my project. What I did was
to
create a struct for an XML Element.

// Represent an attribute of an XML element
typedef struct {
 char *name;
 char *type;
 char *value;
} ElementAttribute;

typedef     vector<ElementAttribute>     ElementsAttrib;

// Represent an XML Element Parsed
typedef struct {
 ElementsAttrib attributes;
 string content;
 string name;
} ElementXML;

Then inside the startElement() I had

// copy element's attributes into local data structure
 for(int i = 0; i < attributes.getLength(); i++)
 {
  ElementAttribute attrib;
  attrib.name = XMLString::transcode(attributes.getName(i));
  attrib.type = XMLString::transcode(attributes.getType(i));
  attrib.value = XMLString::transcode(attributes.getValue(i));

  elemEntry.attributes.push_back(attrib);        // elemEntry is a
ElementXML struct
 }

Hope this helps you.

- Keno -


---------------------------------------------------------------------
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