Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
declarations.c
Go to the documentation of this file.
1 /* *************************************************************************************
2  Copyright (c) 2021, Lowell D. Thomas
3  All rights reserved.
4 
5  This file is part of APG Version 7.0.
6  APG Version 7.0 may be used under the terms of the BSD 2-Clause License.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  1. Redistributions of source code must retain the above copyright notice, this
12  list of conditions and the following disclaimer.
13 
14  2. Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 * *************************************************************************************/
33 #include "callbacks.h"
34 
35 static const char* s_cpUtf8 = "UTF-8";
36 static const char* s_cpUtf8Default = "UTF-8 (default value)";
37 static const char* s_cpVersionDefault = "1.0 (default value)";
38 static const char* s_cpNoDefault= "no (default value)";
39 static const char* s_cpUtf16 = "UTF-16";
40 static const char* s_cpVersion = "1.0";
41 static const char* s_cpYes = "yes";
42 static const char* s_cpNo = "no";
43 static const char* s_cpStandaloneError= "standalone declaration error: must be \"yes\" or \"no\"";
44 static const char* s_cpCData = "CDATA";
45 static const uint32_t s_uiAmp = 38;
46 static const uint32_t s_uiSemi = 59;
47 
48 /*********************************************************
49  * DOCUMENT ++++++++++++++++++++++++++++++++++++++++++++++
50  ********************************************************/
51 void vDocument(callback_data* spData){
52  xml* spXml = (xml*)spData->vpUserData;
53  if(spData->uiParserState == ID_ACTIVE){
54  }else if(spData->uiParserState == ID_MATCH){
55  if(spData->uiParserPhraseLength != spData->uiStringLength){
56  XML_THROW("Syntax error. A syntactically correct document was found but followed by extraneous characters.");
57  }
58  }else if(spData->uiParserState == ID_NOMATCH){
59  XML_THROW("Syntax error. Document not matched.");
60  }
61 }
62 /*********************************************************
63  * DOCUMENT ----------------------------------------------
64  ********************************************************/
65 
66 /*********************************************************
67  * XML DECLARATION +++++++++++++++++++++++++++++++++++++++
68  ********************************************************/
70  xml* spXml = (xml*)spData->vpUserData;
71  if(spData->uiParserState == ID_MATCH){
72  vVecClear(spXml->vpVec8);
73  vVecClear(spXml->vpVecString);
74  }else if(spData->uiParserState == ID_NOMATCH){
75  if(spXml->pfnXmlDeclCallback){
76  // default info
77  xmldecl_info sInfo;
78  sInfo.cpExists = s_cpNo;
79  sInfo.cpVersion = s_cpVersionDefault;
80  sInfo.cpEncoding = s_cpUtf8Default;
81  sInfo.cpStandalone = s_cpNoDefault;
82  spXml->pfnXmlDeclCallback(&sInfo, spXml->vpXmlDeclData);
83  }
84  }
85 }
87  if(spData->uiParserState == ID_MATCH){
88  // check semantics
89  xml* spXml = (xml*)spData->vpUserData;
90  char caBuf[CABUF_LEN];
91  const char* cpEncoding = s_cpUtf8;
92  const char* cpStandalone;
93  const char* cpTrueType = cpUtilUtfTypeName(spXml->uiTrueType);
94  if(!spXml->sXmlDecl.cpVersion){
95  XML_THROW("XML declaration version number not declared");
96  }
97  if(strcmp(spXml->sXmlDecl.cpVersion, s_cpVersion) != 0){
98  XML_THROW("XML declaration version number is \"%s\". Must be \"1.0\"");
99  }
100  if(!spXml->sXmlDecl.cpEncoding){
101  cpEncoding = s_cpUtf8Default;
102  }else{
103  if(strcmp(spXml->sXmlDecl.cpEncoding, s_cpUtf8) == 0){
104  cpEncoding = s_cpUtf8;
105  if(spXml->uiTrueType != UTF_8){
106  snprintf(caBuf, CABUF_LEN,
107  "XML declaration encoding is %s but data has type %s",
108  spXml->sXmlDecl.cpEncoding, cpTrueType);
109  XML_THROW(caBuf);
110  }
111  }else if(strcmp(spXml->sXmlDecl.cpEncoding, s_cpUtf16) == 0){
112  cpEncoding =s_cpUtf16;
113  if(!(spXml->uiTrueType == UTF_16 || spXml->uiTrueType == UTF_16BE || spXml->uiTrueType == UTF_16LE)){
114  snprintf(caBuf, CABUF_LEN,
115  "XML declaration encoding is %s but data has type %s",
116  spXml->sXmlDecl.cpEncoding, cpTrueType);
117  XML_THROW(caBuf);
118  }
119  }else{
120  snprintf(caBuf, CABUF_LEN,
121  "XML declaration encoding is \"%s\": Must be \"UTF-8\" or \"UTF-16\"",
122  spXml->sXmlDecl.cpEncoding);
123  XML_THROW(caBuf);
124  }
125  }
126  if(spXml->sXmlDecl.cpStandalone){
127  cpStandalone = spXml->sXmlDecl.cpStandalone;
128  if(strcmp(spXml->sXmlDecl.cpStandalone, s_cpStandaloneError) == 0){
129  XML_THROW(s_cpStandaloneError);
130  }
131  }else{
132  cpStandalone = s_cpNoDefault;
133  }
134  if(spXml->pfnXmlDeclCallback){
135  // NOTE: all strings are static and are valid for the duration of the callback
136  spXml->sXmlDecl.cpExists = s_cpYes;
137  spXml->sXmlDecl.cpVersion = s_cpVersion;
138  spXml->sXmlDecl.cpEncoding = cpEncoding;
139  spXml->sXmlDecl.cpStandalone = cpStandalone;
140  spXml->pfnXmlDeclCallback(&spXml->sXmlDecl, spXml->vpXmlDeclData);
141 
142  // clear the work vectors
143  vVecClear(spXml->vpVecString);
144  vVecClear(spXml->vpVecCData);
145  vVecClear(spXml->vpVec8);
146  }
147  }else if(spData->uiParserState == ID_NOMATCH){
148  xml* spXml = (xml*)spData->vpUserData;
149  XML_THROW("XML declaration syntax error.");
150  }
151 }
153  if (spData->uiParserState == ID_NOMATCH){
154  xml* spXml = (xml*)spData->vpUserData;
155  XML_THROW("version information is malformed");
156  }
157 }
159  if(spData->uiParserState == ID_MATCH){
160  xml* spXml = (xml*)spData->vpUserData;
161  char* cpNum = (char*)vpVecPushn(spXml->vpVecString, NULL, (spData->uiParserPhraseLength + 1));
162  aint ui = 0;
163  for(; ui < spData->uiParserPhraseLength; ui++){
164  cpNum[ui] = (char)spData->acpString[spData->uiParserOffset + ui];
165  }
166  cpNum[ui] = 0;
167  spXml->sXmlDecl.cpVersion = cpNum;
168  }else if(spData->uiParserState == ID_NOMATCH){
169  xml* spXml = (xml*)spData->vpUserData;
170  XML_THROW("XML declaration syntax error. Version number not of form \"1.123...\"");
171  }
172 }
173 
174 void vEncDef(callback_data* spData){
175  if (spData->uiParserState == ID_NOMATCH){
176  xml* spXml = (xml*)spData->vpUserData;
177  XML_THROW("XML declaration syntax error. Malformed encoding definition.");
178  }
179 }
180 void vEncName(callback_data* spData){
181  xml* spXml = (xml*)spData->vpUserData;
182  if(spData->uiParserState == ID_MATCH){
183  char* cpBuf = (char*)vpVecPushn(spXml->vpVecString, NULL, (spData->uiParserOffset + 1));
184  aint ui;
185  for(ui = 0; ui < spData->uiParserPhraseLength; ui++){
186  cpBuf[ui] = (char)spData->acpString[spData->uiParserOffset + ui];
187  }
188  cpBuf[ui] = 0;
189  spXml->sXmlDecl.cpEncoding = cpBuf;
190  }else if (spData->uiParserState == ID_NOMATCH){
191  XML_THROW("XML declaration syntax error. Malformed encoding name.");
192  }
193 }
195  if(spData->uiParserState == ID_MATCH){
196  xml* spXml = (xml*)spData->vpUserData;
197  XML_THROW("XML declaration syntax error. standalone must be either \"yes\" or \"no\".");
198  }
199 }
200 void vSDeclYes(callback_data* spData){
201  if(spData->uiParserState == ID_MATCH){
202  xml* spXml = (xml*)spData->vpUserData;
203  spXml->sXmlDecl.cpStandalone = s_cpYes;
204  spXml->bStandalone = APG_TRUE;
205  }
206 }
207 void vSDeclNo(callback_data* spData){
208  if(spData->uiParserState == ID_MATCH){
209  xml* spXml = (xml*)spData->vpUserData;
210  spXml->sXmlDecl.cpStandalone = s_cpNo;
211  spXml->bStandalone = APG_FALSE;
212  }
213 }
214 /*********************************************************
215  * XML DECLARATION ---------------------------------------
216  ********************************************************/
217 
218 /*********************************************************
219  * DOCUMENT TYPE DECLARATION (DTD) +++++++++++++++++++++++
220  ********************************************************/
221 void vDtdOpen(callback_data* spData){
222  if(spData->uiParserState == ID_MATCH){
223  xml* spXml = (xml*)spData->vpUserData;
224  spXml->uiDTDOffset = spData->uiParserOffset;
225  }else if(spData->uiParserState == ID_NOMATCH){
226  xml* spXml = (xml*)spData->vpUserData;
227  if(spXml->pfnDTDCallback){
228  dtd_info sDtd = {};
229  spXml->pfnDTDCallback(&sDtd, spXml->vpDTDData);
230  }
231  }
232 }
233 void vDtdName(callback_data* spData){
234  if(spData->uiParserState == ID_MATCH){
235  xml* spXml = (xml*)spData->vpUserData;
236  spXml->sDtdName.uiOffset = uiVecLen(spXml->vpVec32);
237  spXml->sDtdName.uiLength = (uint32_t)uiVecLen(spXml->vpVecName);
238  vpVecPushn(spXml->vpVec32, vpVecFirst(spXml->vpVecName), spXml->sDtdName.uiLength);
239  }
240 }
241 void vDtdClose(callback_data* spData){
242  if(spData->uiParserState == ID_MATCH){
243  xml* spXml = (xml*)spData->vpUserData;
244  if(spXml->pfnDTDCallback){
245  aint ui, uiIndex, uiCount;
246  u32_phrase* spTempData;
247  entity_decl* spNamedValues;
248  dtd_info sDtd = {};
249  vVecClear(spXml->vpVecCData);
250  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
251  vMakeCDataDisplay(spXml, &spXml->sDtdName, spTempData, spData->uiParserOffset);
252  sDtd.bExists = APG_TRUE;
253  sDtd.bStandalone = spXml->bStandalone;
254  sDtd.bExtSubset = spXml->bExtSubset;
255  sDtd.uiExternalIds = spXml->uiExternalIds;
256  sDtd.uiPEDecls= spXml->uiPEDecls;
257  sDtd.uiPERefs = spXml->uiPERefs;
258  sDtd.uiAttListsDeclared = spXml->uiAttListsDeclared;
259  sDtd.uiElementDecls = spXml->uiElementDecls;
260  sDtd.spName = spTempData;
261  sDtd.uiNotationDecls = uiVecLen(spXml->vpVecNotationDecls);
262  sDtd.uiGEDeclsDeclared = spXml->uiGEDeclsTotal;
263  sDtd.uiGEDeclsNotProcessed = spXml->uiGEDeclsNotProcessed;
264  uiCount = uiVecLen(spXml->vpVecGEDefs);
265  sDtd.uiGEDeclsUnique = uiCount;
266  if(uiVecLen(spXml->vpVecGEDefs)){
267  uiIndex = uiVecLen(spXml->vpVecCData);
268  spNamedValues = (entity_decl*)vpVecFirst(spXml->vpVecGEDefs);
269  for(ui = 0; ui < uiCount; ui++, spNamedValues++){
270  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
271  vMakeCDataDisplay(spXml, &spNamedValues->sName, spTempData, spData->uiParserOffset);
272  }
273  sDtd.spGENames = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
274 
275  // make the list of GE values data
276  uiIndex = uiVecLen(spXml->vpVecCData);
277  spNamedValues = (entity_decl*)vpVecFirst(spXml->vpVecGEDefs);
278  for(ui = 0; ui < uiCount; ui++, spNamedValues++){
279  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
280  vMakeCDataDisplay(spXml, &spNamedValues->sValue, spTempData, spData->uiParserOffset);
281  }
282  sDtd.spGEValues = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
283  }
284  sDtd.uiAttListsDeclared = spXml->uiAttListsDeclared;
285  sDtd.uiAttListsNotProcessed = spXml->uiAttListsNotProcessed;
286  uiCount = uiVecLen(spXml->vpVecAttDecls);
287  sDtd.uiAttListsUnique = uiCount;
288  if(uiCount){
289  // make the list of attribute list element names data
290  uiIndex = uiVecLen(spXml->vpVecCData);
291  att_decl* spAttList = (att_decl*)vpVecFirst(spXml->vpVecAttDecls);
292  for(ui = 0; ui < uiCount; ui++, spAttList++){
293  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
294  vMakeCDataDisplay(spXml, &spAttList->sElementName, spTempData, spData->uiParserOffset);
295  }
296  sDtd.spAttElementNames = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
297 
298  // make the list of attribute list attribute names data
299  uiIndex = uiVecLen(spXml->vpVecCData);
300  spAttList = (att_decl*)vpVecFirst(spXml->vpVecAttDecls);
301  for(ui = 0; ui < uiCount; ui++, spAttList++){
302  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
303  vMakeCDataDisplay(spXml, &spAttList->sAttName, spTempData, spData->uiParserOffset);
304  }
305  sDtd.spAttNames = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
306 
307  // make the list of attribute types
308  uiIndex = uiVecLen(spXml->vpVecCData);
309  spAttList = (att_decl*)vpVecFirst(spXml->vpVecAttDecls);
310  for(ui = 0; ui < uiCount; ui++, spAttList++){
311  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
312  vMakeCDataDisplay(spXml, &spAttList->sAttType, spTempData, spData->uiParserOffset);
313  }
314  sDtd.spAttTypes = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
315 
316  // make the list of attribute values
317  uiIndex = uiVecLen(spXml->vpVecCData);
318  spAttList = (att_decl*)vpVecFirst(spXml->vpVecAttDecls);
319  for(ui = 0; ui < uiCount; ui++, spAttList++){
320  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
321  vMakeCDataDisplay(spXml, &spAttList->sAttValue, spTempData, spData->uiParserOffset);
322  }
323  sDtd.spAttValues = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
324  }
325  if(sDtd.uiNotationDecls){
326  // make the list of GE names data
327  uiIndex = uiVecLen(spXml->vpVecCData);
328  spNamedValues = (entity_decl*)vpVecFirst(spXml->vpVecNotationDecls);
329  for(ui = 0; ui < sDtd.uiNotationDecls; ui++, spNamedValues++){
330  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
331  vMakeCDataDisplay(spXml, &spNamedValues->sName, spTempData, spData->uiParserOffset);
332  }
333  sDtd.spNotationNames = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
334 
335  // make the list of GE values data
336  uiIndex = uiVecLen(spXml->vpVecCData);
337  spNamedValues = (entity_decl*)vpVecFirst(spXml->vpVecNotationDecls);
338  for(ui = 0; ui < sDtd.uiNotationDecls; ui++, spNamedValues++){
339  spTempData = (u32_phrase*)vpVecPush(spXml->vpVecCData, NULL);
340  vMakeCDataDisplay(spXml, &spNamedValues->sValue, spTempData, spData->uiParserOffset);
341  }
342  sDtd.spNotationValues = (u32_phrase*)vpVecAt(spXml->vpVecCData, uiIndex);
343  }
344 
345  // call the user's callback function
346  spXml->pfnDTDCallback(&sDtd, spXml->vpDTDData);
347 
348  }
349  if(uiMsgsCount(spXml->vpMsgs)){
350 // printf("XML non-validating parser exit on DTD errors.\n");
351 // vUtilPrintMsgs(spXml->vpMsgs);
352 // printf("\n");
353  vThrowError(spXml, "Document Type Declaration bad content",
354  spXml->uiDTDOffset, __LINE__, __FILE__, __func__);
355  }
356  // clear the work vectors
357  vVecClear(spXml->vpVecString);
358  vVecClear(spXml->vpVecCData);
359  vVecClear(spXml->vpVec8);
360  vMsgsClear(spXml->vpMsgs);
361  }else if(spData->uiParserState == ID_NOMATCH){
362  xml* spXml = (xml*)spData->vpUserData;
363  XML_THROW("Document Type Declaration syntax error");
364  }
365 }
366 
367 void vExtSubset(callback_data* spData){
368  if(spData->uiParserState == ID_MATCH){
369  xml* spXml = (xml*)spData->vpUserData;
370  spXml->bExtSubset = APG_TRUE;
371  vLogMsg(spXml, spData->uiParserOffset, "External Subset");
372  }
373 }
374 /****************** EXTERNAL ID ******************************/
376  if(spData->uiParserState == ID_MATCH){
377  xml* spXml = (xml*)spData->vpUserData;
378  spXml->uiExternalIds++;
379  vLogMsg(spXml, spData->uiParserOffset, "External ID");
380  }
381 }
383  if(spData->uiParserState == ID_MATCH){
384  xml* spXml = (xml*)spData->vpUserData;
385  spXml->uiExternalIds++;
386  }
387 }
388 /****************** EXTERNAL ID ******************************/
389 /****************** PARAMETER ENTITY *************************/
391  if(spData->uiParserState == ID_MATCH){
392  xml* spXml = (xml*)spData->vpUserData;
393  spXml->uiPEDecls++;
394  }
395 }
397  if(spData->uiParserState == ID_NOMATCH){
398  xml* spXml = (xml*)spData->vpUserData;
399  XML_THROW("Parameter Entity Declaration syntax error. Expected closure not found");
400  }
401 }
403  if(spData->uiParserState == ID_MATCH){
404  xml* spXml = (xml*)spData->vpUserData;
405  spXml->uiPERefs++;
406  }
407 }
409  if(spData->uiParserState == ID_MATCH){
410  xml* spXml = (xml*)spData->vpUserData;
411  XML_THROW("Well-formedness constraint: PEs in Internal Subset\n"
412  "In the internal DTD subset, parameter-entity references MUST NOT occur within markup declarations...");
413  }
414 }
415 /****************** PARAMETER ENTITY *************************/
416 /****************** GENERAL ENTITY ***************************/
418  if(spData->uiParserState == ID_MATCH){
419  xml* spXml = (xml*)spData->vpUserData;
420  uint32_t* uipName = (uint32_t*)vpVecFirst(spXml->vpVecName);
421  aint uiNameLen = uiVecLen(spXml->vpVecName);
422  if(!uipName || !uiNameLen){
423  XML_THROW("General Entity Declaration has no name.");
424  }
425 
426  // initialize the name General Entity named value
427  memset((void*)&spXml->sCurrentEntity, 0, sizeof(entity_decl));
428  // save the name
429  spXml->sCurrentEntity.sName.uiOffset = (uint32_t)uiVecLen(spXml->vpVec32);
430  spXml->sCurrentEntity.sName.uiLength = uiNameLen;
431  vpVecPushn(spXml->vpVec32, uipName, uiNameLen);
432 
433  // set up for the named value
434  spXml->sCurrentEntity.sValue.uiOffset = (uint32_t)uiVecLen(spXml->vpVec32);
435  spXml->sCurrentEntity.sValue.uiLength = 0;
436  spXml->sCurrentEntity.uiInputOffset = spData->uiParserOffset;
437  spXml->uiSavedOffset = spData->uiParserOffset;
438  }
439 }
440 void vGEPERef(callback_data* spData){
441  if(spData->uiParserState == ID_MATCH){
442  xml* spXml = (xml*)spData->vpUserData;
443  spXml->sCurrentEntity.bGEPERef = APG_TRUE;
444  vLogMsg(spXml, spData->uiParserOffset, "General Entity declaration contains unread Parameter Entity");
445  }
446 }
447 void vGEDefEx(callback_data* spData){
448  if(spData->uiParserState == ID_MATCH){
449  xml* spXml = (xml*)spData->vpUserData;
450  spXml->sCurrentEntity.bGEDefEx = APG_TRUE;
451  vLogMsg(spXml, spData->uiParserOffset, "General Entity has an external definition");
452  }
453 }
455  if(spData->uiParserState == ID_MATCH){
456  xml* spXml = (xml*)spData->vpUserData;
457  spXml->uiGEDeclsTotal++;
458  while(APG_TRUE){
459  if((spXml->uiPERefs == 0) || spXml->bStandalone){
460  // OK to process this GE
461  uint32_t* uipChars = (uint32_t*)vpVecFirst(spXml->vpVec32);
462  aint uiLen32 = uiVecLen(spXml->vpVec32);
463  if(uiLen32 < spXml->sCurrentEntity.sValue.uiOffset){
464  XML_THROW("General Entity Declaration syntax error. No value data.");
465  }
466  spXml->sCurrentEntity.sValue.uiLength = uiLen32 - spXml->sCurrentEntity.sValue.uiOffset;
467 
468  // lookup
469  uint32_t* uipName = uipChars + spXml->sCurrentEntity.sName.uiOffset;
470  uint32_t uiLen = spXml->sCurrentEntity.sName.uiLength;
471  entity_decl* spFound = spEntityNameLookup(spXml, spData->uiParserOffset, uipName, uiLen);
472  if(!spFound){
473  // not found - add it and sort
474  spXml->sCurrentEntity.spXml = spXml;
475  vpVecPush(spXml->vpVecGEDefs, &spXml->sCurrentEntity);
476  qsort(vpVecFirst(spXml->vpVecGEDefs), (size_t)uiVecLen(spXml->vpVecGEDefs),
477  sizeof(entity_decl), iEntityComp);
478  }
479  break;
480  }
481  spXml->uiGEDeclsNotProcessed++;
482  if(spXml->sCurrentEntity.bGEPERef){
483  // don't process this GE due to parameter entity in definition
484  vLogMsg(spXml, spXml->uiSavedOffset, "General Entity not processed (contains parameter entity)");
485  break;
486  }
487  if(spXml->sCurrentEntity.bGEDefEx){
488  // don't process this GE due to external definition
489  vLogMsg(spXml, spXml->uiSavedOffset, "General Entity not processed (contains external definition)");
490  break;
491  }
492  // don't process this GE due to conditions
493  vLogMsg(spXml, spXml->uiSavedOffset, "General Entity not processed (preceded by parameter entity)");
494  break;
495  }
496  }else if(spData->uiParserState == ID_NOMATCH){
497  xml* spXml = (xml*)spData->vpUserData;
498  XML_THROW("General Entity Declaration syntax error. Expected closure not found");
499  }
500 }
502  if(spData->uiParserState == ID_NOMATCH){
503  xml* spXml = (xml*)spData->vpUserData;
504  XML_THROW("Expected closing quotation mark (single or double) not found");
505  }
506 }
508  if(spData->uiParserState == ID_MATCH){
509  xml* spXml = (xml*)spData->vpUserData;
510  vpVecPush(spXml->vpVec32, (void*)&spXml->uiChar);
511  }
512 }
513 void vGERef(callback_data* spData){
514  if(spData->uiParserState == ID_MATCH){
515  xml* spXml = (xml*)spData->vpUserData;
516  uint32_t* uipRefName = (uint32_t*)vpVecFirst(spXml->vpVecName);
517  uint32_t uiRefLen = (uint32_t)uiVecLen(spXml->vpVecName);
518  uint32_t* uipThisName = (uint32_t*)vpVecFirst(spXml->vpVec32) + spXml->sCurrentEntity.sName.uiOffset;
519  uint32_t uiThisLen = spXml->sCurrentEntity.sName.uiLength;
520  if(bCompNames(uipRefName, uiRefLen, uipThisName, uiThisLen)){
521  vLogMsg(spXml, spXml->uiSavedOffset,
522  "Well-formedness constraint: No Recursion\n"
523  "A parsed entity MUST NOT contain a recursive reference to itself, either directly or indirectly.");
524  spXml->sCurrentEntity.bEntityDeclaredError = APG_TRUE;
525  return;
526  }
527  // it's a valid name
528  vpVecPush(spXml->vpVec32, (void*)&s_uiAmp);
529  vpVecPushn(spXml->vpVec32, vpVecFirst(spXml->vpVecName), uiVecLen(spXml->vpVecName));
530  vpVecPush(spXml->vpVec32, (void*)&s_uiSemi);
531  }
532 }
533 /****************** GENERAL ENTITY ***************************/
534 /****************** ATTRIBUTES *******************************/
536  if(spData->uiParserState == ID_MATCH){
537  xml* spXml = (xml*)spData->vpUserData;
538  spXml->uiAttListsDeclared++;
539  if((spXml->uiPERefs == 0) || spXml->bStandalone){
540  // OK to process this attribute
541  uint32_t* uipName = (uint32_t*)vpVecFirst(spXml->vpVecName);
542  aint uiNameLen = uiVecLen(spXml->vpVecName);
543  if(!uipName || !uiNameLen){
544  XML_THROW("Attribute List Declaration element has no name.");
545  }
546 
547  // push an att value & save the element name
548  memset((void*)&spXml->sCurrentAttList, 0, sizeof(spXml->sCurrentAttList));
549  spXml->sCurrentAttList.spXml = spXml;
550  spXml->sCurrentAttList.sElementName.uiOffset = (uint32_t)uiVecLen(spXml->vpVec32);
551  spXml->sCurrentAttList.sElementName.uiLength = (uint32_t)uiNameLen;
552  vpVecPushn(spXml->vpVec32, uipName, uiNameLen);
553  spXml->uiSavedOffset = spData->uiParserOffset;
554  }
555  }
556 }
557 void vAttName(callback_data* spData){
558  if(spData->uiParserState == ID_MATCH){
559  xml* spXml = (xml*)spData->vpUserData;
560  if((spXml->uiPERefs == 0) || spXml->bStandalone){
561  // OK to process this attribute
562  uint32_t* uipName = (uint32_t*)vpVecFirst(spXml->vpVecName);
563  aint uiNameLen = uiVecLen(spXml->vpVecName);
564  if(!uipName || !uiNameLen){
565  XML_THROW("Attribute List Declaration attribute has no name.");
566  }
567 
568  // get the current attribute value & save the attribute name
569  spXml->sCurrentAttList.sAttName.uiOffset = (uint32_t)uiVecLen(spXml->vpVec32);
570  spXml->sCurrentAttList.sAttName.uiLength = (uint32_t)uiNameLen;
571  vpVecPushn(spXml->vpVec32, uipName, uiNameLen);
572  }// else{ don't process this GE due to conditions
573  }
574 }
575 void vAttType(callback_data* spData){
576  if(spData->uiParserState == ID_MATCH){
577  xml* spXml = (xml*)spData->vpUserData;
578  if((spXml->uiPERefs == 0) || spXml->bStandalone){
579  vConvertParsedData(spXml, &spData->acpString[spData->uiParserOffset], spData->uiParserPhraseLength,
580  &spXml->sCurrentAttList.sAttType.uiOffset, &spXml->sCurrentAttList.sAttType.uiLength);
581  aint ui;
582  uint32_t* uipData = (uint32_t*)vpVecFirst(spXml->vpVec32) + spXml->sCurrentAttList.sAttType.uiOffset;
583  spXml->sCurrentAttList.bIsCDATA = APG_FALSE;
584  if(spXml->sCurrentAttList.sAttType.uiLength == 5){
585  for(ui = 0; ui < 5; ui++){
586  if(s_cpCData[ui] != (char)uipData[ui]){
587  goto notfound;
588  }
589  }
590  spXml->sCurrentAttList.bIsCDATA = APG_TRUE;
591  }
592  notfound:;
593 
594  // initialize the value entry
595  spXml->sCurrentAttList.sAttValue.uiOffset = (uint32_t)uiVecLen(spXml->vpVec32);
596  spXml->sCurrentAttList.sAttValue.uiLength = 0;
597  }// else{ don't process this GE due to conditions
598  }
599 }
601  if(spData->uiParserState == ID_MATCH){
602  xml* spXml = (xml*)spData->vpUserData;
603  if((spXml->uiPERefs == 0) || spXml->bStandalone){
604  // get the current attribute value & save the attribute value
605  spXml->sCurrentAttList.bHasData = APG_TRUE;
606  uint32_t* uipAttValue = (uint32_t*)vpVecAt(spXml->vpVec32, spXml->sCurrentAttList.sAttValue.uiOffset);
607  spXml->sCurrentAttList.sAttValue.uiLength = (uint32_t)uiVecLen(spXml->vpVec32) -
608  spXml->sCurrentAttList.sAttValue.uiOffset;
609  spXml->sCurrentAttList.sAttValue = sNormalizeAttributeValue(spXml, spData->uiParserOffset, uipAttValue,
610  spXml->sCurrentAttList.sAttValue.uiLength, spXml->sCurrentAttList.bIsCDATA);
611  }// else{ don't process this GE due to conditions
612  }
613 }
614 void vAttDef(callback_data* spData){
615  if(spData->uiParserState == ID_MATCH){
616  xml* spXml = (xml*)spData->vpUserData;
617  if(spXml->sCurrentAttList.uiAttCount){
618  spXml->uiAttListsDeclared++;
619  }
620  if((spXml->uiPERefs == 0) || spXml->bStandalone){
621  // get the current attribute value & save the attribute value
622  if(spXml->sCurrentAttList.bHasData || !spXml->sCurrentAttList.bInvalidValue){
623  // look up the element/attribute name pair - ignore this declaration if it is a duplicate
624  att_decl* spFound = spLeftMostElement(spXml, &spXml->sCurrentAttList);
625  if(spFound){
626  aint ui;
627  if(spFound->uiAttCount){
628  // see if the attribute name is unique for this element
629  uint32_t* uipChars = (uint32_t*)vpVecFirst(spXml->vpVec32);
630  uint32_t* uipLName = uipChars + spXml->sCurrentAttList.sAttName.uiOffset;
631  uint32_t uiLLen = spXml->sCurrentAttList.sAttName.uiLength;
632  uint32_t* uipRName;
633  uint32_t uiRLen;
634  for(ui = 0; ui < spFound->uiAttCount; ui++){
635  uipRName = uipChars + spFound[ui].sAttName.uiOffset;
636  uiRLen = spFound[ui].sAttName.uiLength;
637  if(bCompNames(uipLName, uiLLen, uipRName, uiRLen)){
638  // duplicate attribute name for this element -ignore it
639  return;
640  }
641  }
642  }
643  // if the attribute name is unique
644  for(ui = 0; ui < spFound->uiAttCount; ui++){
645  spFound[ui].uiAttCount++;
646  }
647  spXml->sCurrentAttList.uiAttCount = spFound->uiAttCount;
648  vpVecPush(spXml->vpVecAttDecls, &spXml->sCurrentAttList);
649  qsort(vpVecFirst(spXml->vpVecAttDecls), (size_t)uiVecLen(spXml->vpVecAttDecls), sizeof(att_decl), iAttComp);
650 
651  }else{
652  // first element by this name - push it on the list and sort
653  spXml->sCurrentAttList.uiAttCount = 1;
654  vpVecPush(spXml->vpVecAttDecls, &spXml->sCurrentAttList);
655  qsort(vpVecFirst(spXml->vpVecAttDecls), (size_t)uiVecLen(spXml->vpVecAttDecls), sizeof(att_decl), iAttComp);
656  }
657  }
658  }else{
659  // don't process this GE due to conditions
660  vLogMsg(spXml, spData->uiParserOffset,
661  "Attribute List declaration not processed due to PE references found and standalone=\"no\".");
662  spXml->uiAttListsNotProcessed++;
663  }
664  }
665 }
667  if(spData->uiParserState == ID_NOMATCH){
668  xml* spXml = (xml*)spData->vpUserData;
669  XML_THROW("Expected close of attribute list declaration not found");
670  }
671 }
672 
673 /****************** ATTRIBUTES *******************************/
674 /****************** NOTATIONAL REFERENCE *********************/
676  if(spData->uiParserState == ID_MATCH){
677  xml* spXml = (xml*)spData->vpUserData;
678  uint32_t* uipName = (uint32_t*)vpVecFirst(spXml->vpVecName);
679  aint uiNameLen = uiVecLen(spXml->vpVecName);
680  if(!uipName || !uiNameLen){
681  XML_THROW("Notation Declaration has no name.");
682  }
683 
684  // initialize the Notation Declaration named value
685  entity_decl* spNotation = (entity_decl*)vpVecPush(spXml->vpVecNotationDecls, NULL);
686  memset(spNotation, 0, sizeof(entity_decl));
687 
688  // push the name cdata_id on the save vec
689  spNotation->sName.uiOffset = (uint32_t)uiVecLen(spXml->vpVec32);
690  spNotation->sName.uiLength = (uint32_t)uiNameLen;
691  vpVecPushn(spXml->vpVec32, uipName, uiNameLen);
692 
693  // set up for the named value
694  spXml->uiSavedOffset = spData->uiParserOffset;
695  }
696 }
698  if(spData->uiParserState == ID_MATCH){
699  xml* spXml = (xml*)spData->vpUserData;
700  // convert the definition characters and save
701  entity_decl* spNotation = (entity_decl*)vpVecLast(spXml->vpVecNotationDecls);
702  if(!spNotation){
703  XML_THROW("Notation Declaration syntax error. Name value of Notation should not be empty.");
704  }
705  // convert parsed data to UTF-32
706  vConvertParsedData(spXml, &spData->acpString[spData->uiParserOffset], spData->uiParserPhraseLength,
707  &spNotation->sValue.uiOffset, &spNotation->sValue.uiLength);
708  }
709 }
711  if(spData->uiParserState == ID_NOMATCH){
712  xml* spXml = (xml*)spData->vpUserData;
713  XML_THROW("Notation Declaration syntax error. Expected closure not found");
714  }
715 }
716 /****************** NOTATIONAL REFERENCE *********************/
718  if(spData->uiParserState == ID_MATCH){
719  xml* spXml = (xml*)spData->vpUserData;
720  spXml->uiSavedOffset = spData->uiParserOffset;
721  spXml->uiElementDecls++;
722  }
723 }
725  if(spData->uiParserState == ID_NOMATCH){
726  xml* spXml = (xml*)spData->vpUserData;
727  vLogMsg(spXml, spXml->uiSavedOffset, "Malformed element declaration.");
728  XML_THROW("Element declaration expected closure not found");
729  }
730 }
731 /*********************************************************
732  * DOCUMENT TYPE DECLARATION (DTD) +++++++++++++++++++++++
733  ********************************************************/
734 /*********************************************************
735  * ENTITY REFERENCES +++++++++++++++++++++++++++++++++++++
736  ********************************************************/
737 void vRefClose(callback_data* spData){
738  if(spData->uiParserState == ID_NOMATCH){
739  xml* spXml = (xml*)spData->vpUserData;
740  XML_THROW("mal formed reference, expected ; not found");
741  }
742 }
743 /*********************************************************
744  * ENTITY REFERENCES -------------------------------------
745  ********************************************************/
vExtSubset
void vExtSubset(callback_data *spData)
Definition: declarations.c:367
vThrowError
void vThrowError(xml *spXml, const char *cpMsg, aint uiOffset, unsigned int uiLine, const char *cpFile, const char *cpFunc)
Definition: basics.c:47
UTF_16
#define UTF_16
Data type macro for UTF-16 encoding/decoding.
Definition: conv.h:79
dtd_info::spNotationValues
u32_phrase * spNotationValues
A list of the Notation values, if any.
Definition: xml.h:100
dtd_info::spGEValues
u32_phrase * spGEValues
A list of (uiGEDeclsUnique) declared General Entity Declaration values, if any.
Definition: xml.h:94
vXmlDeclClose
void vXmlDeclClose(callback_data *spData)
Definition: declarations.c:86
vGEDefEx
void vGEDefEx(callback_data *spData)
Definition: declarations.c:447
vCloseQuote
void vCloseQuote(callback_data *spData)
Definition: declarations.c:501
dtd_info::spAttNames
u32_phrase * spAttNames
A list of (uiAttListsUnique) names of declared attribute defaults.
Definition: xml.h:96
dtd_info::spName
u32_phrase * spName
The DTD name (name of the root element).
Definition: xml.h:92
cdata_id::uiLength
uint32_t uiLength
The number of 32-bit data characters.
Definition: xmlp.h:44
vElementOpen
void vElementOpen(callback_data *spData)
Definition: declarations.c:717
vRefClose
void vRefClose(callback_data *spData)
Definition: declarations.c:737
vSDeclOther
void vSDeclOther(callback_data *spData)
Definition: declarations.c:194
callback_data::uiParserOffset
aint uiParserOffset
[read only] Offset from acpString to the first character to match
Definition: parser.h:160
uiMsgsCount
aint uiMsgsCount(void *vpCtx)
Get the number of logged messages.
Definition: msglog.c:213
callback_data::acpString
const achar * acpString
[read only] Pointer to the input sub-string,
Definition: parser.h:156
bCompNames
abool bCompNames(const uint32_t *uipLName, uint32_t uiLLen, const uint32_t *uipRName, uint32_t uiRLen)
Definition: basics.c:676
vDtdName
void vDtdName(callback_data *spData)
Definition: declarations.c:233
xml
This is the encapsulated data for the xml component. The component context or handle is an opaque poi...
att_decl::sAttValue
cdata_id sAttValue
The attribute normalized value, offset and length.
Definition: xmlp.h:65
callback_data::uiParserState
aint uiParserState
[read only] ID_ACTIVE if the parser is going down the tree. ID_MATCH or ID_NOMATCH if coming up the t...
Definition: parser.h:158
dtd_info::uiPERefs
aint uiPERefs
The number of Parameter Entity references.
Definition: xml.h:81
vNExternalID
void vNExternalID(callback_data *spData)
Definition: declarations.c:382
vAttlistClose
void vAttlistClose(callback_data *spData)
Definition: declarations.c:666
vSDeclYes
void vSDeclYes(callback_data *spData)
Definition: declarations.c:200
vPERefError
void vPERefError(callback_data *spData)
Definition: declarations.c:408
entity_decl
Provides the offset into the general 32-bit vector and length of a name and value pair.
Definition: xmlp.h:80
dtd_info::bExtSubset
abool bExtSubset
True if an external subset is declared.
Definition: xml.h:78
dtd_info::uiExternalIds
aint uiExternalIds
The number of external IDs declared.
Definition: xml.h:79
dtd_info::uiAttListsDeclared
aint uiAttListsDeclared
The number of ALL Attribute declarations.
Definition: xml.h:87
dtd_info::spAttElementNames
u32_phrase * spAttElementNames
A list of (uiAttListsUnique) element names of declared attribute defaults.
Definition: xml.h:95
vpVecAt
void * vpVecAt(void *vpCtx, aint uiIndex)
Get a the indexed vector element. The vector is not altered.
Definition: vector.c:362
vGERef
void vGERef(callback_data *spData)
Definition: declarations.c:513
xmldecl_info::cpExists
const char * cpExists
"yes" if the XML declaration exists, "no" otherwise.
Definition: xml.h:59
xmldecl_info::cpStandalone
const char * cpStandalone
The value of the standalone declaration.
Definition: xml.h:65
vSDeclNo
void vSDeclNo(callback_data *spData)
Definition: declarations.c:207
dtd_info::uiGEDeclsUnique
aint uiGEDeclsUnique
A count of the unique and valid General Entities declared.
Definition: xml.h:83
spLeftMostElement
att_decl * spLeftMostElement(xml *spXml, att_decl *spAttList)
Definition: basics.c:606
iEntityComp
int iEntityComp(const void *vpL, const void *vpR)
Definition: basics.c:832
vAttType
void vAttType(callback_data *spData)
Definition: declarations.c:575
UTF_16BE
#define UTF_16BE
Data type macro for UTF-16BE encoding/decoding.
Definition: conv.h:81
aint
uint_fast32_t aint
The APG parser's unsigned integer type.
Definition: apg.h:79
vpVecLast
void * vpVecLast(void *vpCtx)
Get the last element one the vector. The vector is not altered.
Definition: vector.c:343
entity_decl::sValue
cdata_id sValue
The offset (into vpVec32) and length of the value.
Definition: xmlp.h:83
callbacks.h
Declaration for all of the XML Component parser callback functions.
dtd_info::spAttValues
u32_phrase * spAttValues
A list of (uiAttListsUnique) normalized values of declared attribute defaults.
Definition: xml.h:98
callback_data::uiParserPhraseLength
aint uiParserPhraseLength
[read only] The parser's matched phrase length if uiParserState is ID_MATCH or ID_NOMATCH....
Definition: parser.h:161
vEncDef
void vEncDef(callback_data *spData)
Definition: declarations.c:174
cdata_id::uiOffset
uint32_t uiOffset
The offset into vpVec32 array for the start of the data.
Definition: xmlp.h:43
vAttlistOpen
void vAttlistOpen(callback_data *spData)
Definition: declarations.c:535
vMsgsClear
void vMsgsClear(void *vpCtx)
Clears the object of all messages.
Definition: msglog.c:124
vDtdClose
void vDtdClose(callback_data *spData)
Definition: declarations.c:241
iAttComp
int iAttComp(const void *vpL, const void *vpR)
Definition: basics.c:808
att_decl::sElementName
cdata_id sElementName
The element name, offset and length.
Definition: xmlp.h:62
vEntityChar
void vEntityChar(callback_data *spData)
Definition: declarations.c:507
sNormalizeAttributeValue
cdata_id sNormalizeAttributeValue(xml *spXml, aint uiOffset, uint32_t *uipAttValue, uint32_t uiLength, abool bIsCDATA)
Definition: basics.c:682
uiVecLen
aint uiVecLen(void *vpCtx)
Get the vector length. That is, the number of elements on the vector.
Definition: vector.c:385
vVersionNum
void vVersionNum(callback_data *spData)
Definition: declarations.c:158
dtd_info::spNotationNames
u32_phrase * spNotationNames
A list of the Notation names, if any.
Definition: xml.h:99
dtd_info::uiGEDeclsNotProcessed
aint uiGEDeclsNotProcessed
The number of General Entity declarations not processed because of condition:
Definition: xml.h:85
dtd_info
Information about the Document Type Declaration.
Definition: xml.h:75
cpUtilUtfTypeName
const char * cpUtilUtfTypeName(aint uiType)
Convert a conversion type identifier to a readable, printable ASCII string. Conversion type identifie...
Definition: utilities.c:607
entity_decl::sName
cdata_id sName
The offset (into vpVec32) and length of the name.
Definition: xmlp.h:82
vMakeCDataDisplay
void vMakeCDataDisplay(xml *spXml, cdata_id *spDataId, u32_phrase *spCData, aint uiOffset)
Definition: basics.c:156
ID_ACTIVE
#define ID_ACTIVE
indicates active parser state, parser has just entered the node and is moving down the parse tree
Definition: parser.h:72
vNotationOpen
void vNotationOpen(callback_data *spData)
Definition: declarations.c:675
ID_MATCH
#define ID_MATCH
indicates a matched phrase parser state on return from parse tree below this node
Definition: parser.h:73
xmldecl_info
Information about the XML declaration.
Definition: xml.h:58
vDtdOpen
void vDtdOpen(callback_data *spData)
Definition: declarations.c:221
callback_data
The data struct passed to each callback function.
Definition: parser.h:134
spEntityNameLookup
entity_decl * spEntityNameLookup(xml *spXml, aint uiOffset, uint32_t *uipName, uint32_t uiNameLen)
Find the left-most occurrence of the given entity name.
Definition: basics.c:645
XML_THROW
#define XML_THROW(msg)
Definition: callbacks.h:53
UTF_16LE
#define UTF_16LE
Data type macro for UTF-16LE encoding/decoding.
Definition: conv.h:83
att_decl::uiAttCount
aint uiAttCount
The number of different attribute names associated with this element name.
Definition: xmlp.h:66
vExternalID
void vExternalID(callback_data *spData)
Definition: declarations.c:375
dtd_info::bExists
abool bExists
True if the DTD exists, false otherwise.
Definition: xml.h:76
vAttlistValue
void vAttlistValue(callback_data *spData)
Definition: declarations.c:600
vpVecFirst
void * vpVecFirst(void *vpCtx)
Get the first element one the vector. The vector is not altered.
Definition: vector.c:326
vpVecPushn
void * vpVecPushn(void *vpCtx, void *vpElement, aint uiCount)
Adds one or more elements to the end of the array.
Definition: vector.c:221
dtd_info::uiGEDeclsDeclared
aint uiGEDeclsDeclared
A count of ALL General Entities declared.
Definition: xml.h:82
vGEDeclName
void vGEDeclName(callback_data *spData)
Definition: declarations.c:417
vPEDeclClose
void vPEDeclClose(callback_data *spData)
Definition: declarations.c:396
vGEPERef
void vGEPERef(callback_data *spData)
Definition: declarations.c:440
vPEReference
void vPEReference(callback_data *spData)
Definition: declarations.c:402
xmldecl_info::cpVersion
const char * cpVersion
The value of version="1.ddd". Default is 1.0. Any other value is a fatal error.
Definition: xml.h:60
callback_data::vpUserData
void * vpUserData
[input/output] User-defined data passed to to the parser in parser_config.
Definition: parser.h:136
APG_TRUE
#define APG_TRUE
Definition: apg.h:291
vAttDef
void vAttDef(callback_data *spData)
Definition: declarations.c:614
vNotationDef
void vNotationDef(callback_data *spData)
Definition: declarations.c:697
dtd_info::spAttTypes
u32_phrase * spAttTypes
A list of (uiAttListsUnique) types of declared attribute defaults.
Definition: xml.h:97
vXmlDeclOpen
void vXmlDeclOpen(callback_data *spData)
Definition: declarations.c:69
dtd_info::uiAttListsUnique
aint uiAttListsUnique
The number of unique and valid Attribute declarations.
Definition: xml.h:88
UTF_8
#define UTF_8
Data type macro for UTF-8 encoding/decoding.
Definition: conv.h:77
att_decl::sAttName
cdata_id sAttName
The attribute name, offset and length.
Definition: xmlp.h:63
att_decl::sAttType
cdata_id sAttType
attribute type, offset and length.
Definition: xmlp.h:64
dtd_info::uiElementDecls
aint uiElementDecls
The number of element declarations found.
Definition: xml.h:102
ID_NOMATCH
#define ID_NOMATCH
indicates that no phrase was matched on return from parse tree below this node
Definition: parser.h:74
vEncName
void vEncName(callback_data *spData)
Definition: declarations.c:180
xmldecl_info::cpEncoding
const char * cpEncoding
If present must be UTF-8 or UTF-16. It is a fatal error if the data is not in the specified format....
Definition: xml.h:62
dtd_info::uiAttListsNotProcessed
aint uiAttListsNotProcessed
The number of Attribute List declarations not processed because of above condition:
Definition: xml.h:90
dtd_info::bStandalone
abool bStandalone
True if standalone = "yes", false if standalone = "no".
Definition: xml.h:77
u32_phrase
Defines a pointer to an array of 32-bit unsigned integers plus its length. Typically needed by Unicod...
Definition: lib.h:73
vDocument
void vDocument(callback_data *spData)
Definition: declarations.c:51
vElementClose
void vElementClose(callback_data *spData)
Definition: declarations.c:724
callback_data::uiStringLength
aint uiStringLength
[read only] The input string length.
Definition: parser.h:157
att_decl
Identifies the element name, attribute name and default attribute value of attribute list declaration...
Definition: xmlp.h:60
vVersionInfo
void vVersionInfo(callback_data *spData)
Definition: declarations.c:152
dtd_info::uiPEDecls
aint uiPEDecls
The number of Parameter Entities declared.
Definition: xml.h:80
CABUF_LEN
#define CABUF_LEN
Definition: callbacks.h:51
vPEDeclOpen
void vPEDeclOpen(callback_data *spData)
Definition: declarations.c:390
vpVecPush
void * vpVecPush(void *vpCtx, void *vpElement)
Adds one element to the end of the array.
Definition: vector.c:193
dtd_info::uiNotationDecls
aint uiNotationDecls
The number of notation declarations found.
Definition: xml.h:101
vGEDeclClose
void vGEDeclClose(callback_data *spData)
Definition: declarations.c:454
vAttName
void vAttName(callback_data *spData)
Definition: declarations.c:557
vConvertParsedData
void vConvertParsedData(xml *spXml, const achar *acpData, aint uiDataLen, uint32_t *uipOffset, uint32_t *uipLength)
Converts parsed UTF-8 data to UTF-32 code points.
Definition: basics.c:234
vVecClear
void vVecClear(void *vpCtx)
Clears all used elements in a vector component.
Definition: vector.c:420
vLogMsg
void vLogMsg(xml *spXml, aint uiOffset, char *cpTitle)
Definition: basics.c:61
dtd_info::spGENames
u32_phrase * spGENames
A list of (uiGEDeclsUnique) declared General Entity names, if any.
Definition: xml.h:93
vNotationClose
void vNotationClose(callback_data *spData)
Definition: declarations.c:710
APG_FALSE
#define APG_FALSE
Definition: apg.h:292
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.