1

JSON response is of Filename , Content:

{
  “Filename” : “abc.pdf”
  “Content” : “abejmkkjshkduhjkskwbkjejjkhugaib” 
}

where

Filename : String 
Content : Byte[]

How to write Byte[] in my XSD schema ?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
immu
  • 21
  • 1
  • 3
  • Why have you asked 7 questions yet [accepted](https://meta.stackexchange.com/q/5234/234215) no answers? – kjhughes Apr 23 '19 at 12:03
  • Dear, I Do not know how to accept the answers – immu Apr 29 '19 at 09:43
  • It's simply. If you click on the [***accepted***](https://meta.stackexchange.com/q/5234/234215) link in my comment, you can read how. (Basically all you have to do is click on the gray checkmark next to the answer. It will then turn green.) – kjhughes Apr 29 '19 at 11:27
  • Now that you know how, why don't you accept the answers that have helped you? – kjhughes May 06 '19 at 15:33

1 Answers1

2

You cannot directly store raw bytes in XML files, but you can encode them in Base64 and store the encoding. For Base64-encoded data, use base64Binary in XSD.

Be sure that your data is actually Base64, because xs:base64 is not the same as xs:string.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • Thanks for the Response Can i Use in the below Format – immu Apr 20 '19 at 16:24
  • Yes, provided that the content in `FileContent` is encoded as Base64. – kjhughes Apr 20 '19 at 16:26
  • Really thanks hughes, Last doubt Should i need to Encode as Base64 ? or directly as above mentioned i can uses as base64Binary? – immu Apr 20 '19 at 16:42
  • During Xml and XSD Validation i'm getting this error , Could you Please help me Is Not A Valid Value For 'base64Binary Of Element 'FileContent' Is Not Valid., Line '3', Column '2011'. – immu Apr 20 '19 at 16:44
  • As I said, your data has to actually be encoded in Base64 format. See updated answer. – kjhughes Apr 20 '19 at 16:52
  • Thanks Mate, Did not see. Now Working. – immu Apr 20 '19 at 17:02
  • You're welcome. Please [**accept**](https://meta.stackexchange.com/q/5234/234215) this answer if it's helped. Thanks. – kjhughes Apr 20 '19 at 17:11