Genivia Home Documentation
Miscellaneous functions

updated Tue Nov 23 2021 by Robert van Engelen
 
Miscellaneous functions

This module defines other useful functions. More...

Functions

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

Detailed Description

This module defines 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:
... // 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
struct soap * soap_new1(soap_mode input_and_output_mode)
Allocate and initialize a new soap context with input and output soap_mode flags.
#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:2061
void soap_begin(struct soap *soap)
Reset context.
Context with the engine state.
Definition: stdsoap2.h:2851
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
tag1parsed (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));
...
char * soap_strdup(struct soap *soap, const char *string)
Copy a string to managed memory.
struct soap * soap_new()
Allocate and initialize a new soap context.
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
prefixprefix 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
stringstring to match
patternpattern to match