Given the following ASN1 definition:
InitialUE-Identity ::= CHOICE {
s-TMSI S-TMSI,
randomValue BIT STRING (SIZE (40))
}
An XER encoding for randomvalue: 0x59AA46959A
would be:
<InitialUE-Identity>
<randomValue>0101100110101010010001101001010110011010</randomValue>
</InitialUE-Identity>
Is there any way to input a BIT STRING in hex format? Something like:
<InitialUE-Identity>
<randomValue>0x59AA46959A</randomValue>
</InitialUE-Identity>
Install an XSLT processor with support for the EXPath Binary function library, and it's then easy to do a transformation that converts the hex to binary.
http://expath.org/spec/binary#hex
Well, I thought it was. Looking more carefully, you can read the hex easily using bin:hex(randomValue), but outputting the sequence-of-ones-and-zeros looks more tricky. In fact, it's probably just as easy to do it by hand: just loop over the hex digits and convert each one to a sequence of four ones-and-zeros using a lookup table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.