Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xml_parser Struct Reference

Public Member Functions

 xml_parser (xml_allocator *alloc_)
char_t * parse_doctype_primitive (char_t *s)
char_t * parse_doctype_ignore (char_t *s)
char_t * parse_doctype_group (char_t *s, char_t endch)
char_t * parse_exclamation (char_t *s, xml_node_struct *cursor, unsigned int optmsk, char_t endch)
char_t * parse_question (char_t *s, xml_node_struct *&ref_cursor, unsigned int optmsk, char_t endch)
char_t * parse_tree (char_t *s, xml_node_struct *root, unsigned int optmsk, char_t endch)

Static Public Member Functions

static char_t * parse_skip_bom (char_t *s)
static bool has_element_node_siblings (xml_node_struct *node)
static xml_parse_result parse (char_t *buffer, size_t length, xml_document_struct *xmldoc, xml_node_struct *root, unsigned int optmsk)

Public Attributes

xml_allocatoralloc
char_t * error_offset
xml_parse_status error_status

Detailed Description

Definition at line 2929 of file pugixml.cc.

Constructor & Destructor Documentation

◆ xml_parser()

xml_parser::xml_parser ( xml_allocator * alloc_)
inline

Definition at line 2935 of file pugixml.cc.

2935 : alloc(alloc_), error_offset(0), error_status(status_ok)
2936 {
2937 }
xml_parse_status error_status
Definition pugixml.cc:2933
char_t * error_offset
Definition pugixml.cc:2932
xml_allocator * alloc
Definition pugixml.cc:2931

Referenced by parse().

Member Function Documentation

◆ has_element_node_siblings()

bool xml_parser::has_element_node_siblings ( xml_node_struct * node)
inlinestatic

Definition at line 3510 of file pugixml.cc.

3511 {
3512 while (node)
3513 {
3514 if (PUGI__NODETYPE(node) == node_element) return true;
3515
3516 node = node->next_sibling;
3517 }
3518
3519 return false;
3520 }
#define PUGI__NODETYPE(n)
Definition pugixml.cc:456

Referenced by parse().

◆ parse()

xml_parse_result xml_parser::parse ( char_t * buffer,
size_t length,
xml_document_struct * xmldoc,
xml_node_struct * root,
unsigned int optmsk )
inlinestatic

Definition at line 3522 of file pugixml.cc.

3523 {
3524 // early-out for empty documents
3525 if (length == 0)
3526 return make_parse_result(PUGI__OPTSET(parse_fragment) ? status_ok : status_no_document_element);
3527
3528 // get last child of the root before parsing
3529 xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : 0;
3530
3531 // create parser on stack
3532 xml_parser parser(static_cast<xml_allocator*>(xmldoc));
3533
3534 // save last character and make buffer zero-terminated (speeds up parsing)
3535 char_t endch = buffer[length - 1];
3536 buffer[length - 1] = 0;
3537
3538 // skip BOM to make sure it does not end up as part of parse output
3539 char_t* buffer_data = parse_skip_bom(buffer);
3540
3541 // perform actual parsing
3542 parser.parse_tree(buffer_data, root, optmsk, endch);
3543
3544 xml_parse_result result = make_parse_result(parser.error_status, parser.error_offset ? parser.error_offset - buffer : 0);
3545 assert(result.offset >= 0 && static_cast<size_t>(result.offset) <= length);
3546
3547 if (result)
3548 {
3549 // since we removed last character, we have to handle the only possible false positive (stray <)
3550 if (endch == '<')
3551 return make_parse_result(status_unrecognized_tag, length - 1);
3552
3553 // check if there are any element nodes parsed
3554 xml_node_struct* first_root_child_parsed = last_root_child ? last_root_child->next_sibling + 0 : root->first_child+ 0;
3555
3556 if (!PUGI__OPTSET(parse_fragment) && !has_element_node_siblings(first_root_child_parsed))
3557 return make_parse_result(status_no_document_element, length - 1);
3558 }
3559 else
3560 {
3561 // roll back offset if it occurs on a null terminator in the source buffer
3562 if (result.offset > 0 && static_cast<size_t>(result.offset) == length - 1 && endch == 0)
3563 result.offset--;
3564 }
3565
3566 return result;
3567 }
PUGIXML_CHAR char_t
Definition pugixml.hpp:137
#define PUGI__OPTSET(OPT)
Definition pugixml.cc:2606
xml_parse_result make_parse_result(xml_parse_status status, ptrdiff_t offset=0)
Definition pugixml.cc:2920
static char_t * parse_skip_bom(char_t *s)
Definition pugixml.cc:3504
xml_parser(xml_allocator *alloc_)
Definition pugixml.cc:2935
static bool has_element_node_siblings(xml_node_struct *node)
Definition pugixml.cc:3510

