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

Boris Kolpackov boris at codesynthesis.com
Tue Nov 3 04:19:00 EST 2009


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