## globals

globals —

## Synopsis

    void        xmlInitGlobals                  (void);
    void        xmlCleanupGlobals               (void);
    void        (*xmlRegisterNodeFunc)          (xmlNodePtr node);
    void        (*xmlDeregisterNodeFunc)        (xmlNodePtr node);
    struct      xmlGlobalState;
    typedef     xmlGlobalStatePtr;
    void        xmlInitializeGlobalState        (xmlGlobalStatePtr gs);
    void        xmlThrDefSetGenericErrorFunc    (void *ctx,
                                                 xmlGenericErrorFunc handler);
    xmlRegisterNodeFunc xmlRegisterNodeDefault  (xmlRegisterNodeFunc func);
    xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault
                                                (xmlRegisterNodeFunc func);
    xmlDeregisterNodeFunc xmlDeregisterNodeDefault
                                                (xmlDeregisterNodeFunc func);
    xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault
                                                (xmlDeregisterNodeFunc func);
    #define     xmlMalloc                       (size)
    #define     xmlMallocAtomic                 (size)
    #define     xmlRealloc                      (ptr, size)
    #define     xmlFree
    #define     xmlMemStrdup                    (str)
    #define     docbDefaultSAXHandler
    #define     htmlDefaultSAXHandler
    #define     oldXMLWDcompatibility
    #define     xmlBufferAllocScheme
    xmlBufferAllocationScheme xmlThrDefBufferAllocScheme
                                                (xmlBufferAllocationScheme v);
    #define     xmlDefaultBufferSize
    int         xmlThrDefDefaultBufferSize      (int v);
    #define     xmlDefaultSAXHandler
    #define     xmlDefaultSAXLocator
    #define     xmlDoValidityCheckingDefaultValue
    int         xmlThrDefDoValidityCheckingDefaultValue
                                                (int v);
    #define     xmlGenericError
    #define     xmlGenericErrorContext
    #define     xmlGetWarningsDefaultValue
    int         xmlThrDefGetWarningsDefaultValue
                                                (int v);
    #define     xmlIndentTreeOutput
    int         xmlThrDefIndentTreeOutput       (int v);
    #define     xmlTreeIndentString
    const char* xmlThrDefTreeIndentString       (const char *v);
    #define     xmlKeepBlanksDefaultValue
    int         xmlThrDefKeepBlanksDefaultValue (int v);
    #define     xmlLineNumbersDefaultValue
    int         xmlThrDefLineNumbersDefaultValue
                                                (int v);
    #define     xmlLoadExtDtdDefaultValue
    int         xmlThrDefLoadExtDtdDefaultValue (int v);
    #define     xmlParserDebugEntities
    int         xmlThrDefParserDebugEntities    (int v);
    #define     xmlParserVersion
    #define     xmlPedanticParserDefaultValue
    int         xmlThrDefPedanticParserDefaultValue
                                                (int v);
    #define     xmlSaveNoEmptyTags
    int         xmlThrDefSaveNoEmptyTags        (int v);
    #define     xmlSubstituteEntitiesDefaultValue
    int         xmlThrDefSubstituteEntitiesDefaultValue
                                                (int v);
    #define     xmlRegisterNodeDefaultValue
    #define     xmlDeregisterNodeDefaultValue

## Description

## Details

### xmlInitGlobals ()

    void        xmlInitGlobals                  (void);

### xmlCleanupGlobals ()

    void        xmlCleanupGlobals               (void);

### xmlRegisterNodeFunc ()

    void        (*xmlRegisterNodeFunc)          (xmlNodePtr node);

`node` : |

### xmlDeregisterNodeFunc ()

    void        (*xmlDeregisterNodeFunc)        (xmlNodePtr node);

`node` : |

