This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28180 - [f+o 3.1] Whitespace in xml-to-json()
Summary: [f+o 3.1] Whitespace in xml-to-json()
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2015-03-09 16:48 UTC by Michael Kay
Modified: 2016-04-29 20:42 UTC (History)
0 users

See Also:


Description Michael Kay 2015-03-09 16:48:35 UTC
The specification of xml-to-json() states that whitespace text nodes are ignored. However, this doesn't make sense for text nodes that are children of a <j:string> element, since the text node child of j:string contains the value of the string, which may be whitespace. It should say "whitespace text nodes are ignored, except those whose parent element is an element named 'string'"

Also, for the content of other simple-valued elements (number, boolean) I think it makes sense to strip leading and trailing whitespace, so that an untyped input is accepted if the result of validating it against the schema would be accepted.
Comment 1 Michael Kay 2015-03-11 13:01:08 UTC
The change was accepted by the WG on 10 Mar 2015 and has been applied to the spec.