◆ parse_doctype_group()

char_t * xml_parser::parse_doctype_group ( char_t * s,
char_t endch )
inline

Definition at line 3010 of file pugixml.cc.

3011 {
3012 size_t depth = 0;
3013
3014 assert((s[0] == '<' || s[0] == 0) && s[1] == '!');
3015 s += 2;
3016
3017 while (*s)
3018 {
3019 if (s[0] == '<' && s[1] == '!' && s[2] != '-')
3020 {
3021 if (s[2] == '[')
3022 {
3023 // ignore
3024 s = parse_doctype_ignore(s);
3025 if (!s) return s;
3026 }
3027 else
3028 {
3029 // some control group
3030 s += 2;
3031 depth++;
3032 }
3033 }
3034 else if (s[0] == '<' || s[0] == '"' || s[0] == '\'')
3035 {
3036 // unknown tag (forbidden), or some primitive group
3038 if (!s) return s;
3039 }
3040 else if (*s == '>')
3041 {
3042 if (depth == 0)
3043 return s;
3044
3045 depth--;
3046 s++;
3047 }
3048 else s++;
3049 }
3050
3051 if (depth != 0 || endch != '>') PUGI__THROW_ERROR(status_bad_doctype, s);
3052
3053 return s;
3054 }
#define PUGI__THROW_ERROR(err, m)
Definition pugixml.cc:2613
char_t * parse_doctype_primitive(char_t *s)
Definition pugixml.cc:2946
char_t * parse_doctype_ignore(char_t *s)
Definition pugixml.cc:2979

Referenced by parse_exclamation().

◆ parse_doctype_ignore()

char_t * xml_parser::parse_doctype_ignore ( char_t * s)
inline

Definition at line 2979 of file pugixml.cc.

2980 {
2981 size_t depth = 0;
2982
2983 assert(s[0] == '<' && s[1] == '!' && s[2] == '[');
2984 s += 3;
2985
2986 while (*s)
2987 {
2988 if (s[0] == '<' && s[1] == '!' && s[2] == '[')
2989 {
2990 // nested ignore section
2991 s += 3;
2992 depth++;
2993 }
2994 else if (s[0] == ']' && s[1] == ']' && s[2] == '>')
2995 {
2996 // ignore section end
2997 s += 3;
2998
2999 if (depth == 0)
3000 return s;
3001
3002 depth--;
3003 }
3004 else s++;
3005 }
3006
3007 PUGI__THROW_ERROR(status_bad_doctype, s);
3008 }

Referenced by parse_doctype_group().

◆ parse_doctype_primitive()

char_t * xml_parser::parse_doctype_primitive ( char_t * s)
inline

Definition at line 2946 of file pugixml.cc.

