Hi,
        could you open a bug on this so it does not get lost.

cheers,


Gareth


On Tue, 17 Jun 2003, Verker, Anat wrote:

> Hi,
> 
> I've encountered a problem when using new lines in attribute value.
> This is a fragment from the original xml file I used:
> 
> <text text1="aaa&#xA;bbb&#xA;ccc"/>
> 
> According to the Attribute-Value Normalization algorithm 
> (http://www.w3.org/TR/REC-xml#AVNormalize) a character reference (i.e. &#xA;) is 
> replaced with the referenced character (i.e. 0xA).
> After parsing, I write the content to a file (using the sample code of 
> SAXPrintHandlers). The value written to the file doesn't contain &#xA; but 0xA.
> Then I parse the xml again, but not the original xml file, but the file that I 
> previously created. Now, according to the Attribute-Value Normalization algorithm, 
> 0xA is replaced with a space character, which means that I'm losing my new line.
> 
> This is the code fragment where I write the attribute values:
> 
> // attributes is of type AttributeList
> // fFormatter is of type XMLFormatter
> 
> for (unsigned int i = 0; i < attributes.getLength(); i++) {
>       fFormatter
>               << XMLFormatter::NoEscapes
>               << chSpace << attributes.getName(i)
>               << chEqual << chDoubleQuote
>               << XMLFormatter::AttrEscapes
>               << attributes.getValue(i)
>               << XMLFormatter::NoEscapes
>               << chDoubleQuote;
> }
> 
> I tried replacing each 0xA with &#xA; before writing the attribute value to the 
> formatter, but then I got the following output:
> <text text1="aaa&amp;#xA;bbb&amp;#xA;ccc"/>
> When I omitted XMLFormatter::AttrEscapes I got the following output:
> <text text1="aaa&#xA;bbb&#xA;ccc"/>
> This is actually what I want but I'm not sure that omitting 
> XMLFormatter::AttrEscapes is the right solution (it can harm other things, can't 
> it?).
> 
> Please advise.
> 
> Thanks,
> Anat Verker.
> ***********************************************************************************
> Information contained in this email message is intended only for use of the 
> individual or entity named above. If the reader of this message is not the intended 
> recipient, or the employee or agent responsible to deliver it to the intended 
> recipient, you are hereby notified that any dissemination, distribution or copying 
> of this communication is strictly prohibited. If you have received this 
> communication in error, please immediately notify the [EMAIL PROTECTED] and destroy 
> the original message.
> ***********************************************************************************
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




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

Reply via email to