xml:space="preserve" isn’t respected in the no-style-information "document tree" presentation of an XML document
Categories
(Core :: XML, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox126 | --- | fixed |
People
(Reporter: bugs, Assigned: peterv)
Details
Attachments
(2 files)
Comment 1•10 years ago
|
||
| Reporter | ||
Comment 2•10 years ago
|
||
Comment 3•10 years ago
|
||
Comment 4•10 years ago
|
||
Comment 5•10 years ago
|
||
Updated•10 years ago
|
| Reporter | ||
Comment 6•10 years ago
|
||
Comment 7•10 years ago
|
||
| Reporter | ||
Comment 8•10 years ago
|
||
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
| Reporter | ||
Comment 11•10 years ago
|
||
Updated•10 years ago
|
Comment 12•4 years ago
|
||
I just ran into the same issue. I’m collecting metadata about files on my site, and unstyled XML is currently the best way to present them to casual viewers. Some of the metadata needs whitespace preserved, and Firefox does not seem to support that.
The other browser I tried (lynx) just loads the file in an editor, since it’s served as application/xml, so it sorta preserves them ☻
Updated•3 years ago
|
Comment 13•2 years ago
|
||
Comment 14•2 years ago
|
||
Even the testcase I just attached (also online, served as Content-Type: application/xml) with an inline DTD won’t work, so unfortunately, this cannot be used to work around this bug: Firefox ignores the xml:space even if not only present but also defined (as requested in comment #7).
Firefox does parse and use the DTD, as can be seen by it showing e.g. <info name="ICOP" xml:space="default"> in the formatted XML view whereas the document has <info name="ICOP">, i.e. it adds the default value.
However, despite displaying <info name="ICMT" xml:space="preserve">, the resulting text is mangled.
To add insult to injury, ^U shows the entire inline DTD in red undersquiggles, with a hover text of “Bogus comment.” (wtf‽), so there are apparently multiple things going wrong.
To make it fully clear: yes, I expect xml:space to work in the formatted XML view in that whitespace must not be collapsed. I would additionally be happy if the monospace font would be used to display tags with that attribute set.
Comment 15•2 years ago
|
||
reconfirmed in 115.4.0esr btw, but I cannot seem to set this in the metadata here
Comment 16•2 years ago
|
||
Thanks for the notes and the testcase.
(In reply to [:mirabilos] from comment #14)
Even the testcase I just attached (also online, served as
Content-Type: application/xml) with an inline DTD won’t work, so unfortunately, this cannot be used to work around this bug: Firefox ignores thexml:spaceeven if not only present but also defined (as requested in comment #7).
To clarify comment 7, that was me digging up & speculating about what the spec calls for (and hence what-might-be-reasonable-to-expect-from-an-XML-viewer-that-conforms-to-the-XML-spec), not what Firefox actually does.
To add insult to injury, ^U shows the entire inline DTD in red undersquiggles, with a hover text of “Bogus comment.” (wtf‽), so there are apparently multiple things going wrong.
That's maybe worth filing as a distinct bug, and CC :hsivonen who works on our parser.
To make it fully clear: yes, I expect
xml:spaceto work in the formatted XML view in that whitespace must not be collapsed. I would additionally be happy if the monospace font would be used to display tags with that attribute set.
For comparison-between-web-engines, it seems Chrome displays XML files with a monospace font. That seems like a good idea in general, perhaps. But like Firefox, they collapse whitespace despite xml:space="preserve".
(In reply to [:mirabilos] from comment #15)
reconfirmed in 115.4.0esr btw, but I cannot seem to set this in the metadata here
Yeah, reconfirmed in Firefox 121 Nightly here. It's fine to not update metadata for which-versions-are-affected for longstanding bugs like this (representing every-affected-Firefox-version would be quite cumbersome). I've just adjusted Version to Trunk.
Fair warning, I don't think the XML viewer gets a lot of active development, so don't take my response here as any sort of promise-of-a-fix-coming-soon. :)
Comment 17•2 years ago
|
||
I reported the corresponding issue against Google Chrome. I do not normally have access to Safari or Internet Exploder or what’s its name.
lynx just downloads the file (as it’s served as application/xml) and, for text/xml, probably would just display it as-is.
links2 does display it as-is, so no fancy collapsing, etc. but also no breaking of whitespace.
Konqueror 3 strips all tags and attributes and just displays the raw CDATA, as does Opera 9.64 ☹
Konqueror 5, like Chromium, behaves like Firefox but at least does choose a monospace font for the entire rendered XML tree, which already is an improvement.
Firefox 1.5 behaves the same as 115.
Firefox is always preserving white space in the sense meant by the XML processor / application split in the XML spec. That is, all of it ends up in the DOM.
It indeed would be nice if the transformation of unstyled XML special-cased xml:space, though. Perhaps peterv knows how easy or hard it would be to make the transformation make xml:space="preserve" parts of the input have white-space: pre-wrap in the output.
| Assignee | ||
Comment 19•2 years ago
|
||
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Comment 20•2 years ago
|
||
Is pre-wrap wise though, as opposed to just pre and (if needed) horizontal scrolling for the whole enclosing tag?
I think one would need to experiment with both a little. I guess if needed, F12 can be used to change this, too.
Comment 21•2 years ago
|
||
Comment 22•2 years ago
|
||
| bugherder | ||
Description
•