### struct xmlGlobalState

    struct xmlGlobalState
    {
    	const char *xmlParserVersion;

    	xmlSAXLocator xmlDefaultSAXLocator;
    	xmlSAXHandler xmlDefaultSAXHandler;
    	xmlSAXHandler docbDefaultSAXHandler;
    	xmlSAXHandler htmlDefaultSAXHandler;

    	xmlFreeFunc xmlFree;
    	xmlMallocFunc xmlMalloc;
    	xmlStrdupFunc xmlMemStrdup;
    	xmlReallocFunc xmlRealloc;

    	xmlGenericErrorFunc xmlGenericError;
    	void *xmlGenericErrorContext;

    	int oldXMLWDcompatibility;

    	xmlBufferAllocationScheme xmlBufferAllocScheme;
    	int xmlDefaultBufferSize;

    	int xmlSubstituteEntitiesDefaultValue;
    	int xmlDoValidityCheckingDefaultValue;
    	int xmlGetWarningsDefaultValue;
    	int xmlKeepBlanksDefaultValue;
    	int xmlLineNumbersDefaultValue;
    	int xmlLoadExtDtdDefaultValue;
    	int xmlParserDebugEntities;
    	int xmlPedanticParserDefaultValue;

    	int xmlSaveNoEmptyTags;
    	int xmlIndentTreeOutput;
    	const char *xmlTreeIndentString;

      	xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
      	xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;

    	xmlMallocFunc xmlMallocAtomic;
    };

### xmlGlobalStatePtr

    typedef xmlGlobalState *xmlGlobalStatePtr;

### xmlInitializeGlobalState ()

    void        xmlInitializeGlobalState        (xmlGlobalStatePtr gs);

xmlInitializeGlobalState() initialize a global state with all the default values of the library.

`gs` : | a pointer to a newly allocated global state

### xmlThrDefSetGenericErrorFunc ()

    void        xmlThrDefSetGenericErrorFunc    (void *ctx,
                                                 xmlGenericErrorFunc handler);

`ctx` : |
`handler` : |

### xmlRegisterNodeDefault ()

    xmlRegisterNodeFunc xmlRegisterNodeDefault  (xmlRegisterNodeFunc func);

Registers a callback for node creation

`func` : | function pointer to the new RegisterNodeFunc
Returns : | the old value of the registration function

### xmlThrDefRegisterNodeDefault ()

    xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault
                                                (xmlRegisterNodeFunc func);

`func` : |
Returns : |

### xmlDeregisterNodeDefault ()

    xmlDeregisterNodeFunc xmlDeregisterNodeDefault
                                                (xmlDeregisterNodeFunc func);

Registers a callback for node destruction

`func` : | function pointer to the new DeregisterNodeFunc
Returns : | the previous value of the deregistration function

### xmlThrDefDeregisterNodeDefault ()

    xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault
                                                (xmlDeregisterNodeFunc func);

`func` : |
Returns : |

### xmlMalloc()

    #define     xmlMalloc(size)

Wrapper for the malloc() function used in the XML library.

`size` : |

### xmlMallocAtomic()

    #define     xmlMallocAtomic(size)

Wrapper for the malloc() function used in the XML library for allocation of block not containing pointers to other areas.

`size` : |

### xmlRealloc()

    #define     xmlRealloc(ptr, size)

Wrapper for the realloc() function used in the XML library.

`ptr` : |
`size` : |

### xmlFree

    #define     xmlFree

The variable holding the libxml free() implementation

### xmlMemStrdup()

    #define     xmlMemStrdup(str)

Wrapper for the strdup() function, xmlStrdup() is usually preferred.

`str` : |

### docbDefaultSAXHandler

    #define     docbDefaultSAXHandler

Default handler for SGML DocBook, builds the DOM tree

### htmlDefaultSAXHandler

    #define     htmlDefaultSAXHandler

Default handler for HTML, builds the DOM tree

### oldXMLWDcompatibility

    #define     oldXMLWDcompatibility

Global setting, DEPRECATED.

### xmlBufferAllocScheme

    #define     xmlBufferAllocScheme

Global setting, default allocation policy for buffers, default is XML_BUFFER_ALLOC_EXACT

### xmlThrDefBufferAllocScheme ()

    xmlBufferAllocationScheme xmlThrDefBufferAllocScheme
                                                (xmlBufferAllocationScheme v);

`v` : |
Returns : |

### xmlDefaultBufferSize

    #define     xmlDefaultBufferSize

Global setting, default buffer size. Default value is BASE_BUFFER_SIZE

### xmlThrDefDefaultBufferSize ()

    int         xmlThrDefDefaultBufferSize      (int v);

`v` : |
Returns : |

### xmlDefaultSAXHandler

    #define     xmlDefaultSAXHandler

Default handler for XML, builds the DOM tree

### xmlDefaultSAXLocator

    #define     xmlDefaultSAXLocator

The default SAX Locator { getPublicId, getSystemId, getLineNumber, getColumnNumber}

### xmlDoValidityCheckingDefaultValue

    #define     xmlDoValidityCheckingDefaultValue

