|  | Home | Documentation | Miscellaneous functions updated by Robert van Engelen |

Miscellaneous functions

This module describes other useful functions. More...

## Functions

void | soap_begin (struct soap *soap)
| Reset context.
const char * | soap_rand_uuid (struct soap *soap, const char *prefix)
| Returns a randomized unique UUID string.
int | soap_tag_cmp (const char *string, const char *pattern)
| Compare string to a pattern.
int | soap_match_tag (struct soap *soap, const char *tag1, const char *tag2)
| Match an XML tag name.

## Detailed Description

This module describes other useful functions.

## Function Documentation

## ◆ soap_begin()

void soap_begin | ( | struct soap * | soap | ) |

Reset context.

This function resets the context to start serialization with the serialize functions. Alternatively, soap_begin_send can be used before calling the serialize functions, but this is sometimes not possible so this function can be used instead.

Example:

struct soap *soap = soap_new1(SOAP_XML_GRAPH);
... // further initializations
struct ns__someElement elt;
... // populate elt
soap_begin(soap); // reset context before calling serialize functions
soap_serialize_ns__someElement(soap, &elt); // analyze pointers for multi-ref serialization
SOAP_XML_GRAPH
#define SOAP_XML_GRAPH
soap_mode XML input/output flag value to serialize C/C++ (cyclic) data structures in XML with id-ref ...
Definition stdsoap2.h:2137
soap_begin
void soap_begin(struct soap *soap)
Reset context.
soap
Context with the engine state.
Definition stdsoap2.h:2929

See also
  soap_begin_send.

Parameters

  soap | soap context

## ◆ soap_match_tag()

int soap_match_tag | ( | struct soap * | soap,
|  | const char * | tag1,
|  | const char * | tag2 )

Match an XML tag name.

This function returns #SOAP_OK when the two specified XML tag names match. The first tag name is a qualified or unqualified parsed tag name when the parser is pulling XML tags. The second tag name is an unqualified or namespace-normalized qualified tag name or pattern to match. A namespace-normalized qualified tag name uses a prefix defined in the namespaces table. A pattern consists of two types of wildcard meta-characters: * matches any text of any length and - matches any single character. Returns #SOAP_OK when the tags are matching or #SOAP_TAG_MISMATCH when the tags are non-matching.

Warning
  This function should only be used while the XML parser is actively parsing input, for example in the soap::fignore callback.

Returns
  #SOAP_OK (match) or #SOAP_TAG_MISMATCH (no match)

Parameters

  soap | soap context
  tag1 | parsed (un)qualified tag name string to match
  tag2 | (namespace-normalized qualified) tag name string or pattern to match

## ◆ soap_rand_uuid()

const char * soap_rand_uuid | ( | struct soap * | soap,
|  | const char * | prefix )

Returns a randomized unique UUID string.

This function returns a randomized unique UUID string stored in a temporary buffer. The UUID string starts with the specified prefix if non-NULL.

Example:

struct soap *soap = soap_new();
const char *uuid = soap_strdup(soap, soap_rand_uuid(soap, NULL));
...
soap_strdup
*Copy a string to managed memory char * soap_strdup(struct soap *soap, const char *string) * @returns copy of string or NULL when the specified string is NULL or on failure to allocate(out of memory)
soap_rand_uuid
const char * soap_rand_uuid(struct soap *soap, const char *prefix)
Returns a randomized unique UUID string.

Returns
  randomized UUID string stored in a temporary buffer

Parameters

  soap | soap context
  prefix | prefix string or NULL

## ◆ soap_tag_cmp()

int soap_tag_cmp | ( | const char * | string,
|  | const char * | pattern )

Compare string to a pattern.

This function returns zero when the specified string matches the given pattern, nonzero otherwise. A pattern consists of two types of wildcard meta-characters: * matches any text of any length and - matches any single character. This function is commonly used to match XML tags and XML namespace URIs, such as the URI pattern in the third column of the namespaces table.

Returns
  zero (match) or nonzero (no match)

Parameters

  string | string to match
  pattern | pattern to match