Class WsMan::XmlDoc
In: rwsman_xmlattr.c
Parent: Object

fill wrapper struct

Methods

body   context   element   header   rawxml   root   to_s   xpath  

Public Instance methods

Access the SOAP body of the document

[Source]

/*
 * Access the SOAP body of the document
 * call-seq:
 *   doc.body -> XmlNode
 *
 */

static VALUE
xmldoc_body( VALUE self )
{
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );

    return rwsman_xmlnode_new( ws_xml_get_soap_body( doc ) );
}

Retrieve context id of the enumeration request. Returns nil if instance is no enumeration result, i.e. from enumerate or pull

[Source]

/*
 * call-seq:
 *   enum_result.context -> string
 *
 * Retrieve context id of the enumeration request.
 * Returns +nil+ if instance is no enumeration result, i.e. from +enumerate+ or +pull+
 */

static VALUE
xmldoc_context( VALUE self )
{
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );
    const char *context = wsmc_get_enum_context( doc );
    if (context && *context) return rb_str_new2( context );
    return Qnil;
}

Access node by name

[Source]

/*
 * Access node by name
 * call-seq:
 *   doc.element name -> XmlDoc
 *
 */

static VALUE
xmldoc_element( VALUE self, VALUE name )
{
    char *n = StringValuePtr( name );

    WsXmlDocH doc = rwsman_xmldoc_unpack( self );
    WsXmlNodeH node = ws_xml_get_soap_element( doc, n );
    if (node) return rwsman_xmlnode_new( node );
    return Qnil;
}

Access the SOAP header of the document

[Source]

/*
 * Access the SOAP header of the document
 * call-seq:
 *   doc.header -> XmlNode
 *
 */

static VALUE
xmldoc_header( VALUE self )
{
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );

    return rwsman_xmlnode_new( ws_xml_get_soap_header( doc ) );
}

Access the raw xml representation of the document

[Source]

/*
 * Access the raw xml representation of the document
 *
 * call-seq:
 *   doc.rawxml -> string
 *   doc.to_s -> string
 *
 */

static VALUE
xmldoc_rawxml( VALUE self )
{
//fprintf( stderr, "%s, self@%p\n", __func__, (void *)self );
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );
    WsXmlNodeH node = ws_xml_get_doc_root( doc );
    char *buf = NULL; int size;

    ws_xml_dump_memory_node_tree( node, &buf, &size );
    return rb_str_new( buf, size );
}

Access the root node of the document

[Source]

/*
 * Access the root node of the document
 * call-seq:
 *   doc.root -> XmlNode
 *
 */

static VALUE
xmldoc_root( VALUE self )
{
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );
    WsXmlNodeH node = ws_xml_get_doc_root( doc );

    return rwsman_xmlnode_new( node );
}

Access the raw xml representation of the document

[Source]

/*
 * Access the raw xml representation of the document
 *
 * call-seq:
 *   doc.rawxml -> string
 *   doc.to_s -> string
 *
 */

static VALUE
xmldoc_rawxml( VALUE self )
{
//fprintf( stderr, "%s, self@%p\n", __func__, (void *)self );
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );
    WsXmlNodeH node = ws_xml_get_doc_root( doc );
    char *buf = NULL; int size;

    ws_xml_dump_memory_node_tree( node, &buf, &size );
    return rb_str_new( buf, size );
}

Get the xpath value

[Source]

/*
 * Get the xpath value
 * call-seq:
 *   doc.xpath e -> string
 *
 */

static VALUE
xmldoc_xpath_value( VALUE self, VALUE expr )
{
    WsXmlDocH doc = rwsman_xmldoc_unpack( self );
    char *e = StringValuePtr( expr );

    char *v = ws_xml_get_xpath_value( doc, e );
    return rb_str_new2( v );
}

[Validate]