|
libxmq
Libxmq C API
|
#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 |
Functions | |
| XMQContentType | xmqDetectContentType (const char *start, const char *stop) |
| const char * | xmqParseErrorToString (XMQStatus e) |
| XMQParseCallbacks * | xmqNewParseCallbacks () |
| 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) |
| XMQParseState * | xmqNewParseState (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) |
| XMQNode * | xmqGetRootNode (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. XMQReturnNode xmqAddElement(XMQDoc *doq, XMQNode *parent, const char *name, XMQNS ns) | |
| 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) |
| XMQOutputSettings * | xmqNewOutputSettings () |
| 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) |
| XMQNode * | xmqGetNode (XMQDoc *doc, const char *xpath) |
| XMQNode * | xmqGetNodeRel (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) |
| XMQLineConfig * | xmqNewLineConfig () |
| 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) |
| #define _hideLBfromEditor { |
| #define _hideRBfromEditor } |
| #define NS_ANCESTOR | ( | uri | ) |
Search for the namespace in parent and parents parent etc. If not found, create the namespace in the root element.
| #define NS_HERE | ( | uri | ) |
Create a new namespace for this node.
| #define NS_NONE ((XMQNS){XMQ_NS_NONE,NULL}) |
Assign no namespace to this node.
| #define NS_PARENT ((XMQNS){XMQ_NS_PARENT,NULL}) |
Reuse the parent namespace for this node.
| typedef enum XMQColorName XMQColorName |
XMQColorName is used to color the output when pretty printing xmq.
| typedef struct XMQLineConfig XMQLineConfig |
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.
| 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.
| typedef struct XMQNS XMQNS |
| typedef struct XMQOutputSettings XMQOutputSettings |
Opaque structure storing a output settings when printing xmq, xml or json.
| typedef struct XMQParseCallbacks 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.
| typedef struct XMQParseState XMQParseState |
An opaque structure to maintain the parse state and the list of callbacks to be invoked when parsing xmq.
| typedef struct XMQReader XMQReader |
| typedef struct XMQReturnAttr XMQReturnAttr |
| typedef struct XMQReturnConstString XMQReturnConstString |
| typedef struct XMQReturnDoc XMQReturnDoc |
| typedef struct XMQReturnNode XMQReturnNode |
| typedef struct XMQReturnString XMQReturnString |
| 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.
| writer_state | Your own writer_state supplied to the printing function. |
| start | Start of buffer to write. |
| stop | Points to byte after buffer to write. If NULL then assume start is null terminated. |
| typedef struct XMQWriter XMQWriter |
| enum NamespaceAction |
| enum XMQColorName |
XMQColorName is used to color the output when pretty printing xmq.
| enum XMQContentType |
Specify the file/buffer content type both for input and for output.
| enum 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.
| enum 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 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  	 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.
| 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. |
| enum XMQRenderFormat |
XMQRenderFormat decides how to format the xmq output: PLAIN, or for human consumption in TERMINAL, HTML, HTMQ, TEX.
| enum XMQStatus |
The xmq functions return OK or error values using the XMQStatus.
| 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 ) |
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.
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.
| doq | The xmq document. |
| node | The node into which the namespace declaration is put. |
| ns_uri | The new namespace uri. |
| prefix | The desired prefix. |
Only NS_HERE is allowed.
| XMQReturnNode xmqAddRootElement | ( | XMQDoc * | doq, |
| const char * | name, | ||
| XMQNS | ns ) |
| 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"
| 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.
| void xmqClearDoc | ( | XMQDoc * | doc | ) |
xmqClearDoc:
Clear out, make the document empty.
| 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!", ( 'a line'&10;)
| content | The string to safely quote using xmq quoting and output on a single line. |
| bool xmqDebugging | ( | ) |
xmqDebugging:
Return whether debugging is enabled or not.
| 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.
| start | Points to first byte of buffer to scan for content type. |
| stop | Points to byte after buffer. |
The error as status enum.
| doc | The document which we tried to parse. |
| const char * xmqDocError | ( | XMQDoc * | doc | ) |
Extract the parsing error.
| doc | The document which we tried to parse. |
| 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.
| 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.
| void xmqFreeDoc | ( | XMQDoc * | doc | ) |
xmqFreeDoc:
Free the document object and all associated memory.
| void xmqFreeLineConfig | ( | XMQLineConfig * | lc | ) |
xmqFreeLineConfig:
Free the XMQLineConfig structure.
| void xmqFreeOutputSettings | ( | XMQOutputSettings * | os | ) |
Free the print settings structure.
| void xmqFreeParseCallbacks | ( | XMQParseCallbacks * | cb | ) |
xmqFreeParseCallbacks:
Free the XMQParseCallback structure.
| void xmqFreeParseState | ( | XMQParseState * | state | ) |
xmqFreeParseState:
Free the memory allocated for the state.
| const char * xmqGetContent | ( | XMQNode * | node | ) |
xmqGetContent: get content of element node @node: Node
| 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.
| 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: @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.
| void * xmqGetImplementationDoc | ( | XMQDoc * | doq | ) |
xmqGetImplementationDoc:
Get the underlying implementation doc, could be an xmlDocPtr from libxml2 for example.
| 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: @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.
| 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: @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.
| const char * xmqGetName | ( | XMQNode * | node | ) |
xmqGetName: get name of node @node: Node
xmqGetNode: @doc: the xmq doc object @xpath: the location of the content to be returned as a node ptr.
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.
| XMQContentType xmqGetOriginalContentType | ( | XMQDoc * | doq | ) |
xmqGetOriginalContentType:
If available, return the original content type (xmq/htmq/xml/html/json/text) of this document.
| size_t xmqGetOriginalSize | ( | XMQDoc * | doq | ) |
xmqGetOriginalSize:
If available, return the size of the original content, ie the loaded file size.
| 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: @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.
| char * xmqLineDoc | ( | XMQLineConfig * | lc, |
| XMQDoc * | doc ) |
xmqLineDoc:
Generate from the doc a compact single line xmq string containing no newlines at all, for logging.
| 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' 'next line')}
| char * xmqLineVPrintf | ( | XMQLineConfig * | lc, |
| const char * | element_name, | ||
| va_list | ap ) |
| void xmqLogFilter | ( | const char * | log_filter | ) |
xmqLogFilter
Enable/Disable debug/trace logging for certain prefixes.
| bool xmqLoggingXMQ | ( | ) |
xmqLogXMQ:
Return whether logging in pure xmq is enabled or not.
| XMQReturnDoc xmqNewDoc | ( | ) |
Create an empty document object.
| XMQLineConfig * xmqNewLineConfig | ( | ) |
xmqNewLineConfig:
Allocate a default XMQLineConfig.
| XMQOutputSettings * xmqNewOutputSettings | ( | ) |
Allocate the print settings structure and zero it.
| XMQParseCallbacks * xmqNewParseCallbacks | ( | ) |
xmqNewParseCallbacks:
Allocate an empty XMQParseCallback structure. All callbacks are NULL and none will be called.
| 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.
| 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.
| 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.
| 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.
| bool xmqParseBufferWithIXML | ( | XMQDoc * | doc, |
| const char * | start, | ||
| const char * | stop, | ||
| XMQDoc * | ixml_grammar, | ||
| int | flags ) |
xmqParseBufferWithIXML:
Parse buffer using the supplied IXML grammar.
| bool xmqParseBufferWithType | ( | XMQDoc * | doc, |
| const char * | start, | ||
| const char * | stop, | ||
| const char * | implicit_root, | ||
| XMQContentType | ct, | ||
| int | flags ) |
xmqParseBufferWithType:
Parse buffer.
| const char * xmqParseErrorToString | ( | XMQStatus | e | ) |
xmqParseErrorToString: : Translate this error to a human readable string.
| bool xmqParseFile | ( | XMQDoc * | doc, |
| const char * | file, | ||
| const char * | implicit_root, | ||
| int | flags ) |
xmqParseFileWithIXML:
Load a file and parse it using the supplied IXML grammar. If file is NULL read from stdin.
| 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.
| 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.
| doc | The xmq doc object to populate with the parsed data. |
| reader | Use this reader to fetch input data. |
| reader_state | Pass this reader_state to the reader. |
| implicit_root | The implicit root. |
| flags | Specify parser settings. |
| void xmqPrint | ( | XMQDoc * | doc, |
| XMQOutputSettings * | settings ) |
Pretty print the document according to the settings.
| 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.
| 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.
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.
| void xmqSetAddIndent | ( | XMQOutputSettings * | os, |
| int | add_indent ) |
| XMQReturnAttr xmqSetAttribute | ( | XMQDoc * | doq, |
| XMQNode * | node, | ||
| const char * | name, | ||
| const char * | value, | ||
| XMQNS | ns ) |
Create/update an attribute in an existing node.
NS_HERE is not permitted for an attribute.
| void xmqSetBackgroundMode | ( | XMQOutputSettings * | os, |
| bool | bg_dark_mode ) |
| void xmqSetCompact | ( | XMQOutputSettings * | os, |
| bool | compact ) |
| void xmqSetContent | ( | XMQNode * | node, |
| const char * | raw_content ) |
xmqSetContent: set the raw content of element node @node: Node
| void xmqSetDebug | ( | bool | e | ) |
xmqSetDebug:
Enable/Disable debugging.
| 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.
| doq | Document for which the source should be named. |
| source_name | The document source file name. |
| void xmqSetEscapeNewlines | ( | XMQOutputSettings * | os, |
| bool | escape_newlines ) |
| void xmqSetEscapeNon7bit | ( | XMQOutputSettings * | os, |
| bool | escape_non_7bit ) |
| void xmqSetEscapeTabs | ( | XMQOutputSettings * | os, |
| bool | escape_tabs ) |
| void xmqSetImplementationDoc | ( | XMQDoc * | doq, |
| void * | doc ) |
xmqSetImplementationDoc:
Set the underlying implementation doc, could be an xmlDocPtr from libxml2 for example.
| void xmqSetLineHumanReadable | ( | XMQLineConfig * | lc, |
| bool | enable ) |
xmqSetLineHumanReadable(XMQLineConfig *lc, bool enable);
If enable is true then generate a more human readable log line.
| void xmqSetLogHumanReadable | ( | bool | e | ) |
xmqSetLogHumanReadable:
Enable/Disable verbose/debug/tracing output as human readable. The default is in xmq format.
| void xmqSetOmitDecl | ( | XMQOutputSettings * | os, |
| bool | omit_decl ) |
| void xmqSetOriginalSize | ( | XMQDoc * | doq, |
| size_t | size ) |
xmqSetOriginalSize:
Override the original size of the document.
| void xmqSetOutputFormat | ( | XMQOutputSettings * | os, |
| XMQContentType | output_format ) |
| void xmqSetPreferDoubleQuotes | ( | XMQOutputSettings * | os, |
| bool | prefer_double_quotes ) |
| 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.
| void xmqSetRenderFormat | ( | XMQOutputSettings * | os, |
| XMQRenderFormat | render_to ) |
| void xmqSetRenderOnlyStyle | ( | XMQOutputSettings * | os, |
| bool | only_style ) |
| void xmqSetRenderRaw | ( | XMQOutputSettings * | os, |
| bool | render_raw ) |
| void xmqSetRenderTheme | ( | XMQOutputSettings * | os, |
| const char * | theme_spec ) |
| 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.
| void xmqSetTrace | ( | bool | e | ) |
xmqSetTrace:
Enable/Disable tracing.
| void xmqSetTrueColor | ( | XMQOutputSettings * | os, |
| bool | truecolor ) |
| 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.
| void xmqSetupDefaultColors | ( | XMQOutputSettings * | settings | ) |
xmqSetupDefaultColors:
Set the default colors for settings based on the theme and background color.
| void xmqSetupParseCallbacksColorizeTokens | ( | XMQParseCallbacks * | state, |
| XMQRenderFormat | render_format ) |
xmqSetupParseCallbacksColorizeTokens:
Used to colorize xmq input, without building a parse tree.
| void xmqSetupParseCallbacksDebugContent | ( | XMQParseCallbacks * | state | ) |
xmqSetupParseCallbacksDebugContent:
Used debug the decoded content.
| void xmqSetupParseCallbacksDebugTokens | ( | XMQParseCallbacks * | state | ) |
xmqSetupParseCallbacksDebugTokens:
Used to debug location, type of tokens.
| void xmqSetupPrintFile | ( | XMQOutputSettings * | ps, |
| const char * | file ) |
Setup the printer to print to a file.
| void xmqSetupPrintFileDescriptor | ( | XMQOutputSettings * | ps, |
| int | fd ) |
Setup the printer to print to a filedescriptor.
| void xmqSetupPrintMemory | ( | XMQOutputSettings * | ps, |
| char ** | start, | ||
| char ** | stop ) |
Setup the printer to print to a dynamically memory buffer.
| void xmqSetupPrintSkip | ( | XMQOutputSettings * | ps, |
| size_t * | skip ) |
Setup where to store any potential skip. This is not an ideal solution. Fix?
| void xmqSetupPrintStdOutStdErr | ( | XMQOutputSettings * | ps | ) |
Setup the printer to print content to stdout and errors to sderr.
| void xmqSetUseColor | ( | XMQOutputSettings * | os, |
| bool | use_color ) |
| void xmqSetVerbose | ( | bool | e | ) |
xmqSetVerbose:
Enable/Disable verbose logging.
| void xmqSetWriterContent | ( | XMQOutputSettings * | os, |
| XMQWriter | content ) |
| void xmqSetWriterError | ( | XMQOutputSettings * | os, |
| XMQWriter | error ) |
| int xmqStateErrno | ( | XMQParseState * | state | ) |
xmqStateErrno: @state: the parse state.
If the parse fails then use this function to get the integer value of XMQStatus.
| 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.
| bool xmqTokenizeBuffer | ( | XMQParseState * | state, |
| const char * | start, | ||
| const char * | stop ) |
Parse a buffer with xmq content.
| bool xmqTokenizeFile | ( | XMQParseState * | state, |
| const char * | file ) |
Parse a file with xmq content.
| bool xmqTokenizeFileDescriptor | ( | XMQParseState * | state, |
| int | fd ) |
Parse a file descriptor with xmq content.
| bool xmqTracing | ( | ) |
xmqTracing:
Return whether tracing is enabled or not.
| void xmqTrimWhitespace | ( | XMQDoc * | doc, |
| int | flags ) |
Trim xml whitespace.
| const char * xmqVersion | ( | ) |
xmqVersion:
Return the current xmq version in this library.