| Class | WsMan::XmlDoc |
| In: |
rwsman_xmlattr.c
|
| Parent: | Object |
Retrieve context id of the enumeration request. Returns nil if instance is no enumeration result, i.e. from enumerate or pull
/*
* 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
/*
* 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 raw xml representation of the document
/*
* 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 raw xml representation of the document
/*
* 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
/*
* 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 );
}