One mistake more on my code: u cannot assingn a char* to a char[], so:
 
main
{
    char foo[BUF_SIZE];
    char* trimmedFoo;
    strcpy(foo, textNode.getNodeValue().transcode());
    trimmedFoo = trim (foo);
}
main
{
    char foo[BUF_SIZE];
    strcpy(foo, textNode.getNodeValue().transcode());
    trim (foo);
}
Where the trim function may be like:
char* trim(char* source){
    int i,j;
    i = strlen(source)-1;
    // trim the right side
    while ((i>=0)&&(source[i]==' ')){
        i--;
    }
    source[i+1]='\0';
    //trim the left side
    i = strlen(source);
    j = 0;
    while( (j<i-1)&&(source[j]==' ')){
        j++;
    }
    return (source+j);
}
 
Regards.
 
Jorge.
 
 
 
 
Jorge Pozo Ram�rez
Accenture - Spain
Technology Consulting Services
Government GMU
email: [EMAIL PROTECTED]
------------------------------------------------------------
Subdirecci�n General de Inform�tica
- Ministerio de Justicia -
Madrid, Espa�a
email: [EMAIL PROTECTED]
Tel:9 13902646

----- Original Message -----
Sent: Thursday, December 20, 2001 5:56 AM
Subject: Handling "white space" in element value

Hi,

I have the following requirement

# : represents a white space character in data

1) <tag1>ABC</tag1>
2) <tag2>#ABC</tag2>
3) <tag3>ABC#</tag3>

I would like to extract the value ABC, without the whitespace.

I tried out the following, but does not seem to work.  Can anyone suggest a way out -

                    const XMLCh * textNodeString = (textNode.getNodeValue()).rawBuffer();
                    XMLString::collapseWS ( textNodeString );
                    char * textNodeValue = textNodeString.transcode();

--
With best regards, 

Shirish
 

****************************************************************
Este mensaje ha sido analizado con una herramienta
de deteccion de virus para su seguridad.
Ministerio de Justicia
***************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**********************************************************************
Este mensaje ha sido analizado con una herramienta de
deteccion de virus para su seguridad.

Ministerio de Justicia
www.mju.es
**********************************************************************


**********************************************************************
Este mensaje ha sido analizado con una herramienta de
deteccion de virus para su seguridad.

Ministerio de Justicia
www.mju.es
**********************************************************************


**********************************************************************
Este mensaje ha sido analizado con una herramienta de
deteccion de virus para su seguridad.

Ministerio de Justicia
www.mju.es
**********************************************************************


**********************************************************************
Este mensaje ha sido analizado con una herramienta de
deteccion de virus para su seguridad.

Ministerio de Justicia
www.mju.es
**********************************************************************

Reply via email to