109
115
short int version; // "1.0"
110
116
zstring version_string; // this the version as a string
111
117
short int indent; // "yes" or "no", implemented
118
#ifdef ZORBA_WITH_JSON
119
short int cloudscript_multiple_items; // "no", "array", "appended", implemented
120
short int cloudscript_extensions; // implemented
121
short int cloudscript_xdm_method; // A legal value for "method", implemented
122
#endif /* ZORBA_WITH_JSON */
112
123
bool version_has_default_value; // Used during validation to set version to
113
124
// "4.0" when output method is "html"
114
125
rchandle<emitter> e;
216
228
* Outputs the end of the serialized document.
218
virtual void emit_declaration_end();
230
virtual void emit_end();
233
* Serializes the given item, depending on its type, and its children. This
234
* will be called by serializer for each top-level item in the sequence.
236
* @param item the item to serialize
238
virtual void emit_item(store::Item* item);
240
// End of the "public" emitter API. All remaining methods are implementation
241
// details and will not be called from outside.
221
245
* Outputs the doctype declaration. This function is not used by the
222
246
* default emitter, it is intended to be defined by the XML, HTML and XHTML
225
249
virtual void emit_doctype(const zstring& elementName);
228
* Serializes the given item, depending on its type, and its children.
230
* @param item the item to serialize
232
virtual void emit_item(store::Item* item);
235
252
* Serializes the given streamable item.
237
254
* @param item the item to serialize
339
355
virtual void emit_declaration();
341
358
virtual void emit_doctype(const zstring& elementName);
344
361
bool theEmitAttributes;
364
///////////////////////////////////////////////////////////
366
// class json_emitter //
368
///////////////////////////////////////////////////////////
370
#ifdef ZORBA_WITH_JSON
372
class json_emitter : public emitter
375
json_emitter(serializer* the_serializer, transcoder& the_transcoder);
377
virtual ~json_emitter();
379
virtual void emit_declaration();
381
virtual void emit_item(store::Item *item);
383
virtual void emit_end();
388
* Outputs a JSON item. This method is called both for top-level JSON
389
* items as well as any items within a JSON object or array, so it may
390
* output simple typed values differently than standard XML serialization.
392
void emit_json_item(store::Item* item, int depth);
394
void emit_json_object(store::Item* object, int depth);
396
void emit_json_array(store::Item* array, int depth);
398
void emit_json_pair(store::Item* pair, int depth);
400
void emit_json_value(store::Item* value, int depth);
402
void emit_cloudscript_value(zstring type, zstring value, int depth);
404
void emit_cloudscript_xdm_node(store::Item *item, int depth);
406
void emit_json_string(zstring string);
408
store::Item_t theCloudScriptValueName;
409
store::Item_t theTypeName;
410
store::Item_t theValueName;
411
store::Item_t theCloudScriptXDMNodeName;
413
rchandle<emitter> theXMLEmitter;
414
rchandle<transcoder> theXMLTranscoder;
415
std::stringstream* theXMLStringStream;
416
bool theMultipleItems;
420
///////////////////////////////////////////////////////////
422
// class jsoniq_emitter (auto-detects JSON or XML) //
424
///////////////////////////////////////////////////////////
426
class jsoniq_emitter : public emitter
429
jsoniq_emitter(serializer* the_serializer, transcoder& the_transcoder);
431
virtual ~jsoniq_emitter();
433
virtual void emit_declaration();
435
virtual void emit_item(store::Item *item);
437
virtual void emit_end();
440
enum JSONiqEmitterState {
441
JESTATE_UNDETERMINED,
446
serializer::emitter* theEmitter;
449
#endif /* ZORBA_WITH_JSON */
348
453
///////////////////////////////////////////////////////////
372
478
html_emitter(serializer* the_serializer, transcoder& the_transcoder);
374
480
virtual void emit_declaration();
375
virtual void emit_declaration_end();
481
virtual void emit_end();
376
484
virtual void emit_doctype(const zstring& elementName);
377
485
virtual void emit_node(const store::Item* item, int depth);
425
534
std::stringstream& aSStream,
426
535
SAX2_ContentHandler* aSAX2ContentHandler);
537
void emit_declaration();
538
void emit_item(store::Item* item );
428
542
void emit_startPrefixMapping(
429
543
const store::Item* item,
430
544
store::NsBindings& nsBindings );
432
546
void emit_endPrefixMapping(store::NsBindings& nsBindings );
434
void emit_declaration();
436
void emit_declaration_end();
438
548
void emit_node(const store::Item* item, int depth);
440
550
void emit_node(const store::Item* item);