[xml] Dealing with carriage returns and tabs in xml documents



Hi,

when parsing a xml document like this:

<this>
        <is>text</is>
        <test>
        </test>
</this>

using SAX all carriage returns and tabulators are considered as characters 
and charactersSAXFunc shows them all. 
 
Is there a way to filter them or better how can I get ONLY text without CR 
from the callback function charactersSAXFunc(void *ctx, const xmlChar *ch, 
int len)???

printf("%s",ch) is showing "text</" and NOT "text"

Example:
I want "text" between tags <is> and </is>

this one doesn't work:

<this>
        <is>text</is>
        <test>
        </test>
</this>
bla bla
SAX.characters(
,2)
SAX.characters(test,4)
SAX.characters(
,2)


this one is o.k. but unreadable

<this><is>text</is><test></test></this>

SAX.characters(text,4)

Thank you

Patrick :-}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]