2947 {
2948 if (*s == '"' || *s == '\'')
2949 {
2950 // quoted string
2951 char_t ch = *s++;
2952 PUGI__SCANFOR(*s == ch);
2953 if (!*s) PUGI__THROW_ERROR(status_bad_doctype, s);
2954
2955 s++;
2956 }
2957 else if (s[0] == '<' && s[1] == '?')
2958 {
2959 // <? ... ?>
2960 s += 2;
2961 PUGI__SCANFOR(s[0] == '?' && s[1] == '>'); // no need for ENDSWITH because ?> can't terminate proper doctype
2962 if (!*s) PUGI__THROW_ERROR(status_bad_doctype, s);
2963
2964 s += 2;
2965 }
2966 else if (s[0] == '<' && s[1] == '!' && s[2] == '-' && s[3] == '-')
2967 {
2968 s += 4;
2969 PUGI__SCANFOR(s[0] == '-' && s[1] == '-' && s[2] == '>'); // no need for ENDSWITH because --> can't terminate proper doctype
2970 if (!*s) PUGI__THROW_ERROR(status_bad_doctype, s);
2971
2972 s += 3;
2973 }
2974 else PUGI__THROW_ERROR(status_bad_doctype, s);
2975
2976 return s;
2977 }
#define PUGI__SCANFOR(X)
Definition pugixml.cc:2609

Referenced by parse_doctype_group().

◆ parse_exclamation()

char_t * xml_parser::parse_exclamation ( char_t * s,
xml_node_struct * cursor,
unsigned int optmsk,
char_t endch )
inline

Definition at line 3056 of file pugixml.cc.

3057 {
3058 // parse node contents, starting with exclamation mark
3059 ++s;
3060
3061 if (*s == '-') // '<!-...'
3062 {
3063 ++s;
3064
3065 if (*s == '-') // '<!--...'
3066 {
3067 ++s;
3068
3069 if (PUGI__OPTSET(parse_comments))
3070 {
3071 PUGI__PUSHNODE(node_comment); // Append a new node on the tree.
3072 cursor->value = s; // Save the offset.
3073 }
3074
3075 if (PUGI__OPTSET(parse_eol) && PUGI__OPTSET(parse_comments))
3076 {
3077 s = strconv_comment(s, endch);
3078
3079 if (!s) PUGI__THROW_ERROR(status_bad_comment, cursor->value);
3080 }
3081 else
3082 {
3083 // Scan for terminating '-->'.
3084 PUGI__SCANFOR(s[0] == '-' && s[1] == '-' && PUGI__ENDSWITH(s[2], '>'));
3085 PUGI__CHECK_ERROR(status_bad_comment, s);
3086
3087 if (PUGI__OPTSET(parse_comments))
3088 *s = 0; // Zero-terminate this segment at the first terminating '-'.
3089
3090 s += (s[2] == '>' ? 3 : 2); // Step over the '\0->'.
3091 }
3092 }
3093 else PUGI__THROW_ERROR(status_bad_comment, s);
3094 }
3095 else if (*s == '[')
3096 {
3097 // '<![CDATA[...'
3098 if (*++s=='C' && *++s=='D' && *++s=='A' && *++s=='T' && *++s=='A' && *++s == '[')
3099 {
3100 ++s;
3101
3102 if (PUGI__OPTSET(parse_cdata))
3103 {
3104 PUGI__PUSHNODE(node_cdata); // Append a new node on the tree.
3105 cursor->value = s; // Save the offset.
3106
3107 if (PUGI__OPTSET(parse_eol))
3108 {
3109 s = strconv_cdata(s, endch);
3110
3111 if (!s) PUGI__THROW_ERROR(status_bad_cdata, cursor->value);
3112 }
3113 else
3114 {
3115 // Scan for terminating ']]>'.
3116 PUGI__SCANFOR(s[0] == ']' && s[1] == ']' && PUGI__ENDSWITH(s[2], '>'));
3117 PUGI__CHECK_ERROR(status_bad_cdata, s);
3118
3119 *s++ = 0; // Zero-terminate this segment.
3120 }
3121 }
3122 else // Flagged for discard, but we still have to scan for the terminator.
3123 {
3124 // Scan for terminating ']]>'.
3125 PUGI__SCANFOR(s[0] == ']' && s[1] == ']' && PUGI__ENDSWITH(s[2], '>'));
3126 PUGI__CHECK_ERROR(status_bad_cdata, s);
3127
3128 ++s;
3129 }
3130
3131 s += (s[1] == '>' ? 2 : 1); // Step over the last ']>'.
3132 }
3133 else PUGI__THROW_ERROR(status_bad_cdata, s);
3134 }
3135 else if (s[0] == 'D' && s[1] == 'O' && s[2] == 'C' && s[3] == 'T' && s[4] == 'Y' && s[5] == 'P' && PUGI__ENDSWITH(s[6], 'E'))
3136 {
3137 s -= 2;
3138
3139 if (cursor->parent) PUGI__THROW_ERROR(status_bad_doctype, s);
3140
3141 char_t* mark = s + 9;
3142
3143 s = parse_doctype_group(s, endch);
3144 if (!s) return s;
3145
3146 assert((*s == 0 && endch == '>') || *s == '>');
3147 if (*s) *s++ = 0;
3148
3149 if (PUGI__OPTSET(parse_doctype))
3150 {
3151 while (PUGI__IS_CHARTYPE(*mark, ct_space)) ++mark;
3152
3153 PUGI__PUSHNODE(node_doctype);
3154
3155 cursor->value = mark;
3156 }
3157 }
3158 else if (*s == 0 && endch == '-') PUGI__THROW_ERROR(status_bad_comment, s);
3159 else if (*s == 0 && endch == '[') PUGI__THROW_ERROR(status_bad_cdata, s);
3160 else PUGI__THROW_ERROR(status_unrecognized_tag, s);
3161
3162 return s;
3163 }
#define PUGI__CHECK_ERROR(err, m)
Definition pugixml.cc:2614
PUGI__FN char_t * strconv_comment(char_t *s, char_t endch)
Definition pugixml.cc:2616
#define PUGI__IS_CHARTYPE(c, ct)
Definition pugixml.cc:1915
#define PUGI__ENDSWITH(c, e)
Definition pugixml.cc:2604
#define PUGI__PUSHNODE(TYPE)
Definition pugixml.cc:2607
@ ct_space
Definition pugixml.cc:1850
PUGI__FN char_t * strconv_cdata(char_t *s, char_t endch)
Definition pugixml.cc:2644
char_t * parse_doctype_group(char_t *s, char_t endch)
Definition pugixml.cc:3010

