How does XML maintain white-space in any documents

How does XML maintain white-space in any documents?

E

Expert

Verified

All white-space, with TAB characters, line breaks and normal spaces, until now between structural tools where no text can ever show, is passed by the parser not changed to the application (formatter, converter, browser and viewer), identifying the context wherein the white-space was determined (data content, element content or mixed content, when this information is obtainable to the parser, for example: from a DTD or Schema). It means this is the application's responsibility to make a decision what to do with space, except the parsers:

• Insignificant white-space among structural tools (space that occurs where only tool content is allowed, for example: between other tools, where text data never happens) will find as passed to the application (within SGML this white-space gets suppressed, that is why you can put all which extra space in HTML documents and not worry regarding it)

• Important white-space (space which occurs within elements which can contain text and markup mixed together, usually mixed content or PCDATA) will still get passed to the application exactly as under SGML. It is the application's responsibility to handle it correctly.

• The parser should inform the application that white-space has happened in element content, when it can detect this. SGML user will recognize that such information is not in the ESIS, but this is in the Grove.

< chapter >
< title >
My title for
Chapter 3.
< /title >
< para >
text
< /para >
< /chapter >

In the illustration above, the application will obtain all the pretty-printing linebreaks, TABs, and spaces among the elements. This is the function of the application, not the parser, to decide that type of white-space to discard and that to retain. Several XML applications have configurable options to permit programmers or users to control how that white-space is handled.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.