xml.minidom is stripping out my CRLF's in attrib values!!

Harvey Thomas hst at empolis.co.uk
Mon Sep 9 10:39:45 EDT 2002


sismex01 at hebmex.com wrote:
> 
> Probably not sripped, but normalized:
> 
> for example, your original string:
> >>> s = "spotted\x0Awith black and white"
> 
> becomes the normalized string:
> >>> s = "spotted with black and white"
> 
> Is something like this happening?
> 
> If it is, then it's the correct behaviour, according
> to the XML standard: all text should be normalized,
> except if it's in a CDATA block.
> 
> HTH
> 
> -gus

White space is usually normalized, but it can be preserved (if your parser supports it) with the xml:space attribute.
If an element has the attribute xml:space="preserve" then white space in that element should not be normalized. If you are parsng with a DTD and your root element is called ROOT then change/create the !ATTLIST declaration to be

<attlist ROOT xml:space #FIXED "preserve"
...other attribute definitions...>

_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.




More information about the Python-list mailing list