Jump to content

White Space In Xml Document.


mysite

Recommended Posts

Hi All,On the following URL, at the section of "White-space is Preserved in XML"http://www.w3schools.com/xml/xml_syntax.aspsays that With XML, the white-space in a document is not truncated. But when I try it on the IDE, I'm using aptana for XML, it not work like that.

<?xml version="1.0" encoding="utf-8"?> <root> 	<test> 		10 & 23 	</test>	<test val="qutation mark">'</test>	<test val="double quotes">"</test>	<!-- this is the XML comment as much similar to the HTML comments -->	<test val="amporsand">&</test>	<test vall="multiple spaces">this				end '\n' many spaces</test> </root>

I can see multiple white-spaces as a single space. Can anyone guide me on this please. Thanks a lot... :)

Link to comment
Share on other sites

The relevant part of the XML specification: http://www.w3.org/TR/REC-xml/#sec-white-space.Summary: it is up to the DTD as to whether white space should be preserved, or not necessarily, within a certain element. So, if your DTD specified xml:space (preserve) for the test element, then the spacing will be preserved, otherwise it is up to the default behaviour of the application (Aptana in this case).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...