libabigail
|
Internal namespace for xml manipulation utilities. More...
Classes | |
struct | charDeleter |
This functor is used to instantiate a shared_ptr for xmlChar. More... | |
struct | textReaderDeleter |
This functor is used to instantiate a shared_ptr for the xmlTextReader. More... | |
Typedefs | |
typedef shared_ptr< xmlTextReader > | reader_sptr |
A convenience typedef for a shared pointer of xmlTextReader. More... | |
typedef shared_ptr< xmlChar > | xml_char_sptr |
A convenience typedef for a shared pointer of xmlChar. More... | |
Functions | |
std::string | escape_xml_comment (const std::string &str) |
Escape the '-' character, to avoid having a '–' in a comment. More... | |
void | escape_xml_comment (const std::string &str, std::string &escaped) |
Escape the '-' character, to avoid having a '–' in a comment. More... | |
std::string | escape_xml_string (const std::string &str) |
Escape the 5 characters representing the predefined XML entities. More... | |
void | escape_xml_string (const std::string &str, std::string &escaped) |
Escape the 5 characters representing the predefined XML entities. More... | |
int | get_xml_node_depth (xmlNodePtr n) |
Return the depth of an xml element node. More... | |
void | initialize () |
The initialization function of libxml2 abstraction layer. This function must be called prior to using any of the libxml2 capabilities. More... | |
reader_sptr | new_reader_from_buffer (const std::string &buffer) |
Instanciate an xmlTextReader that parses the content of an in-memory buffer, wrap it into a smart pointer and return it. More... | |
reader_sptr | new_reader_from_file (const std::string &path) |
Instantiate an xmlTextReader that parses the content of an on-disk file, wrap it into a smart pointer and return it. More... | |
reader_sptr | new_reader_from_istream (std::istream *in) |
Instanciate an xmlTextReader that parses a content coming from an input stream. More... | |
std::string | unescape_xml_comment (const std::string &str) |
Read a string, detect the '#&45;' entity and un-escape it into the '-' character. More... | |
void | unescape_xml_comment (const std::string &str, std::string &escaped) |
Read a string, detect the '#&45;' entity and un-escape it into the '-' character. More... | |
std::string | unescape_xml_string (const std::string &str) |
Read a string, detect the 5 predefined XML entities it may contain and un-escape them, by writting their corresponding characters back in. The pre-defined entities are: More... | |
void | unescape_xml_string (const std::string &str, std::string &escaped) |
Read a string, detect the 5 predefined XML entities it may contain and un-escape them, by writting their corresponding characters back in. The pre-defined entities are: More... | |
bool | xml_char_sptr_to_string (xml_char_sptr ssptr, std::string &s) |
Convert a shared pointer to xmlChar into an std::string. More... | |
Internal namespace for xml manipulation utilities.
typedef shared_ptr<xmlTextReader> reader_sptr |
A convenience typedef for a shared pointer of xmlTextReader.
Definition at line 29 of file abg-libxml-utils.h.
typedef shared_ptr<xmlChar> xml_char_sptr |
A convenience typedef for a shared pointer of xmlChar.
Definition at line 32 of file abg-libxml-utils.h.
std::string escape_xml_comment | ( | const std::string & | str | ) |
Escape the '-' character, to avoid having a '–' in a comment.
The resulting entity for '-' is '-'.
/
str | the input string to read to search for the characters / to escape. / / |
Definition at line 405 of file abg-libxml-utils.cc.
void escape_xml_comment | ( | const std::string & | str, |
std::string & | escaped | ||
) |
Escape the '-' character, to avoid having a '–' in a comment.
The resulting entity for '-' is '-'.
/
str | the input string to read to search for the characters / to escape. / / |
escaped | the output string where to write the resulting / string that contains the pre-defined characters escaped as / predefined entitites. |
Definition at line 381 of file abg-libxml-utils.cc.
std::string escape_xml_string | ( | const std::string & | str | ) |
Escape the 5 characters representing the predefined XML entities.
The resulting entities and their matching characters are:
< for the character '<', > for the character '>', ' for the character ''', " for the character '"', and & for the character '&'.
/
str | the input string to read to search for the characters / to escape. / / |
Definition at line 363 of file abg-libxml-utils.cc.
void escape_xml_string | ( | const std::string & | str, |
std::string & | escaped | ||
) |
Escape the 5 characters representing the predefined XML entities.
The resulting entities and their matching characters are:
< for the character '<', > for the character '>', ' for the character ''', " for the character '"', and & for the character '&'.
/
str | the input string to read to search for the characters / to escape. / / |
escaped | the output string where to write the resulting / string that contains the pre-defined characters escaped as / predefined entitites. |
Definition at line 323 of file abg-libxml-utils.cc.
int get_xml_node_depth | ( | xmlNodePtr | n | ) |
Return the depth of an xml element node.
Note that the node must be attached to an XML document.
n | the xml to consider. |
Definition at line 297 of file abg-libxml-utils.cc.
void initialize | ( | ) |
The initialization function of libxml2 abstraction layer. This function must be called prior to using any of the libxml2 capabilities.
Definition at line 172 of file abg-libxml-utils.cc.
reader_sptr new_reader_from_buffer | ( | const std::string & | buffer | ) |
Instanciate an xmlTextReader that parses the content of an in-memory buffer, wrap it into a smart pointer and return it.
buffer | the in-memory buffer to be parsed by the returned instance of xmlTextReader. |
Definition at line 200 of file abg-libxml-utils.cc.
reader_sptr new_reader_from_file | ( | const std::string & | path | ) |
Instantiate an xmlTextReader that parses the content of an on-disk file, wrap it into a smart pointer and return it.
path | the path to the file to be parsed by the returned instance of xmlTextReader. |
Definition at line 186 of file abg-libxml-utils.cc.
reader_sptr new_reader_from_istream | ( | std::istream * | in | ) |
Instanciate an xmlTextReader that parses a content coming from an input stream.
in | the input stream to consider. |
Definition at line 250 of file abg-libxml-utils.cc.
std::string unescape_xml_comment | ( | const std::string & | str | ) |
Read a string, detect the '#&45;' entity and un-escape it into the '-' character.
str | the input XML string to consider. |
Definition at line 542 of file abg-libxml-utils.cc.
void unescape_xml_comment | ( | const std::string & | str, |
std::string & | escaped | ||
) |
Read a string, detect the '#&45;' entity and un-escape it into the '-' character.
str | the input XML string to consider. |
escaped | where to write the resulting un-escaped string. |
Definition at line 512 of file abg-libxml-utils.cc.
std::string unescape_xml_string | ( | const std::string & | str | ) |
Read a string, detect the 5 predefined XML entities it may contain and un-escape them, by writting their corresponding characters back in. The pre-defined entities are:
< for the character '<', > for the character '>', ' for the character ''', " for the character '"', and & for the character '&'.
str | the input XML string to consider. |
Definition at line 498 of file abg-libxml-utils.cc.
void unescape_xml_string | ( | const std::string & | str, |
std::string & | escaped | ||
) |
Read a string, detect the 5 predefined XML entities it may contain and un-escape them, by writting their corresponding characters back in. The pre-defined entities are:
< for the character '<', > for the character '>', ' for the character ''', " for the character '"', and & for the character '&'.
str | the input XML string to consider. |
escaped | where to write the resulting un-escaped string. |
Definition at line 424 of file abg-libxml-utils.cc.
bool xml_char_sptr_to_string | ( | xml_char_sptr | ssptr, |
std::string & | s | ||
) |
Convert a shared pointer to xmlChar into an std::string.
If the xmlChar is NULL, set "" to the string.
ssptr | the shared point to xmlChar to convert. |
s | the output string. |
Definition at line 270 of file abg-libxml-utils.cc.