<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>5771</bug_id>
          
          <creation_ts>2008-06-19 09:43:31 +0000</creation_ts>
          <short_desc>[FO] Feature request: get binary data from URI</short_desc>
          <delta_ts>2013-07-18 13:40:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Mills">tim</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>abel.braaksma</cc>
    
    <cc>liam</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>20592</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2008-06-19 09:43:31 +0000</bug_when>
    <thetext>RFC 2397 defines the &apos;data&apos; URL scheme, which allows base 64 encoded binary data to be represented in a URI.  This is commonly used in SVG to include binary image data.

Might I suggest the addition of a function to retrieve data from a URI as xs:base64Binary?

Perhaps something along the lines of

fn:binary-data($uri as xs:string?) as xs:base64Binary?
fn:binary-data-available($uri as xs:string?) as xs:boolean?

following the pattern for fn:doc and fn:doc-available.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23916</commentid>
    <comment_count>1</comment_count>
    <who name="Liam R E Quin">liam</who>
    <bug_when>2009-02-24 22:14:49 +0000</bug_when>
    <thetext>You can do this today using existing string processing functions:
cast the URI to a string, use substring-after to remove the &quot;data:&quot;
and then process the base64 data as if from a string, e.g. with a
base64Binary constructor.

So, closed as WONTFIX; if you feel we&apos;re missing a reason why we need this,
please reopen. 

Thanks!



</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23926</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2009-02-25 09:03:20 +0000</bug_when>
    <thetext>I think you may have misunderstood me.  What I&apos;m suggesting is reading data at a specified URL as binary data.

e.g. binary-data(&apos;http://www.w3.org/Icons/w3c_main&apos;)

As far as I am aware, the only functions which read external data are fn:doc, fn:collection and fn:unparsed-text.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23927</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-02-25 09:59:12 +0000</bug_when>
    <thetext>Well, that seems like a different requirement from reading URIs using the &quot;data&quot; scheme.

Incidentally, XSLT has a function unparsed-text() for reading plain text files, there&apos;s no intrinsic reason why that shouldn&apos;t migrate into XQuery along with other XSLT functions that are going that way.

I can see that unparsed-binary() would sometimes be useful too. My main reservation is that it would open up a whole new area for functions and operators dealing with binary data. For example, Saxon currently has extension functions to convert between xs:base64Binary/xs:hexBinary and xs:string/xs:byte*, in both directions, giving 8 functions in all. There have also been requests in the past for functions that do bitwise and/or/xor, or that test/set individual bits or bytes (though converting to xs:byte* is arguably a sufficient enabler for that).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23928</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2009-02-25 10:11:53 +0000</bug_when>
    <thetext>In my original post, I was suggesting this function as a means to allow the creation of &apos;data&apos; scheme URIs, not reading them.  Sorry for the confusion.

I agree that there is quite a bit that _could_ be usefully added to aid manipulation of hexy/base64 binary data, e.g. an equivalent of substring.  

While many operations could be done using existing functions operating on the lexical representation of these types (i.e. cast as string), it would of course require a means to read binary data in the first place, hence the feature request.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23939</commentid>
    <comment_count>5</comment_count>
    <who name="Liam R E Quin">liam</who>
    <bug_when>2009-02-25 21:35:18 +0000</bug_when>
    <thetext>Closed as &quot;INVALID&quot;.  People can write image handling libraries, but
let&apos;s not introduce such a thing a feature at a time.

The Working Groups considered the original request, and today considered your
clarification.  We don&apos;t feel at this time that the work needed to expand
handling of binary data is justified, particularly as we don&apos;t have clear
use cases or examples.  But if you end up developing such a library and
it proves popular, it would quite likely be a candidate for standardisation
in some future version of Functions and operators.

The unparsed-text function is another matter, and we&apos;ll track that separately.


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28284</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-10-12 22:30:02 +0000</bug_when>
    <thetext>Sicne the WG decided that this was out of scope for this version of the specification, and there has been no push-back, I am marking this as closed. Please feel free to reopen it if you think further discussion is needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90917</commentid>
    <comment_count>7</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2013-07-18 13:40:23 +0000</bug_when>
    <thetext>Note for reference, after the F2F of February 2013, handling binary data has become a part of EXPath. As of March 5, 2013, it is a Candidate Module: http://expath.org/spec/binary/editor.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>