#include <ExpatCoreParser.h>
|
typedef std::lock_guard< std::mutex > | lock_t |
|
|
static void | start (void *, const char *el, const char **attr) |
|
static void | end (void *, const char *el) |
|
static void | char_data (void *, const XML_Char *s, int len) |
|
static void | default_handler (void *, const XML_Char *s, int len) |
|
static void | comment (void *, const XML_Char *s) |
|
static int | external_entity (XML_Parser parser, const XML_Char *context, const XML_Char *, const XML_Char *systemId, const XML_Char *) |
|
static void | entity (void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *) |
|
static const std::string & | find_external_entity (const std::string &name) |
|
static const std::string & | find_text_entity (const std::string &name) |
|
Definition at line 15 of file ExpatCoreParser.h.
◆ ExternalEntityMap
◆ lock_t
◆ ExpatCoreParser()
ExpatCoreParser::ExpatCoreParser |
( |
const std::string & |
prefix | ) |
|
|
private |
◆ char_data()
void ExpatCoreParser::char_data |
( |
void * |
user_data, |
|
|
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
staticprivate |
◆ clean()
void ExpatCoreParser::clean |
( |
| ) |
|
|
private |
◆ comment()
void ExpatCoreParser::comment |
( |
void * |
user_data, |
|
|
const XML_Char * |
s |
|
) |
| |
|
staticprivate |
◆ default_handler()
void ExpatCoreParser::default_handler |
( |
void * |
user_data, |
|
|
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
staticprivate |
◆ do_char_data()
void ExpatCoreParser::do_char_data |
( |
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
private |
Definition at line 174 of file ExpatCoreParser.cxx.
175 if (len == 0)
return;
176 while ((len > 0) && (
s[len-1] ==
'\n')) len--;
177 if (len == 0)
return;
178 char* temp = (
char*)
malloc (len + 1);
179 strncpy (temp,
s, len);
182 std::cout <<
"ExpatCoreParser::do_char_data> [" << temp <<
"]" << std::endl;
◆ do_comment()
void ExpatCoreParser::do_comment |
( |
const XML_Char * |
s | ) |
|
|
private |
Definition at line 202 of file ExpatCoreParser.cxx.
204 m_top = std::make_unique<CoreParser::DOMNode> ();
209 std::cout <<
"ExpatCoreParser::do_comment> s=" <<
s <<
" top=" <<
m_top.get() <<
" last=" <<
m_last <<
" node=" <<
node << std::endl;
◆ do_default_handler()
void ExpatCoreParser::do_default_handler |
( |
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
private |
Definition at line 188 of file ExpatCoreParser.cxx.
189 if (len == 0)
return;
190 while ((len > 0) && (
s[len-1] ==
'\n')) len--;
191 if (len == 0)
return;
192 char* temp = (
char*)
malloc (len + 1);
193 strncpy (temp,
s, len);
196 std::cout <<
"ExpatCoreParser::do_default_handler> [" << temp <<
"]" << std::endl;
◆ do_end()
void ExpatCoreParser::do_end |
( |
const char * |
el | ) |
|
|
private |
◆ do_external_entity()
int ExpatCoreParser::do_external_entity |
( |
XML_Parser |
parser, |
|
|
const XML_Char * |
context, |
|
|
const XML_Char * |
systemId |
|
) |
| |
|
private |
Definition at line 347 of file ExpatCoreParser.cxx.
349 std::string context_str;
350 if (context == 0) context_str =
"none";
351 else context_str = context;
356 if (replacement !=
"") {
358 std::cout <<
"ExpatCoreParser::do_external_entity> "
359 <<
" context=[" << context_str <<
"]"
360 <<
" replacement=[" << replacement <<
"]"
363 XML_Parser
p = XML_ExternalEntityParserCreate (
parser, context, NULL);
371 if (replacement ==
"NULL") {
374 if (replacement !=
"") {
379 std::cout <<
"ExpatCoreParser::do_external_entity> "
380 <<
" context=[" << context_str <<
"]"
382 <<
" replacement=[" << replacement <<
"]"
385 XML_Parser
p = XML_ExternalEntityParserCreate (
parser, context, NULL);
◆ do_start()
void ExpatCoreParser::do_start |
( |
const char * |
el, |
|
|
const char ** |
attr |
|
) |
| |
|
private |
Definition at line 146 of file ExpatCoreParser.cxx.
148 std::map <std::string, std::string>
a;
150 m_top = std::make_unique<CoreParser::DOMNode> ();
155 std::cout <<
"ExpatCoreParser::do_start> el=" <<
el <<
" top=" <<
m_top.get() <<
" last=" <<
m_last <<
" node=" <<
node << std::endl;
158 for (
i = 0; attr[
i];
i += 2) {
159 const char*
name = attr[
i];
160 const char*
value = attr[
i+1];
◆ end()
void ExpatCoreParser::end |
( |
void * |
user_data, |
|
|
const char * |
el |
|
) |
| |
|
staticprivate |
◆ entity()
void ExpatCoreParser::entity |
( |
void * |
userData, |
|
|
const XML_Char * |
entityName, |
|
|
int |
is_parameter_entity, |
|
|
const XML_Char * |
value, |
|
|
int |
value_length, |
|
|
const XML_Char * |
base, |
|
|
const XML_Char * |
systemId, |
|
|
const XML_Char * |
publicId, |
|
|
const XML_Char * |
|
|
) |
| |
|
staticprivate |
Definition at line 102 of file ExpatCoreParser.cxx.
113 if (!publicId) publicId =
"none";
114 std::string temp =
"none";
116 char*
t = (
char*)
malloc (value_length + 1);
117 strncpy (
t,
value, value_length);
119 temp = (
const char*)
t;
124 std::cout <<
"ExpatCoreParser::entity[" << 0 <<
"]> " << entityName;
125 std::cout <<
" is_parameter=" << is_parameter_entity;
126 std::cout <<
" value=[" << temp <<
"]";
127 std::cout <<
" base=[" <<
base <<
"]";
128 std::cout <<
" systemId=[" <<
systemId <<
"]";
129 std::cout <<
" publicId=[" << publicId <<
"]";
130 std::cout << std::endl;
◆ external_entity()
int ExpatCoreParser::external_entity |
( |
XML_Parser |
parser, |
|
|
const XML_Char * |
context, |
|
|
const XML_Char * |
, |
|
|
const XML_Char * |
systemId, |
|
|
const XML_Char * |
|
|
) |
| |
|
staticprivate |
◆ find_external_entity()
const std::string & ExpatCoreParser::find_external_entity |
( |
const std::string & |
name | ) |
|
|
staticprivate |
Definition at line 393 of file ExpatCoreParser.cxx.
395 ExternalEntityMap::const_iterator
it = s_entities.find (
name);
396 if (
it == s_entities.end ()) {
397 static const std::string
empty;
400 return ((*it).second);
◆ find_text_entity()
const std::string & ExpatCoreParser::find_text_entity |
( |
const std::string & |
name | ) |
|
|
staticprivate |
Definition at line 405 of file ExpatCoreParser.cxx.
407 ExternalEntityMap::const_iterator
it = s_text_entities.find (
name);
408 if (
it == s_text_entities.end ()) {
409 static const std::string
empty;
412 return ((*it).second);
◆ generic_parse()
int ExpatCoreParser::generic_parse |
( |
XML_Parser |
p, |
|
|
const std::string & |
file_name |
|
) |
| |
|
private |
Definition at line 217 of file ExpatCoreParser.cxx.
220 std::cout <<
"ExpatCoreParser::generic_parse> file_name=" <<
file_name <<
" prefix=" <<
m_prefix << std::endl;
224 docfd = fopen (temp_name.c_str (),
"r");
227 docfd = fopen (temp_name.c_str (),
"r");
231 const char* xmlpathenv =
::getenv (
"XMLPATH");
232 if (xmlpathenv == 0)
return (0);
233 std::string xmlpath = xmlpathenv;
234 std::string::size_type
pos = 0;
235 while (
pos != std::string::npos){
236 std::string::size_type
sep = xmlpath.find (
":",
pos);
237 if (
sep == std::string::npos){
238 temp_name = xmlpath.substr (
pos);
239 pos = std::string::npos;
241 temp_name = xmlpath.substr (
pos,
sep -
pos);
244 if (temp_name.empty())
continue;
245 std::string last_temp_name = temp_name;
249 std::cout <<
"ExpatCoreParser::generic_parse> file_name=" <<
file_name
250 <<
" xmlpath=" << xmlpath
251 <<
" temp_name=" << temp_name
255 docfd = fopen (temp_name.c_str (),
"r");
256 if (docfd != 0)
break;
259 temp_name = last_temp_name;
265 std::cout <<
"ExpatCoreParser::generic_parse> file_name=" <<
file_name
266 <<
" xmlpath=" << xmlpath
267 <<
" temp_name=" << temp_name
270 docfd = fopen (temp_name.c_str (),
"r");
271 if (docfd != 0)
break;
280 XML_SetParamEntityParsing (
p, XML_PARAM_ENTITY_PARSING_ALWAYS);
285 XML_SetUserData (
p,
this);
287 std::cout <<
"ExpatCoreParser::generic_parse> starting" << std::endl;
294 std::cout <<
"Read error" << std::endl;
298 int done = feof (docfd);
300 if (XML_ParseBuffer (
p,
BUFFSIZE, done) == XML_STATUS_ERROR) {
302 std::cout <<
"ExpatCoreParser::Parse error at line " << XML_GetCurrentLineNumber(
p)
305 << XML_ErrorString (XML_GetErrorCode(
p)) << std::endl;
◆ generic_text_parse()
int ExpatCoreParser::generic_text_parse |
( |
XML_Parser |
p, |
|
|
const std::string & |
text |
|
) |
| |
|
private |
Definition at line 317 of file ExpatCoreParser.cxx.
319 std::cout <<
"ExpatCoreParser::generic_text_parse> " << std::endl;
322 XML_SetParamEntityParsing (
p, XML_PARAM_ENTITY_PARSING_ALWAYS);
327 XML_SetUserData (
p,
this);
329 std::cout <<
"ExpatCoreParser::generic_text_parse> starting" << std::endl;
332 char*
buff = (
char*) XML_GetBuffer (
p,
text.size() + 1);
335 if (XML_ParseBuffer (
p,
text.size(), done) == XML_STATUS_ERROR) {
336 std::cout <<
"ExpatCoreParser::Parse error at line " << XML_GetCurrentLineNumber(
p)
338 << XML_ErrorString (XML_GetErrorCode(
p)) << std::endl;
◆ get_document()
◆ parse()
Definition at line 417 of file ExpatCoreParser.cxx.
421 if (
pos != std::string::npos){
426 XML_Parser
p = XML_ParserCreate (NULL);
428 std::cout <<
"ExpatCoreParser::Couldn't allocate memory for parser" << std::endl;
433 if (
result == 0)
return nullptr;
434 return me.get_document ();
◆ register_external_entity()
void ExpatCoreParser::register_external_entity |
( |
const std::string & |
name, |
|
|
const std::string & |
file_name |
|
) |
| |
|
static |
Definition at line 82 of file ExpatCoreParser.cxx.
84 std::cout <<
"ExpatCoreParser::register_external_entity> name=" <<
name
85 <<
" file_name=" <<
file_name << std::endl;
◆ register_text_entity()
void ExpatCoreParser::register_text_entity |
( |
const std::string & |
name, |
|
|
const std::string & |
text |
|
) |
| |
|
static |
◆ start()
void ExpatCoreParser::start |
( |
void * |
user_data, |
|
|
const char * |
el, |
|
|
const char ** |
attr |
|
) |
| |
|
staticprivate |
◆ ATLAS_THREAD_SAFE [1/2]
◆ ATLAS_THREAD_SAFE [2/2]
◆ m_last
◆ m_prefix
std::string ExpatCoreParser::m_prefix |
|
private |
◆ m_top
◆ s_mutex
std::mutex ExpatCoreParser::s_mutex |
|
staticprivate |
The documentation for this class was generated from the following files: