xmq

xmq

Functions

bool (*XMQWrite) ()
XMQProceed (*XMQNodeCallback) ()
XMQContentType xmqDetectContentType ()
const char * xmqParseErrorToString ()
XMQParseCallbacks * xmqNewParseCallbacks ()
void xmqFreeParseCallbacks ()
void xmqSetupParseCallbacksColorizeTokens ()
void xmqSetupParseCallbacksDebugTokens ()
void xmqSetupParseCallbacksDebugContent ()
bool xmqTokenizeBuffer ()
bool xmqTokenizeFile ()
bool xmqTokenizeFileDescriptor ()
XMQParseState * xmqNewParseState ()
void xmqFreeParseState ()
void xmqSetStateSourceName ()
int xmqStateErrno ()
const char * xmqStateErrorMsg ()
void xmqSetPrintAllParsesIXML ()
void xmqSetTryToRecoverIXML ()
XMQDoc * xmqNewDoc ()
void xmqSetDocSourceName ()
const char * xmqGetDocSourceName ()
XMQContentType xmqGetOriginalContentType ()
size_t xmqGetOriginalSize ()
void xmqSetOriginalSize ()
XMQNode * xmqGetRootNode ()
void * xmqGetImplementationDoc ()
void xmqSetImplementationDoc ()
void xmqFreeDoc ()
bool xmqParseFile ()
bool xmqParseBuffer ()
bool xmqParseReader ()
XMQOutputSettings * xmqNewOutputSettings ()
void xmqFreeOutputSettings ()
void xmqSetAddIndent ()
void xmqSetCompact ()
void xmqSetUseColor ()
void xmqSetBackgroundMode ()
void xmqSetPreferDoubleQuotes ()
void xmqSetEscapeNewlines ()
void xmqSetEscapeNon7bit ()
void xmqSetEscapeTabs ()
void xmqSetOutputFormat ()
void xmqSetOmitDecl ()
void xmqSetRenderFormat ()
void xmqSetRenderTheme ()
void xmqSetRenderRaw ()
void xmqSetRenderOnlyStyle ()
void xmqSetWriterContent ()
void xmqSetWriterError ()
void xmqSetupPrintStdOutStdErr ()
void xmqSetupPrintFile ()
void xmqSetupPrintFileDescriptor ()
void xmqSetupPrintMemory ()
void xmqSetupPrintSkip ()
void xmqPrint ()
void xmqTrimWhitespace ()
char * xmqCompactQuote ()
const char * xmqDocError ()
XMQParseError xmqDocErrno ()
const char * xmqGetName ()
const char * xmqGetContent ()
int32_t xmqGetInt ()
int32_t xmqGetIntRel ()
int64_t xmqGetLong ()
int64_t xmqGetLongRel ()
double xmqGetDouble ()
double xmqGetDoubleRel ()
const char * xmqGetString ()
const char * xmqGetStringRel ()
int xmqForeach ()
int xmqForeachRel ()
int xmqReplaceEntity ()
int xmqReplaceEntityWithNode ()
const char * xmqVersion ()
void xmqSetVerbose ()
void xmqSetDebug ()
void xmqSetTrace ()
void xmqLogFilter ()
bool xmqDebugging ()
bool xmqTracing ()
void xmqSetLogHumanReadable ()
bool xmqLoggingXMQ ()
bool xmqParseBufferWithType ()
bool xmqParseFileWithType ()
bool xmqParseBufferWithIXML ()
bool xmqParseFileWithIXML ()
void xmqSetupDefaultColors ()
void xmqOverrideSettings ()
void xmqRenderHtmlSettings ()
void xmqOverrideColor ()
XMQLineConfig * xmqNewLineConfig ()
void xmqFreeLineConfig ()
void xmqSetLineHumanReadable ()
char * xmqLineDoc ()
char * xmqLinePrintf ()
char * xmqLineVPrintf ()

Types and Values

Description

Functions

XMQWrite ()

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

