Project

Profile

Help

Bug #6652

closed

parse-xml fails if the string its parsing begins with a BOM

Added by Norm Tovey-Walsh 6 days ago. Updated 6 days ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
External resources
Sprint/Milestone:
-
Start date:
2025-01-16
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

For example:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="xs"
                version="3.0">

<xsl:output method="xml" encoding="utf-8" indent="no"/>

<xsl:template match="/" name="xsl:initial-template">
  <xsl:variable name="root" as="element()"><root/></xsl:variable>
  <xsl:sequence select='parse-xml(serialize($root, map{"byte-order-mark": true()}))'/>
</xsl:template>

</xsl:stylesheet>

This is contrived, but a real world example of getting a text/plain response from a web service and discovering a BOM at the beginning has been reported.

Please register to edit this issue

Also available in: Atom PDF