libdom
Loading...
Searching...
No Matches
Functions | Variables
namespace.c File Reference
#include <string.h>
#include <dom/dom.h>
#include "utils/namespace.h"
#include "utils/validate.h"
#include "utils/utils.h"

Functions

dom_exception dom_namespace_finalise (void)
 
dom_exception _dom_namespace_validate_qname (dom_string *qname, dom_string *namespace)
 
dom_exception _dom_namespace_split_qname (dom_string *qname, dom_string **prefix, dom_string **localname)
 
dom_string_dom_namespace_get_xml_prefix (void)
 
dom_string_dom_namespace_get_xmlns_prefix (void)
 

Variables

dom_stringdom_namespaces [DOM_NAMESPACE_COUNT]
 

Function Documentation

◆ _dom_namespace_get_xml_prefix()

dom_string * _dom_namespace_get_xml_prefix ( void )

Get the XML prefix dom_string

Returns
the xml prefix dom_string.

Note: The client of this function may or may not call the dom_string_ref on the returned dom_string, because this string will only be destroyed when the dom_finalise is called. But if the client call dom_string_ref, it must call dom_string_unref to maintain a correct ref count of the dom_string.

◆ _dom_namespace_get_xmlns_prefix()

dom_string * _dom_namespace_get_xmlns_prefix ( void )

Get the XMLNS prefix dom_string.

Returns
the xmlns prefix dom_string

Note: The client of this function may or may not call the dom_string_ref on the returned dom_string, because this string will only be destroyed when the dom_finalise is called. But if the client call dom_string_ref, it must call dom_string_unref to maintain a correct ref count of the dom_string.

◆ _dom_namespace_split_qname()

dom_exception _dom_namespace_split_qname ( dom_string * qname,
dom_string ** prefix,
dom_string ** localname )

Split a QName into a namespace prefix and localname string

Parameters
qnameThe qname to split
prefixPointer to location to receive prefix
localnamePointer to location to receive localname
Returns
DOM_NO_ERR on success.

If there is no prefix present in ::qname, then ::prefix will be NULL.

::prefix and ::localname will be referenced. The caller should unreference them once finished.

◆ _dom_namespace_validate_qname()

dom_exception _dom_namespace_validate_qname ( dom_string * qname,
dom_string * namespace )

Ensure a QName is valid

Parameters
qnameThe qname to validate
namespaceThe namespace URI associated with the QName, or NULL
Returns
DOM_NO_ERR if valid, DOM_INVALID_CHARACTER_ERR if ::qname contains an invalid character, DOM_NAMESPACE_ERR if ::qname is malformed, or it has a prefix and ::namespace is NULL, or ::qname has a prefix "xml" and ::namespace is not "http://www.w3.org/XML/1998/namespace", or ::qname has a prefix "xmlns" and ::namespace is not "http://www.w3.org/2000/xmlns", or ::namespace is "http://www.w3.org/2000/xmlns" and ::qname is not (or is not prefixed by) "xmlns".

◆ dom_namespace_finalise()

dom_exception dom_namespace_finalise ( void )

Finalise the namespace component

Returns
DOM_NO_ERR on success.

Variable Documentation

◆ dom_namespaces

dom_string* dom_namespaces[DOM_NAMESPACE_COUNT]
Initial value:
= {
NULL,
}