Global setting, indicate that the parser should work in validating mode. Disabled by default.

### xmlThrDefDoValidityCheckingDefaultValue ()

    int         xmlThrDefDoValidityCheckingDefaultValue
                                                (int v);

`v` : |
Returns : |

### xmlGenericError

    #define     xmlGenericError

Global setting: function used for generic error callbacks

### xmlGenericErrorContext

    #define     xmlGenericErrorContext

Global setting passed to generic error callbacks

### xmlGetWarningsDefaultValue

    #define     xmlGetWarningsDefaultValue

Global setting, indicate that the parser should provide warnings. Activated by default.

### xmlThrDefGetWarningsDefaultValue ()

    int         xmlThrDefGetWarningsDefaultValue
                                                (int v);

`v` : |
Returns : |

### xmlIndentTreeOutput

    #define     xmlIndentTreeOutput

Global setting, asking the serializer to indent the output tree by default Enabled by default

### xmlThrDefIndentTreeOutput ()

    int         xmlThrDefIndentTreeOutput       (int v);

`v` : |
Returns : |

### xmlTreeIndentString

    #define     xmlTreeIndentString

The string used to do one-level indent. By default is equal to " " (two spaces)

### xmlThrDefTreeIndentString ()

    const char* xmlThrDefTreeIndentString       (const char *v);

`v` : |
Returns : |

### xmlKeepBlanksDefaultValue

    #define     xmlKeepBlanksDefaultValue

Global setting, indicate that the parser should keep all blanks nodes found in the content Activated by default, this is actually needed to have the parser conformant to the XML Recommendation, however the option is kept for some applications since this was libxml1 default behaviour.

### xmlThrDefKeepBlanksDefaultValue ()

    int         xmlThrDefKeepBlanksDefaultValue (int v);

`v` : |
Returns : |

### xmlLineNumbersDefaultValue

    #define     xmlLineNumbersDefaultValue

Global setting, indicate that the parser should store the line number in the content field of elements in the DOM tree. Disabled by default since this may not be safe for old classes of applicaton.

### xmlThrDefLineNumbersDefaultValue ()

    int         xmlThrDefLineNumbersDefaultValue
                                                (int v);

`v` : |
Returns : |

### xmlLoadExtDtdDefaultValue

    #define     xmlLoadExtDtdDefaultValue

Global setting, indicate that the parser should load DTD while not validating. Disabled by default.

### xmlThrDefLoadExtDtdDefaultValue ()

    int         xmlThrDefLoadExtDtdDefaultValue (int v);

`v` : |
Returns : |

### xmlParserDebugEntities

    #define     xmlParserDebugEntities

Global setting, asking the parser to print out debugging informations. while handling entities. Disabled by default

### xmlThrDefParserDebugEntities ()

    int         xmlThrDefParserDebugEntities    (int v);

`v` : |
Returns : |

### xmlParserVersion

    #define     xmlParserVersion

Constant string describing the internal version of the library

### xmlPedanticParserDefaultValue

    #define     xmlPedanticParserDefaultValue

Global setting, indicate that the parser be pedantic Disabled by default.

### xmlThrDefPedanticParserDefaultValue ()

    int         xmlThrDefPedanticParserDefaultValue
                                                (int v);

`v` : |
Returns : |

### xmlSaveNoEmptyTags

    #define     xmlSaveNoEmptyTags

Global setting, asking the serializer to not output empty tags as <empty/> but <empty></empty>. those two forms are undistinguishable once parsed. Disabled by default

### xmlThrDefSaveNoEmptyTags ()

    int         xmlThrDefSaveNoEmptyTags        (int v);

`v` : |
Returns : |

### xmlSubstituteEntitiesDefaultValue

    #define     xmlSubstituteEntitiesDefaultValue

Global setting, indicate that the parser should not generate entity references but replace them with the actual content of the entity Disabled by default, this should be activated when using XPath since the XPath data model requires entities replacement and the XPath engine does not handle entities references transparently.

### xmlThrDefSubstituteEntitiesDefaultValue ()

    int         xmlThrDefSubstituteEntitiesDefaultValue
                                                (int v);

`v` : |
Returns : |

### xmlRegisterNodeDefaultValue

    #define     xmlRegisterNodeDefaultValue

### xmlDeregisterNodeDefaultValue

    #define     xmlDeregisterNodeDefaultValue