about hexBinary

I,m a new user.who can tell me follow problem:

my schema like this:

<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “http://www.w3.org/2001/XMLSchema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “person_schema”>
<tsd:collection name = “people”></tsd:collection>
<tsd:doctype name = “person”>
tsd:logical
tsd:contentclosed</tsd:content>
</tsd:logical>
</tsd:doctype>
tsd:adminInfo
tsd:server4.1.4.1</tsd:server>
tsd:modified2004-10-09T23:59:55.593+08:00</tsd:modified>
tsd:created2004-10-09T23:59:55.593+08:00</tsd:created>
tsd:versionTSD4</tsd:version>
</tsd:adminInfo>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
xs:annotation
xs:documentation DTD for doctype person. </xs:documentation>
</xs:annotation>
<xs:element name = “person”>
xs:complexType
xs:sequence
<xs:element ref = “surname”></xs:element>
<xs:element ref = “firstname”></xs:element>
<xs:element ref = “sex”></xs:element>
<xs:element ref = “city” minOccurs = “0”></xs:element>
<xs:element ref = “remarks” minOccurs = “0” maxOccurs = “unbounded”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name = “surname” type = “xs:string”></xs:element>
<xs:element name = “firstname” type = “xs:string”></xs:element>
<xs:element name = “sex” type = “xs:string”></xs:element>
<xs:element name = “city” type = “xs:string”></xs:element>
<xs:element name = “remarks” type = “xs:hexBinary”></xs:element>
</xs:schema>

then, I wand load a xml document to the tamino.What should like my xml document?


<?xml version="1.0" encoding="ISO-8859-1"?>

Atkins
Paul
Male
Portsmouth
Professional Diver

xs:hexBinary is used to include non-textual binary information in an XML document by giving its hexadecimal (base 16) representation. The only characters that should appear in such an element are those used for hexadecimal digits, namely the decimal digits 0-9 and the letters a-f or A-F (case is not important.)

If you really wanted to encode the text string ?Professional Diver? in a hexBinary field, you would first need to pick a character encoding. Supposing you chose ASCII (the most obvious choice for this string ? UTF-8 or ISO-8859-1 would also work and in this case the result would be identical) the result would be ?50726f66657373696f6e616c204469766572?.

Hi Curtis,

I tried to use the data that you specified but when I try to retrieve the instance from Xplorer, it does not return the required string which is “Professional Diver”. I am not very sure how to retrieve this data.

Regards,
Vipin Makode

If you really want it to return the string “Professional Diver” then you should not define the node as xs:hexBinary in your schema.

XML is a text format; it cannot directly include arbitrary binary data, only Unicode characters in certain defined ranges. If you need to include binary data within an XML document, you have to find a way to represent it using valid characters. XML Schema defines two primitive types, xs:hexBinary and xs:base64Binary, that support two common ways to encode binary data as textual characters.

The bottom line is that if a node is defined in the schema as xs:hexBinary there is a presumption that its content will require additional processing ? specifically, translating each consecutive pair of characters into the corresponding 8-bit value ? before the application will be able to use it.