Referenced by parse_tree().

◆ parse_question()

char_t * xml_parser::parse_question ( char_t * s,
xml_node_struct *& ref_cursor,
unsigned int optmsk,
char_t endch )
inline

Definition at line 3165 of file pugixml.cc.

3166 {
3167 // load into registers
3168 xml_node_struct* cursor = ref_cursor;
3169 char_t ch = 0;
3170
3171 // parse node contents, starting with question mark
3172 ++s;
3173
3174 // read PI target
3175 char_t* target = s;
3176
3177 if (!PUGI__IS_CHARTYPE(*s, ct_start_symbol)) PUGI__THROW_ERROR(status_bad_pi, s);
3178
3180 PUGI__CHECK_ERROR(status_bad_pi, s);
3181
3182 // determine node type; stricmp / strcasecmp is not portable
3183 bool declaration = (target[0] | ' ') == 'x' && (target[1] | ' ') == 'm' && (target[2] | ' ') == 'l' && target + 3 == s;
3184
3185 if (declaration ? PUGI__OPTSET(parse_declaration) : PUGI__OPTSET(parse_pi))
3186 {
3187 if (declaration)
3188 {
3189 // disallow non top-level declarations
3190 if (cursor->parent) PUGI__THROW_ERROR(status_bad_pi, s);
3191
3192 PUGI__PUSHNODE(node_declaration);
3193 }
3194 else
3195 {
3196 PUGI__PUSHNODE(node_pi);
3197 }
3198
3199 cursor->name = target;
3200
3201 PUGI__ENDSEG();
3202
3203 // parse value/attributes
3204 if (ch == '?')
3205 {
3206 // empty node
3207 if (!PUGI__ENDSWITH(*s, '>')) PUGI__THROW_ERROR(status_bad_pi, s);
3208 s += (*s == '>');
3209
3210 PUGI__POPNODE();
3211 }
3212 else if (PUGI__IS_CHARTYPE(ch, ct_space))
3213 {
3214 PUGI__SKIPWS();
3215
3216 // scan for tag end
3217 char_t* value = s;
3218
3219 PUGI__SCANFOR(s[0] == '?' && PUGI__ENDSWITH(s[1], '>'));
3220 PUGI__CHECK_ERROR(status_bad_pi, s);
3221
3222 if (declaration)
3223 {
3224 // replace ending ? with / so that 'element' terminates properly
3225 *s = '/';
3226
3227 // we exit from this function with cursor at node_declaration, which is a signal to parse() to go to LOC_ATTRIBUTES
3228 s = value;
3229 }
3230 else
3231 {
3232 // store value and step over >
3233 cursor->value = value;
3234
3235 PUGI__POPNODE();
3236
3237 PUGI__ENDSEG();
3238
3239 s += (*s == '>');
3240 }
3241 }
3242 else PUGI__THROW_ERROR(status_bad_pi, s);
3243 }
3244 else
3245 {
3246 // scan for tag end
3247 PUGI__SCANFOR(s[0] == '?' && PUGI__ENDSWITH(s[1], '>'));
3248 PUGI__CHECK_ERROR(status_bad_pi, s);
3249
3250 s += (s[1] == '>' ? 2 : 1);
3251 }
3252
3253 // store from registers
3254 ref_cursor = cursor;
3255
3256 return s;
3257 }
#define PUGI__ENDSEG()
Definition pugixml.cc:2612
#define PUGI__SKIPWS()
Definition pugixml.cc:2605
#define PUGI__POPNODE()
Definition pugixml.cc:2608
#define PUGI__SCANWHILE(X)
Definition pugixml.cc:2610
@ ct_start_symbol
Definition pugixml.cc:1854
@ ct_symbol
Definition pugixml.cc:1853

