Whitespace Suppression

Space characters, tabs, carriage returns, and line feeds are considered to be whitespace. Schema language has a pattern facet that lets you specify that whitespace should be suppressed when retrieving the content of a string Element or Attribute. By default all whitespace is preserved. However, using this feature can cause leading and trailing spaces to be stripped before passing the string to an application. Just as it can be unfriendly to add data with default Attributes, if your application thinks that leading or trailing spaces are significant, it can be unfriendly to have them removed. This is not a problem for most people since they tend to trim leading and trailing spaces when creating instance documents. However, it is something to be aware of. If you have an application or trading partner that is sending you whitespace you don't want, you may be able to use this feature to your advantage. To employ it, you must modify your schema to create a new simple type by restriction, using string as the base type, and specify the whitespace facet with the value of “collapse.” You then set the Elements where you want whitespace stripped to be of that type rather than string. Whitespace suppression does not affect schema validation. It affects only the values returned to you by an XML processor.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset