AW: [xsd-users] preserve newlines in xs:string while serialization

Marco Gerber mgerber at junisphere.net
Tue Nov 3 06:11:42 EST 2009


Thanks Boris

It was my fault. I wrote a test case, working with vim and found out, that all newlines are correctly written to the serialized xml file, while before, I always used Firefox to show the generated xml file. However, Firfox's xml preview replaces all newlines with a space. So, all is going ok.

Thank you for the conversation :-)
Marco



-----Ursprüngliche Nachricht-----
Von: Marco Gerber 
Gesendet: Dienstag, 3. November 2009 11:44
An: 'Boris Kolpackov'
Betreff: AW: [xsd-users] preserve newlines in xs:string while serialization

Thanks Boris

It was my fault. I wrote a test case, working with vim and found out, that all newlines are correctly written to the serialized xml file, while before, I always used Firefox to show the generated xml file. However, Firfox's xml preview replaces all newlines with a space. So, all is going ok.

Thank you for the conversation :-)
Marco






-----Ursprüngliche Nachricht-----
Von: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Gesendet: Dienstag, 3. November 2009 10:19
An: Marco Gerber
Cc: xsd-users at codesynthesis.com
Betreff: Re: [xsd-users] preserve newlines in xs:string while serialization

Hi Marco,

Marco Gerber <mgerber at junisphere.net> writes:

> My xml schema has an element which contains a script (bash/perl ...) as
> formatted text. As discussed in [1], my element is also of type
> xs:string without any whitespace restrictions.
>
> <xs:element minOccurs="0" name="Script" type="xs:string" />
> 
> While serialization, I also set  noskipws on my ofstream os. While using
> the xsd generated tree serialization method (serializeInventory(os,
> m_xml_inventory, map, "ISO8859-1")), all newlines are replaced by a
> space.

Hm, this should actually work. Are you creating the tree from scratch
or is it parsed from an XML document? If it is the latter, then can 
you check whether the newlines are there right after parsing by 
printing the element's value?

If this doesn't help solve the problem, I will need a test case
that reproduces this (you can send it to me directly). Also, can
you let me know which platform and C++ compiler you are using as 
well as the Xerces-C++ version?

Boris



More information about the xsd-users mailing list