reading cdata with binary data in xml by java -


i have xml coming response of soap web service. xml following--

<![cdata[<?xml version="1.0" encoding="utf-8"?><pro_code>abce096</pro_code>  <pdf_stream>jvberi0xljqkjeljz9mkmsawig9iajw8l0jhc2vgb250l1rpbwvzlvjvbwful1r5cguvrm9udc9f&#13;</pdf_stream>]]> 

by using following have picked pro_code

xpath.compile("//illustrations/product_code/text()").evaluate(doc, xpathconstants.nodeset)).... 

but, pdf_stream bytestream. how can read , convert pdf?

the content of pdf encoded in base64. can decode using base64.getdecoder().decode(string) if use java 8.

you can find more details base64 decoder here.

if don't use java 8, can still use base64 apache commons codec.

nb: have trailing html entity (&#13) need remove first


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -