Jaxb-xml Schema Types, Binary Data

Source: Internet
Author: User
Tags printable characters

Data that have no "natural" representation with printable characters must, for inclusion in a XML file, still be represent ed in printable characters. The simple technique-consists in converting, the binary byte values to their hexadecimal representations. The XML Schema datatype to use of the IS xsd:hexBinary . A Sample Schema declaration is shown below.

 <  xsd:complextype  name  = "Binarytype"  >  <  xsd:sequence  >  <  xsd:element  name  = "Data"   type  =" Xsd:hexbinary " Span style= "color: #0000ff;" >/>  </ xsd:sequence  >  </ xsd:complextype  Span style= "color: #0000ff;" >>  

The Java class produced by JAXB contains a convenient pair of getters and setters methods for accessing the instance Vari Able (called  data ) that stores the binary data. Its type and the type for passing the binary data is  byte[] . All conversions is handled by JAXB.

 Public class binarytype {    protectedbyte[] data;      Public byte [] GetData () {        return  data;    }      Public void setData (byte[] value) {        this. Data = ((byte[]) value);}    }

Jaxb-xml Schema Types, Binary Data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.