Module: FastXML

Defined in:
lib/fastxml.rb,
lib/fastxml/error.rb,
lib/fastxml/version.rb,
ext/fastxml/fastxml.c

Defined Under Namespace

Classes: ArgError, Error, ParseError

Constant Summary collapse

VERSION =
"1.1.3"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.attrObject

Returns the value of attribute attr.



7
8
9
# File 'lib/fastxml.rb', line 7

def attr
  @attr
end

.buf_sizeObject

Returns the value of attribute buf_size.



7
8
9
# File 'lib/fastxml.rb', line 7

def buf_size
  @buf_size
end

.canonicalObject

Returns the value of attribute canonical.



7
8
9
# File 'lib/fastxml.rb', line 7

def canonical
  @canonical
end

.cdataObject

Returns the value of attribute cdata.



7
8
9
# File 'lib/fastxml.rb', line 7

def cdata
  @cdata
end

.commObject

Returns the value of attribute comm.



7
8
9
# File 'lib/fastxml.rb', line 7

def comm
  @comm
end

.contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/fastxml.rb', line 7

def content
  @content
end

.docObject

Returns the value of attribute doc.



7
8
9
# File 'lib/fastxml.rb', line 7

def doc
  @doc
end

.encodingObject

Returns the value of attribute encoding.



7
8
9
# File 'lib/fastxml.rb', line 7

def encoding
  @encoding
end

.force_arrayObject

Returns the value of attribute force_array.



7
8
9
# File 'lib/fastxml.rb', line 7

def force_array
  @force_array
end

.force_contentObject

Returns the value of attribute force_content.



7
8
9
# File 'lib/fastxml.rb', line 7

def force_content
  @force_content
end

.indentObject

Returns the value of attribute indent.



7
8
9
# File 'lib/fastxml.rb', line 7

def indent
  @indent
end

.keep_rootObject

Returns the value of attribute keep_root.



7
8
9
# File 'lib/fastxml.rb', line 7

def keep_root
  @keep_root
end

.max_depthObject

Returns the value of attribute max_depth.



7
8
9
# File 'lib/fastxml.rb', line 7

def max_depth
  @max_depth
end

.merge_textObject

Returns the value of attribute merge_text.



7
8
9
# File 'lib/fastxml.rb', line 7

def merge_text
  @merge_text
end

.methodObject

Returns the value of attribute method.



7
8
9
# File 'lib/fastxml.rb', line 7

def method
  @method
end

.outputObject

Returns the value of attribute output.



7
8
9
# File 'lib/fastxml.rb', line 7

def output
  @output
end

.rootObject

Returns the value of attribute root.



7
8
9
# File 'lib/fastxml.rb', line 7

def root
  @root
end

.textObject

Returns the value of attribute text.



7
8
9
# File 'lib/fastxml.rb', line 7

def text
  @text
end

.trimObject

Returns the value of attribute trim.



7
8
9
# File 'lib/fastxml.rb', line 7

def trim
  @trim
end

.use_attrObject

Returns the value of attribute use_attr.



7
8
9
# File 'lib/fastxml.rb', line 7

def use_attr
  @use_attr
end

.utf8Object

Returns the value of attribute utf8.



7
8
9
# File 'lib/fastxml.rb', line 7

def utf8
  @utf8
end

.versionObject

Returns the value of attribute version.



7
8
9
# File 'lib/fastxml.rb', line 7

def version
  @version
end

.xml_declObject

Returns the value of attribute xml_decl.



7
8
9
# File 'lib/fastxml.rb', line 7

def xml_decl
  @xml_decl
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (FastXML)

    the object that the method was called on



32
33
34
# File 'lib/fastxml.rb', line 32

def self.configure
  yield(self)
end

.hash2xml(*args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'ext/fastxml/fastxml.c', line 34

static VALUE
hash2xml(int argc, VALUE *argv, VALUE self) {
    xh_h2x_ctx_t  ctx;
    VALUE         result;
    int           state;
    xh_h2x_arg_t  arg;

    arg.argc = argc;
    arg.argv = argv;
    arg.ctx  = &ctx;

    result = rb_protect(hash2xml_exec, (VALUE) &arg, &state);

    if (state) {
        xh_h2x_destroy_ctx(&ctx);
        rb_exc_raise(rb_errinfo());
    }

    if (ctx.opts.output != Qnil) result = Qnil;

    xh_h2x_destroy_ctx(&ctx);

    return result;
}

.xml2hash(*args) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'ext/fastxml/fastxml.c', line 68

static VALUE
xml2hash(int argc, VALUE *argv, VALUE self) {
    xh_x2h_ctx_t  ctx;
    VALUE         result;
    int           state;
    xh_x2h_arg_t  arg;

    arg.argc = argc;
    arg.argv = argv;
    arg.ctx  = &ctx;

    result = rb_protect(xml2hash_exec, (VALUE) &arg, &state);

    if (state) {
        xh_x2h_destroy_ctx(&ctx);
        rb_exc_raise(rb_errinfo());
    }

    xh_x2h_destroy_ctx(&ctx);

    return result;
}