You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Norbert Kintzler <NK...@easy-soft-dresden.de> on 2001/11/28 16:55:23 UTC

Line break preservation in attributes with XML Schema validation

Hi all,

In a XML import/export I need to transport text inside element attributes
preserving line breaks.

According to the XML specification if I use the character reference &#xA;
in contrast to the linefeed character itself it has to be preserved.
If I parse the document without Schema and validation, it works correct that
way.

With Schema validation (which I need to use) the line breaks are converted
to normal spaces (&#x20;). I tried different built-in types without luck.
Then I defined my own type, which - according to my understanding of the
XML Schema specificaion - should preserve whitespaces:

 <xsd:simpleType name="whitespaceString" final="restriction">
  <xsd:restriction base="xsd:string">
   <xsd:whiteSpace value="preserve"/>
  </xsd:restriction>
 </xsd:simpleType>

But using this type did not help.

Here is the part from the specification which makes me believe I am doing it
right:
(http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace)

whiteSpace is applicable to all atomic and list datatypes. For all atomic
datatypes other than string (and types derived by restriction from it) the
value of whiteSpace is collapse and cannot be changed by a schema author;
for string the value of whiteSpace is preserve; for any type derived by
restriction from string the value of whiteSpace can be any of the three
legal values.

I use Xerces-C nightly build 20011122 (1.6 'pre-alpha-candidate') DOM
Parser.

Any help on this will be greatly appreciated.

Norbert Kintzler
easy-soft GmbH Dresden

NKintzler@easy-soft-dresden.de
http://www.easy-soft-dresden.de





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Line break preservation in attributes with XML Schema validation

Posted by Juergen Hermann <jh...@web.de>.
On Wed, 28 Nov 2001 16:55:23 +0100, Norbert Kintzler wrote:

>In a XML import/export I need to transport text inside element attributes
>preserving line breaks.

Any reason you cannot use a <br/> tag? (convert to/from that tag on 
ex/import)



Ciao, Jürgen

--
Jürgen Hermann, Developer (jhe@webde-ag.de)
WEB.DE AG, http://webde-ag.de/



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org