Skipping spaces between tags?

Stefano

Usenet Archive
Joined
Jan 22, 2000
Messages
51
Reaction score
0
Hi All,
as per the specs, should a XML parser skip spaces between <tag> and </tag> (example: <data> this is the text </data> => trimmed 'this is the text') ?

Thanks in advance

Stefano
 

Richard Tobin

Usenet Archive
Joined
Jan 6, 2000
Messages
4,251
Reaction score
0
Stefano said:
as per the specs, should a XML parser skip spaces between <tag> and </tag> (example: <data> this is the text </data> => trimmed 'this is the text') ?

No. As the spec says in 2.10:

An XML processor must always pass all characters in a document that are not markup through to the application.

An *application* can do what it likes, but a conformant XML parser must not remove the spaces.

-- Richard
 

Faehndrich Philippe

Usenet Archive
Joined
Aug 7, 2003
Messages
1
Reaction score
0
On 7 Aug 2003 06:31:30 -0700
(Stefano) wrote:

Hi All,
as per the specs, should a XML parser skip spaces between <tag> and </tag> (example: <data> this is the text </data> => trimmed 'this is the text') ?

Thanks in advance

Stefano

If you *need* to have the spaces trimmed, you can use the "normalize-space" XPath function.

Philippe Faehndrich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,802
Members
249,594
Latest member
henrywalsh

Latest Threads

Top