xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wer...@gmx.de
Subject Re: MemBufFormatTarget possible bug
Date Wed, 09 Apr 2008 09:40:31 GMT
hi Alberto

I do not fill it. XQilla do it somehow in the writer Object:

 memtarget = new MemBufFormatTarget(0,dynamic_context->getMemoryManager());
 EventSerializer writer("UTF-8", "1.1", memtarget, 
                        dynamic_context->getMemoryManager());
 writer.addNewlines(true);
 NSFixupFilter nsfilter(&writer, dynamic_context->getMemoryManager());
 query->execute(&nsfilter, dynamic_context.get());    //XQQuery

sorry for not explaining every object. I guess the filling happens in EventSerializer ('writer'
object in my code respectively), i found the constructor in the source of xqilla:

 EventSerializer::EventSerializer(char *encoding, char *xmlVersion,  
      XMLFormatTarget *target, MemoryManager *mm)
   : formatter_(encoding, xmlVersion, target, XMLFormatter::CharEscapes,  
  XMLFormatter::UnRep_CharRef, mm),
    elementStarted_(false),
    level_(0),
    addNewlines_(false)
 {
 }

formatter is defined as:
 XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatter formatter_;
The filling happens, i guess over this method:

 void EventSerializer::piEvent(const XMLCh *target, const XMLCh *value)
 {
   formatter_ << XMLFormatter::NoEscapes << XMLFormatter::UnRep_Fail;

   if(elementStarted_) {
     elementStarted_ = false;
     formatter_ << elem_end;
   }

  formatter_ << pi_start;
  formatter_ << target;
  formatter_ << space;
  formatter_ << value;
  formatter_ << pi_end;

  if(addNewlines_ && level_ == 0) {
    formatter_ << newline;
   }
 }



greetings
  Affe


-------- Original-Nachricht --------
> Datum: Wed, 09 Apr 2008 10:20:19 +0200


> Von: Alberto Massari <amassari@datadirect.com>
> An: c-users@xerces.apache.org
> Betreff: Re: MemBufFormatTarget possible bug

> Affe,
> could you show us how are you filling the MemBufFormatTarget?
> 
> Alberto
> 
> wernwa@gmx.de wrote:
> > There are still problems with the Constructor initializing. The Buffer
> seems not dependent on the length i am initializing.
> >
> > I am working with XQilla libraries on top of Xercesc. When i initialize
> the Constructor with the memory manager and with 0 length, then it
> functions (hopefully stable now, the buffer is ok for different queries). But i do
> not know why there is corrupt buffer if  the length is big like 1024 or
> without the second parameter MemoryManager. Maybe someone has the same
> problem.
> >
> > memtarget = new
> MemBufFormatTarget(0,dynamic_context->getMemoryManager());
> >
> > greetings
> >   Affe
> >   
> 

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

Mime
View raw message