123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595 |
- #ifndef BOOST_PROPERTY_TREE_RAPIDXML_HPP_INCLUDED
- #define BOOST_PROPERTY_TREE_RAPIDXML_HPP_INCLUDED
- #include <boost/assert.hpp>
- #include <cstddef>
- #include <new>
- #ifdef _MSC_VER
- #pragma warning(push)
- #pragma warning(disable:4127)
- #endif
-
- #include <exception>
- #define BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR(what, where) throw parse_error(what, where)
- namespace boost { namespace property_tree { namespace detail {namespace rapidxml
- {
-
-
-
-
-
-
-
-
-
-
-
- class parse_error: public std::exception
- {
-
- public:
-
-
- parse_error(const char *wa, void *we)
- : m_what(wa)
- , m_where(we)
- {
- }
-
-
- const char *what() const throw() BOOST_OVERRIDE
- {
- return m_what;
- }
-
-
-
- template<class Ch>
- Ch *where() const
- {
- return reinterpret_cast<Ch *>(m_where);
- }
- private:
- const char *m_what;
- void *m_where;
- };
- }}}}
- #ifndef BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE
-
-
-
- #define BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE (64 * 1024)
- #endif
- #ifndef BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE
-
-
-
- #define BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE (64 * 1024)
- #endif
- #ifndef BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT
-
-
-
-
- #define BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT sizeof(void *)
- #endif
- namespace boost { namespace property_tree { namespace detail {namespace rapidxml
- {
-
- template<class Ch> class xml_node;
- template<class Ch> class xml_attribute;
- template<class Ch> class xml_document;
-
-
-
- enum node_type
- {
- node_document,
- node_element,
- node_data,
- node_cdata,
- node_comment,
- node_declaration,
- node_doctype,
- node_pi
- };
-
-
-
-
-
-
-
- const int parse_no_data_nodes = 0x1;
-
-
-
-
-
-
-
- const int parse_no_element_values = 0x2;
-
-
-
-
-
-
- const int parse_no_string_terminators = 0x4;
-
-
-
-
-
-
- const int parse_no_entity_translation = 0x8;
-
-
-
-
-
-
- const int parse_no_utf8 = 0x10;
-
-
-
-
-
-
- const int parse_declaration_node = 0x20;
-
-
-
-
-
-
- const int parse_comment_nodes = 0x40;
-
-
-
-
-
-
-
- const int parse_doctype_node = 0x80;
-
-
-
-
-
-
- const int parse_pi_nodes = 0x100;
-
-
-
-
-
-
-
- const int parse_validate_closing_tags = 0x200;
-
-
-
-
-
-
-
- const int parse_trim_whitespace = 0x400;
-
-
-
-
-
-
-
- const int parse_normalize_whitespace = 0x800;
-
-
-
-
-
-
-
-
-
-
- const int parse_default = 0;
-
-
-
-
-
-
-
-
-
- const int parse_non_destructive = parse_no_string_terminators | parse_no_entity_translation;
-
-
-
-
- const int parse_fastest = parse_non_destructive | parse_no_data_nodes;
-
-
-
-
-
- const int parse_full = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags;
-
-
-
- namespace internal
- {
-
-
- template<int Dummy>
- struct lookup_tables
- {
- static const unsigned char lookup_whitespace[256];
- static const unsigned char lookup_node_name[256];
- static const unsigned char lookup_text[256];
- static const unsigned char lookup_text_pure_no_ws[256];
- static const unsigned char lookup_text_pure_with_ws[256];
- static const unsigned char lookup_attribute_name[256];
- static const unsigned char lookup_attribute_data_1[256];
- static const unsigned char lookup_attribute_data_1_pure[256];
- static const unsigned char lookup_attribute_data_2[256];
- static const unsigned char lookup_attribute_data_2_pure[256];
- static const unsigned char lookup_digits[256];
- static const unsigned char lookup_upcase[256];
- };
-
- template<class Ch>
- inline std::size_t measure(const Ch *p)
- {
- const Ch *tmp = p;
- while (*tmp)
- ++tmp;
- return tmp - p;
- }
-
- template<class Ch>
- inline bool compare(const Ch *p1, std::size_t size1, const Ch *p2, std::size_t size2, bool case_sensitive)
- {
- if (size1 != size2)
- return false;
- if (case_sensitive)
- {
- for (const Ch *end = p1 + size1; p1 < end; ++p1, ++p2)
- if (*p1 != *p2)
- return false;
- }
- else
- {
- for (const Ch *end = p1 + size1; p1 < end; ++p1, ++p2)
- if (lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p1)] != lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p2)])
- return false;
- }
- return true;
- }
- template<class Ch>
- inline size_t get_index(const Ch c)
- {
-
-
- unsigned n = c;
- if (n > 127)
- {
- return 'z';
- }
- return c;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<class Ch = char>
- class memory_pool
- {
-
- public:
-
-
- typedef void *(boost_ptree_raw_alloc_func)(std::size_t);
- typedef void (boost_ptree_raw_free_func)(void *);
-
-
-
- memory_pool()
- : m_alloc_func(0)
- , m_free_func(0)
- {
- init();
- }
-
-
-
- ~memory_pool()
- {
- clear();
- }
-
-
-
-
-
-
-
-
-
-
- xml_node<Ch> *allocate_node(node_type type,
- const Ch *name = 0, const Ch *value = 0,
- std::size_t name_size = 0, std::size_t value_size = 0)
- {
- void *memory = allocate_aligned(sizeof(xml_node<Ch>));
- xml_node<Ch> *node = new(memory) xml_node<Ch>(type);
- if (name)
- {
- if (name_size > 0)
- node->name(name, name_size);
- else
- node->name(name);
- }
- if (value)
- {
- if (value_size > 0)
- node->value(value, value_size);
- else
- node->value(value);
- }
- return node;
- }
-
-
-
-
-
-
-
-
-
- xml_attribute<Ch> *allocate_attribute(const Ch *name = 0, const Ch *value = 0,
- std::size_t name_size = 0, std::size_t value_size = 0)
- {
- void *memory = allocate_aligned(sizeof(xml_attribute<Ch>));
- xml_attribute<Ch> *attribute = new(memory) xml_attribute<Ch>;
- if (name)
- {
- if (name_size > 0)
- attribute->name(name, name_size);
- else
- attribute->name(name);
- }
- if (value)
- {
- if (value_size > 0)
- attribute->value(value, value_size);
- else
- attribute->value(value);
- }
- return attribute;
- }
-
-
-
-
-
-
-
- Ch *allocate_string(const Ch *source = 0, std::size_t size = 0)
- {
- BOOST_ASSERT(source || size);
- if (size == 0)
- size = internal::measure(source) + 1;
- Ch *result = static_cast<Ch *>(allocate_aligned(size * sizeof(Ch)));
- if (source)
- for (std::size_t i = 0; i < size; ++i)
- result[i] = source[i];
- return result;
- }
-
-
-
-
-
-
-
-
-
- xml_node<Ch> *clone_node(const xml_node<Ch> *source, xml_node<Ch> *result = 0)
- {
-
- if (result)
- {
- result->remove_all_attributes();
- result->remove_all_nodes();
- result->type(source->type());
- }
- else
- result = allocate_node(source->type());
-
- result->name(source->name(), source->name_size());
- result->value(source->value(), source->value_size());
-
- for (xml_node<Ch> *child = source->first_node(); child; child = child->next_sibling())
- result->append_node(clone_node(child));
- for (xml_attribute<Ch> *attr = source->first_attribute(); attr; attr = attr->next_attribute())
- result->append_attribute(allocate_attribute(attr->name(), attr->value(), attr->name_size(), attr->value_size()));
- return result;
- }
-
-
-
- void clear()
- {
- while (m_begin != m_static_memory)
- {
- char *previous_begin = reinterpret_cast<header *>(align(m_begin))->previous_begin;
- if (m_free_func)
- m_free_func(m_begin);
- else
- delete[] m_begin;
- m_begin = previous_begin;
- }
- init();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- void set_allocator(boost_ptree_raw_alloc_func *af, boost_ptree_raw_free_func *ff)
- {
- BOOST_ASSERT(m_begin == m_static_memory && m_ptr == align(m_begin));
- m_alloc_func = af;
- m_free_func = ff;
- }
- private:
- struct header
- {
- char *previous_begin;
- };
- void init()
- {
- m_begin = m_static_memory;
- m_ptr = align(m_begin);
- m_end = m_static_memory + sizeof(m_static_memory);
- }
-
- char *align(char *ptr)
- {
- std::size_t alignment = ((BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - (std::size_t(ptr) & (BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - 1))) & (BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - 1));
- return ptr + alignment;
- }
-
- char *allocate_raw(std::size_t size)
- {
-
- void *memory;
- if (m_alloc_func)
- {
- memory = m_alloc_func(size);
- BOOST_ASSERT(memory);
- }
- else
- {
- memory = new char[size];
- }
- return static_cast<char *>(memory);
- }
-
- void *allocate_aligned(std::size_t size)
- {
-
- char *result = align(m_ptr);
-
- if (result + size > m_end)
- {
-
- std::size_t pool_size = BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE;
- if (pool_size < size)
- pool_size = size;
-
-
- std::size_t alloc_size = sizeof(header) + (2 * BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - 2) + pool_size;
- char *raw_memory = allocate_raw(alloc_size);
-
-
- char *pool = align(raw_memory);
- header *new_header = reinterpret_cast<header *>(pool);
- new_header->previous_begin = m_begin;
- m_begin = raw_memory;
- m_ptr = pool + sizeof(header);
- m_end = raw_memory + alloc_size;
-
- result = align(m_ptr);
- }
-
- m_ptr = result + size;
- return result;
- }
- char *m_begin;
- char *m_ptr;
- char *m_end;
- char m_static_memory[BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE];
- boost_ptree_raw_alloc_func *m_alloc_func;
- boost_ptree_raw_free_func *m_free_func;
- };
-
-
-
-
-
- template<class Ch = char>
- class xml_base
- {
- public:
-
-
-
-
-
- xml_base()
- : m_name(0)
- , m_value(0)
- , m_parent(0)
- {
- }
-
-
-
-
-
-
-
-
-
- Ch *name() const
- {
- return m_name ? m_name : nullstr();
- }
-
-
-
- std::size_t name_size() const
- {
- return m_name ? m_name_size : 0;
- }
-
-
-
-
-
-
- Ch *value() const
- {
- return m_value ? m_value : nullstr();
- }
-
-
-
- std::size_t value_size() const
- {
- return m_value ? m_value_size : 0;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- void name(const Ch *n, std::size_t size)
- {
- m_name = const_cast<Ch *>(n);
- m_name_size = size;
- }
-
-
-
- void name(const Ch *n)
- {
- name(n, internal::measure(n));
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- void value(const Ch *val, std::size_t size)
- {
- m_value = const_cast<Ch *>(val);
- m_value_size = size;
- }
-
-
-
- void value(const Ch *val)
- {
- this->value(val, internal::measure(val));
- }
-
-
-
-
-
- xml_node<Ch> *parent() const
- {
- return m_parent;
- }
- protected:
-
- static Ch *nullstr()
- {
- static Ch zero = Ch('\0');
- return &zero;
- }
- Ch *m_name;
- Ch *m_value;
- std::size_t m_name_size;
- std::size_t m_value_size;
- xml_node<Ch> *m_parent;
- };
-
-
-
-
-
- template<class Ch = char>
- class xml_attribute: public xml_base<Ch>
- {
- friend class xml_node<Ch>;
-
- public:
-
-
-
-
-
- xml_attribute()
- {
- }
-
-
-
-
-
- xml_document<Ch> *document() const
- {
- if (xml_node<Ch> *node = this->parent())
- {
- while (node->parent())
- node = node->parent();
- return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0;
- }
- else
- return 0;
- }
-
-
-
-
-
- xml_attribute<Ch> *previous_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_attribute<Ch> *attribute = m_prev_attribute; attribute; attribute = attribute->m_prev_attribute)
- if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive))
- return attribute;
- return 0;
- }
- else
- return this->m_parent ? m_prev_attribute : 0;
- }
-
-
-
-
-
- xml_attribute<Ch> *next_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_attribute<Ch> *attribute = m_next_attribute; attribute; attribute = attribute->m_next_attribute)
- if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive))
- return attribute;
- return 0;
- }
- else
- return this->m_parent ? m_next_attribute : 0;
- }
- private:
- xml_attribute<Ch> *m_prev_attribute;
- xml_attribute<Ch> *m_next_attribute;
-
- };
-
-
-
-
-
-
-
-
-
-
- template<class Ch = char>
- class xml_node: public xml_base<Ch>
- {
- public:
-
-
-
-
-
-
- xml_node(node_type t)
- : m_type(t)
- , m_first_node(0)
- , m_first_attribute(0)
- {
- }
-
-
-
-
-
- node_type type() const
- {
- return m_type;
- }
-
-
-
-
-
- xml_document<Ch> *document() const
- {
- xml_node<Ch> *node = const_cast<xml_node<Ch> *>(this);
- while (node->parent())
- node = node->parent();
- return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0;
- }
-
-
-
-
-
- xml_node<Ch> *first_node(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_node<Ch> *child = m_first_node; child; child = child->next_sibling())
- if (internal::compare(child->name(), child->name_size(), n, nsize, case_sensitive))
- return child;
- return 0;
- }
- else
- return m_first_node;
- }
-
-
-
-
-
-
-
- xml_node<Ch> *last_node(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- BOOST_ASSERT(m_first_node);
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_node<Ch> *child = m_last_node; child; child = child->previous_sibling())
- if (internal::compare(child->name(), child->name_size(), n, nsize, case_sensitive))
- return child;
- return 0;
- }
- else
- return m_last_node;
- }
-
-
-
-
-
-
-
- xml_node<Ch> *previous_sibling(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- BOOST_ASSERT(this->m_parent);
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_node<Ch> *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling)
- if (internal::compare(sibling->name(), sibling->name_size(), n, nsize, case_sensitive))
- return sibling;
- return 0;
- }
- else
- return m_prev_sibling;
- }
-
-
-
-
-
-
-
- xml_node<Ch> *next_sibling(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- BOOST_ASSERT(this->m_parent);
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_node<Ch> *sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling)
- if (internal::compare(sibling->name(), sibling->name_size(), n, nsize, case_sensitive))
- return sibling;
- return 0;
- }
- else
- return m_next_sibling;
- }
-
-
-
-
-
- xml_attribute<Ch> *first_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_attribute<Ch> *attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute)
- if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive))
- return attribute;
- return 0;
- }
- else
- return m_first_attribute;
- }
-
-
-
-
-
- xml_attribute<Ch> *last_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const
- {
- if (n)
- {
- if (nsize == 0)
- nsize = internal::measure(n);
- for (xml_attribute<Ch> *attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute)
- if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive))
- return attribute;
- return 0;
- }
- else
- return m_first_attribute ? m_last_attribute : 0;
- }
-
-
-
-
-
- void type(node_type t)
- {
- m_type = t;
- }
-
-
-
-
-
- void prepend_node(xml_node<Ch> *child)
- {
- BOOST_ASSERT(child && !child->parent() && child->type() != node_document);
- if (first_node())
- {
- child->m_next_sibling = m_first_node;
- m_first_node->m_prev_sibling = child;
- }
- else
- {
- child->m_next_sibling = 0;
- m_last_node = child;
- }
- m_first_node = child;
- child->m_parent = this;
- child->m_prev_sibling = 0;
- }
-
-
-
- void append_node(xml_node<Ch> *child)
- {
- BOOST_ASSERT(child && !child->parent() && child->type() != node_document);
- if (first_node())
- {
- child->m_prev_sibling = m_last_node;
- m_last_node->m_next_sibling = child;
- }
- else
- {
- child->m_prev_sibling = 0;
- m_first_node = child;
- }
- m_last_node = child;
- child->m_parent = this;
- child->m_next_sibling = 0;
- }
-
-
-
-
- void insert_node(xml_node<Ch> *where, xml_node<Ch> *child)
- {
- BOOST_ASSERT(!where || where->parent() == this);
- BOOST_ASSERT(child && !child->parent() && child->type() != node_document);
- if (where == m_first_node)
- prepend_node(child);
- else if (where == 0)
- append_node(child);
- else
- {
- child->m_prev_sibling = where->m_prev_sibling;
- child->m_next_sibling = where;
- where->m_prev_sibling->m_next_sibling = child;
- where->m_prev_sibling = child;
- child->m_parent = this;
- }
- }
-
-
-
- void remove_first_node()
- {
- BOOST_ASSERT(first_node());
- xml_node<Ch> *child = m_first_node;
- m_first_node = child->m_next_sibling;
- if (child->m_next_sibling)
- child->m_next_sibling->m_prev_sibling = 0;
- else
- m_last_node = 0;
- child->m_parent = 0;
- }
-
-
-
- void remove_last_node()
- {
- BOOST_ASSERT(first_node());
- xml_node<Ch> *child = m_last_node;
- if (child->m_prev_sibling)
- {
- m_last_node = child->m_prev_sibling;
- child->m_prev_sibling->m_next_sibling = 0;
- }
- else
- m_first_node = 0;
- child->m_parent = 0;
- }
-
-
- void remove_node(xml_node<Ch> *where)
- {
- BOOST_ASSERT(where && where->parent() == this);
- BOOST_ASSERT(first_node());
- if (where == m_first_node)
- remove_first_node();
- else if (where == m_last_node)
- remove_last_node();
- else
- {
- where->m_prev_sibling->m_next_sibling = where->m_next_sibling;
- where->m_next_sibling->m_prev_sibling = where->m_prev_sibling;
- where->m_parent = 0;
- }
- }
-
- void remove_all_nodes()
- {
- for (xml_node<Ch> *node = first_node(); node; node = node->m_next_sibling)
- node->m_parent = 0;
- m_first_node = 0;
- }
-
-
- void prepend_attribute(xml_attribute<Ch> *attribute)
- {
- BOOST_ASSERT(attribute && !attribute->parent());
- if (first_attribute())
- {
- attribute->m_next_attribute = m_first_attribute;
- m_first_attribute->m_prev_attribute = attribute;
- }
- else
- {
- attribute->m_next_attribute = 0;
- m_last_attribute = attribute;
- }
- m_first_attribute = attribute;
- attribute->m_parent = this;
- attribute->m_prev_attribute = 0;
- }
-
-
- void append_attribute(xml_attribute<Ch> *attribute)
- {
- BOOST_ASSERT(attribute && !attribute->parent());
- if (first_attribute())
- {
- attribute->m_prev_attribute = m_last_attribute;
- m_last_attribute->m_next_attribute = attribute;
- }
- else
- {
- attribute->m_prev_attribute = 0;
- m_first_attribute = attribute;
- }
- m_last_attribute = attribute;
- attribute->m_parent = this;
- attribute->m_next_attribute = 0;
- }
-
-
-
-
- void insert_attribute(xml_attribute<Ch> *where, xml_attribute<Ch> *attribute)
- {
- BOOST_ASSERT(!where || where->parent() == this);
- BOOST_ASSERT(attribute && !attribute->parent());
- if (where == m_first_attribute)
- prepend_attribute(attribute);
- else if (where == 0)
- append_attribute(attribute);
- else
- {
- attribute->m_prev_attribute = where->m_prev_attribute;
- attribute->m_next_attribute = where;
- where->m_prev_attribute->m_next_attribute = attribute;
- where->m_prev_attribute = attribute;
- attribute->m_parent = this;
- }
- }
-
-
-
- void remove_first_attribute()
- {
- BOOST_ASSERT(first_attribute());
- xml_attribute<Ch> *attribute = m_first_attribute;
- if (attribute->m_next_attribute)
- {
- attribute->m_next_attribute->m_prev_attribute = 0;
- }
- else
- m_last_attribute = 0;
- attribute->m_parent = 0;
- m_first_attribute = attribute->m_next_attribute;
- }
-
-
-
- void remove_last_attribute()
- {
- BOOST_ASSERT(first_attribute());
- xml_attribute<Ch> *attribute = m_last_attribute;
- if (attribute->m_prev_attribute)
- {
- attribute->m_prev_attribute->m_next_attribute = 0;
- m_last_attribute = attribute->m_prev_attribute;
- }
- else
- m_first_attribute = 0;
- attribute->m_parent = 0;
- }
-
-
- void remove_attribute(xml_attribute<Ch> *where)
- {
- BOOST_ASSERT(first_attribute() && where->parent() == this);
- if (where == m_first_attribute)
- remove_first_attribute();
- else if (where == m_last_attribute)
- remove_last_attribute();
- else
- {
- where->m_prev_attribute->m_next_attribute = where->m_next_attribute;
- where->m_next_attribute->m_prev_attribute = where->m_prev_attribute;
- where->m_parent = 0;
- }
- }
-
- void remove_all_attributes()
- {
- for (xml_attribute<Ch> *attribute = first_attribute(); attribute; attribute = attribute->m_next_attribute)
- attribute->m_parent = 0;
- m_first_attribute = 0;
- }
-
- private:
-
-
-
- xml_node(const xml_node &);
- void operator =(const xml_node &);
-
-
-
-
-
-
-
-
-
-
-
-
- node_type m_type;
- xml_node<Ch> *m_first_node;
- xml_node<Ch> *m_last_node;
- xml_attribute<Ch> *m_first_attribute;
- xml_attribute<Ch> *m_last_attribute;
- xml_node<Ch> *m_prev_sibling;
- xml_node<Ch> *m_next_sibling;
- };
-
-
-
-
-
-
-
-
-
-
- template<class Ch = char>
- class xml_document: public xml_node<Ch>, public memory_pool<Ch>
- {
-
- public:
-
- xml_document()
- : xml_node<Ch>(node_document)
- {
- }
-
-
-
-
-
-
-
-
-
-
-
- template<int Flags>
- void parse(Ch *text)
- {
- BOOST_ASSERT(text);
-
-
- this->remove_all_nodes();
- this->remove_all_attributes();
-
-
- parse_bom<Flags>(text);
-
-
- while (true)
- {
-
- skip<whitespace_pred, Flags>(text);
- if (*text == 0)
- break;
-
- if (*text == Ch('<'))
- {
- ++text;
- if (xml_node<Ch> *node = parse_node<Flags>(text))
- this->append_node(node);
- }
- else
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected <", text);
- }
- }
-
-
- void clear()
- {
- this->remove_all_nodes();
- this->remove_all_attributes();
- memory_pool<Ch>::clear();
- }
-
- private:
-
-
-
-
- struct whitespace_pred
- {
- static unsigned char test(Ch ch)
- {
- return internal::lookup_tables<0>::lookup_whitespace[internal::get_index(ch)];
- }
- };
-
- struct node_name_pred
- {
- static unsigned char test(Ch ch)
- {
- return internal::lookup_tables<0>::lookup_node_name[internal::get_index(ch)];
- }
- };
-
- struct attribute_name_pred
- {
- static unsigned char test(Ch ch)
- {
- return internal::lookup_tables<0>::lookup_attribute_name[internal::get_index(ch)];
- }
- };
-
- struct text_pred
- {
- static unsigned char test(Ch ch)
- {
- return internal::lookup_tables<0>::lookup_text[internal::get_index(ch)];
- }
- };
-
- struct text_pure_no_ws_pred
- {
- static unsigned char test(Ch ch)
- {
- return internal::lookup_tables<0>::lookup_text_pure_no_ws[internal::get_index(ch)];
- }
- };
-
- struct text_pure_with_ws_pred
- {
- static unsigned char test(Ch ch)
- {
- return internal::lookup_tables<0>::lookup_text_pure_with_ws[internal::get_index(ch)];
- }
- };
-
- template<Ch Quote>
- struct attribute_value_pred
- {
- static unsigned char test(Ch ch)
- {
- if (Quote == Ch('\''))
- return internal::lookup_tables<0>::lookup_attribute_data_1[internal::get_index(ch)];
- if (Quote == Ch('\"'))
- return internal::lookup_tables<0>::lookup_attribute_data_2[internal::get_index(ch)];
- return 0;
- }
- };
-
- template<Ch Quote>
- struct attribute_value_pure_pred
- {
- static unsigned char test(Ch ch)
- {
- if (Quote == Ch('\''))
- return internal::lookup_tables<0>::lookup_attribute_data_1_pure[internal::get_index(ch)];
- if (Quote == Ch('\"'))
- return internal::lookup_tables<0>::lookup_attribute_data_2_pure[internal::get_index(ch)];
- return 0;
- }
- };
-
- template<int Flags>
- static void insert_coded_character(Ch *&text, unsigned long code)
- {
- if (Flags & parse_no_utf8)
- {
-
-
- text[0] = static_cast<unsigned char>(code);
- text += 1;
- }
- else
- {
-
- if (code < 0x80)
- {
- text[0] = static_cast<unsigned char>(code);
- text += 1;
- }
- else if (code < 0x800)
- {
- text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
- text[0] = static_cast<unsigned char>(code | 0xC0);
- text += 2;
- }
- else if (code < 0x10000)
- {
- text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
- text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
- text[0] = static_cast<unsigned char>(code | 0xE0);
- text += 3;
- }
- else if (code < 0x110000)
- {
- text[3] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
- text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
- text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
- text[0] = static_cast<unsigned char>(code | 0xF0);
- text += 4;
- }
- else
- {
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("invalid numeric character entity", text);
- }
- }
- }
-
- template<class StopPred, int Flags>
- static void skip(Ch *&text)
- {
- Ch *tmp = text;
- while (StopPred::test(*tmp))
- ++tmp;
- text = tmp;
- }
-
-
-
- template<class StopPred, class StopPredPure, int Flags>
- static Ch *skip_and_expand_character_refs(Ch *&text)
- {
-
- if (Flags & parse_no_entity_translation &&
- !(Flags & parse_normalize_whitespace) &&
- !(Flags & parse_trim_whitespace))
- {
- skip<StopPred, Flags>(text);
- return text;
- }
-
-
- skip<StopPredPure, Flags>(text);
-
- Ch *src = text;
- Ch *dest = src;
- while (StopPred::test(*src))
- {
-
- if (!(Flags & parse_no_entity_translation))
- {
-
- if (src[0] == Ch('&'))
- {
- switch (src[1])
- {
-
- case Ch('a'):
- if (src[2] == Ch('m') && src[3] == Ch('p') && src[4] == Ch(';'))
- {
- *dest = Ch('&');
- ++dest;
- src += 5;
- continue;
- }
- if (src[2] == Ch('p') && src[3] == Ch('o') && src[4] == Ch('s') && src[5] == Ch(';'))
- {
- *dest = Ch('\'');
- ++dest;
- src += 6;
- continue;
- }
- break;
-
- case Ch('q'):
- if (src[2] == Ch('u') && src[3] == Ch('o') && src[4] == Ch('t') && src[5] == Ch(';'))
- {
- *dest = Ch('"');
- ++dest;
- src += 6;
- continue;
- }
- break;
-
- case Ch('g'):
- if (src[2] == Ch('t') && src[3] == Ch(';'))
- {
- *dest = Ch('>');
- ++dest;
- src += 4;
- continue;
- }
- break;
-
- case Ch('l'):
- if (src[2] == Ch('t') && src[3] == Ch(';'))
- {
- *dest = Ch('<');
- ++dest;
- src += 4;
- continue;
- }
- break;
-
- case Ch('#'):
- if (src[2] == Ch('x'))
- {
- unsigned long code = 0;
- src += 3;
- while (true)
- {
- unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast<unsigned char>(*src)];
- if (digit == 0xFF)
- break;
- code = code * 16 + digit;
- ++src;
- }
- insert_coded_character<Flags>(dest, code);
- }
- else
- {
- unsigned long code = 0;
- src += 2;
- while (true)
- {
- unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast<unsigned char>(*src)];
- if (digit == 0xFF)
- break;
- code = code * 10 + digit;
- ++src;
- }
- insert_coded_character<Flags>(dest, code);
- }
- if (*src == Ch(';'))
- ++src;
- else
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ;", src);
- continue;
-
- default:
-
- break;
- }
- }
- }
-
-
- if (Flags & parse_normalize_whitespace)
- {
-
- if (whitespace_pred::test(*src))
- {
- *dest = Ch(' '); ++dest;
- ++src;
-
- while (whitespace_pred::test(*src))
- ++src;
- continue;
- }
- }
-
- *dest++ = *src++;
- }
-
- text = src;
- return dest;
- }
-
-
-
-
- template<int Flags>
- void parse_bom(char *&text)
- {
- if (static_cast<unsigned char>(text[0]) == 0xEF &&
- static_cast<unsigned char>(text[1]) == 0xBB &&
- static_cast<unsigned char>(text[2]) == 0xBF)
- {
- text += 3;
- }
- }
-
-
- template<int Flags>
- void parse_bom(wchar_t *&text)
- {
- const wchar_t bom = 0xFEFF;
- if (text[0] == bom)
- {
- ++text;
- }
- }
-
- template<int Flags>
- xml_node<Ch> *parse_xml_declaration(Ch *&text)
- {
-
- if (!(Flags & parse_declaration_node))
- {
-
- while (text[0] != Ch('?') || text[1] != Ch('>'))
- {
- if (!text[0])
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
- text += 2;
- return 0;
- }
-
- xml_node<Ch> *declaration = this->allocate_node(node_declaration);
-
- skip<whitespace_pred, Flags>(text);
-
- parse_node_attributes<Flags>(text, declaration);
-
-
- if (text[0] != Ch('?') || text[1] != Ch('>'))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ?>", text);
- text += 2;
-
- return declaration;
- }
-
- template<int Flags>
- xml_node<Ch> *parse_comment(Ch *&text)
- {
-
- if (!(Flags & parse_comment_nodes))
- {
-
- while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))
- {
- if (!text[0])
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
- text += 3;
- return 0;
- }
-
- Ch *val = text;
-
- while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))
- {
- if (!text[0])
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
-
- xml_node<Ch> *comment = this->allocate_node(node_comment);
- comment->value(val, text - val);
-
-
- if (!(Flags & parse_no_string_terminators))
- *text = Ch('\0');
-
- text += 3;
- return comment;
- }
-
- template<int Flags>
- xml_node<Ch> *parse_doctype(Ch *&text)
- {
-
- Ch *val = text;
-
- while (*text != Ch('>'))
- {
-
- switch (*text)
- {
-
-
-
- case Ch('['):
- {
- ++text;
- int depth = 1;
- while (depth > 0)
- {
- switch (*text)
- {
- case Ch('['): ++depth; break;
- case Ch(']'): --depth; break;
- case 0: BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- default: break;
- }
- ++text;
- }
- break;
- }
-
-
- case Ch('\0'):
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
-
-
- default:
- ++text;
- }
- }
-
-
- if (Flags & parse_doctype_node)
- {
-
- xml_node<Ch> *doctype = this->allocate_node(node_doctype);
- doctype->value(val, text - val);
-
-
- if (!(Flags & parse_no_string_terminators))
- *text = Ch('\0');
- text += 1;
- return doctype;
- }
- else
- {
- text += 1;
- return 0;
- }
- }
-
- template<int Flags>
- xml_node<Ch> *parse_pi(Ch *&text)
- {
-
- if (Flags & parse_pi_nodes)
- {
-
- xml_node<Ch> *pi = this->allocate_node(node_pi);
-
- Ch *n = text;
- skip<node_name_pred, Flags>(text);
- if (text == n)
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected PI target", text);
- pi->name(n, text - n);
-
-
- skip<whitespace_pred, Flags>(text);
-
- Ch *val = text;
-
-
- while (text[0] != Ch('?') || text[1] != Ch('>'))
- {
- if (*text == Ch('\0'))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
-
- pi->value(val, text - val);
-
- if (!(Flags & parse_no_string_terminators))
- {
- pi->name()[pi->name_size()] = Ch('\0');
- pi->value()[pi->value_size()] = Ch('\0');
- }
-
- text += 2;
- return pi;
- }
- else
- {
-
- while (text[0] != Ch('?') || text[1] != Ch('>'))
- {
- if (*text == Ch('\0'))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
- text += 2;
- return 0;
- }
- }
-
-
-
- template<int Flags>
- Ch parse_and_append_data(xml_node<Ch> *node, Ch *&text, Ch *contents_start)
- {
-
- if (!(Flags & parse_trim_whitespace))
- text = contents_start;
-
-
- Ch *val = text, *end;
- if (Flags & parse_normalize_whitespace)
- end = skip_and_expand_character_refs<text_pred, text_pure_with_ws_pred, Flags>(text);
- else
- end = skip_and_expand_character_refs<text_pred, text_pure_no_ws_pred, Flags>(text);
-
- if (Flags & parse_trim_whitespace)
- {
- if (Flags & parse_normalize_whitespace)
- {
-
- if (*(end - 1) == Ch(' '))
- --end;
- }
- else
- {
-
- while (whitespace_pred::test(*(end - 1)))
- --end;
- }
- }
-
-
-
- if (!(Flags & parse_no_data_nodes))
- {
- xml_node<Ch> *data = this->allocate_node(node_data);
- data->value(val, end - val);
- node->append_node(data);
- }
-
- if (!(Flags & parse_no_element_values))
- if (*node->value() == Ch('\0'))
- node->value(val, end - val);
-
- if (!(Flags & parse_no_string_terminators))
- {
- Ch ch = *text;
- *end = Ch('\0');
- return ch;
- }
-
- return *text;
- }
-
- template<int Flags>
- xml_node<Ch> *parse_cdata(Ch *&text)
- {
-
- if (Flags & parse_no_data_nodes)
- {
-
- while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))
- {
- if (!text[0])
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
- text += 3;
- return 0;
- }
-
- Ch *val = text;
- while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))
- {
- if (!text[0])
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
-
- xml_node<Ch> *cdata = this->allocate_node(node_cdata);
- cdata->value(val, text - val);
-
- if (!(Flags & parse_no_string_terminators))
- *text = Ch('\0');
- text += 3;
- return cdata;
- }
-
-
- template<int Flags>
- xml_node<Ch> *parse_element(Ch *&text)
- {
-
- xml_node<Ch> *element = this->allocate_node(node_element);
-
- Ch *n = text;
- skip<node_name_pred, Flags>(text);
- if (text == n)
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected element name", text);
- element->name(n, text - n);
-
-
- skip<whitespace_pred, Flags>(text);
-
- parse_node_attributes<Flags>(text, element);
-
- if (*text == Ch('>'))
- {
- ++text;
- parse_node_contents<Flags>(text, element);
- }
- else if (*text == Ch('/'))
- {
- ++text;
- if (*text != Ch('>'))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected >", text);
- ++text;
- }
- else
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected >", text);
-
- if (!(Flags & parse_no_string_terminators))
- element->name()[element->name_size()] = Ch('\0');
-
- return element;
- }
-
- template<int Flags>
- xml_node<Ch> *parse_node(Ch *&text)
- {
-
- switch (text[0])
- {
-
- default:
-
- return parse_element<Flags>(text);
-
- case Ch('?'):
- ++text;
- if ((text[0] == Ch('x') || text[0] == Ch('X')) &&
- (text[1] == Ch('m') || text[1] == Ch('M')) &&
- (text[2] == Ch('l') || text[2] == Ch('L')) &&
- whitespace_pred::test(text[3]))
- {
-
- text += 4;
- return parse_xml_declaration<Flags>(text);
- }
- else
- {
-
- return parse_pi<Flags>(text);
- }
-
-
- case Ch('!'):
-
- switch (text[1])
- {
-
-
- case Ch('-'):
- if (text[2] == Ch('-'))
- {
-
- text += 3;
- return parse_comment<Flags>(text);
- }
- break;
-
- case Ch('['):
- if (text[2] == Ch('C') && text[3] == Ch('D') && text[4] == Ch('A') &&
- text[5] == Ch('T') && text[6] == Ch('A') && text[7] == Ch('['))
- {
-
- text += 8;
- return parse_cdata<Flags>(text);
- }
- break;
-
- case Ch('D'):
- if (text[2] == Ch('O') && text[3] == Ch('C') && text[4] == Ch('T') &&
- text[5] == Ch('Y') && text[6] == Ch('P') && text[7] == Ch('E') &&
- whitespace_pred::test(text[8]))
- {
-
- text += 9;
- return parse_doctype<Flags>(text);
- }
- break;
- default: break;
- }
-
- ++text;
- while (*text != Ch('>'))
- {
- if (*text == 0)
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
- ++text;
- }
- ++text;
- return 0;
- }
- }
-
- template<int Flags>
- void parse_node_contents(Ch *&text, xml_node<Ch> *node)
- {
-
- while (true)
- {
-
- Ch *contents_start = text;
- if (Flags & parse_trim_whitespace)
- skip<whitespace_pred, Flags>(text);
- Ch next_char = *text;
-
-
-
-
- after_data_node:
-
-
- switch (next_char)
- {
-
-
- case Ch('<'):
- if (text[1] == Ch('/'))
- {
-
- text += 2;
- if (Flags & parse_validate_closing_tags)
- {
-
- Ch *closing_name = text;
- skip<node_name_pred, Flags>(text);
- if (!internal::compare(node->name(), node->name_size(), closing_name, text - closing_name, true))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("invalid closing tag name", text);
- }
- else
- {
-
- skip<node_name_pred, Flags>(text);
- }
-
- skip<whitespace_pred, Flags>(text);
- if (*text != Ch('>'))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected >", text);
- ++text;
- return;
- }
- else
- {
-
- ++text;
- if (xml_node<Ch> *child = parse_node<Flags>(text))
- node->append_node(child);
- }
- break;
-
- case Ch('\0'):
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text);
-
- default:
- next_char = parse_and_append_data<Flags>(node, text, contents_start);
- goto after_data_node;
- }
- }
- }
-
-
- template<int Flags>
- void parse_node_attributes(Ch *&text, xml_node<Ch> *node)
- {
-
- while (attribute_name_pred::test(*text))
- {
-
- Ch *n = text;
- ++text;
- skip<attribute_name_pred, Flags>(text);
- if (text == n)
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected attribute name", n);
-
- xml_attribute<Ch> *attribute = this->allocate_attribute();
- attribute->name(n, text - n);
- node->append_attribute(attribute);
-
- skip<whitespace_pred, Flags>(text);
-
- if (*text != Ch('='))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected =", text);
- ++text;
-
- if (!(Flags & parse_no_string_terminators))
- attribute->name()[attribute->name_size()] = 0;
-
- skip<whitespace_pred, Flags>(text);
-
- Ch quote = *text;
- if (quote != Ch('\'') && quote != Ch('"'))
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ' or \"", text);
- ++text;
-
- Ch *val = text, *end;
- const int AttFlags = Flags & ~parse_normalize_whitespace;
- if (quote == Ch('\''))
- end = skip_and_expand_character_refs<attribute_value_pred<Ch('\'')>, attribute_value_pure_pred<Ch('\'')>, AttFlags>(text);
- else
- end = skip_and_expand_character_refs<attribute_value_pred<Ch('"')>, attribute_value_pure_pred<Ch('"')>, AttFlags>(text);
-
-
- attribute->value(val, end - val);
-
-
- if (*text != quote)
- BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ' or \"", text);
- ++text;
-
- if (!(Flags & parse_no_string_terminators))
- attribute->value()[attribute->value_size()] = 0;
-
- skip<whitespace_pred, Flags>(text);
- }
- }
- };
-
- namespace internal
- {
-
- template<int Dummy>
- const unsigned char lookup_tables<Dummy>::lookup_whitespace[256] =
- {
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- };
-
-
- template<int Dummy>
- const unsigned char lookup_tables<Dummy>::lookup_text_pure_with_ws[256] =
- {
-
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- };
-
- template<int Dummy>
- const unsigned char lookup_tables<Dummy>::lookup_attribute_name[256] =
- {
-
- 0, 1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1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- };
-
- template<int Dummy>
- const unsigned char lookup_tables<Dummy>::lookup_digits[256] =
- {
-
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,255,255,255,255,255,255,
- 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
- };
-
-
- template<int Dummy>
- const unsigned char lookup_tables<Dummy>::lookup_upcase[256] =
- {
-
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
- };
- }
-
- }}}}
- #undef BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR
- #ifdef _MSC_VER
- #pragma warning(pop)
- #endif
- #endif
|