Example #1
0
store::Item_t get_json_value( store::Item_t const &object,
                              char const *key ) {
  zstring key_str( key );
  store::Item_t key_item;
  GENV_ITEMFACTORY->createString( key_item, key_str );
  return object->getObjectValue( key_item );
}
Example #2
0
static void get_options( store::Item_t const &options_object,
                         options_type *options ) {
  ZORBA_ASSERT( options_object->getKind() == store::Item::OBJECT );
  store::Iterator_t i( options_object->getObjectKeys() );
  i->open();
  store::Item_t opt_key;
  while ( i->next( opt_key ) ) {
    zstring const opt_name( opt_key->getStringValue() );
    store::Item_t const opt_value( options_object->getObjectValue( opt_key ) );
    (*options)[ opt_name ] = opt_value->getStringValue();
  }
  i->close();
}
Example #3
0
static void j2x_object( store::Item_t const &object_item,
                        store::Item_t *parent_xml_item ) {
  ZORBA_ASSERT( parent_xml_item );
  store::Item_t junk_item, key_item, type_name;

  store::Iterator_t k( object_item->getObjectKeys() );
  k->open();
  while ( k->next( key_item ) ) {
    store::Item_t att_name;
    GENV_ITEMFACTORY->createQName(
      att_name, "", "", key_item->getStringValue()
    );
    store::Item_t value_item( object_item->getObjectValue( key_item ) );
    zstring value_str( value_item->getStringValue() );
    GENV_ITEMFACTORY->createString( value_item, value_str );
    type_name = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
    GENV_ITEMFACTORY->createAttributeNode(
      junk_item, *parent_xml_item, att_name, type_name, value_item
    );
  }
  k->close();
}