Any function implementing XMQWrite must handle stop == NULL.

Parameters

writer_state

necessary state for writing.

 

start

start of buffer to write

 

stop

points to byte after buffer to write. If NULL then assume start is null terminated.

 

XMQNodeCallback ()

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

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

start

points to first byte of buffer to scan for content type

 

stop

points to byte after buffer

 

xmqParseErrorToString ()

const char *
xmqParseErrorToString (XMQParseError e);

Parameters

e

Translate this error to a human readable string.

 

xmqNewParseCallbacks ()

XMQParseCallbacks *
xmqNewParseCallbacks ();

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


xmqFreeParseCallbacks ()

void
xmqFreeParseCallbacks (XMQParseCallbacks *cb);

Free the XMQParseCallback structure.


xmqSetupParseCallbacksColorizeTokens ()

void
xmqSetupParseCallbacksColorizeTokens (XMQParseCallbacks *state,
                                      XMQRenderFormat render_format);

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


xmqSetupParseCallbacksDebugTokens ()

void
xmqSetupParseCallbacksDebugTokens (XMQParseCallbacks *state);

Used to debug location, type of tokens.


xmqSetupParseCallbacksDebugContent ()

void
xmqSetupParseCallbacksDebugContent (XMQParseCallbacks *state);

Used debug the decoded content.


xmqTokenizeBuffer ()

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

xmqTokenizeFile ()

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

xmqTokenizeFileDescriptor ()

bool
xmqTokenizeFileDescriptor (XMQParseState *state,
                           int fd);

xmqNewParseState ()

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

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.

Parameters

callbacks

these callbacks will be invoked for each token.

 

settings

these settings are available to the callbacks.

 

xmqFreeParseState ()

void
xmqFreeParseState (XMQParseState *state);

Free the memory allocated for the state.


xmqSetStateSourceName ()

void
xmqSetStateSourceName (XMQParseState *state,
                       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

doq

Parser which source file name should be set.

 

source_name

The document source location.

 

xmqStateErrno ()

int
xmqStateErrno (XMQParseState *state);

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

Parameters

state

the parse state.

 

xmqStateErrorMsg ()

const char *
xmqStateErrorMsg (XMQParseState *state);

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

Parameters

state

the parse state.

 

xmqSetPrintAllParsesIXML ()

void
xmqSetPrintAllParsesIXML (XMQParseState *state,
                          bool all_parses);

If the parse is ambiguous generate all possible trees.

Parameters

state

the parse state.

 

all_parses

if true then generate all possible trees.

 

xmqSetTryToRecoverIXML ()

void
xmqSetTryToRecoverIXML (XMQParseState *state,
                        bool try_recover);

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

Parameters

state

the parse state.

 

try_recover

if true then try to recover a failed parse.

 

xmqNewDoc ()

XMQDoc *
xmqNewDoc ();

Create an empty document object.


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

doq

Document which source file name should be set.

 

source_name

The document source location.

 

xmqGetDocSourceName ()

const char *
xmqGetDocSourceName (XMQDoc *doq);

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.

Parameters

doq

Document which source file name should be gotten.

 

xmqGetOriginalContentType ()

XMQContentType
xmqGetOriginalContentType (XMQDoc *doq);

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


xmqGetOriginalSize ()

size_t
xmqGetOriginalSize (XMQDoc *doq);

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


xmqSetOriginalSize ()

void
xmqSetOriginalSize (XMQDoc *doq,
                    size_t size);

Override the original size of the document.


xmqGetRootNode ()

XMQNode *
xmqGetRootNode (XMQDoc *doq);

Get root node suitable for xmqForeach.


xmqGetImplementationDoc ()

void *
xmqGetImplementationDoc (XMQDoc *doq);

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


xmqSetImplementationDoc ()

void
xmqSetImplementationDoc (XMQDoc *doq,
                         void *doc);

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


xmqFreeDoc ()

void
xmqFreeDoc (XMQDoc *doc);

Free the document object and all associated memory.


xmqParseFile ()

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

Parse a file, or if file is NULL, read from stdin.

Parameters

doc

the xmq doc object

 

file

file to load from file syste, or stdin if file is NULL

 

implicit_root

the implicit root

 

xmqParseBuffer ()

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

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

Parameters

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

 

xmqParseReader ()

bool
xmqParseReader (XMQDoc *doc,
                XMQReader *reader,
                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

doc

the xmq doc object

 

reader

use this reader to fetch input data

 

implicit_root

the implicit root

 

xmqNewOutputSettings ()

XMQOutputSettings *
xmqNewOutputSettings ();

xmqFreeOutputSettings ()

void
xmqFreeOutputSettings (XMQOutputSettings *os);

xmqSetAddIndent ()

void
xmqSetAddIndent (XMQOutputSettings *os,
                 int add_indent);

xmqSetCompact ()

void
xmqSetCompact (XMQOutputSettings *os,
               bool compact);

xmqSetUseColor ()

void
xmqSetUseColor (XMQOutputSettings *os,
                bool use_color);

xmqSetBackgroundMode ()

void
xmqSetBackgroundMode (XMQOutputSettings *os,
                      bool bg_dark_mode);

xmqSetPreferDoubleQuotes ()

void
xmqSetPreferDoubleQuotes (XMQOutputSettings *os,
                          bool prefer_double_quotes);

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);

xmqSetOutputFormat ()

void
xmqSetOutputFormat (XMQOutputSettings *os,
                    XMQContentType output_format);

xmqSetOmitDecl ()

void
xmqSetOmitDecl (XMQOutputSettings *os,
                bool omit_decl);

xmqSetRenderFormat ()

void
xmqSetRenderFormat (XMQOutputSettings *os,
                    XMQRenderFormat render_to);

xmqSetRenderTheme ()

void
xmqSetRenderTheme (XMQOutputSettings *os,
                   const char *theme_name);

xmqSetRenderRaw ()

void
xmqSetRenderRaw (XMQOutputSettings *os,
                 bool render_raw);

xmqSetRenderOnlyStyle ()

void
xmqSetRenderOnlyStyle (XMQOutputSettings *os,
                       bool only_style);

xmqSetWriterContent ()

void
xmqSetWriterContent (XMQOutputSettings *os,
                     XMQWriter content);

xmqSetWriterError ()

void
xmqSetWriterError (XMQOutputSettings *os,
                   XMQWriter error);

xmqSetupPrintStdOutStdErr ()

void
xmqSetupPrintStdOutStdErr (XMQOutputSettings *ps);

xmqSetupPrintFile ()

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

xmqSetupPrintFileDescriptor ()

void
xmqSetupPrintFileDescriptor (XMQOutputSettings *ps,
                             int fd);

xmqSetupPrintMemory ()

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

xmqSetupPrintSkip ()

void
xmqSetupPrintSkip (XMQOutputSettings *ps,
                   size_t *skip);

xmqPrint ()

void
xmqPrint (XMQDoc *doc,
          XMQOutputSettings *settings);

xmqTrimWhitespace ()

void
xmqTrimWhitespace (XMQDoc *doc,
                   int flags);

xmqCompactQuote ()

char *
xmqCompactQuote (const char *content);

xmqDocError ()

const char *
xmqDocError (XMQDoc *doc);

xmqDocErrno ()

XMQParseError
xmqDocErrno (XMQDoc *doc);

xmqGetName ()

const char *
xmqGetName (XMQNode *node);

xmqGetContent ()

const char *
xmqGetContent (XMQNode *node);

xmqGetInt ()

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

Parameters

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);

Parameters

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);

Parameters

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);

Parameters

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.

 

xmqGetDouble ()

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

Parameters

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);

Parameters

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.

 

xmqGetString ()

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

Parameters

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);

Parameters

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.

 

xmqForeach ()

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

xmqForeachRel ()

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

xmqReplaceEntity ()

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

xmqReplaceEntityWithNode ()

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

xmqVersion ()

const char *
xmqVersion ();

Return the current xmq version in this library.


xmqSetVerbose ()

void
xmqSetVerbose (bool e);

Enable/Disable verbose logging.


xmqSetDebug ()

void
xmqSetDebug (bool e);

Enable/Disable debugging.


xmqSetTrace ()

void
xmqSetTrace (bool e);

Enable/Disable tracing.


xmqLogFilter ()

void
xmqLogFilter (const char *log_filter);

Enable/Disable debug/trace logging for certain prefixes.


xmqDebugging ()

bool
xmqDebugging ();

Return whether debugging is enabled or not.


xmqTracing ()

bool
xmqTracing ();

Return whether tracing is enabled or not.


xmqSetLogHumanReadable ()

void
xmqSetLogHumanReadable (bool e);

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


xmqLoggingXMQ ()

bool
xmqLoggingXMQ ();

xmqParseBufferWithType ()

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

Parse buffer.


xmqParseFileWithType ()

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

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


xmqParseBufferWithIXML ()

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

Parse buffer using the supplied IXML grammar.


xmqParseFileWithIXML ()

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

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


xmqSetupDefaultColors ()

void
xmqSetupDefaultColors (XMQOutputSettings *settings);

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


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);

xmqRenderHtmlSettings ()

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

xmqOverrideColor ()

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

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

Parameters

render_style

Use "" for the default render_style

 

sc

The syntax element you want to change the color for.

 

xmqNewLineConfig ()

XMQLineConfig *
xmqNewLineConfig ();

Allocate a default XMQLineConfig.


xmqFreeLineConfig ()

void
xmqFreeLineConfig (XMQLineConfig *lc);

Free the XMQLineConfig structure.


xmqSetLineHumanReadable ()

void
xmqSetLineHumanReadable (XMQLineConfig *lc,
                         bool enable);

xmqLineDoc ()

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

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,
               ...);

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);

Types and Values

XMQDoc

typedef struct XMQDoc XMQDoc;

Structure storing a loaded xmq/xml/json document.


XMQNode

typedef struct XMQNode XMQNode;

Structure referencing a node/attr in the xmq/xml/json document.


XMQParseState

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


XMQParseCallbacks

typedef struct XMQParseCallbacks XMQParseCallbacks;

Store your own parse callbacks into this structure and register your own callback structure 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.


enum XMQContentType

Specify the file/buffer content type.

Members

XMQ_CONTENT_UNKNOWN

a failed content detect will mark the content type as unknown

 

XMQ_CONTENT_DETECT

auto detect the content type

 

XMQ_CONTENT_XMQ

xmq detected

 

XMQ_CONTENT_HTMQ

htmq detected

 

XMQ_CONTENT_XML

xml detected

 

XMQ_CONTENT_HTML

html detected

 

XMQ_CONTENT_JSON

json detected

 

XMQ_CONTENT_IXML

ixml selected

 

XMQ_CONTENT_TEXT

valid utf8 text input/output is selected

 

XMQ_CONTENT_CLINES

xpath="c-escaped string"

 

enum XMQRenderFormat

The xmq output can be rendered as PLAIN, or for human consumption in TERMINAL, HTML, HTMQ, TEX or RAW.

Members

XMQ_RENDER_PLAIN

normal output for data storage

 

XMQ_RENDER_TERMINAL

colorize using ansi codes

 

XMQ_RENDER_HTML

colorize using html tags

 

XMQ_RENDER_HTMQ

colorize using htmq tags

 

XMQ_RENDER_TEX

colorize using tex

 

XMQ_RENDER_RAW

write the text content using UTF8 with no escapes

 

enum XMQFlagBits

If a 0 is provided as the flags 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;	&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.

Members

XMQ_FLAG_TRIM_NONE

Do not trim any whitespace.

 

XMQ_FLAG_TRIM_HEURISTIC

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

 

XMQ_FLAG_TRIM_EXACT

