[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Processing binary data using XPath ... wow!
- From: "Costello, Roger L." <costello@mitre.org>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Mon, 11 Aug 2014 09:33:51 +0000
Hi Folks,
Are you aware of the ExPath Binary Module? It is awesome:
The ExPath Binary Module provides an API
for XPath 2.0 to handle binary data.
Wow!
It defines extension functions to process data
from binary files, including extracting subparts,
searching, basic binary operations and conversion
between binary and structured forms.
Fantastic!
It has been designed to be compatible with
XQuery 1.0 and XSLT 2.0, as well as any
other XPath 2.0 usage.
Standards-based!
A few more exciting facts about processing binary data using XPath:
1. The binary data is converted to base64 text (i.e., the binary is encoded as base64 text). The ExPath Binary Module provides XPath functions for searching and manipulating the binary data in its base64 form.
2. XML documents have always been able to carry base64 data (since base64 is just text). But processing that base64 data was difficult, requiring custom-coding. Now the ExPath Binary Module provides us with standard functions for processing base64 data. Fantastic!
3. There is a companion standard, The ExPath File Module, which contains XPath functions for reading and writing binary files:
file:read-binary(filename) is an XPath function
that takes as its argument the name of a binary
file (e.g., the name of a PDF file) and it returns
the file as base64 text.
file:write-binary(filename, base64) is an XPath
function that takes as its argument the name of
a file and base64 text and writes the base64 text
as binary to the file.
file:append-binary(filename, base64) is an XPath
function that takes as its argument the name of
a file and base64 text and appends the base64 text
as binary to the file.
4. Here are a few examples of things that can be done using the new XPath functions:
- Get the dimensions of an image file.
- Extract image metadata.
- Process images embedded as base64
encodings in an XML document.
5. The 9.6 PE/EE editions of Saxon, which are anticipated to be released in the next few months, will contain complete implementations of ExPath Binary Module and ExPath File Module.
/Roger
Binary Module 1.0 (http://www.w3.org/2013/12/expath-binary-20131203/)
File Module (http://expath.org/spec/file)
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]