libxmq
Libxmq C API
Loading...
Searching...
No Matches
xmq.h File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  XMQReader
struct  XMQWriter
struct  XMQReturnDoc
struct  XMQReturnNode
struct  XMQReturnAttr
struct  XMQReturnString
struct  XMQReturnConstString
struct  XMQNS

Macros

#define _hideLBfromEditor   {
#define _hideRBfromEditor   }
#define NS_NONE   ((XMQNS){XMQ_NS_NONE,NULL})
#define NS_PARENT   ((XMQNS){XMQ_NS_PARENT,NULL})
#define NS_HERE(uri)
#define NS_ANCESTOR(uri)

Typedefs

typedef struct XMQDoc XMQDoc
typedef struct XMQNode XMQNode
typedef struct XMQAttr XMQAttr
typedef struct XMQParseState XMQParseState
typedef struct XMQParseCallbacks XMQParseCallbacks
typedef struct XMQOutputSettings XMQOutputSettings
typedef enum XMQColorName XMQColorName
typedef struct XMQReader XMQReader
typedef bool(* XMQWrite) (void *writer_state, const char *start, const char *stop)
typedef struct XMQWriter XMQWriter
typedef XMQProceed(* XMQNodeCallback) (XMQDoc *doc, XMQNode *node, void *user_data)
typedef struct XMQReturnDoc XMQReturnDoc
typedef struct XMQReturnNode XMQReturnNode
typedef struct XMQReturnAttr XMQReturnAttr
typedef struct XMQReturnString XMQReturnString
typedef struct XMQReturnConstString XMQReturnConstString
typedef struct XMQLineConfig XMQLineConfig
typedef struct XMQNS XMQNS

Enumerations

enum  XMQContentType {
  XMQ_CONTENT_UNKNOWN = 0 , XMQ_CONTENT_DETECT = 1 , XMQ_CONTENT_XMQ = 2 , XMQ_CONTENT_HTMQ = 3 ,
  XMQ_CONTENT_XML = 4 , XMQ_CONTENT_HTML = 5 , XMQ_CONTENT_JSON = 6 , XMQ_CONTENT_IXML = 7 ,
  XMQ_CONTENT_TEXT = 8 , XMQ_CONTENT_CLINES = 9
}
 Specify the file/buffer content type both for input and for output. More...
enum  XMQRenderFormat {
  XMQ_RENDER_PLAIN = 0 , XMQ_RENDER_TERMINAL = 1 , XMQ_RENDER_HTML = 2 , XMQ_RENDER_HTMQ = 3 ,
  XMQ_RENDER_TEX = 4
}
 XMQRenderFormat decides how to format the xmq output: PLAIN, or for human consumption in TERMINAL, HTML, HTMQ, TEX. More...
enum  XMQFlagBits {
  XMQ_FLAG_TRIM_NONE = 1 , XMQ_FLAG_TRIM_HEURISTIC = 2 , XMQ_FLAG_TRIM_EXACT = 4 , XMQ_FLAG_NOMERGE = 8 ,
  XMQ_FLAG_IXML_ALL_PARSES = 16 , XMQ_FLAG_IXML_TRY_TO_RECOVER = 32 , XMQ_FLAG_IXML_FAIL_SILENT = 64
}
enum  XMQColorName {
  XMQ_COLOR_C , XMQ_COLOR_Q , XMQ_COLOR_E , XMQ_COLOR_NS ,
  XMQ_COLOR_EN , XMQ_COLOR_EK , XMQ_COLOR_EKV , XMQ_COLOR_AK ,
  XMQ_COLOR_AKV , XMQ_COLOR_CP , XMQ_COLOR_NSD , XMQ_COLOR_UW ,
  XMQ_COLOR_XLS
}
enum  XMQProceed { XMQ_CONTINUE , XMQ_STOP }
enum  XMQStatus {
  XMQ_OK = 0 , XMQ_ERROR_CANNOT_READ_FILE = 1 , XMQ_ERROR_OOM = 2 , XMQ_ERROR_NOT_XMQ = 3 ,
  XMQ_ERROR_QUOTE_NOT_CLOSED = 4 , XMQ_ERROR_ENTITY_NOT_CLOSED = 5 , XMQ_ERROR_COMMENT_NOT_CLOSED = 6 , XMQ_ERROR_COMMENT_CLOSED_WITH_TOO_MANY_SLASHES = 7 ,
  XMQ_ERROR_BODY_NOT_CLOSED = 8 , XMQ_ERROR_ATTRIBUTES_NOT_CLOSED = 9 , XMQ_ERROR_COMPOUND_NOT_CLOSED = 10 , XMQ_ERROR_COMPOUND_MAY_NOT_CONTAIN = 11 ,
  XMQ_ERROR_QUOTE_CLOSED_WITH_TOO_MANY_QUOTES = 12 , XMQ_ERROR_UNEXPECTED_CLOSING_BRACE = 13 , XMQ_ERROR_EXPECTED_CONTENT_AFTER_EQUALS = 14 , XMQ_ERROR_UNEXPECTED_TAB = 15 ,
  XMQ_ERROR_INVALID_CHAR = 16 , XMQ_ERROR_BAD_DOCTYPE = 17 , XMQ_ERROR_JSON_INVALID_ESCAPE = 18 , XMQ_ERROR_JSON_INVALID_CHAR = 19 ,
  XMQ_ERROR_CANNOT_HANDLE_XML = 20 , XMQ_ERROR_CANNOT_HANDLE_HTML = 21 , XMQ_ERROR_CANNOT_HANDLE_JSON = 22 , XMQ_ERROR_EXPECTED_XMQ = 23 ,
  XMQ_ERROR_EXPECTED_HTMQ = 24 , XMQ_ERROR_EXPECTED_XML = 25 , XMQ_ERROR_EXPECTED_HTML = 26 , XMQ_ERROR_EXPECTED_JSON = 27 ,
  XMQ_ERROR_PARSING_XML = 28 , XMQ_ERROR_PARSING_HTML = 29 , XMQ_ERROR_VALUE_CANNOT_START_WITH = 30 , XMQ_ERROR_INVALID_NAMESPACE_URI = 31 ,
  XMQ_ERROR_INVALID_NAMESPACE_PREFIX = 32 , XMQ_ERROR_NAMESPACE_PREFIX_ALREADY_TAKEN = 33 , XMQ_ERROR_BAD_RANGE = 35 , XMQ_ERROR_BAD_VALUE = 36 ,
  XMQ_ERROR_IXML_SYNTAX_ERROR = 50 , XMQ_WARNING_QUOTES_NEEDED = 1000
}
enum  XMQCoreType {
  XMQ_CORE_BOOL , XMQ_CORE_I8 , XMQ_CORE_I16 , XMQ_CORE_I32 ,
  XMQ_CORE_I64 , XMQ_CORE_I128 , XMQ_CORE_U8 , XMQ_CORE_U16 ,
  XMQ_CORE_U32 , XMQ_CORE_U64 , XMQ_CORE_U128 , XMQ_CORE_F32 ,
  XMQ_CORE_F64 , XMQ_CORE_STRING , XMQ_CORE_EMAIL , XMQ_CORE_URI ,
  XMQ_CORE_URL , XMQ_CORE_IP_ADDRESS , XMQ_CORE_IPV4_ADDRESS , XMQ_CORE_IPV6_ADDRESS ,
  XMQ_BINARY_BASE64
}
enum  NamespaceAction { XMQ_NS_NONE , XMQ_NS_PARENT , XMQ_NS_HERE , XMQ_NS_ANCESTOR }

Functions

XMQContentType xmqDetectContentType (const char *start, const char *stop)
const char * xmqParseErrorToString (XMQStatus e)
XMQParseCallbacksxmqNewParseCallbacks ()
void xmqFreeParseCallbacks (XMQParseCallbacks *cb)
void xmqSetupParseCallbacksColorizeTokens (XMQParseCallbacks *state, XMQRenderFormat render_format)
void xmqSetupParseCallbacksDebugTokens (XMQParseCallbacks *state)
void xmqSetupParseCallbacksDebugContent (XMQParseCallbacks *state)
bool xmqTokenizeBuffer (XMQParseState *state, const char *start, const char *stop)
bool xmqTokenizeFile (XMQParseState *state, const char *file)
bool xmqTokenizeFileDescriptor (XMQParseState *state, int fd)
XMQParseStatexmqNewParseState (XMQParseCallbacks *callbacks, XMQOutputSettings *settings)
void xmqFreeParseState (XMQParseState *state)
void xmqSetStateSourceName (XMQParseState *state, const char *source_name)
int xmqStateErrno (XMQParseState *state)
const char * xmqStateErrorMsg (XMQParseState *state)
void xmqSetPrintAllParsesIXML (XMQParseState *state, bool all_parses)
void xmqSetTryToRecoverIXML (XMQParseState *state, bool try_recover)
XMQReturnDoc xmqNewDoc ()
void xmqSetDocSourceName (XMQDoc *doq, const char *source_name)
const char * xmqGetDocSourceName (XMQDoc *doq)
XMQContentType xmqGetOriginalContentType (XMQDoc *doq)
size_t xmqGetOriginalSize (XMQDoc *doq)
void xmqSetOriginalSize (XMQDoc *doq, size_t size)
XMQNodexmqGetRootNode (XMQDoc *doq)
The name of the new element.

Create a new element node below an existing element.

@doq The xmq document. @parent The exiting element.

@ns The namespace setting.

xmqAddElement(doc, p, "el", NS_NONE); // No namespace.
xmqAddElement(doc, p, "el", NS_PARENT); // Inherit parent namespace.
xmqAddElement(doc, p, "el", NS_HERE("urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_HERE("{drv}urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_ANCESTOR("urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_ANCESTOR("{drv}urn:myapp:driver"));
#define NS_PARENT
Definition xmq.h:636
XMQReturnNode xmqAddElement(XMQDoc *doq, XMQNode *parent, const char *name, XMQNS ns)
#define NS_HERE(uri)
Definition xmq.h:638
#define NS_NONE
Definition xmq.h:634
#define NS_ANCESTOR(uri)
Definition xmq.h:641
XMQReturnNode xmqAddRootElement (XMQDoc *doq, const char *name, XMQNS ns)
XMQReturnNode xmqAddElement (XMQDoc *doq, XMQNode *parent, const char *name, XMQNS ns)
XMQReturnNode xmqAddKeyValue (XMQDoc *doq, XMQNode *parent, const char *key, const char *value, XMQNS ns)
XMQReturnAttr xmqSetAttribute (XMQDoc *doq, XMQNode *node, const char *name, const char *value, XMQNS ns)
XMQStatus xmqAddNamespace (XMQDoc *doq, XMQNode *node, XMQNS ns)
XMQReturnString xmqChangePrefix (XMQDoc *doq, XMQNode *node, const char *ns_uri, const char *old_prefix, const char *new_prefix)
void * xmqGetImplementationDoc (XMQDoc *doq)
void xmqSetImplementationDoc (XMQDoc *doq, void *doc)
void xmqClearDoc (XMQDoc *doc)
void xmqFreeDoc (XMQDoc *doc)
bool xmqParseFile (XMQDoc *doc, const char *file, const char *implicit_root, int flags)
bool xmqParseBuffer (XMQDoc *doc, const char *start, const char *stop, const char *implicit_root, int flags)
bool xmqParseReader (XMQDoc *doc, XMQReader *reader, void *reader_state, const char *implicit_root, int flags)
XMQOutputSettingsxmqNewOutputSettings ()
void xmqFreeOutputSettings (XMQOutputSettings *os)
void xmqSetAddIndent (XMQOutputSettings *os, int add_indent)
void xmqSetCompact (XMQOutputSettings *os, bool compact)
void xmqSetUseColor (XMQOutputSettings *os, bool use_color)
void xmqSetTrueColor (XMQOutputSettings *os, bool truecolor)
void xmqSetBackgroundMode (XMQOutputSettings *os, bool bg_dark_mode)
void xmqSetPreferDoubleQuotes (XMQOutputSettings *os, bool prefer_double_quotes)
void xmqSetEscapeNewlines (XMQOutputSettings *os, bool escape_newlines)
void xmqSetEscapeNon7bit (XMQOutputSettings *os, bool escape_non_7bit)
void xmqSetEscapeTabs (XMQOutputSettings *os, bool escape_tabs)
void xmqSetOutputFormat (XMQOutputSettings *os, XMQContentType output_format)
void xmqSetOmitDecl (XMQOutputSettings *os, bool omit_decl)
void xmqSetRenderFormat (XMQOutputSettings *os, XMQRenderFormat render_to)
void xmqSetRenderTheme (XMQOutputSettings *os, const char *theme_spec)
void xmqSetRenderRaw (XMQOutputSettings *os, bool render_raw)
void xmqSetRenderOnlyStyle (XMQOutputSettings *os, bool only_style)
void xmqSetWriterContent (XMQOutputSettings *os, XMQWriter content)
void xmqSetWriterError (XMQOutputSettings *os, XMQWriter error)
void xmqSetupPrintStdOutStdErr (XMQOutputSettings *ps)
void xmqSetupPrintFile (XMQOutputSettings *ps, const char *file)
void xmqSetupPrintFileDescriptor (XMQOutputSettings *ps, int fd)
void xmqSetupPrintMemory (XMQOutputSettings *ps, char **start, char **stop)
void xmqSetupPrintSkip (XMQOutputSettings *ps, size_t *skip)
void xmqPrint (XMQDoc *doc, XMQOutputSettings *settings)
void xmqAnnotateOffsets (XMQDoc *doc, const char *attribute_name, const char *ns)
void xmqTrimWhitespace (XMQDoc *doc, int flags)
char * xmqCompactQuote (const char *content)
const char * xmqDocError (XMQDoc *doc)
XMQStatus xmqDocErrno (XMQDoc *doc)
const char * xmqGetName (XMQNode *node)
const char * xmqGetContent (XMQNode *node)
void xmqSetContent (XMQNode *node, const char *raw_content)
XMQNodexmqGetNode (XMQDoc *doc, const char *xpath)
XMQNodexmqGetNodeRel (XMQDoc *doc, const char *xpath, XMQNode *relative)
int32_t xmqGetInt (XMQDoc *doc, const char *xpath)
int32_t xmqGetIntRel (XMQDoc *doc, const char *xpath, XMQNode *relative)
int64_t xmqGetLong (XMQDoc *doc, const char *xpath)
int64_t xmqGetLongRel (XMQDoc *doc, const char *xpath, XMQNode *relative)
double xmqGetDouble (XMQDoc *doc, const char *xpath)
double xmqGetDoubleRel (XMQDoc *doc, const char *xpath, XMQNode *relative)
const char * xmqGetString (XMQDoc *doc, const char *xpath)
const char * xmqGetStringRel (XMQDoc *doc, const char *xpath, XMQNode *relative)
int xmqForeach (XMQDoc *doq, const char *xpath, XMQNodeCallback cb, void *user_data)
int xmqForeachRel (XMQDoc *doq, const char *xpath, XMQNodeCallback cb, void *user_data, XMQNode *relative)
int xmqReplaceEntity (XMQDoc *doq, const char *entity, const char *content)
int xmqReplaceEntityWithNode (XMQDoc *doq, const char *entity, XMQDoc *idoq, XMQNode *inode)
const char * xmqVersion ()
void xmqSetVerbose (bool e)
void xmqSetDebug (bool e)
void xmqSetTrace (bool e)
void xmqLogFilter (const char *log_filter)
bool xmqDebugging ()
bool xmqTracing ()
void xmqSetLogHumanReadable (bool e)
bool xmqLoggingXMQ ()
bool xmqParseBufferWithType (XMQDoc *doc, const char *start, const char *stop, const char *implicit_root, XMQContentType ct, int flags)
bool xmqParseFileWithType (XMQDoc *doc, const char *file, const char *implicit_root, XMQContentType ct, int flags)
bool xmqParseBufferWithIXML (XMQDoc *doc, const char *start, const char *stop, XMQDoc *ixml_grammar, int flags)
bool xmqParseFileWithIXML (XMQDoc *doc, const char *file, XMQDoc *ixml_grammar, int flags)
void xmqSetupDefaultColors (XMQOutputSettings *settings)
void xmqOverrideSettings (XMQOutputSettings *settings, const char *indentation_space, const char *explicit_space, const char *explicit_tab, const char *explicit_cr, const char *explicit_nl)
void xmqRenderHtmlSettings (XMQOutputSettings *settings, const char *use_id, const char *use_class)
void xmqOverrideColor (XMQOutputSettings *settings, const char *render_style, XMQColorName cn, const char *pre, const char *post, const char *ns)
XMQLineConfigxmqNewLineConfig ()
void xmqFreeLineConfig (XMQLineConfig *lc)
void xmqSetLineHumanReadable (XMQLineConfig *lc, bool enable)
char * xmqLineDoc (XMQLineConfig *lc, XMQDoc *doc)
char * xmqLinePrintf (XMQLineConfig *lc, const char *element_name,...)
char * xmqLineVPrintf (XMQLineConfig *lc, const char *element_name, va_list ap)

Macro Definition Documentation

◆ _hideLBfromEditor

#define _hideLBfromEditor   {

◆ _hideRBfromEditor

#define _hideRBfromEditor   }

◆ NS_ANCESTOR

#define NS_ANCESTOR ( uri)
Value:
Definition xmq.h:627
@ XMQ_NS_ANCESTOR
Definition xmq.h:622

Search for the namespace in parent and parents parent etc. If not found, create the namespace in the root element.

◆ NS_HERE

#define NS_HERE ( uri)
Value:
@ XMQ_NS_HERE
Definition xmq.h:621

Create a new namespace for this node.

◆ NS_NONE

#define NS_NONE   ((XMQNS){XMQ_NS_NONE,NULL})

Assign no namespace to this node.

◆ NS_PARENT

#define NS_PARENT   ((XMQNS){XMQ_NS_PARENT,NULL})

Reuse the parent namespace for this node.

Typedef Documentation

◆ XMQAttr

typedef struct XMQAttr XMQAttr

Opaque structure storing an attribute in the document.

◆ XMQColorName

typedef enum XMQColorName XMQColorName

XMQColorName is used to color the output when pretty printing xmq.

◆ XMQDoc

typedef struct XMQDoc XMQDoc

Opaque structure storing a document.

◆ XMQLineConfig

typedef struct XMQLineConfig XMQLineConfig

◆ XMQNode

typedef struct XMQNode XMQNode

Opaque structure storing a node in the document. A node can be an element, text or entity. An element containing only text and entities is usually displayed as a key=value.

◆ XMQNodeCallback

typedef XMQProceed(* XMQNodeCallback) (XMQDoc *doc, XMQNode *node, void *user_data)

XMQNodeCallback: The function type which is called by foreach functions. @doc: The document being processed. @node: The node triggering the callback. @user_data: The user data supplied to for_each.

◆ XMQNS

typedef struct XMQNS XMQNS

◆ XMQOutputSettings

Opaque structure storing a output settings when printing xmq, xml or json.

◆ XMQParseCallbacks

Store your own parse callbacks into this structure and register it with the XMQParseState. Then you will get your own callbacks when parsing XMQ and using these callbacks you can implement your own document builder or token handler.

◆ XMQParseState

typedef struct XMQParseState XMQParseState

An opaque structure to maintain the parse state and the list of callbacks to be invoked when parsing xmq.

◆ XMQReader

typedef struct XMQReader XMQReader

◆ XMQReturnAttr

typedef struct XMQReturnAttr XMQReturnAttr

◆ XMQReturnConstString

typedef struct XMQReturnConstString XMQReturnConstString

◆ XMQReturnDoc

typedef struct XMQReturnDoc XMQReturnDoc

◆ XMQReturnNode

typedef struct XMQReturnNode XMQReturnNode

◆ XMQReturnString

typedef struct XMQReturnString XMQReturnString

◆ XMQWrite

typedef bool(* XMQWrite) (void *writer_state, const char *start, const char *stop)

You can pass your own xmq_writer to the printer routines to do your own final output. Any function implementing XMQWrite must handle stop == NULL.

Parameters
writer_stateYour own writer_state supplied to the printing function.
startStart of buffer to write.
stopPoints to byte after buffer to write. If NULL then assume start is null terminated.

◆ XMQWriter

typedef struct XMQWriter XMQWriter

Enumeration Type Documentation

◆ NamespaceAction

Enumerator
XMQ_NS_NONE 
XMQ_NS_PARENT 
XMQ_NS_HERE 
XMQ_NS_ANCESTOR 

◆ XMQColorName

XMQColorName is used to color the output when pretty printing xmq.

Enumerator
XMQ_COLOR_C 

Comment.

XMQ_COLOR_Q 

Quote.

XMQ_COLOR_E 

Entity.

XMQ_COLOR_NS 

Name Space (both for element and attribute).

XMQ_COLOR_EN 

Element name.

XMQ_COLOR_EK 

Element key.

XMQ_COLOR_EKV 

Element key value.

XMQ_COLOR_AK 

Attribute key.

XMQ_COLOR_AKV 

Attribute key value.

XMQ_COLOR_CP 

Compound Parentheses.

XMQ_COLOR_NSD 

Name Space Declaration xmlns.

XMQ_COLOR_UW 

Unicode whitespace.

XMQ_COLOR_XLS 

Override xls prefixed element names with this color.

◆ XMQContentType

Specify the file/buffer content type both for input and for output.

Enumerator
XMQ_CONTENT_UNKNOWN 

Unknown buffer content.

XMQ_CONTENT_DETECT 

Try to detect buffer content, is it xmq, xml or json?

XMQ_CONTENT_XMQ 

Content is xmq.

XMQ_CONTENT_HTMQ 

Content is htmq.

XMQ_CONTENT_XML 

Content is xml.

XMQ_CONTENT_HTML 

Content is html.

XMQ_CONTENT_JSON 

Content is json.

XMQ_CONTENT_IXML 

Content is ixml.

XMQ_CONTENT_TEXT 

Content is text.

XMQ_CONTENT_CLINES 

Cline content looks like: xpath="c-escaped string"

◆ XMQCoreType

When loading xmq/xml/json as a config file, the content is parsed and decoded according the the requested type. These are the available core types.

Enumerator
XMQ_CORE_BOOL 
XMQ_CORE_I8 

Signed 8 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_I16 

Signed 16 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_I32 

Signed 32 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_I64 

Signed 64 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_I128 

Signed 128 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_U8 

Unsigned 8 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_U16 

Unsigned 16 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_U32 

Unsigned 32 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_U64 

Unsigned 64 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_U128 

Unsigned 128 bit integer. Can be decimal, hex (0x) or octal (0).

XMQ_CORE_F32 

Floating point 32bit.

XMQ_CORE_F64 

Floating point 64bit.

XMQ_CORE_STRING 

Zero to infinite sized unicode string. No zero bytes.

XMQ_CORE_EMAIL 

String formatted as a valid email address.

XMQ_CORE_URI 

String formatted as a valid uri/iri.

XMQ_CORE_URL 

String formatted as a valid url.

XMQ_CORE_IP_ADDRESS 

Either a v4 or a v6.

XMQ_CORE_IPV4_ADDRESS 

128.0.0.1

XMQ_CORE_IPV6_ADDRESS 

::0

XMQ_BINARY_BASE64 

Base64 encoded binary data.

◆ XMQFlagBits

The flag bits specify by the parser builds the document.

If a 0 is provided as the flag bits to the parse functions, then it will parse using the these default settings:

When loading xml/html: trim the whitespace from the input to generate the most likely desired xmq output. merge character entities

When loading xmq/htmq: no trimming but merge character entities such as &#10; and consecutive text quotes

If you load xml with XMQ_TRIM_NONE (–trim=none) there will be a lot of unnecessary whitespace stored in the xmq, like &#32;&#9;&#10; etc. You can then view the xmq with XMQ_TRIM_HEURISTIC (–trim=heuristic) to drop the whitespace.

If you load xmq with –nomerge then character entities and separate text blocks will be kept as is. The –nomerge currently does not work for XML/HTML since libxml2 does not have a setting for merge, it always merges.

Enumerator
XMQ_FLAG_TRIM_NONE 

Do not trim any whitespace. Only relevant when parsing xml.

XMQ_FLAG_TRIM_HEURISTIC 

Remove leading/ending whitespace, but try to keep significant, remove incidental indentation.

XMQ_FLAG_TRIM_EXACT 

Not implemented.

XMQ_FLAG_NOMERGE 

Do not merge adjacent text nodes and character entity nodes.

XMQ_FLAG_IXML_ALL_PARSES 

When ixml parse is ambiguous generate all parses.

XMQ_FLAG_IXML_TRY_TO_RECOVER 

When ixml parse fails, try to recover.

XMQ_FLAG_IXML_FAIL_SILENT 

If the ixml parse fails generate an empty document and no errors.

◆ XMQProceed

enum XMQProceed

The XMQProceed is used to proceed or stop when iterating over xmq nodes.

Enumerator
XMQ_CONTINUE 

Return XMQ_CONTINUE to continue iterating over xmq nodes.

XMQ_STOP 

Return XMQ_STOP to stop iterating.

◆ XMQRenderFormat

XMQRenderFormat decides how to format the xmq output: PLAIN, or for human consumption in TERMINAL, HTML, HTMQ, TEX.

Enumerator
XMQ_RENDER_PLAIN 

Normal output for data storage.

XMQ_RENDER_TERMINAL 

Colorize output using ansi codes.

XMQ_RENDER_HTML 

Colorize output using html tags.

XMQ_RENDER_HTMQ 

Colorize output using htmq tags.

XMQ_RENDER_TEX 

Colorize using latex.

◆ XMQStatus

enum XMQStatus

The xmq functions return OK or error values using the XMQStatus.

Enumerator
XMQ_OK 

No error.

XMQ_ERROR_CANNOT_READ_FILE 

File not found or cannot be opened for reading.

XMQ_ERROR_OOM 

Out of memory.

XMQ_ERROR_NOT_XMQ 

Expected xmq but auto detect sees early that it is not xmq.

XMQ_ERROR_QUOTE_NOT_CLOSED 

An xmq quote is not closed, ie single quotes are missing.

XMQ_ERROR_ENTITY_NOT_CLOSED 

An entity is missing the semicolon.

XMQ_ERROR_COMMENT_NOT_CLOSED 

A comment has not been closed.

XMQ_ERROR_COMMENT_CLOSED_WITH_TOO_MANY_SLASHES 

A comment close is not balanced.

XMQ_ERROR_BODY_NOT_CLOSED 

A body is missing a closing brace.

XMQ_ERROR_ATTRIBUTES_NOT_CLOSED 

The attribute list is missing the closing parentheses.

XMQ_ERROR_COMPOUND_NOT_CLOSED 

Compound content is missing the closing double parentheses.

XMQ_ERROR_COMPOUND_MAY_NOT_CONTAIN 

Compound content may only contains quotes and entities.

XMQ_ERROR_QUOTE_CLOSED_WITH_TOO_MANY_QUOTES 

Too many closing single quotes.

XMQ_ERROR_UNEXPECTED_CLOSING_BRACE 

An unexpected closing brace.

XMQ_ERROR_EXPECTED_CONTENT_AFTER_EQUALS 

Expected a value after equals.

XMQ_ERROR_UNEXPECTED_TAB 

Tabs are not permitted as token separators.

XMQ_ERROR_INVALID_CHAR 

An invalid character found.

XMQ_ERROR_BAD_DOCTYPE 

The doctype could not be parsed.

XMQ_ERROR_JSON_INVALID_ESCAPE 

An invalid json escape sequence.

XMQ_ERROR_JSON_INVALID_CHAR 

An invalid json character.

XMQ_ERROR_CANNOT_HANDLE_XML 

The XMl parser has been left out to shrink code size.

XMQ_ERROR_CANNOT_HANDLE_HTML 

The HTML parser has been left out to shrink code size.

XMQ_ERROR_CANNOT_HANDLE_JSON 

The JSON parser has been left out to shrink code size.

XMQ_ERROR_EXPECTED_XMQ 

Expecte xmq but was given something else.

XMQ_ERROR_EXPECTED_HTMQ 

Expecte htmq but was given something else.

XMQ_ERROR_EXPECTED_XML 

Expecte xml but was given something else.

XMQ_ERROR_EXPECTED_HTML 

Expecte html but was given something else.

XMQ_ERROR_EXPECTED_JSON 

Expecte json but was given something else.

XMQ_ERROR_PARSING_XML 

Error while parsing xml.

XMQ_ERROR_PARSING_HTML 

Error while parsing html.

XMQ_ERROR_VALUE_CANNOT_START_WITH 

A value after a key cannot start with comments or equals.

XMQ_ERROR_INVALID_NAMESPACE_URI 

Not a proper uri for a namespace.

XMQ_ERROR_INVALID_NAMESPACE_PREFIX 

Not a proper prefix for a namespace.

XMQ_ERROR_NAMESPACE_PREFIX_ALREADY_TAKEN 

When adding a new namespace with a prefix, the prefix has already been used.

XMQ_ERROR_BAD_RANGE 

Pointer errors to buffers are wrong.

XMQ_ERROR_BAD_VALUE 

Invalid enums provided or other bad input to functions.

XMQ_ERROR_IXML_SYNTAX_ERROR 

The ixml grammar cannot be parsed.

XMQ_WARNING_QUOTES_NEEDED 

Warning, when parse succeeds, but it seems there is a mistake.

Function Documentation

◆ xmqAddElement()

XMQReturnNode xmqAddElement ( XMQDoc * doq,
XMQNode * parent,
const char * name,
XMQNS ns )

◆ xmqAddKeyValue()

XMQReturnNode xmqAddKeyValue ( XMQDoc * doq,
XMQNode * parent,
const char * key,
const char * value,
XMQNS ns )

Create a key value under an existing node.

@doq The xmq document. @parent The parent in which the key value is created. @key The key. @value The value. @ns The namespace setting.

xmqAddElement(doc, p, "el", NS_NONE); // No namespace.
xmqAddElement(doc, p, "el", NS_PARENT); // Inherit parent namespace.
xmqAddElement(doc, p, "el", NS_HERE("urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_HERE("{drv}urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_ANCESTOR("urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_ANCESTOR("{drv}urn:myapp:driver"));

◆ xmqAddNamespace()

XMQStatus xmqAddNamespace ( XMQDoc * doq,
XMQNode * node,
XMQNS ns )

Add a prefixed namespace to a node. It must have a prefix since the default namespace can only be assigned when the node is created. If the prefix is already taken an error is returned.

Parameters
doqThe xmq document.
nodeThe node into which the namespace declaration is put.
ns_uriThe new namespace uri.
prefixThe desired prefix.
Returns
XMQ_OK if all ok.
xmqAddNamespace(doc, p, "el", NS_HERE("{drv}urn:myapp:driver"));
XMQStatus xmqAddNamespace(XMQDoc *doq, XMQNode *node, XMQNS ns)

Only NS_HERE is allowed.

◆ xmqAddRootElement()

XMQReturnNode xmqAddRootElement ( XMQDoc * doq,
const char * name,
XMQNS ns )

◆ xmqAnnotateOffsets()

void xmqAnnotateOffsets ( XMQDoc * doc,
const char * attribute_name,
const char * ns )

Recurse through the document and add offsets. I.e. <root>ABCDEFGHIJxyz</root> wille become <root o="0">ABCDEFGHIJxyz</root> assuming attribute_name="o"

◆ xmqChangePrefix()

XMQReturnString xmqChangePrefix ( XMQDoc * doq,
XMQNode * node,
const char * ns_uri,
const char * old_prefix,
const char * new_prefix )

Change the preferred prefix that was chosen automatically with xmqAddNamespace. Pass XMQ_NO_PREFIX to change the default prefix. If there is a conflict, the XMQ_ERROR_PREFIX_EXISTS is return.

◆ xmqClearDoc()

void xmqClearDoc ( XMQDoc * doc)

xmqClearDoc:

Clear out, make the document empty.

◆ xmqCompactQuote()

char * xmqCompactQuote ( const char * content)

Create a compact single line quote safely storing the content. Output can for example be: 123, John, 'John Doe', "There's a light!", (&#10;'a line'&10;)

Parameters
contentThe string to safely quote using xmq quoting and output on a single line.
Returns
Return a new null terminated buffer which the caller needs to free.

◆ xmqDebugging()

bool xmqDebugging ( )

xmqDebugging:

Return whether debugging is enabled or not.

◆ xmqDetectContentType()

XMQContentType xmqDetectContentType ( const char * start,
const char * stop )

Detect the content type xmq/xml/html/json by examining a few leading non-whitespace words/characters.

Parameters
startPoints to first byte of buffer to scan for content type.
stopPoints to byte after buffer.

◆ xmqDocErrno()

XMQStatus xmqDocErrno ( XMQDoc * doc)

The error as status enum.

Parameters
docThe document which we tried to parse.
Returns
The error status code.

◆ xmqDocError()

const char * xmqDocError ( XMQDoc * doc)

Extract the parsing error.

Parameters
docThe document which we tried to parse.
Returns
An explanatory text of the error. Is freed when the document itself is freed.

◆ xmqForeach()

int xmqForeach ( XMQDoc * doq,
const char * xpath,
XMQNodeCallback cb,
void * user_data )

xmqForeach: Find all locations matching the xpath. @xpath: the xpath pattern. @cb: the function to call for each found node. Can be NULL. @user_data: the user_data supplied to the function.

Returns the number of hits.

◆ xmqForeachRel()

int xmqForeachRel ( XMQDoc * doq,
const char * xpath,
XMQNodeCallback cb,
void * user_data,
XMQNode * relative )

xmqForeachRel: Find all locations matching the xpath. @xpath: the xpath pattern. @cb: the function to call for each found node. Can be NULL. @user_data: the user_data supplied to the function. @relative: find nodes relative to this node.

Returns the number of hits.

◆ xmqFreeDoc()

void xmqFreeDoc ( XMQDoc * doc)

xmqFreeDoc:

Free the document object and all associated memory.

◆ xmqFreeLineConfig()

void xmqFreeLineConfig ( XMQLineConfig * lc)

xmqFreeLineConfig:

Free the XMQLineConfig structure.

◆ xmqFreeOutputSettings()

void xmqFreeOutputSettings ( XMQOutputSettings * os)

Free the print settings structure.

◆ xmqFreeParseCallbacks()

void xmqFreeParseCallbacks ( XMQParseCallbacks * cb)

xmqFreeParseCallbacks:

Free the XMQParseCallback structure.

◆ xmqFreeParseState()

void xmqFreeParseState ( XMQParseState * state)

xmqFreeParseState:

Free the memory allocated for the state.

◆ xmqGetContent()

const char * xmqGetContent ( XMQNode * node)

xmqGetContent: get content of element node @node: Node

◆ xmqGetDocSourceName()

const char * xmqGetDocSourceName ( XMQDoc * doq)

xmqGetDocSourceName: @doq: Document which source file name should be gotten.

Returns the source name used to make error message more readable when parsing fails. The source name is often the file name, but can be "-" for stdin or anything you like.

◆ xmqGetDouble()

double xmqGetDouble ( XMQDoc * doc,
const char * xpath )

xmqGetDouble: @doc: the xmq doc object @xpath: the location of the content to be parsed as double float.

◆ xmqGetDoubleRel()

double xmqGetDoubleRel ( XMQDoc * doc,
const char * xpath,
XMQNode * relative )

xmqGetDoubleRel: @doc: the xmq doc object @xpath: the location of the content to be parsed as double float. @relative: the xpath is search using this node as the starting point.

◆ xmqGetImplementationDoc()

void * xmqGetImplementationDoc ( XMQDoc * doq)

xmqGetImplementationDoc:

Get the underlying implementation doc, could be an xmlDocPtr from libxml2 for example.

◆ xmqGetInt()

int32_t xmqGetInt ( XMQDoc * doc,
const char * xpath )

xmqGetInt: @doc: the xmq doc object @xpath: the location of the content to be parsed as an 32 bit signed integer.

◆ xmqGetIntRel()

int32_t xmqGetIntRel ( XMQDoc * doc,
const char * xpath,
XMQNode * relative )

xmqGetIntRel: @doc: the xmq doc object @xpath: the location of the content to be parsed as an 32 bit signed integer. @relative: the xpath is search using this node as the starting point.

◆ xmqGetLong()

int64_t xmqGetLong ( XMQDoc * doc,
const char * xpath )

xmqGetLong: @doc: the xmq doc object @xpath: the location of the content to be parsed as an 64 bit signed integer.

◆ xmqGetLongRel()

int64_t xmqGetLongRel ( XMQDoc * doc,
const char * xpath,
XMQNode * relative )

xmqGetLongRel: @doc: the xmq doc object @xpath: the location of the content to be parsed as an 64 bit signed integer. @relative: the xpath is search using this node as the starting point.

◆ xmqGetName()

const char * xmqGetName ( XMQNode * node)

xmqGetName: get name of node @node: Node

◆ xmqGetNode()

XMQNode * xmqGetNode ( XMQDoc * doc,
const char * xpath )

xmqGetNode: @doc: the xmq doc object @xpath: the location of the content to be returned as a node ptr.

◆ xmqGetNodeRel()

XMQNode * xmqGetNodeRel ( XMQDoc * doc,
const char * xpath,
XMQNode * relative )

xmqGetNodeRel: @doc: the xmq doc object @xpath: the location of the content to be returned as a node ptr. @relative: the xpath is search using this node as the starting point.

◆ xmqGetOriginalContentType()

XMQContentType xmqGetOriginalContentType ( XMQDoc * doq)

xmqGetOriginalContentType:

If available, return the original content type (xmq/htmq/xml/html/json/text) of this document.

◆ xmqGetOriginalSize()

size_t xmqGetOriginalSize ( XMQDoc * doq)

xmqGetOriginalSize:

If available, return the size of the original content, ie the loaded file size.

◆ xmqGetRootNode()

XMQNode * xmqGetRootNode ( XMQDoc * doq)

xmqGetRootNode:

Get root node suitable for xmqForeach.

◆ xmqGetString()

const char * xmqGetString ( XMQDoc * doc,
const char * xpath )

xmqGetString: @doc: the xmq doc object @xpath: the location of the content to be parsed as string.

◆ xmqGetStringRel()

const char * xmqGetStringRel ( XMQDoc * doc,
const char * xpath,
XMQNode * relative )

xmqGetStringRel: @doc: the xmq doc object @xpath: the location of the content to be parsed as string. @relative: the xpath is search using this node as the starting point.

◆ xmqLineDoc()

char * xmqLineDoc ( XMQLineConfig * lc,
XMQDoc * doc )

xmqLineDoc:

Generate from the doc a compact single line xmq string containing no newlines at all, for logging.

◆ xmqLinePrintf()

char * xmqLinePrintf ( XMQLineConfig * lc,
const char * element_name,
... )

xmqLinePrintf:

Generate a compact single line xmq string containing no newlines at all, for logging. The content is constructed from printf formatted strings: xmqLinePrintf(&lc, "car{", "model=", "%s", modelstring, "id=", "%d", idnumber, "description=", "desc: %s", multilinedescription, "}"); Generates: car{model=Volvo id=123 description=('desc: lines of'&#10;'next line')}

◆ xmqLineVPrintf()

char * xmqLineVPrintf ( XMQLineConfig * lc,
const char * element_name,
va_list ap )

◆ xmqLogFilter()

void xmqLogFilter ( const char * log_filter)

xmqLogFilter

Enable/Disable debug/trace logging for certain prefixes.

◆ xmqLoggingXMQ()

bool xmqLoggingXMQ ( )

xmqLogXMQ:

Return whether logging in pure xmq is enabled or not.

◆ xmqNewDoc()

XMQReturnDoc xmqNewDoc ( )

Create an empty document object.

Returns
A return doc structure with status and doc pointer. If status == XMQ_OK then doc pointer is valid. If status == XMQ_ERROR_OOM the doc pointer is NULL.

◆ xmqNewLineConfig()

XMQLineConfig * xmqNewLineConfig ( )

xmqNewLineConfig:

Allocate a default XMQLineConfig.

◆ xmqNewOutputSettings()

XMQOutputSettings * xmqNewOutputSettings ( )

Allocate the print settings structure and zero it.

◆ xmqNewParseCallbacks()

XMQParseCallbacks * xmqNewParseCallbacks ( )

xmqNewParseCallbacks:

Allocate an empty XMQParseCallback structure. All callbacks are NULL and none will be called.

◆ xmqNewParseState()

XMQParseState * xmqNewParseState ( XMQParseCallbacks * callbacks,
XMQOutputSettings * settings )

xmqNewParseState: @callbacks: these callbacks will be invoked for each token. @settings: these settings are available to the callbacks.

Now prepare a parse state that is used to actually parse an xmq file. The print settings can be referenced from the callbacks for example when tokenizing.

◆ xmqOverrideColor()

void xmqOverrideColor ( XMQOutputSettings * settings,
const char * render_style,
XMQColorName cn,
const char * pre,
const char * post,
const char * ns )

xmqOverrideColor: @settings: @render_style: Use "" for the default render_style @sc: The syntax element you want to change the color for.

Change the color strings for the given color type. You have to run xmqSetupDefaultColors first.

◆ xmqOverrideSettings()

void xmqOverrideSettings ( XMQOutputSettings * settings,
const char * indentation_space,
const char * explicit_space,
const char * explicit_tab,
const char * explicit_cr,
const char * explicit_nl )

xmqOverrideSetting: Change the default strings for spaces etc. @settings: The output settings to modify. @indentation_space: If NULL use " ". @explicit_space: If NULL use " ". @explicit_tab: If NULL use "\t" @explicit_cr: If NULL use "\r". @explicit_nl: If NULL use "\n". @prefix_line: If NULL do not print any prefix. @postfix_line: If NULL do not print any postfix.

◆ xmqParseBuffer()

bool xmqParseBuffer ( XMQDoc * doc,
const char * start,
const char * stop,
const char * implicit_root,
int flags )

xmqParseBuffer: @doc: the xmq doc object @start: start of buffer to parse @stop: points to byte after last byte in buffer @implicit_root: the implicit root

Parse a buffer or a file and create a document. The xmq format permits multiple root nodes if an implicit root is supplied.

◆ xmqParseBufferWithIXML()

bool xmqParseBufferWithIXML ( XMQDoc * doc,
const char * start,
const char * stop,
XMQDoc * ixml_grammar,
int flags )

xmqParseBufferWithIXML:

Parse buffer using the supplied IXML grammar.

◆ xmqParseBufferWithType()

bool xmqParseBufferWithType ( XMQDoc * doc,
const char * start,
const char * stop,
const char * implicit_root,
XMQContentType ct,
int flags )

xmqParseBufferWithType:

Parse buffer.

◆ xmqParseErrorToString()

const char * xmqParseErrorToString ( XMQStatus e)

xmqParseErrorToString: : Translate this error to a human readable string.

◆ xmqParseFile()

bool xmqParseFile ( XMQDoc * doc,
const char * file,
const char * implicit_root,
int flags )

◆ xmqParseFileWithIXML()

bool xmqParseFileWithIXML ( XMQDoc * doc,
const char * file,
XMQDoc * ixml_grammar,
int flags )

xmqParseFileWithIXML:

Load a file and parse it using the supplied IXML grammar. If file is NULL read from stdin.

◆ xmqParseFileWithType()

bool xmqParseFileWithType ( XMQDoc * doc,
const char * file,
const char * implicit_root,
XMQContentType ct,
int flags )

xmqParseFileWithType:

Load and parse file. If file is NULL read from stdin.

◆ xmqParseReader()

bool xmqParseReader ( XMQDoc * doc,
XMQReader * reader,
void * reader_state,
const char * implicit_root,
int flags )

Parse data fetched with a reader and create a document. The xmq format permits multiple root nodes if an implicit root is supplied.

Parameters
docThe xmq doc object to populate with the parsed data.
readerUse this reader to fetch input data.
reader_statePass this reader_state to the reader.
implicit_rootThe implicit root.
flagsSpecify parser settings.

◆ xmqPrint()

void xmqPrint ( XMQDoc * doc,
XMQOutputSettings * settings )

Pretty print the document according to the settings.

◆ xmqRenderHtmlSettings()

void xmqRenderHtmlSettings ( XMQOutputSettings * settings,
const char * use_id,
const char * use_class )

xmqRenderHtmlSettings: Change the id or clas for the rendered html. @settings: The output settings to modify. @use_id: Mark the pre tag with this id. @use_class: Mark the pre tag with this class.

◆ xmqReplaceEntity()

int xmqReplaceEntity ( XMQDoc * doq,
const char * entity,
const char * content )

xmqReplaceEntity: Replace the selected entity with the supplied content. @entity: the entity @content: the string content to be inserted

Returns the number of replacements.

◆ xmqReplaceEntityWithNode()

int xmqReplaceEntityWithNode ( XMQDoc * doq,
const char * entity,
XMQDoc * idoq,
XMQNode * inode )

xmqReplaceEntity: Replace the selected entity with the supplied content node. @entity: the entity @content: the string content to be inserted

Returns the number of replacements.

◆ xmqSetAddIndent()

void xmqSetAddIndent ( XMQOutputSettings * os,
int add_indent )

◆ xmqSetAttribute()

XMQReturnAttr xmqSetAttribute ( XMQDoc * doq,
XMQNode * node,
const char * name,
const char * value,
XMQNS ns )

Create/update an attribute in an existing node.

xmqAddElement(doc, p, "el", NS_NONE); // No namespace.
xmqAddElement(doc, p, "el", NS_PARENT); // Inherit parent namespace.
xmqAddElement(doc, p, "el", NS_ANCESTOR("urn:myapp:driver"));
xmqAddElement(doc, p, "el", NS_ANCESTOR("{drv}urn:myapp:driver"));

NS_HERE is not permitted for an attribute.

◆ xmqSetBackgroundMode()

void xmqSetBackgroundMode ( XMQOutputSettings * os,
bool bg_dark_mode )

◆ xmqSetCompact()

void xmqSetCompact ( XMQOutputSettings * os,
bool compact )

◆ xmqSetContent()

void xmqSetContent ( XMQNode * node,
const char * raw_content )

xmqSetContent: set the raw content of element node @node: Node

◆ xmqSetDebug()

void xmqSetDebug ( bool e)

xmqSetDebug:

Enable/Disable debugging.

◆ xmqSetDocSourceName()

void xmqSetDocSourceName ( XMQDoc * doq,
const char * source_name )

Set the source name to make error message more readable when parsing fails. The source name is often the file name, but can be "-" for stdin or anything you like.

Parameters
doqDocument for which the source should be named.
source_nameThe document source file name.

◆ xmqSetEscapeNewlines()

void xmqSetEscapeNewlines ( XMQOutputSettings * os,
bool escape_newlines )

◆ xmqSetEscapeNon7bit()

void xmqSetEscapeNon7bit ( XMQOutputSettings * os,
bool escape_non_7bit )

◆ xmqSetEscapeTabs()

void xmqSetEscapeTabs ( XMQOutputSettings * os,
bool escape_tabs )

◆ xmqSetImplementationDoc()

void xmqSetImplementationDoc ( XMQDoc * doq,
void * doc )

xmqSetImplementationDoc:

Set the underlying implementation doc, could be an xmlDocPtr from libxml2 for example.

◆ xmqSetLineHumanReadable()

void xmqSetLineHumanReadable ( XMQLineConfig * lc,
bool enable )

xmqSetLineHumanReadable(XMQLineConfig *lc, bool enable);

If enable is true then generate a more human readable log line.

◆ xmqSetLogHumanReadable()

void xmqSetLogHumanReadable ( bool e)

xmqSetLogHumanReadable:

Enable/Disable verbose/debug/tracing output as human readable. The default is in xmq format.

◆ xmqSetOmitDecl()

void xmqSetOmitDecl ( XMQOutputSettings * os,
bool omit_decl )

◆ xmqSetOriginalSize()

void xmqSetOriginalSize ( XMQDoc * doq,
size_t size )

xmqSetOriginalSize:

Override the original size of the document.

◆ xmqSetOutputFormat()

void xmqSetOutputFormat ( XMQOutputSettings * os,
XMQContentType output_format )

◆ xmqSetPreferDoubleQuotes()

void xmqSetPreferDoubleQuotes ( XMQOutputSettings * os,
bool prefer_double_quotes )

◆ xmqSetPrintAllParsesIXML()

void xmqSetPrintAllParsesIXML ( XMQParseState * state,
bool all_parses )

xmqSetPrintAllParsesIXML: @state: the parse state. @all_parses: if true then generate all possible trees.

If the parse is ambiguous generate all possible trees.

◆ xmqSetRenderFormat()

void xmqSetRenderFormat ( XMQOutputSettings * os,
XMQRenderFormat render_to )

◆ xmqSetRenderOnlyStyle()

void xmqSetRenderOnlyStyle ( XMQOutputSettings * os,
bool only_style )

◆ xmqSetRenderRaw()

void xmqSetRenderRaw ( XMQOutputSettings * os,
bool render_raw )

◆ xmqSetRenderTheme()

void xmqSetRenderTheme ( XMQOutputSettings * os,
const char * theme_spec )

◆ xmqSetStateSourceName()

void xmqSetStateSourceName ( XMQParseState * state,
const char * source_name )

xmqSetStateSourceName: @doq: Parser which source file name should be set. @source_name: The document source location.

Set the source name to make error message more readable when parsing fails. The source name is often the file name, but can be "-" for stdin or anything you like.

◆ xmqSetTrace()

void xmqSetTrace ( bool e)

xmqSetTrace:

Enable/Disable tracing.

◆ xmqSetTrueColor()

void xmqSetTrueColor ( XMQOutputSettings * os,
bool truecolor )

◆ xmqSetTryToRecoverIXML()

void xmqSetTryToRecoverIXML ( XMQParseState * state,
bool try_recover )

xmqSetTryToRecoverIXML: @state: the parse state. @try_recover: if true then try to recover a failed parse.

If the parse fails then try to recover. Default is to fail.

◆ xmqSetupDefaultColors()

void xmqSetupDefaultColors ( XMQOutputSettings * settings)

xmqSetupDefaultColors:

Set the default colors for settings based on the theme and background color.

◆ xmqSetupParseCallbacksColorizeTokens()

void xmqSetupParseCallbacksColorizeTokens ( XMQParseCallbacks * state,
XMQRenderFormat render_format )

xmqSetupParseCallbacksColorizeTokens:

Used to colorize xmq input, without building a parse tree.

◆ xmqSetupParseCallbacksDebugContent()

void xmqSetupParseCallbacksDebugContent ( XMQParseCallbacks * state)

xmqSetupParseCallbacksDebugContent:

Used debug the decoded content.

◆ xmqSetupParseCallbacksDebugTokens()

void xmqSetupParseCallbacksDebugTokens ( XMQParseCallbacks * state)

xmqSetupParseCallbacksDebugTokens:

Used to debug location, type of tokens.

◆ xmqSetupPrintFile()

void xmqSetupPrintFile ( XMQOutputSettings * ps,
const char * file )

Setup the printer to print to a file.

◆ xmqSetupPrintFileDescriptor()

void xmqSetupPrintFileDescriptor ( XMQOutputSettings * ps,
int fd )

Setup the printer to print to a filedescriptor.

◆ xmqSetupPrintMemory()

void xmqSetupPrintMemory ( XMQOutputSettings * ps,
char ** start,
char ** stop )

Setup the printer to print to a dynamically memory buffer.

◆ xmqSetupPrintSkip()

void xmqSetupPrintSkip ( XMQOutputSettings * ps,
size_t * skip )

Setup where to store any potential skip. This is not an ideal solution. Fix?

◆ xmqSetupPrintStdOutStdErr()

void xmqSetupPrintStdOutStdErr ( XMQOutputSettings * ps)

Setup the printer to print content to stdout and errors to sderr.

◆ xmqSetUseColor()

void xmqSetUseColor ( XMQOutputSettings * os,
bool use_color )

◆ xmqSetVerbose()

void xmqSetVerbose ( bool e)

xmqSetVerbose:

Enable/Disable verbose logging.

◆ xmqSetWriterContent()

void xmqSetWriterContent ( XMQOutputSettings * os,
XMQWriter content )

◆ xmqSetWriterError()

void xmqSetWriterError ( XMQOutputSettings * os,
XMQWriter error )

◆ xmqStateErrno()

int xmqStateErrno ( XMQParseState * state)

xmqStateErrno: @state: the parse state.

If the parse fails then use this function to get the integer value of XMQStatus.

◆ xmqStateErrorMsg()

const char * xmqStateErrorMsg ( XMQParseState * state)

xmqStateErrorMsg: @state: the parse state.

If the parse fails then use this function to get a string explaining the error.

◆ xmqTokenizeBuffer()

bool xmqTokenizeBuffer ( XMQParseState * state,
const char * start,
const char * stop )

Parse a buffer with xmq content.

◆ xmqTokenizeFile()

bool xmqTokenizeFile ( XMQParseState * state,
const char * file )

Parse a file with xmq content.

◆ xmqTokenizeFileDescriptor()

bool xmqTokenizeFileDescriptor ( XMQParseState * state,
int fd )

Parse a file descriptor with xmq content.

◆ xmqTracing()

bool xmqTracing ( )

xmqTracing:

Return whether tracing is enabled or not.

◆ xmqTrimWhitespace()

void xmqTrimWhitespace ( XMQDoc * doc,
int flags )

Trim xml whitespace.

◆ xmqVersion()

const char * xmqVersion ( )

xmqVersion:

Return the current xmq version in this library.