Metadata encoding apparatus and method for digital broadcasting and metadata decoding apparatus and method

A metadata encoding/decoding apparatus for digital broadcasting and a method thereof are provided to compress and recover XML instance document by using a binary type by synchronizing XML(extensible markup language) schema based metadata with broadcasting program. A metadata encoding apparatus for digital broadcasting comprises a schema management unit(120), and an instance management unit(130). The schema management unit generates a second schema document by compiling a first schema document and generates/manages the first schema document in a structured FSA(finite state automata). The instance management unit changes the instance document into a binary chunk object by using the FSA and outputs the object by a binary file. The schema management unit includes a schema compiler unit(121) generating a second schema document, and an FSA generating unit(122) generating/managing the first schema document in the FSA. An instance compiler unit(131) changes the instance document into the binary chuck object. A chunk recording unit(132) outputs the binary chunk object into the binary file. A schema effectiveness tester(110) inputs the instance document by the instance management unit. Thereby, the XML instance document is easily compressed and recovered.