Trim exactly according to XML rules. Depends on your XSD,space:preserve and more and is COMPLICATED!

 

XMQ_FLAG_NOMERGE

Do not merge text and character entities.

 

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.

 

enum XMQColorName

Members

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

   

struct XMQReader

struct XMQReader {
    void *reader_state;
    size_t (*read)(void *reader_state, char *start, char *stop);
};

The xmq parser uses the reader to fetch data into a buffer (start <= i < stop). You can create your own reader with a function that takes a pointer to the reader state. Returns the number of bytes stored in buffer, maximum stored is stop-start.

Members

void *reader_state;

points to the reader state

 

read ()

invoked with the reader state and where to store input data.

 

struct XMQWriter

struct XMQWriter {
    void *writer_state;
    XMQWrite write;
};

The xmq printer uses the writer to write data supplied from a buffer (start <= i < stop). You can create your own writer with a function that takes a pointer to the writer state. The writer function must return true if the writing was successful.

Members

void *writer_state;

points to the writer state

 

XMQWrite write;

invoked with the writer state to store output data. Must accept stop == NULL which assumes start is null terminated.

 

XMQOutputSettings


enum XMQProceed

Members

XMQ_CONTINUE

Return "continue" to continue iterating over xmq nodes.

 

XMQ_STOP

   

enum XMQParseError

Possible parse errors.

Members

XMQ_ERROR_NONE

   

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

an body is missing a closing brace.

 

XMQ_ERROR_ATTRIBUTES_NOT_CLOSED

the attribute list is missing the closing parentheses.

 

XMQ_ERROR_COMPOUND_NOT_CLOSED

   

XMQ_ERROR_COMPOUND_MAY_NOT_CONTAIN

   

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

   

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 character.

 

XMQ_ERROR_CANNOT_HANDLE_XML

x

 

XMQ_ERROR_CANNOT_HANDLE_HTML

x

 

XMQ_ERROR_CANNOT_HANDLE_JSON

x

 

XMQ_ERROR_EXPECTED_XMQ

x

 

XMQ_ERROR_EXPECTED_HTMQ

x

 

XMQ_ERROR_EXPECTED_XML

x

 

XMQ_ERROR_EXPECTED_HTML

x

 

XMQ_ERROR_EXPECTED_JSON

x

 

XMQ_ERROR_PARSING_XML

   

XMQ_ERROR_PARSING_HTML

   

XMQ_ERROR_VALUE_CANNOT_START_WITH

   

XMQ_ERROR_IXML_SYNTAX_ERROR

   

XMQ_WARNING_QUOTES_NEEDED

   

enum XMQCoreType

Members

XMQ_CORE_BOOL

   

XMQ_CORE_I8

Signed 8 bit integer.

 

XMQ_CORE_I16

Signed 16 bit integer.

 

XMQ_CORE_I32

Signed 32 bit integer.

 

XMQ_CORE_I64

Signed 64 bit integer.

 

XMQ_CORE_I128

Signed 128 bit integer.

 

XMQ_CORE_U8

Unsigned 8 bit integer.

 

XMQ_CORE_U16

Unsigned 16 bit integer.

 

XMQ_CORE_U32

Unsigned 32 bit integer.

 

XMQ_CORE_U64

Unsigned 64 bit integer.

 

XMQ_CORE_U128

Unsigned 128 bit integer.

 

XMQ_CORE_F32

   

XMQ_CORE_F64

   

XMQ_CORE_STRING

Zero to infinite sized unicode string. No zero bytes.

 

XMQ_CORE_EMAIL

   

XMQ_CORE_URI

   

XMQ_CORE_URL

   

XMQ_CORE_IP_ADDRESS

Either a v4 or a v6.

 

XMQ_CORE_IPV4_ADDRESS

128.0.0.1

 

XMQ_CORE_IPV6_ADDRESS

::0

 

XMQLineConfig

typedef struct XMQLineConfig XMQLineConfig;