Referenced by parse_tree().

◆ parse_skip_bom()

char_t * xml_parser::parse_skip_bom ( char_t * s)
inlinestatic

Definition at line 3504 of file pugixml.cc.

3505 {
3506 return (s[0] == '\xef' && s[1] == '\xbb' && s[2] == '\xbf') ? s + 3 : s;
3507 }

Referenced by parse().

◆ parse_tree()

char_t * xml_parser::parse_tree ( char_t * s,
xml_node_struct * root,
unsigned int optmsk,
char_t endch )
inline

Definition at line 3259 of file pugixml.cc.

3260 {
3261 strconv_attribute_t strconv_attribute = get_strconv_attribute(optmsk);
3262 strconv_pcdata_t strconv_pcdata = get_strconv_pcdata(optmsk);
3263
3264 char_t ch = 0;
3265 xml_node_struct* cursor = root;
3266 char_t* mark = s;
3267
3268 while (*s != 0)
3269 {
3270 if (*s == '<')
3271 {
3272 ++s;
3273
3274 LOC_TAG:
3275 if (PUGI__IS_CHARTYPE(*s, ct_start_symbol)) // '<#...'
3276 {
3277 PUGI__PUSHNODE(node_element); // Append a new node to the tree.
3278
3279 cursor->name = s;
3280
3281 PUGI__SCANWHILE_UNROLL(PUGI__IS_CHARTYPE(ss, ct_symbol)); // Scan for a terminator.
3282 PUGI__ENDSEG(); // Save char in 'ch', terminate & step over.
3283
3284 if (ch == '>')
3285 {
3286 // end of tag
3287 }
3288 else if (PUGI__IS_CHARTYPE(ch, ct_space))
3289 {
3290 LOC_ATTRIBUTES:
3291 while (true)
3292 {
3293 PUGI__SKIPWS(); // Eat any whitespace.
3294
3295 if (PUGI__IS_CHARTYPE(*s, ct_start_symbol)) // <... #...
3296 {
3297 xml_attribute_struct* a = append_new_attribute(cursor, *alloc); // Make space for this attribute.
3298 if (!a) PUGI__THROW_ERROR(status_out_of_memory, s);
3299
3300 a->name = s; // Save the offset.
3301
3302 PUGI__SCANWHILE_UNROLL(PUGI__IS_CHARTYPE(ss, ct_symbol)); // Scan for a terminator.
3303 PUGI__ENDSEG(); // Save char in 'ch', terminate & step over.
3304
3305 if (PUGI__IS_CHARTYPE(ch, ct_space))
3306 {
3307 PUGI__SKIPWS(); // Eat any whitespace.
3308
3309 ch = *s;
3310 ++s;
3311 }
3312
3313 if (ch == '=') // '<... #=...'
3314 {
3315 PUGI__SKIPWS(); // Eat any whitespace.
3316
3317 if (*s == '"' || *s == '\'') // '<... #="...'
3318 {
3319 ch = *s; // Save quote char to avoid breaking on "''" -or- '""'.
3320 ++s; // Step over the quote.
3321 a->value = s; // Save the offset.
3322
3323 s = strconv_attribute(s, ch);
3324
3325 if (!s) PUGI__THROW_ERROR(status_bad_attribute, a->value);
3326
3327 // After this line the loop continues from the start;
3328 // Whitespaces, / and > are ok, symbols and EOF are wrong,
3329 // everything else will be detected
3330 if (PUGI__IS_CHARTYPE(*s, ct_start_symbol)) PUGI__THROW_ERROR(status_bad_attribute, s);
3331 }
3332 else PUGI__THROW_ERROR(status_bad_attribute, s);
3333 }
3334 else PUGI__THROW_ERROR(status_bad_attribute, s);
3335 }
3336 else if (*s == '/')
3337 {
3338 ++s;
3339
3340 if (*s == '>')
3341 {
3342 PUGI__POPNODE();
3343 s++;
3344 break;
3345 }
3346 else if (*s == 0 && endch == '>')
3347 {
3348 PUGI__POPNODE();
3349 break;
3350 }
3351 else PUGI__THROW_ERROR(status_bad_start_element, s);
3352 }
3353 else if (*s == '>')
3354 {
3355 ++s;
3356
3357 break;
3358 }
3359 else if (*s == 0 && endch == '>')
3360 {
3361 break;
3362 }
3363 else PUGI__THROW_ERROR(status_bad_start_element, s);
3364 }
3365
3366 // !!!
3367 }
3368 else if (ch == '/') // '<#.../'
3369 {
3370 if (!PUGI__ENDSWITH(*s, '>')) PUGI__THROW_ERROR(status_bad_start_element, s);
3371
3372 PUGI__POPNODE(); // Pop.
3373
3374 s += (*s == '>');
3375 }
3376 else if (ch == 0)
3377 {
3378 // we stepped over null terminator, backtrack & handle closing tag
3379 --s;
3380
3381 if (endch != '>') PUGI__THROW_ERROR(status_bad_start_element, s);
3382 }
3383 else PUGI__THROW_ERROR(status_bad_start_element, s);
3384 }
3385 else if (*s == '/')
3386 {
3387 ++s;
3388
3389 mark = s;
3390
3391 char_t* name = cursor->name;
3392 if (!name) PUGI__THROW_ERROR(status_end_element_mismatch, mark);
3393
3394 while (PUGI__IS_CHARTYPE(*s, ct_symbol))
3395 {
3396 if (*s++ != *name++) PUGI__THROW_ERROR(status_end_element_mismatch, mark);
3397 }
3398
3399 if (*name)
3400 {
3401 if (*s == 0 && name[0] == endch && name[1] == 0) PUGI__THROW_ERROR(status_bad_end_element, s);
3402 else PUGI__THROW_ERROR(status_end_element_mismatch, mark);
3403 }
3404
3405 PUGI__POPNODE(); // Pop.
3406
3407 PUGI__SKIPWS();
3408
3409 if (*s == 0)
3410 {
3411 if (endch != '>') PUGI__THROW_ERROR(status_bad_end_element, s);
3412 }
3413 else
3414 {
3415 if (*s != '>') PUGI__THROW_ERROR(status_bad_end_element, s);
3416 ++s;
3417 }
3418 }
3419 else if (*s == '?') // '<?...'
3420 {
3421 s = parse_question(s, cursor, optmsk, endch);
3422 if (!s) return s;
3423
3424 assert(cursor);
3425 if (PUGI__NODETYPE(cursor) == node_declaration) goto LOC_ATTRIBUTES;
3426 }
3427 else if (*s == '!') // '<!...'
3428 {
3429 s = parse_exclamation(s, cursor, optmsk, endch);
3430 if (!s) return s;
3431 }
3432 else if (*s == 0 && endch == '?') PUGI__THROW_ERROR(status_bad_pi, s);
3433 else PUGI__THROW_ERROR(status_unrecognized_tag, s);
3434 }
3435 else
3436 {
3437 mark = s; // Save this offset while searching for a terminator.
3438
3439 PUGI__SKIPWS(); // Eat whitespace if no genuine PCDATA here.
3440
3441 if (*s == '<' || !*s)
3442 {
3443 // We skipped some whitespace characters because otherwise we would take the tag branch instead of PCDATA one
3444 assert(mark != s);
3445
3446 if (!PUGI__OPTSET(parse_ws_pcdata | parse_ws_pcdata_single) || PUGI__OPTSET(parse_trim_pcdata))
3447 {
3448 continue;
3449 }
3450 else if (PUGI__OPTSET(parse_ws_pcdata_single))
3451 {
3452 if (s[0] != '<' || s[1] != '/' || cursor->first_child) continue;
3453 }
3454 }
3455
3456 if (!PUGI__OPTSET(parse_trim_pcdata))
3457 s = mark;
3458
3459 if (cursor->parent || PUGI__OPTSET(parse_fragment))
3460 {
3461 if (PUGI__OPTSET(parse_embed_pcdata) && cursor->parent && !cursor->first_child && !cursor->value)
3462 {
3463 cursor->value = s; // Save the offset.
3464 }
3465 else
3466 {
3467 PUGI__PUSHNODE(node_pcdata); // Append a new node on the tree.
3468
3469 cursor->value = s; // Save the offset.
3470
3471 PUGI__POPNODE(); // Pop since this is a standalone.
3472 }
3473
3474 s = strconv_pcdata(s);
3475
3476 if (!*s) break;
3477 }
3478 else
3479 {
3480 PUGI__SCANFOR(*s == '<'); // '...<'
3481 if (!*s) break;
3482
3483 ++s;
3484 }
3485
3486 // We're after '<'
3487 goto LOC_TAG;
3488 }
3489 }
3490
3491 // check that last tag is closed
3492 if (cursor != root) PUGI__THROW_ERROR(status_end_element_mismatch, s);
3493
3494 return s;
3495 }
const char * name(G4int ptype)
char_t *(* strconv_attribute_t)(char_t *, char_t)
Definition pugixml.cc:2743
#define PUGI__SCANWHILE_UNROLL(X)
Definition pugixml.cc:2611
PUGI__FN strconv_attribute_t get_strconv_attribute(unsigned int optmask)
Definition pugixml.cc:2894
PUGI__FN strconv_pcdata_t get_strconv_pcdata(unsigned int optmask)
Definition pugixml.cc:2725
PUGI__FN_NO_INLINE xml_attribute_struct * append_new_attribute(xml_node_struct *node, xml_allocator &alloc)
Definition pugixml.cc:1427
char_t *(* strconv_pcdata_t)(char_t *)
Definition pugixml.cc:2672
char_t * parse_question(char_t *s, xml_node_struct *&ref_cursor, unsigned int optmsk, char_t endch)
Definition pugixml.cc:3165
char_t * parse_exclamation(char_t *s, xml_node_struct *cursor, unsigned int optmsk, char_t endch)
Definition pugixml.cc:3056

Referenced by parse().

Member Data Documentation

◆ alloc

xml_allocator* xml_parser::alloc

Definition at line 2931 of file pugixml.cc.

Referenced by parse_tree(), and xml_parser().

◆ error_offset

char_t* xml_parser::error_offset

Definition at line 2932 of file pugixml.cc.

Referenced by parse(), and xml_parser().

◆ error_status

xml_parse_status xml_parser::error_status

Definition at line 2933 of file pugixml.cc.

Referenced by parse(), and xml_parser().


The documentation for this struct was generated from the following file: