*
XmlDoc holds an XML document and thus represents the root of an XML
tree. XmlDoc is optimized for SOAP type documents, giving accessors
to the SOAP envelope, header and body.
*
Instances of the other XML related classes like XmlAttr and XmlNode
can only be created with an associated XmlDoc instance.
*
Main properties of the XML document are
name of the root element
encoding (defaults to UTF-8)
* */
Create XmlDoc with node name optionally pass namespace as 2nd arg (defaults to NULL)
(const char *name, const char *ns = NULL) {
return ws_xml_create_doc(ns, name);
}
/* destructor */
~_WsXmlDoc() {
ws_xml_destroy_doc( $self );
}
%typemap(newfree) char * "free($1);";
%alias string "to_xml";
%newobject string;
/*
* generic (indented) string representation of the XmlDoc UTF-8 encoded.
* see encode for setting the encoding.
*
* alias: to_xml
*
* call-seq:
* doc.string -> String
* doc.to_xml -> String
*/
char *string() {
int size;
char *buf;
/* force utf-8 encoding since e.g. winrm sends utf-16 */
ws_xml_dump_memory_node_tree_enc( ws_xml_get_doc_root($self), &buf, &size, "UTF-8" );
return buf;
}
%alias encode "to_s";
%newobject encode;
/*
* encode document as string with specific encoding
* (non-indented representation)
*
* encoding defaults to 'utf-8'
*
* alias: to_s
*
* call-seq:
* doc.encode -> String
* doc.encode("UTF-16") -> String
* doc.to_s -> string
*
*/
char *encode(const char *encoding = "utf-8") {
int size;
char *buf;
ws_xml_dump_memory_enc( $self, &buf, &size, encoding );
return buf;
}
/*
* dump document to file
*
* call-seq:
* doc.dump(IO) -> nil
*/
void dump_file(FILE *fp) {
ws_xml_dump_doc( fp, $self );
}
/*
* get root node of doc
* call-seq:
* doc.root -> XmlNode
*
*/
WsXmlNodeH root() {
return ws_xml_get_doc_root( $self );
}
/*
* get soap envelope node
* call-seq:
* doc.envelope -> XmlNode
*
*/
WsXmlNodeH envelope() {
return ws_xml_get_soap_envelope( $self );
}
/*
* get soap header node
* call-seq:
* doc.header -> XmlNode
*
*/
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
get soap body node
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
get enumeration context as string return nil if context not present or empty
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
Generate response envelope document, optionally relating to a specific action.
This creates a new XmlDoc instance representing a response.
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
/*
* dump document to file * *
void dump_file(FILE *fp) {
ws_xml_dump_doc( fp, $self );
}
/*
* get root node of doc
* call-seq:
* doc.root -> XmlNode
*
*/
WsXmlNodeH root() {
return ws_xml_get_doc_root( $self );
}
/*
* get soap envelope node
* call-seq:
* doc.envelope -> XmlNode
*
*/
WsXmlNodeH envelope() {
return ws_xml_get_soap_envelope( $self );
}
/*
* get soap header node
* call-seq:
* doc.header -> XmlNode
*
*/
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
get soap element node by name returns nil if no element with the name can be found
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
encode document as string with specific encoding (non-indented representation)
encoding defaults to 'utf-8'
alias: to_s
char *encode(const char *encoding = "utf-8") {
int size;
char *buf;
ws_xml_dump_memory_enc( $self, &buf, &size, encoding );
return buf;
}
/*
* dump document to file
*
* call-seq:
* doc.dump(IO) -> nil
*/
void dump_file(FILE *fp) {
ws_xml_dump_doc( fp, $self );
}
/*
* get root node of doc
* call-seq:
* doc.root -> XmlNode
*
*/
WsXmlNodeH root() {
return ws_xml_get_doc_root( $self );
}
/*
* get soap envelope node
* call-seq:
* doc.envelope -> XmlNode
*
*/
WsXmlNodeH envelope() {
return ws_xml_get_soap_envelope( $self );
}
/*
* get soap header node
* call-seq:
* doc.header -> XmlNode
*
*/
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
get soap envelope node
WsXmlNodeH envelope() {
return ws_xml_get_soap_envelope( $self );
}
/*
* get soap header node
* call-seq:
* doc.header -> XmlNode
*
*/
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
/*
* retrieve fault data * *
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
Generate fault document based on given status
This creates a new XmlDoc instance representing a fault
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
get soap header node
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
/*
* Check if document represents an end of sequence (last enumeration item) * *
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
Check if document represents a fault
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
get root node of doc
WsXmlNodeH root() {
return ws_xml_get_doc_root( $self );
}
/*
* get soap envelope node
* call-seq:
* doc.envelope -> XmlNode
*
*/
WsXmlNodeH envelope() {
return ws_xml_get_soap_envelope( $self );
}
/*
* get soap header node
* call-seq:
* doc.header -> XmlNode
*
*/
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}
/*
* generic (indented) string representation of the XmlDoc UTF-8 encoded. * see encode for setting the encoding. * * alias: to_xml * *
char *string() {
int size;
char *buf;
/* force utf-8 encoding since e.g. winrm sends utf-16 */
ws_xml_dump_memory_node_tree_enc( ws_xml_get_doc_root($self), &buf, &size, "UTF-8" );
return buf;
}
%alias encode "to_s";
%newobject encode;
/*
* encode document as string with specific encoding
* (non-indented representation)
*
* encoding defaults to 'utf-8'
*
* alias: to_s
*
* call-seq:
* doc.encode -> String
* doc.encode("UTF-16") -> String
* doc.to_s -> string
*
*/
char *encode(const char *encoding = "utf-8") {
int size;
char *buf;
ws_xml_dump_memory_enc( $self, &buf, &size, encoding );
return buf;
}
/*
* dump document to file
*
* call-seq:
* doc.dump(IO) -> nil
*/
void dump_file(FILE *fp) {
ws_xml_dump_doc( fp, $self );
}
/*
* get root node of doc
* call-seq:
* doc.root -> XmlNode
*
*/
WsXmlNodeH root() {
return ws_xml_get_doc_root( $self );
}
/*
* get soap envelope node
* call-seq:
* doc.envelope -> XmlNode
*
*/
WsXmlNodeH envelope() {
return ws_xml_get_soap_envelope( $self );
}
/*
* get soap header node
* call-seq:
* doc.header -> XmlNode
*
*/
WsXmlNodeH header() {
return ws_xml_get_soap_header( $self );
}
/*
* get soap body node
* call-seq:
* doc.body -> XmlNode
*
*/
WsXmlNodeH body() {
return ws_xml_get_soap_body( $self );
}
/*
* get soap element node by name
* returns nil if no element with the name can be found
*
* call-seq:
* doc.element(String) -> XmlNode
*
*/
WsXmlNodeH element(const char *name) {
return ws_xml_get_soap_element( $self, name );
}
%newobject context;
/*
* get enumeration context as string
* return nil if context not present or empty
*
* call-seq:
* doc.context -> String
*
*/
const char *context() {
char *c = wsmc_get_enum_context( $self );
if (c) {
if (*c)
return c;
u_free(c);
}
return NULL;
}
/*
* Generate fault document based on given status
*
* This creates a new XmlDoc instance representing a fault
*
* call-seq:
* doc.generate_fault(Openwsman::Status) -> XmlDoc
*
*/
WsXmlDocH generate_fault(WsmanStatus *s) {
return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg);
}
%rename("fault?") is_fault();
%typemap(out) int is_fault
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents a fault
*
* call-seq:
* doc.fault?(XmlDoc) -> Boolean
*
*/
int is_fault() {
return wsmc_check_for_fault( $self );
}
%newobject fault;
/*
* retrieve fault data
*
* call-seq:
* doc.fault(XmlDoc) -> Openwsman::Fault
* doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault
*/
WsManFault *fault() {
WsManFault *f = NULL;
if (wsmc_check_for_fault($self)) {
f = (WsManFault *)calloc(1, sizeof(WsManFault));
wsmc_get_fault_data($self, f);
}
return f;
}
/*
* Generate response envelope document, optionally relating to a
* specific action.
*
* This creates a new XmlDoc instance representing a response.
*
* call-seq:
* doc.create_response_envelope(String action) -> XmlDoc
*
*/
WsXmlDocH create_response_envelope(const char *action = NULL) {
return wsman_create_response_envelope($self, action);
}
%rename("end_of_sequence?") is_end_of_sequence();
%typemap(out) int is_end_of_sequence
"$result = ($1 != 0) ? Qtrue : Qfalse;";
/*
* Check if document represents an end of sequence (last enumeration item)
*
* call-seq:
* doc.is_end_of_sequence() -> Boolean
*/
int is_end_of_sequence() {
return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 );
}
}