ReactOS  0.4.15-dev-3299-gbe8e5fc
xmllint.c File Reference
#include "libxml.h"
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <time.h>
#include <sys/timeb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/debugXML.h>
#include <libxml/xmlerror.h>
#include <libxml/globals.h>
#include <libxml/xmlreader.h>
Include dependency graph for xmllint.c:

Go to the source code of this file.

Macros

#define XML_XML_DEFAULT_CATALOG   "file:///etc/xml/catalog"
 
#define MAX_PATHS   64
 
#define PATH_SEPARATOR   ':'
 
#define CLOCKS_PER_SEC   100
 

Enumerations

enum  xmllintReturnCode {
  XMLLINT_RETURN_OK = 0, XMLLINT_ERR_UNCLASS = 1, XMLLINT_ERR_DTD = 2, XMLLINT_ERR_VALID = 3,
  XMLLINT_ERR_RDFILE = 4, XMLLINT_ERR_SCHEMACOMP = 5, XMLLINT_ERR_OUT = 6, XMLLINT_ERR_SCHEMAPAT = 7,
  XMLLINT_ERR_RDREGIS = 8, XMLLINT_ERR_MEM = 9, XMLLINT_ERR_XPATH = 10
}
 

Functions

static void parsePath (const xmlChar *path)
 
static xmlParserInputPtr xmllintExternalEntityLoader (const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
 
static void OOM (void)
 
static void myFreeFunc (void *mem)
 
static voidmyMallocFunc (size_t size)
 
static voidmyReallocFunc (void *mem, size_t size)
 
static charmyStrdupFunc (const char *str)
 
static void startTimer (void)
 
static void XMLCDECL LIBXML_ATTR_FORMAT (1, 2)
 
static void xmlHTMLEncodeSend (void)
 
static void xmlHTMLPrintFileInfo (xmlParserInputPtr input)
 
static void xmlHTMLPrintFileContext (xmlParserInputPtr input)
 
static void XMLCDECL LIBXML_ATTR_FORMAT (2, 3)
 
static int myRead (void *f, char *buf, int len)
 
static int myClose (void *context)
 
static int isStandaloneDebug (void *ctx ATTRIBUTE_UNUSED)
 
static int hasInternalSubsetDebug (void *ctx ATTRIBUTE_UNUSED)
 
static int hasExternalSubsetDebug (void *ctx ATTRIBUTE_UNUSED)
 
static void internalSubsetDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
 
static void externalSubsetDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
 
static xmlParserInputPtr resolveEntityDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId)
 
: The entity name

getParameterEntityDebug: @ctxt: An XML parser context

Get a parameter entity by name

Returns the xmlParserInputPtr

static xmlEntityPtr getEntityDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
 
static xmlEntityPtr getParameterEntityDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
 
: the attribute name

attributeDeclDebug: @ctxt: An XML parser context

@type: the attribute type

An attribute definition has been parsed

static void attributeDeclDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *elem, const xmlChar *name, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
 
: The name of the notation

notationDeclDebug: @ctxt: An XML parser context

@publicId: The public ID of the entity @systemId: The system ID of the entity

What to do when a notation declaration has been parsed.

static void notationDeclDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
 
: The name of the entity

unparsedEntityDeclDebug: @ctxt: An XML parser context

@publicId: The public ID of the entity @systemId: The system ID of the entity @notationName: the name of the notation

What to do when an unparsed entity declaration is parsed

static void unparsedEntityDeclDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
 
static void setDocumentLocatorDebug (void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
 
static void startDocumentDebug (void *ctx ATTRIBUTE_UNUSED)
 
static void endDocumentDebug (void *ctx ATTRIBUTE_UNUSED)
 

Variables

static int debug = 0
 
static int maxmem = 0
 
static int recovery = 0
 
static int noent = 0
 
static int noenc = 0
 
static int noblanks = 0
 
static int noout = 0
 
static int nowrap = 0
 
static int repeat = 0
 
static int insert = 0
 
static int htmlout = 0
 
static int testIO = 0
 
static charencoding = NULL
 
static int dtdattrs = 0
 
static int loaddtd = 0
 
static xmllintReturnCode progresult = XMLLINT_RETURN_OK
 
static int quiet = 0
 
static int timing = 0
 
static int generate = 0
 
static int dropdtd = 0
 
static int chkregister = 0
 
static int nbregister = 0
 
static int options = XML_PARSE_COMPACT | XML_PARSE_BIG_LINES
 
static int sax = 0
 
static int oldxml10 = 0
 
static xmlCharpaths [MAX_PATHS+1]
 
static int nbpaths = 0
 
static int load_trace = 0
 
static xmlExternalEntityLoader defaultEntityLoader = NULL
 
static clock_t begin
 
static clock_t end
 
static char buffer [50000]
 
static xmlSAXHandler emptySAXHandlerStruct
 
static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct
 
static int callbacks
 

: The entity name

referenceDebug: @ctxt: An XML parser context

called when an entity reference is detected.

xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct
 
static xmlSAXHandler debugSAXHandlerStruct
 
static void entityDeclDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
 
static void referenceDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
 
static void ignorableWhitespaceDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
 
static void processingInstructionDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *target, const xmlChar *data)
 
static void cdataBlockDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *value, int len)
 
static void commentDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
 

: The element name

endElementDebug: @ctxt: An XML parser context

called when the end of an element has been detected.

static xmlSAXHandler debugSAX2HandlerStruct
 
static xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct
 
static void elementDeclDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, xmlElementContentPtr content ATTRIBUTE_UNUSED)
 
static void startElementDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts)
 
static void endElementDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
 
static void charactersDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
 
static void startElementNsDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
 
static void endElementNsDebug (void *ctx ATTRIBUTE_UNUSED, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
 
static void testSAX (const char *filename)
 
static void parseAndPrintFile (char *filename, xmlParserCtxtPtr rectxt)
 
static void showVersion (const char *name)
 
static void usage (FILE *f, const char *name)
 
static void registerNode (xmlNodePtr node)
 
static void deregisterNode (xmlNodePtr node)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC   100

Definition at line 464 of file xmllint.c.

◆ MAX_PATHS

#define MAX_PATHS   64

Definition at line 207 of file xmllint.c.

◆ PATH_SEPARATOR

#define PATH_SEPARATOR   ':'

Definition at line 211 of file xmllint.c.

◆ XML_XML_DEFAULT_CATALOG

#define XML_XML_DEFAULT_CATALOG   "file:///etc/xml/catalog"

Definition at line 90 of file xmllint.c.

Enumeration Type Documentation

◆ xmllintReturnCode

Enumerator
XMLLINT_RETURN_OK 
XMLLINT_ERR_UNCLASS 
XMLLINT_ERR_DTD 
XMLLINT_ERR_VALID 
XMLLINT_ERR_RDFILE 
XMLLINT_ERR_SCHEMACOMP 
XMLLINT_ERR_OUT 
XMLLINT_ERR_SCHEMAPAT 
XMLLINT_ERR_RDREGIS 
XMLLINT_ERR_MEM 
XMLLINT_ERR_XPATH 

Definition at line 93 of file xmllint.c.

93  {
94  XMLLINT_RETURN_OK = 0, /* No error */
95  XMLLINT_ERR_UNCLASS = 1, /* Unclassified */
96  XMLLINT_ERR_DTD = 2, /* Error in DTD */
97  XMLLINT_ERR_VALID = 3, /* Validation error */
98  XMLLINT_ERR_RDFILE = 4, /* CtxtReadFile error */
99  XMLLINT_ERR_SCHEMACOMP = 5, /* Schema compilation */
100  XMLLINT_ERR_OUT = 6, /* Error writing output */
101  XMLLINT_ERR_SCHEMAPAT = 7, /* Error in schema pattern */
102  XMLLINT_ERR_RDREGIS = 8, /* Error in Reader registration */
103  XMLLINT_ERR_MEM = 9, /* Out of memory error */
104  XMLLINT_ERR_XPATH = 10 /* XPath evaluation error */
xmllintReturnCode
Definition: xmllint.c:93

Function Documentation

◆ attributeDeclDebug()

static void attributeDeclDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar elem,
const xmlChar name,
int  type,
int  def,
const xmlChar defaultValue,
xmlEnumerationPtr  tree 
)
static

Definition at line 1097 of file xmllint.c.

1100 {
1101  callbacks++;
1102  if (noout)
1103  return;
1104  if (defaultValue == NULL)
1105  fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n",
1106  elem, name, type, def);
1107  else
1108  fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
1109  elem, name, type, def, defaultValue);
1111 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static size_t elem
Definition: string.c:68
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int callbacks
Definition: xmllint.c:880
XMLPUBFUN void XMLCALL xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c:1831
static int noout
Definition: xmllint.c:119

◆ cdataBlockDebug()

static void cdataBlockDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar value,
int  len 
)
static

cdataBlockDebug: @ctx: the user data (XML parser context) @value: The pcdata content @len: the block length

called when a pcdata block has been parsed

Definition at line 1372 of file xmllint.c.

1373 {
1374  callbacks++;
1375  if (noout)
1376  return;
1377  fprintf(stdout, "SAX.pcdata(%.20s, %d)\n",
1378  (char *) value, len);
1379 }
Definition: pdh_main.c:93
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLenum GLsizei len
Definition: glext.h:6722
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ charactersDebug()

static void charactersDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar ch,
int  len 
)
static

charactersDebug: @ctxt: An XML parser context @ch: a xmlChar string @len: the number of xmlChar

receiving some chars from the parser. Question: how much at a time ???

Definition at line 1283 of file xmllint.c.

1284 {
1285  char out[40];
1286  int i;
1287 
1288  callbacks++;
1289  if (noout)
1290  return;
1291  for (i = 0;(i<len) && (i < 30);i++)
1292  out[i] = ch[i];
1293  out[i] = 0;
1294 
1295  fprintf(stdout, "SAX.characters(%s, %d)\n", out, len);
1296 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static FILE * out
Definition: regtests2xml.c:44
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ commentDebug()

static void commentDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar value 
)
static

commentDebug: @ctxt: An XML parser context @value: the comment content

A comment has been parsed.

Definition at line 1389 of file xmllint.c.

1390 {
1391  callbacks++;
1392  if (noout)
1393  return;
1394  fprintf(stdout, "SAX.comment(%s)\n", value);
1395 }
Definition: pdh_main.c:93
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ deregisterNode()

static void deregisterNode ( xmlNodePtr  node)
static

Definition at line 3120 of file xmllint.c.

3121 {
3122  assert(node->_private != NULL);
3123  assert(*(long*)node->_private == (long) 0x81726354);
3124  free(node->_private);
3125  nbregister--;
3126 }
static int nbregister
Definition: xmllint.c:191
#define free
Definition: debug_ros.c:5
#define assert(x)
Definition: debug.h:53
#define NULL
Definition: types.h:112
Definition: dlist.c:348

Referenced by main().

◆ elementDeclDebug()

static void elementDeclDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
int  type,
xmlElementContentPtr content  ATTRIBUTE_UNUSED 
)
static

Definition at line 1123 of file xmllint.c.

1125 {
1126  callbacks++;
1127  if (noout)
1128  return;
1129  fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
1130  name, type);
1131 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ endDocumentDebug()

static void endDocumentDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

endDocumentDebug: @ctxt: An XML parser context

called when the document end has been detected.

Definition at line 1223 of file xmllint.c.

1224 {
1225  callbacks++;
1226  if (noout)
1227  return;
1228  fprintf(stdout, "SAX.endDocument()\n");
1229 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ endElementDebug()

static void endElementDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name 
)
static

Definition at line 1265 of file xmllint.c.

1266 {
1267  callbacks++;
1268  if (noout)
1269  return;
1270  fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
1271 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ endElementNsDebug()

static void endElementNsDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar localname,
const xmlChar prefix,
const xmlChar URI 
)
static

Definition at line 1571 of file xmllint.c.

1575 {
1576  callbacks++;
1577  if (noout)
1578  return;
1579  fprintf(stdout, "SAX.endElementNs(%s", (char *) localname);
1580  if (prefix == NULL)
1581  fprintf(stdout, ", NULL");
1582  else
1583  fprintf(stdout, ", %s", (char *) prefix);
1584  if (URI == NULL)
1585  fprintf(stdout, ", NULL)\n");
1586  else
1587  fprintf(stdout, ", '%s')\n", (char *) URI);
1588 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ entityDeclDebug()

static void entityDeclDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
int  type,
const xmlChar publicId,
const xmlChar systemId,
xmlChar content 
)
static

Definition at line 1070 of file xmllint.c.

1072 {
1073 const xmlChar *nullstr = BAD_CAST "(null)";
1074  /* not all libraries handle printing null pointers nicely */
1075  if (publicId == NULL)
1076  publicId = nullstr;
1077  if (systemId == NULL)
1078  systemId = nullstr;
1079  if (content == NULL)
1080  content = (xmlChar *)nullstr;
1081  callbacks++;
1082  if (noout)
1083  return;
1084  fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
1085  name, type, publicId, systemId, content);
1086 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
content
Definition: atl_ax.c:993
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ externalSubsetDebug()

static void externalSubsetDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
const xmlChar ExternalID,
const xmlChar SystemID 
)
static

externalSubsetDebug: @ctxt: An XML parser context

Does this document has an external subset

Definition at line 967 of file xmllint.c.

969 {
970  callbacks++;
971  if (noout)
972  return;
973  fprintf(stdout, "SAX.externalSubset(%s,", name);
974  if (ExternalID == NULL)
975  fprintf(stdout, " ,");
976  else
977  fprintf(stdout, " %s,", ExternalID);
978  if (SystemID == NULL)
979  fprintf(stdout, " )\n");
980  else
981  fprintf(stdout, " %s)\n", SystemID);
982 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ getEntityDebug()

static xmlEntityPtr getEntityDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name 
)
static

Definition at line 1029 of file xmllint.c.

1030 {
1031  callbacks++;
1032  if (noout)
1033  return(NULL);
1034  fprintf(stdout, "SAX.getEntity(%s)\n", name);
1035  return(NULL);
1036 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ getParameterEntityDebug()

static xmlEntityPtr getParameterEntityDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name 
)
static

Definition at line 1048 of file xmllint.c.

1049 {
1050  callbacks++;
1051  if (noout)
1052  return(NULL);
1053  fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
1054  return(NULL);
1055 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ hasExternalSubsetDebug()

static int hasExternalSubsetDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

hasExternalSubsetDebug: @ctxt: An XML parser context

Does this document has an external subset

Returns 1 if true

Definition at line 927 of file xmllint.c.

928 {
929  callbacks++;
930  if (noout)
931  return(0);
932  fprintf(stdout, "SAX.hasExternalSubset()\n");
933  return(0);
934 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ hasInternalSubsetDebug()

static int hasInternalSubsetDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

hasInternalSubsetDebug: @ctxt: An XML parser context

Does this document has an internal subset

Returns 1 if true

Definition at line 909 of file xmllint.c.

910 {
911  callbacks++;
912  if (noout)
913  return(0);
914  fprintf(stdout, "SAX.hasInternalSubset()\n");
915  return(0);
916 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ ignorableWhitespaceDebug()

static void ignorableWhitespaceDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar ch,
int  len 
)
static

ignorableWhitespaceDebug: @ctxt: An XML parser context @ch: a xmlChar string @start: the first char in the string @len: the number of xmlChar

receiving some ignorable whitespaces from the parser. Question: how much at a time ???

Definition at line 1325 of file xmllint.c.

1326 {
1327  char out[40];
1328  int i;
1329 
1330  callbacks++;
1331  if (noout)
1332  return;
1333  for (i = 0;(i<len) && (i < 30);i++)
1334  out[i] = ch[i];
1335  out[i] = 0;
1336  fprintf(stdout, "SAX.ignorableWhitespace(%s, %d)\n", out, len);
1337 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static FILE * out
Definition: regtests2xml.c:44
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ internalSubsetDebug()

static void internalSubsetDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
const xmlChar ExternalID,
const xmlChar SystemID 
)
static

internalSubsetDebug: @ctxt: An XML parser context

Does this document has an internal subset

Definition at line 943 of file xmllint.c.

945 {
946  callbacks++;
947  if (noout)
948  return;
949  fprintf(stdout, "SAX.internalSubset(%s,", name);
950  if (ExternalID == NULL)
951  fprintf(stdout, " ,");
952  else
953  fprintf(stdout, " %s,", ExternalID);
954  if (SystemID == NULL)
955  fprintf(stdout, " )\n");
956  else
957  fprintf(stdout, " %s)\n", SystemID);
958 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ isStandaloneDebug()

static int isStandaloneDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

isStandaloneDebug: @ctxt: An XML parser context

Is this document tagged standalone ?

Returns 1 if true

Definition at line 891 of file xmllint.c.

892 {
893  callbacks++;
894  if (noout)
895  return(0);
896  fprintf(stdout, "SAX.isStandalone()\n");
897  return(0);
898 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ LIBXML_ATTR_FORMAT() [1/2]

static void XMLCDECL LIBXML_ATTR_FORMAT ( ,
 
)
static

Definition at line 473 of file xmllint.c.

475 {
476  long msec;
477  va_list ap;
478 
479  end = clock();
480  msec = ((end - begin) * 1000) / CLOCKS_PER_SEC;
481 
482 #ifndef HAVE_STDARG_H
483 #error "endTimer required stdarg functions"
484 #endif
485  va_start(ap, fmt);
486  vfprintf(stderr, fmt, ap);
487  va_end(ap);
488  fprintf(stderr, " took %ld ms\n", msec);
489 }
#define CLOCKS_PER_SEC
Definition: xmllint.c:464
#define va_end(ap)
Definition: acmsvcex.h:90
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char * va_list
Definition: acmsvcex.h:78
static clock_t begin
Definition: xmllint.c:467
va_start(ap, x)
GLuint GLuint end
Definition: gl.h:1545
_Check_return_ _CRTIMP clock_t __cdecl clock(void)
Definition: clock.c:23
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
FILE * stderr
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
Definition: dsound.c:943

◆ LIBXML_ATTR_FORMAT() [2/2]

static void XMLCDECL LIBXML_ATTR_FORMAT ( ,
 
)
static

xmlHTMLError: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format an error messages, gives file, line, position and extra parameters.

xmlHTMLWarning: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a warning messages, gives file, line, position and extra parameters.

xmlHTMLValidityError: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format an validity error messages, gives file, line, position and extra parameters.

xmlHTMLValidityWarning: @ctx: an XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a validity warning messages, gives file, line, position and extra parameters.

warningDebug: @ctxt: An XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a warning messages, gives file, line, position and extra parameters.

errorDebug: @ctxt: An XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a error messages, gives file, line, position and extra parameters.

fatalErrorDebug: @ctxt: An XML parser context @msg: the message to display/transmit ...: extra parameters for the message display

Display and format a fatalError messages, gives file, line, position and extra parameters.

Definition at line 628 of file xmllint.c.

630 {
633  va_list args;
634  int len;
635 
636  buffer[0] = 0;
637  input = ctxt->input;
638  if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
639  input = ctxt->inputTab[ctxt->inputNr - 2];
640  }
641 
643 
644  xmlGenericError(xmlGenericErrorContext, "<b>error</b>: ");
645  va_start(args, msg);
646  len = strlen(buffer);
647  vsnprintf(&buffer[len], sizeof(buffer) - len, msg, args);
648  va_end(args);
651 
654 }
#define vsnprintf
Definition: tif_win32.c:406
#define args
Definition: format.c:66
xmlParserInputPtr * inputTab
Definition: parser.h:204
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void xmlHTMLEncodeSend(void)
Definition: xmllint.c:529
GLuint buffer
Definition: glext.h:5915
Definition: match.c:390
xmlParserInputPtr input
Definition: parser.h:201
#define va_end(ap)
Definition: acmsvcex.h:90
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
char * va_list
Definition: acmsvcex.h:78
va_start(ap, x)
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
#define msg(x)
Definition: auth_time.c:54
static void xmlHTMLPrintFileContext(xmlParserInputPtr input)
Definition: xmllint.c:578
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362
static void xmlHTMLPrintFileInfo(xmlParserInputPtr input)
Definition: xmllint.c:554

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 3129 of file xmllint.c.

3129  {
3130  int i, acount;
3131  int files = 0;
3132  int version = 0;
3133  const char* indent;
3134 
3135  if (argc <= 1) {
3136  usage(stderr, argv[0]);
3137  return(1);
3138  }
3140  for (i = 1; i < argc ; i++) {
3141  if (!strcmp(argv[i], "-"))
3142  break;
3143 
3144  if (argv[i][0] != '-')
3145  continue;
3146  if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
3147  debug++;
3148  else
3149 #ifdef LIBXML_DEBUG_ENABLED
3150  if ((!strcmp(argv[i], "-shell")) ||
3151  (!strcmp(argv[i], "--shell"))) {
3152  shell++;
3153  noout = 1;
3154  } else
3155 #endif
3156 #ifdef LIBXML_TREE_ENABLED
3157  if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
3158  copy++;
3159  else
3160 #endif /* LIBXML_TREE_ENABLED */
3161  if ((!strcmp(argv[i], "-recover")) ||
3162  (!strcmp(argv[i], "--recover"))) {
3163  recovery++;
3165  } else if ((!strcmp(argv[i], "-huge")) ||
3166  (!strcmp(argv[i], "--huge"))) {
3168  } else if ((!strcmp(argv[i], "-noent")) ||
3169  (!strcmp(argv[i], "--noent"))) {
3170  noent++;
3172  } else if ((!strcmp(argv[i], "-noenc")) ||
3173  (!strcmp(argv[i], "--noenc"))) {
3174  noenc++;
3176  } else if ((!strcmp(argv[i], "-nsclean")) ||
3177  (!strcmp(argv[i], "--nsclean"))) {
3179  } else if ((!strcmp(argv[i], "-nocdata")) ||
3180  (!strcmp(argv[i], "--nocdata"))) {
3182  } else if ((!strcmp(argv[i], "-nodict")) ||
3183  (!strcmp(argv[i], "--nodict"))) {
3185  } else if ((!strcmp(argv[i], "-version")) ||
3186  (!strcmp(argv[i], "--version"))) {
3187  showVersion(argv[0]);
3188  version = 1;
3189  } else if ((!strcmp(argv[i], "-noout")) ||
3190  (!strcmp(argv[i], "--noout")))
3191  noout++;
3192 #ifdef LIBXML_OUTPUT_ENABLED
3193  else if ((!strcmp(argv[i], "-o")) ||
3194  (!strcmp(argv[i], "-output")) ||
3195  (!strcmp(argv[i], "--output"))) {
3196  i++;
3197  output = argv[i];
3198  }
3199 #endif /* LIBXML_OUTPUT_ENABLED */
3200  else if ((!strcmp(argv[i], "-htmlout")) ||
3201  (!strcmp(argv[i], "--htmlout")))
3202  htmlout++;
3203  else if ((!strcmp(argv[i], "-nowrap")) ||
3204  (!strcmp(argv[i], "--nowrap")))
3205  nowrap++;
3206 #ifdef LIBXML_HTML_ENABLED
3207  else if ((!strcmp(argv[i], "-html")) ||
3208  (!strcmp(argv[i], "--html"))) {
3209  html++;
3210  }
3211  else if ((!strcmp(argv[i], "-xmlout")) ||
3212  (!strcmp(argv[i], "--xmlout"))) {
3213  xmlout++;
3214  } else if ((!strcmp(argv[i], "-nodefdtd")) ||
3215  (!strcmp(argv[i], "--nodefdtd"))) {
3216  nodefdtd++;
3217  options |= HTML_PARSE_NODEFDTD;
3218  }
3219 #endif /* LIBXML_HTML_ENABLED */
3220  else if ((!strcmp(argv[i], "-loaddtd")) ||
3221  (!strcmp(argv[i], "--loaddtd"))) {
3222  loaddtd++;
3224  } else if ((!strcmp(argv[i], "-dtdattr")) ||
3225  (!strcmp(argv[i], "--dtdattr"))) {
3226  loaddtd++;
3227  dtdattrs++;
3229  }
3230 #ifdef LIBXML_VALID_ENABLED
3231  else if ((!strcmp(argv[i], "-valid")) ||
3232  (!strcmp(argv[i], "--valid"))) {
3233  valid++;
3235  } else if ((!strcmp(argv[i], "-postvalid")) ||
3236  (!strcmp(argv[i], "--postvalid"))) {
3237  postvalid++;
3238  loaddtd++;
3240  } else if ((!strcmp(argv[i], "-dtdvalid")) ||
3241  (!strcmp(argv[i], "--dtdvalid"))) {
3242  i++;
3243  dtdvalid = argv[i];
3244  loaddtd++;
3246  } else if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
3247  (!strcmp(argv[i], "--dtdvalidfpi"))) {
3248  i++;
3249  dtdvalidfpi = argv[i];
3250  loaddtd++;
3252  }
3253 #endif /* LIBXML_VALID_ENABLED */
3254  else if ((!strcmp(argv[i], "-dropdtd")) ||
3255  (!strcmp(argv[i], "--dropdtd")))
3256  dropdtd++;
3257  else if ((!strcmp(argv[i], "-insert")) ||
3258  (!strcmp(argv[i], "--insert")))
3259  insert++;
3260  else if ((!strcmp(argv[i], "-quiet")) ||
3261  (!strcmp(argv[i], "--quiet")))
3262  quiet++;
3263  else if ((!strcmp(argv[i], "-timing")) ||
3264  (!strcmp(argv[i], "--timing")))
3265  timing++;
3266  else if ((!strcmp(argv[i], "-auto")) ||
3267  (!strcmp(argv[i], "--auto")))
3268  generate++;
3269  else if ((!strcmp(argv[i], "-repeat")) ||
3270  (!strcmp(argv[i], "--repeat"))) {
3271  if (repeat)
3272  repeat *= 10;
3273  else
3274  repeat = 100;
3275  }
3276 #ifdef LIBXML_PUSH_ENABLED
3277  else if ((!strcmp(argv[i], "-push")) ||
3278  (!strcmp(argv[i], "--push")))
3279  push++;
3280  else if ((!strcmp(argv[i], "-pushsmall")) ||
3281  (!strcmp(argv[i], "--pushsmall"))) {
3282  push++;
3283  pushsize = 10;
3284  }
3285 #endif /* LIBXML_PUSH_ENABLED */
3286 #ifdef HAVE_MMAP
3287  else if ((!strcmp(argv[i], "-memory")) ||
3288  (!strcmp(argv[i], "--memory")))
3289  memory++;
3290 #endif
3291  else if ((!strcmp(argv[i], "-testIO")) ||
3292  (!strcmp(argv[i], "--testIO")))
3293  testIO++;
3294 #ifdef LIBXML_XINCLUDE_ENABLED
3295  else if ((!strcmp(argv[i], "-xinclude")) ||
3296  (!strcmp(argv[i], "--xinclude"))) {
3297  xinclude++;
3299  }
3300  else if ((!strcmp(argv[i], "-noxincludenode")) ||
3301  (!strcmp(argv[i], "--noxincludenode"))) {
3302  xinclude++;
3305  }
3306  else if ((!strcmp(argv[i], "-nofixup-base-uris")) ||
3307  (!strcmp(argv[i], "--nofixup-base-uris"))) {
3308  xinclude++;
3311  }
3312 #endif
3313 #ifdef LIBXML_OUTPUT_ENABLED
3314 #ifdef LIBXML_ZLIB_ENABLED
3315  else if ((!strcmp(argv[i], "-compress")) ||
3316  (!strcmp(argv[i], "--compress"))) {
3317  compress++;
3318  xmlSetCompressMode(9);
3319  }
3320 #endif
3321 #endif /* LIBXML_OUTPUT_ENABLED */
3322  else if ((!strcmp(argv[i], "-nowarning")) ||
3323  (!strcmp(argv[i], "--nowarning"))) {
3327  }
3328  else if ((!strcmp(argv[i], "-pedantic")) ||
3329  (!strcmp(argv[i], "--pedantic"))) {
3333  }
3334 #ifdef LIBXML_DEBUG_ENABLED
3335  else if ((!strcmp(argv[i], "-debugent")) ||
3336  (!strcmp(argv[i], "--debugent"))) {
3337  debugent++;
3339  }
3340 #endif
3341 #ifdef LIBXML_C14N_ENABLED
3342  else if ((!strcmp(argv[i], "-c14n")) ||
3343  (!strcmp(argv[i], "--c14n"))) {
3344  canonical++;
3346  }
3347  else if ((!strcmp(argv[i], "-c14n11")) ||
3348  (!strcmp(argv[i], "--c14n11"))) {
3349  canonical_11++;
3351  }
3352  else if ((!strcmp(argv[i], "-exc-c14n")) ||
3353  (!strcmp(argv[i], "--exc-c14n"))) {
3354  exc_canonical++;
3356  }
3357 #endif
3358 #ifdef LIBXML_CATALOG_ENABLED
3359  else if ((!strcmp(argv[i], "-catalogs")) ||
3360  (!strcmp(argv[i], "--catalogs"))) {
3361  catalogs++;
3362  } else if ((!strcmp(argv[i], "-nocatalogs")) ||
3363  (!strcmp(argv[i], "--nocatalogs"))) {
3364  nocatalogs++;
3365  }
3366 #endif
3367  else if ((!strcmp(argv[i], "-encode")) ||
3368  (!strcmp(argv[i], "--encode"))) {
3369  i++;
3370  encoding = argv[i];
3371  /*
3372  * OK it's for testing purposes
3373  */
3374  xmlAddEncodingAlias("UTF-8", "DVEnc");
3375  }
3376  else if ((!strcmp(argv[i], "-noblanks")) ||
3377  (!strcmp(argv[i], "--noblanks"))) {
3378  noblanks++;
3381  }
3382  else if ((!strcmp(argv[i], "-maxmem")) ||
3383  (!strcmp(argv[i], "--maxmem"))) {
3384  i++;
3385  if (sscanf(argv[i], "%d", &maxmem) == 1) {
3387  myStrdupFunc);
3388  } else {
3389  maxmem = 0;
3390  }
3391  }
3392  else if ((!strcmp(argv[i], "-format")) ||
3393  (!strcmp(argv[i], "--format"))) {
3394  noblanks++;
3395 #ifdef LIBXML_OUTPUT_ENABLED
3396  format = 1;
3397 #endif /* LIBXML_OUTPUT_ENABLED */
3399  }
3400  else if ((!strcmp(argv[i], "-pretty")) ||
3401  (!strcmp(argv[i], "--pretty"))) {
3402  i++;
3403 #ifdef LIBXML_OUTPUT_ENABLED
3404  if (argv[i] != NULL) {
3405  format = atoi(argv[i]);
3406  if (format == 1) {
3407  noblanks++;
3409  }
3410  }
3411 #endif /* LIBXML_OUTPUT_ENABLED */
3412  }
3413 #ifdef LIBXML_READER_ENABLED
3414  else if ((!strcmp(argv[i], "-stream")) ||
3415  (!strcmp(argv[i], "--stream"))) {
3416  stream++;
3417  }
3418  else if ((!strcmp(argv[i], "-walker")) ||
3419  (!strcmp(argv[i], "--walker"))) {
3420  walker++;
3421  noout++;
3422 #ifdef LIBXML_PATTERN_ENABLED
3423  } else if ((!strcmp(argv[i], "-pattern")) ||
3424  (!strcmp(argv[i], "--pattern"))) {
3425  i++;
3426  pattern = argv[i];
3427 #endif
3428  }
3429 #endif /* LIBXML_READER_ENABLED */
3430 #ifdef LIBXML_SAX1_ENABLED
3431  else if ((!strcmp(argv[i], "-sax1")) ||
3432  (!strcmp(argv[i], "--sax1"))) {
3433  sax1++;
3435  }
3436 #endif /* LIBXML_SAX1_ENABLED */
3437  else if ((!strcmp(argv[i], "-sax")) ||
3438  (!strcmp(argv[i], "--sax"))) {
3439  sax++;
3440  }
3441  else if ((!strcmp(argv[i], "-chkregister")) ||
3442  (!strcmp(argv[i], "--chkregister"))) {
3443  chkregister++;
3444 #ifdef LIBXML_SCHEMAS_ENABLED
3445  } else if ((!strcmp(argv[i], "-relaxng")) ||
3446  (!strcmp(argv[i], "--relaxng"))) {
3447  i++;
3448  relaxng = argv[i];
3449  noent++;
3451  } else if ((!strcmp(argv[i], "-schema")) ||
3452  (!strcmp(argv[i], "--schema"))) {
3453  i++;
3454  schema = argv[i];
3455  noent++;
3456 #endif
3457 #ifdef LIBXML_SCHEMATRON_ENABLED
3458  } else if ((!strcmp(argv[i], "-schematron")) ||
3459  (!strcmp(argv[i], "--schematron"))) {
3460  i++;
3461  schematron = argv[i];
3462  noent++;
3463 #endif
3464  } else if ((!strcmp(argv[i], "-nonet")) ||
3465  (!strcmp(argv[i], "--nonet"))) {
3468  } else if ((!strcmp(argv[i], "-nocompact")) ||
3469  (!strcmp(argv[i], "--nocompact"))) {
3471  } else if ((!strcmp(argv[i], "-load-trace")) ||
3472  (!strcmp(argv[i], "--load-trace"))) {
3473  load_trace++;
3474  } else if ((!strcmp(argv[i], "-path")) ||
3475  (!strcmp(argv[i], "--path"))) {
3476  i++;
3478 #ifdef LIBXML_XPATH_ENABLED
3479  } else if ((!strcmp(argv[i], "-xpath")) ||
3480  (!strcmp(argv[i], "--xpath"))) {
3481  i++;
3482  noout++;
3483  xpathquery = argv[i];
3484 #endif
3485  } else if ((!strcmp(argv[i], "-oldxml10")) ||
3486  (!strcmp(argv[i], "--oldxml10"))) {
3487  oldxml10++;
3489  } else {
3490  fprintf(stderr, "Unknown option %s\n", argv[i]);
3491  usage(stderr, argv[0]);
3492  return(1);
3493  }
3494  }
3495 
3496 #ifdef LIBXML_CATALOG_ENABLED
3497  if (nocatalogs == 0) {
3498  if (catalogs) {
3499  const char *catal;
3500 
3501  catal = getenv("SGML_CATALOG_FILES");
3502  if (catal != NULL) {
3503  xmlLoadCatalogs(catal);
3504  } else {
3505  fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n");
3506  }
3507  }
3508  }
3509 #endif
3510 
3511 #ifdef LIBXML_SAX1_ENABLED
3512  if (sax1)
3513  xmlSAXDefaultVersion(1);
3514  else
3515  xmlSAXDefaultVersion(2);
3516 #endif /* LIBXML_SAX1_ENABLED */
3517 
3518  if (chkregister) {
3521  }
3522 
3523  indent = getenv("XMLLINT_INDENT");
3524  if(indent != NULL) {
3526  }
3527 
3528 
3531 
3533  if (loaddtd != 0)
3535  if (dtdattrs)
3537  if (noent != 0) xmlSubstituteEntitiesDefault(1);
3538 #ifdef LIBXML_VALID_ENABLED
3540 #endif /* LIBXML_VALID_ENABLED */
3541  if ((htmlout) && (!nowrap)) {
3543  "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n");
3545  "\t\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n");
3547  "<html><head><title>%s output</title></head>\n",
3548  argv[0]);
3550  "<body bgcolor=\"#ffffff\"><h1 align=\"center\">%s output</h1>\n",
3551  argv[0]);
3552  }
3553 
3554 #ifdef LIBXML_SCHEMATRON_ENABLED
3555  if ((schematron != NULL) && (sax == 0)
3556 #ifdef LIBXML_READER_ENABLED
3557  && (stream == 0)
3558 #endif /* LIBXML_READER_ENABLED */
3559  ) {
3560  xmlSchematronParserCtxtPtr ctxt;
3561 
3562  /* forces loading the DTDs */
3565  if (timing) {
3566  startTimer();
3567  }
3568  ctxt = xmlSchematronNewParserCtxt(schematron);
3569 #if 0
3570  xmlSchematronSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
3571  NULL);
3572 #endif
3573  wxschematron = xmlSchematronParse(ctxt);
3574  if (wxschematron == NULL) {
3576  "Schematron schema %s failed to compile\n", schematron);
3578  schematron = NULL;
3579  }
3580  xmlSchematronFreeParserCtxt(ctxt);
3581  if (timing) {
3582  endTimer("Compiling the schemas");
3583  }
3584  }
3585 #endif
3586 #ifdef LIBXML_SCHEMAS_ENABLED
3587  if ((relaxng != NULL) && (sax == 0)
3588 #ifdef LIBXML_READER_ENABLED
3589  && (stream == 0)
3590 #endif /* LIBXML_READER_ENABLED */
3591  ) {
3592  xmlRelaxNGParserCtxtPtr ctxt;
3593 
3594  /* forces loading the DTDs */
3597  if (timing) {
3598  startTimer();
3599  }
3600  ctxt = xmlRelaxNGNewParserCtxt(relaxng);
3601  xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
3602  NULL);
3603  relaxngschemas = xmlRelaxNGParse(ctxt);
3604  if (relaxngschemas == NULL) {
3606  "Relax-NG schema %s failed to compile\n", relaxng);
3608  relaxng = NULL;
3609  }
3610  xmlRelaxNGFreeParserCtxt(ctxt);
3611  if (timing) {
3612  endTimer("Compiling the schemas");
3613  }
3614  } else if ((schema != NULL)
3615 #ifdef LIBXML_READER_ENABLED
3616  && (stream == 0)
3617 #endif
3618  ) {
3619  xmlSchemaParserCtxtPtr ctxt;
3620 
3621  if (timing) {
3622  startTimer();
3623  }
3624  ctxt = xmlSchemaNewParserCtxt(schema);
3625  xmlSchemaSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
3626  wxschemas = xmlSchemaParse(ctxt);
3627  if (wxschemas == NULL) {
3629  "WXS schema %s failed to compile\n", schema);
3631  schema = NULL;
3632  }
3633  xmlSchemaFreeParserCtxt(ctxt);
3634  if (timing) {
3635  endTimer("Compiling the schemas");
3636  }
3637  }
3638 #endif /* LIBXML_SCHEMAS_ENABLED */
3639 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
3640  if ((pattern != NULL) && (walker == 0)) {
3641  patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL);
3642  if (patternc == NULL) {
3644  "Pattern %s failed to compile\n", pattern);
3646  pattern = NULL;
3647  }
3648  }
3649 #endif /* LIBXML_READER_ENABLED && LIBXML_PATTERN_ENABLED */
3650  for (i = 1; i < argc ; i++) {
3651  if ((!strcmp(argv[i], "-encode")) ||
3652  (!strcmp(argv[i], "--encode"))) {
3653  i++;
3654  continue;
3655  } else if ((!strcmp(argv[i], "-o")) ||
3656  (!strcmp(argv[i], "-output")) ||
3657  (!strcmp(argv[i], "--output"))) {
3658  i++;
3659  continue;
3660  }
3661 #ifdef LIBXML_VALID_ENABLED
3662  if ((!strcmp(argv[i], "-dtdvalid")) ||
3663  (!strcmp(argv[i], "--dtdvalid"))) {
3664  i++;
3665  continue;
3666  }
3667  if ((!strcmp(argv[i], "-path")) ||
3668  (!strcmp(argv[i], "--path"))) {
3669  i++;
3670  continue;
3671  }
3672  if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
3673  (!strcmp(argv[i], "--dtdvalidfpi"))) {
3674  i++;
3675  continue;
3676  }
3677 #endif /* LIBXML_VALID_ENABLED */
3678  if ((!strcmp(argv[i], "-relaxng")) ||
3679  (!strcmp(argv[i], "--relaxng"))) {
3680  i++;
3681  continue;
3682  }
3683  if ((!strcmp(argv[i], "-maxmem")) ||
3684  (!strcmp(argv[i], "--maxmem"))) {
3685  i++;
3686  continue;
3687  }
3688  if ((!strcmp(argv[i], "-pretty")) ||
3689  (!strcmp(argv[i], "--pretty"))) {
3690  i++;
3691  continue;
3692  }
3693  if ((!strcmp(argv[i], "-schema")) ||
3694  (!strcmp(argv[i], "--schema"))) {
3695  i++;
3696  continue;
3697  }
3698  if ((!strcmp(argv[i], "-schematron")) ||
3699  (!strcmp(argv[i], "--schematron"))) {
3700  i++;
3701  continue;
3702  }
3703 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
3704  if ((!strcmp(argv[i], "-pattern")) ||
3705  (!strcmp(argv[i], "--pattern"))) {
3706  i++;
3707  continue;
3708  }
3709 #endif
3710 #ifdef LIBXML_XPATH_ENABLED
3711  if ((!strcmp(argv[i], "-xpath")) ||
3712  (!strcmp(argv[i], "--xpath"))) {
3713  i++;
3714  continue;
3715  }
3716 #endif
3717  if ((timing) && (repeat))
3718  startTimer();
3719  /* Remember file names. "-" means stdin. <sven@zen.org> */
3720  if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
3721  if (repeat) {
3722  xmlParserCtxtPtr ctxt = NULL;
3723 
3724  for (acount = 0;acount < repeat;acount++) {
3725 #ifdef LIBXML_READER_ENABLED
3726  if (stream != 0) {
3727  streamFile(argv[i]);
3728  } else {
3729 #endif /* LIBXML_READER_ENABLED */
3730  if (sax) {
3731  testSAX(argv[i]);
3732  } else {
3733  if (ctxt == NULL)
3734  ctxt = xmlNewParserCtxt();
3735  parseAndPrintFile(argv[i], ctxt);
3736  }
3737 #ifdef LIBXML_READER_ENABLED
3738  }
3739 #endif /* LIBXML_READER_ENABLED */
3740  }
3741  if (ctxt != NULL)
3742  xmlFreeParserCtxt(ctxt);
3743  } else {
3744  nbregister = 0;
3745 
3746 #ifdef LIBXML_READER_ENABLED
3747  if (stream != 0)
3748  streamFile(argv[i]);
3749  else
3750 #endif /* LIBXML_READER_ENABLED */
3751  if (sax) {
3752  testSAX(argv[i]);
3753  } else {
3755  }
3756 
3757  if ((chkregister) && (nbregister != 0)) {
3758  fprintf(stderr, "Registration count off: %d\n", nbregister);
3760  }
3761  }
3762  files ++;
3763  if ((timing) && (repeat)) {
3764  endTimer("%d iterations", repeat);
3765  }
3766  }
3767  }
3768  if (generate)
3770  if ((htmlout) && (!nowrap)) {
3771  xmlGenericError(xmlGenericErrorContext, "</body></html>\n");
3772  }
3773  if ((files == 0) && (!generate) && (version == 0)) {
3774  usage(stderr, argv[0]);
3775  }
3776 #ifdef LIBXML_SCHEMATRON_ENABLED
3777  if (wxschematron != NULL)
3778  xmlSchematronFree(wxschematron);
3779 #endif
3780 #ifdef LIBXML_SCHEMAS_ENABLED
3781  if (relaxngschemas != NULL)
3782  xmlRelaxNGFree(relaxngschemas);
3783  if (wxschemas != NULL)
3784  xmlSchemaFree(wxschemas);
3785  xmlRelaxNGCleanupTypes();
3786 #endif
3787 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
3788  if (patternc != NULL)
3789  xmlFreePattern(patternc);
3790 #endif
3791  xmlCleanupParser();
3792  xmlMemoryDump();
3793 
3794  return(progresult);
3795 }
static xmllintReturnCode progresult
Definition: xmllint.c:167
static void deregisterNode(xmlNodePtr node)
Definition: xmllint.c:3120
static int argc
Definition: ServiceArgs.c:12
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader(xmlExternalEntityLoader f)
XMLPUBVAR int xmlGetWarningsDefaultValue
Definition: globals.h:378
static const WCHAR indent[]
Definition: object.c:1156
static int nbregister
Definition: xmllint.c:191
#define XML_DETECT_IDS
Definition: parser.h:139
static int htmlout
Definition: xmllint.c:149
static char * encoding
Definition: xmllint.c:161
static int noblanks
Definition: xmllint.c:118
static int noenc
Definition: xmllint.c:117
static int dropdtd
Definition: xmllint.c:171
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader(void)
static int insert
Definition: xmllint.c:144
static int generate
Definition: xmllint.c:170
#define argv
Definition: mplay32.c:18
static char memory[1024 *256]
Definition: process.c:116
XMLPUBVAR int xmlLoadExtDtdDefaultValue
Definition: globals.h:423
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static int sax
Definition: xmllint.c:199
static int nowrap
Definition: xmllint.c:120
static void * myReallocFunc(void *mem, size_t size)
Definition: xmllint.c:359
static int testIO
Definition: xmllint.c:160
static int load_trace
Definition: xmllint.c:215
static int maxmem
Definition: xmllint.c:111
static void startTimer(void)
Definition: xmllint.c:469
XMLPUBFUN int XMLCALL xmlAddEncodingAlias(const char *name, const char *alias)
Definition: encoding.c:1067
XMLPUBFUN int XMLCALL xmlLineNumbersDefault(int val)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define LIBXML_TEST_VERSION
Definition: xmlversion.h:61
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
static const WCHAR version[]
Definition: asmname.c:66
#define LIBXML_READER_ENABLED
Definition: xmlversion.h:139
#define BAD_CAST
Definition: xmlstring.h:35
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
static xmlParserInputPtr xmllintExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
Definition: xmllint.c:246
XMLPUBVAR const char * xmlTreeIndentString
Definition: globals.h:396
static void myFreeFunc(void *mem)
Definition: xmllint.c:339
static int debug
Definition: xmllint.c:110
XMLPUBFUN int XMLCALL xmlKeepBlanksDefault(int val)
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68
static xmlExternalEntityLoader defaultEntityLoader
Definition: xmllint.c:243
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
Definition: globals.c:645
XMLPUBFUN void XMLCALL xmlSetCompressMode(int mode)
XMLPUBVAR int xmlDoValidityCheckingDefaultValue
Definition: globals.h:337
XMLPUBFUN void XMLCALL xmlMemoryDump(void)
Definition: xmlmemory.c:931
Definition: parse.h:22
unsigned char xmlChar
Definition: xmlstring.h:28
static void * myMallocFunc(size_t size)
Definition: xmllint.c:344
static void parsePath(const xmlChar *path)
Definition: xmllint.c:218
static void testSAX(const char *filename)
Definition: xmllint.c:1628
BOOLEAN valid
static int repeat
Definition: xmllint.c:143
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNoNetExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
static int noent
Definition: xmllint.c:116
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int quiet
Definition: xmllint.c:168
#define XML_COMPLETE_ATTRS
Definition: parser.h:148
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
XMLPUBVAR int xmlParserDebugEntities
Definition: globals.h:432
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define NULL
Definition: types.h:112
const WCHAR * schema
static int oldxml10
Definition: xmllint.c:200
static char * myStrdupFunc(const char *str)
Definition: xmllint.c:374
static int chkregister
Definition: xmllint.c:190
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt)
Definition: xmllint.c:2169
XMLPUBFUN int XMLCALL xmlPedanticParserDefault(int val)
XMLPUBFUN int XMLCALL xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc)
Definition: xmlmemory.c:1041
FILE * stderr
XMLPUBFUN int XMLCALL xmlSubstituteEntitiesDefault(int val)
static void usage(FILE *f, const char *name)
Definition: xmllint.c:2988
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static int recovery
Definition: xmllint.c:115
static int loaddtd
Definition: xmllint.c:166
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
static int timing
Definition: xmllint.c:169
XMLPUBFUN void XMLCALL xmlCleanupParser(void)
Definition: parser.c:14732
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
static void showVersion(const char *name)
Definition: xmllint.c:2949
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
Definition: globals.c:612
static int noout
Definition: xmllint.c:119
GLubyte * pattern
Definition: glext.h:7787
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362
static int dtdattrs
Definition: xmllint.c:165
static void registerNode(xmlNodePtr node)
Definition: xmllint.c:3109

◆ myClose()

static int myClose ( void context)
static

Definition at line 827 of file xmllint.c.

827  {
828  FILE *f = (FILE *) context;
829  if (f == stdin)
830  return(0);
831  return(fclose(f));
832 }
Definition: http.c:7251
FILE * stdin
GLfloat f
Definition: glext.h:7540
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)

Referenced by parseAndPrintFile().

◆ myFreeFunc()

static void myFreeFunc ( void mem)
static

Definition at line 339 of file xmllint.c.

340 {
341  xmlMemFree(mem);
342 }
XMLPUBFUN void XMLCALL xmlMemFree(void *ptr)
Definition: xmlmemory.c:431
Definition: mem.c:156

Referenced by main().

◆ myMallocFunc()

static void* myMallocFunc ( size_t  size)
static

Definition at line 344 of file xmllint.c.

345 {
346  void *ret;
347 
348  ret = xmlMemMalloc(size);
349  if (ret != NULL) {
350  if (xmlMemUsed() > maxmem) {
351  OOM();
352  xmlMemFree(ret);
353  return (NULL);
354  }
355  }
356  return (ret);
357 }
static void OOM(void)
Definition: xmllint.c:332
XMLPUBFUN int XMLCALL xmlMemUsed(void)
Definition: xmlmemory.c:585
XMLPUBFUN void *XMLCALL xmlMemMalloc(size_t size) LIBXML_ATTR_ALLOC_SIZE(1)
Definition: xmlmemory.c:311
static int maxmem
Definition: xmllint.c:111
XMLPUBFUN void XMLCALL xmlMemFree(void *ptr)
Definition: xmlmemory.c:431
GLsizeiptr size
Definition: glext.h:5919
int ret
#define NULL
Definition: types.h:112

Referenced by main().

◆ myRead()

static int myRead ( void f,
char buf,
int  len 
)
static

Definition at line 824 of file xmllint.c.

824  {
825  return(fread(buf, 1, len, (FILE *) f));
826 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
GLfloat f
Definition: glext.h:7540
GLenum GLsizei len
Definition: glext.h:6722

Referenced by parseAndPrintFile().

◆ myReallocFunc()

static void* myReallocFunc ( void mem,
size_t  size 
)
static

Definition at line 359 of file xmllint.c.

360 {
361  void *ret;
362 
364  if (ret != NULL) {
365  if (xmlMemUsed() > maxmem) {
366  OOM();
367  xmlMemFree(ret);
368  return (NULL);
369  }
370  }
371  return (ret);
372 }
static void OOM(void)
Definition: xmllint.c:332
XMLPUBFUN int XMLCALL xmlMemUsed(void)
Definition: xmlmemory.c:585
static int maxmem
Definition: xmllint.c:111
XMLPUBFUN void XMLCALL xmlMemFree(void *ptr)
Definition: xmlmemory.c:431
GLsizeiptr size
Definition: glext.h:5919
int ret
XMLPUBFUN void *XMLCALL xmlMemRealloc(void *ptr, size_t size)
Definition: xmlmemory.c:420
#define NULL
Definition: types.h:112
Definition: mem.c:156

Referenced by main().

◆ myStrdupFunc()

static char* myStrdupFunc ( const char str)
static

Definition at line 374 of file xmllint.c.

375 {
376  char *ret;
377 
379  if (ret != NULL) {
380  if (xmlMemUsed() > maxmem) {
381  OOM();
382  xmlFree(ret);
383  return (NULL);
384  }
385  }
386  return (ret);
387 }
static void OOM(void)
Definition: xmllint.c:332
XMLPUBFUN int XMLCALL xmlMemUsed(void)
Definition: xmlmemory.c:585
static int maxmem
Definition: xmllint.c:111
const WCHAR * str
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
int ret
XMLPUBFUN char *XMLCALL xmlMemoryStrdup(const char *str)
Definition: xmlmemory.c:572
#define NULL
Definition: types.h:112

Referenced by main().

◆ notationDeclDebug()

static void notationDeclDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
const xmlChar publicId,
const xmlChar systemId 
)
static

Definition at line 1143 of file xmllint.c.

1145 {
1146  callbacks++;
1147  if (noout)
1148  return;
1149  fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
1150  (char *) name, (char *) publicId, (char *) systemId);
1151 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ OOM()

static void OOM ( void  )
static

Definition at line 332 of file xmllint.c.

333 {
334  fprintf(stderr, "Ran out of memory needs > %d bytes\n", maxmem);
336 }
static xmllintReturnCode progresult
Definition: xmllint.c:167
static int maxmem
Definition: xmllint.c:111
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
FILE * stderr

Referenced by myMallocFunc(), myReallocFunc(), and myStrdupFunc().

◆ parseAndPrintFile()

static void parseAndPrintFile ( char filename,
xmlParserCtxtPtr  rectxt 
)
static

Definition at line 2169 of file xmllint.c.

2169  {
2170  xmlDocPtr doc = NULL;
2171 #ifdef LIBXML_TREE_ENABLED
2172  xmlDocPtr tmp;
2173 #endif /* LIBXML_TREE_ENABLED */
2174 
2175  if ((timing) && (!repeat))
2176  startTimer();
2177 
2178 
2179 #ifdef LIBXML_TREE_ENABLED
2180  if (filename == NULL) {
2181  if (generate) {
2182  xmlNodePtr n;
2183 
2184  doc = xmlNewDoc(BAD_CAST "1.0");
2185  n = xmlNewDocNode(doc, NULL, BAD_CAST "info", NULL);
2186  xmlNodeSetContent(n, BAD_CAST "abc");
2187  xmlDocSetRootElement(doc, n);
2188  }
2189  }
2190 #endif /* LIBXML_TREE_ENABLED */
2191 #ifdef LIBXML_HTML_ENABLED
2192 #ifdef LIBXML_PUSH_ENABLED
2193  else if ((html) && (push)) {
2194  FILE *f;
2195 
2196  if ((filename[0] == '-') && (filename[1] == 0)) {
2197  f = stdin;
2198  } else {
2199 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2200  f = fopen(filename, "rb");
2201 #elif defined(__OS400__)
2202  f = fopen(filename, "rb");
2203 #else
2204  f = fopen(filename, "r");
2205 #endif
2206  }
2207  if (f != NULL) {
2208  int res;
2209  char chars[4096];
2210  htmlParserCtxtPtr ctxt;
2211 
2212  res = fread(chars, 1, 4, f);
2213  if (res > 0) {
2214  ctxt = htmlCreatePushParserCtxt(NULL, NULL,
2216  htmlCtxtUseOptions(ctxt, options);
2217  while ((res = fread(chars, 1, pushsize, f)) > 0) {
2218  htmlParseChunk(ctxt, chars, res, 0);
2219  }
2220  htmlParseChunk(ctxt, chars, 0, 1);
2221  doc = ctxt->myDoc;
2222  htmlFreeParserCtxt(ctxt);
2223  }
2224  fclose(f);
2225  }
2226  }
2227 #endif /* LIBXML_PUSH_ENABLED */
2228 #ifdef HAVE_MMAP
2229  else if ((html) && (memory)) {
2230  int fd;
2231  struct stat info;
2232  const char *base;
2233  if (stat(filename, &info) < 0)
2234  return;
2235  if ((fd = open(filename, O_RDONLY)) < 0)
2236  return;
2237  base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
2238  if (base == (void *) MAP_FAILED) {
2239  close(fd);
2240  fprintf(stderr, "mmap failure for file %s\n", filename);
2242  return;
2243  }
2244 
2245  doc = htmlReadMemory((char *) base, info.st_size, filename,
2246  NULL, options);
2247 
2248  munmap((char *) base, info.st_size);
2249  close(fd);
2250  }
2251 #endif
2252  else if (html) {
2253  doc = htmlReadFile(filename, NULL, options);
2254  }
2255 #endif /* LIBXML_HTML_ENABLED */
2256  else {
2257 #ifdef LIBXML_PUSH_ENABLED
2258  /*
2259  * build an XML tree from a string;
2260  */
2261  if (push) {
2262  FILE *f;
2263 
2264  /* '-' Usually means stdin -<sven@zen.org> */
2265  if ((filename[0] == '-') && (filename[1] == 0)) {
2266  f = stdin;
2267  } else {
2268 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2269  f = fopen(filename, "rb");
2270 #elif defined(__OS400__)
2271  f = fopen(filename, "rb");
2272 #else
2273  f = fopen(filename, "r");
2274 #endif
2275  }
2276  if (f != NULL) {
2277  int ret;
2278  int res, size = 1024;
2279  char chars[1024];
2280  xmlParserCtxtPtr ctxt;
2281 
2282  /* if (repeat) size = 1024; */
2283  res = fread(chars, 1, 4, f);
2284  if (res > 0) {
2285  ctxt = xmlCreatePushParserCtxt(NULL, NULL,
2286  chars, res, filename);
2287  xmlCtxtUseOptions(ctxt, options);
2288  while ((res = fread(chars, 1, size, f)) > 0) {
2289  xmlParseChunk(ctxt, chars, res, 0);
2290  }
2291  xmlParseChunk(ctxt, chars, 0, 1);
2292  doc = ctxt->myDoc;
2293  ret = ctxt->wellFormed;
2294  xmlFreeParserCtxt(ctxt);
2295  if ((!ret) && (!recovery)) {
2296  xmlFreeDoc(doc);
2297  doc = NULL;
2298  }
2299  }
2300  if (f != stdin)
2301  fclose(f);
2302  }
2303  } else
2304 #endif /* LIBXML_PUSH_ENABLED */
2305  if (testIO) {
2306  if ((filename[0] == '-') && (filename[1] == 0)) {
2307  doc = xmlReadFd(0, NULL, NULL, options);
2308  } else {
2309  FILE *f;
2310 
2311 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2312  f = fopen(filename, "rb");
2313 #elif defined(__OS400__)
2314  f = fopen(filename, "rb");
2315 #else
2316  f = fopen(filename, "r");
2317 #endif
2318  if (f != NULL) {
2319  if (rectxt == NULL)
2320  doc = xmlReadIO(myRead, myClose, f, filename, NULL,
2321  options);
2322  else
2323  doc = xmlCtxtReadIO(rectxt, myRead, myClose, f,
2324  filename, NULL, options);
2325  } else
2326  doc = NULL;
2327  }
2328  } else if (htmlout) {
2329  xmlParserCtxtPtr ctxt;
2330 
2331  if (rectxt == NULL)
2332  ctxt = xmlNewParserCtxt();
2333  else
2334  ctxt = rectxt;
2335  if (ctxt == NULL) {
2336  doc = NULL;
2337  } else {
2338  ctxt->sax->error = xmlHTMLError;
2339  ctxt->sax->warning = xmlHTMLWarning;
2340  ctxt->vctxt.error = xmlHTMLValidityError;
2341  ctxt->vctxt.warning = xmlHTMLValidityWarning;
2342 
2343  doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
2344 
2345  if (rectxt == NULL)
2346  xmlFreeParserCtxt(ctxt);
2347  }
2348 #ifdef HAVE_MMAP
2349  } else if (memory) {
2350  int fd;
2351  struct stat info;
2352  const char *base;
2353  if (stat(filename, &info) < 0)
2354  return;
2355  if ((fd = open(filename, O_RDONLY)) < 0)
2356  return;
2357  base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
2358  if (base == (void *) MAP_FAILED) {
2359  close(fd);
2360  fprintf(stderr, "mmap failure for file %s\n", filename);
2362  return;
2363  }
2364 
2365  if (rectxt == NULL)
2366  doc = xmlReadMemory((char *) base, info.st_size,
2367  filename, NULL, options);
2368  else
2369  doc = xmlCtxtReadMemory(rectxt, (char *) base, info.st_size,
2370  filename, NULL, options);
2371 
2372  munmap((char *) base, info.st_size);
2373  close(fd);
2374 #endif
2375 #ifdef LIBXML_VALID_ENABLED
2376  } else if (valid) {
2377  xmlParserCtxtPtr ctxt = NULL;
2378 
2379  if (rectxt == NULL)
2380  ctxt = xmlNewParserCtxt();
2381  else
2382  ctxt = rectxt;
2383  if (ctxt == NULL) {
2384  doc = NULL;
2385  } else {
2386  doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
2387 
2388  if (ctxt->valid == 0)
2390  if (rectxt == NULL)
2391  xmlFreeParserCtxt(ctxt);
2392  }
2393 #endif /* LIBXML_VALID_ENABLED */
2394  } else {
2395  if (rectxt != NULL)
2396  doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
2397  else {
2398 #ifdef LIBXML_SAX1_ENABLED
2399  if (sax1)
2400  doc = xmlParseFile(filename);
2401  else
2402 #endif /* LIBXML_SAX1_ENABLED */
2403  doc = xmlReadFile(filename, NULL, options);
2404  }
2405  }
2406  }
2407 
2408  /*
2409  * If we don't have a document we might as well give up. Do we
2410  * want an error message here? <sven@zen.org> */
2411  if (doc == NULL) {
2413  return;
2414  }
2415 
2416  if ((timing) && (!repeat)) {
2417  endTimer("Parsing");
2418  }
2419 
2420  /*
2421  * Remove DOCTYPE nodes
2422  */
2423  if (dropdtd) {
2424  xmlDtdPtr dtd;
2425 
2426  dtd = xmlGetIntSubset(doc);
2427  if (dtd != NULL) {
2428  xmlUnlinkNode((xmlNodePtr)dtd);
2429  doc->intSubset = NULL;
2430  xmlFreeDtd(dtd);
2431  }
2432  }
2433 
2434 #ifdef LIBXML_XINCLUDE_ENABLED
2435  if (xinclude) {
2436  if ((timing) && (!repeat)) {
2437  startTimer();
2438  }
2439  if (xmlXIncludeProcessFlags(doc, options) < 0)
2441  if ((timing) && (!repeat)) {
2442  endTimer("Xinclude processing");
2443  }
2444  }
2445 #endif
2446 
2447 #ifdef LIBXML_XPATH_ENABLED
2448  if (xpathquery != NULL) {
2449  doXPathQuery(doc, xpathquery);
2450  }
2451 #endif
2452 
2453 #ifdef LIBXML_DEBUG_ENABLED
2454 #ifdef LIBXML_XPATH_ENABLED
2455  /*
2456  * shell interaction
2457  */
2458  if (shell) {
2459  xmlXPathOrderDocElems(doc);
2460  xmlShell(doc, filename, xmlShellReadline, stdout);
2461  }
2462 #endif
2463 #endif
2464 
2465 #ifdef LIBXML_TREE_ENABLED
2466  /*
2467  * test intermediate copy if needed.
2468  */
2469  if (copy) {
2470  tmp = doc;
2471  if (timing) {
2472  startTimer();
2473  }
2474  doc = xmlCopyDoc(doc, 1);
2475  if (timing) {
2476  endTimer("Copying");
2477  }
2478  if (timing) {
2479  startTimer();
2480  }
2481  xmlFreeDoc(tmp);
2482  if (timing) {
2483  endTimer("Freeing original");
2484  }
2485  }
2486 #endif /* LIBXML_TREE_ENABLED */
2487 
2488 #ifdef LIBXML_VALID_ENABLED
2489  if ((insert) && (!html)) {
2490  const xmlChar* list[256];
2491  int nb, i;
2492  xmlNodePtr node;
2493 
2494  if (doc->children != NULL) {
2495  node = doc->children;
2496  while ((node != NULL) && (node->last == NULL)) node = node->next;
2497  if (node != NULL) {
2498  nb = xmlValidGetValidElements(node->last, NULL, list, 256);
2499  if (nb < 0) {
2500  fprintf(stderr, "could not get valid list of elements\n");
2501  } else if (nb == 0) {
2502  fprintf(stderr, "No element can be inserted under root\n");
2503  } else {
2504  fprintf(stderr, "%d element types can be inserted under root:\n",
2505  nb);
2506  for (i = 0;i < nb;i++) {
2507  fprintf(stderr, "%s\n", (char *) list[i]);
2508  }
2509  }
2510  }
2511  }
2512  }else
2513 #endif /* LIBXML_VALID_ENABLED */
2514 #ifdef LIBXML_READER_ENABLED
2515  if (walker) {
2516  walkDoc(doc);
2517  }
2518 #endif /* LIBXML_READER_ENABLED */
2519 #ifdef LIBXML_OUTPUT_ENABLED
2520  if (noout == 0) {
2521  int ret;
2522 
2523  /*
2524  * print it.
2525  */
2526 #ifdef LIBXML_DEBUG_ENABLED
2527  if (!debug) {
2528 #endif
2529  if ((timing) && (!repeat)) {
2530  startTimer();
2531  }
2532 #ifdef LIBXML_HTML_ENABLED
2533  if ((html) && (!xmlout)) {
2534  if (compress) {
2535  htmlSaveFile(output ? output : "-", doc);
2536  }
2537  else if (encoding != NULL) {
2538  if (format == 1) {
2539  htmlSaveFileFormat(output ? output : "-", doc, encoding, 1);
2540  }
2541  else {
2542  htmlSaveFileFormat(output ? output : "-", doc, encoding, 0);
2543  }
2544  }
2545  else if (format == 1) {
2546  htmlSaveFileFormat(output ? output : "-", doc, NULL, 1);
2547  }
2548  else {
2549  FILE *out;
2550  if (output == NULL)
2551  out = stdout;
2552  else {
2553  out = fopen(output,"wb");
2554  }
2555  if (out != NULL) {
2556  if (htmlDocDump(out, doc) < 0)
2558 
2559  if (output != NULL)
2560  fclose(out);
2561  } else {
2562  fprintf(stderr, "failed to open %s\n", output);
2564  }
2565  }
2566  if ((timing) && (!repeat)) {
2567  endTimer("Saving");
2568  }
2569  } else
2570 #endif
2571 #ifdef LIBXML_C14N_ENABLED
2572  if (canonical) {
2573  xmlChar *result = NULL;
2574  int size;
2575 
2576  size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_0, NULL, 1, &result);
2577  if (size >= 0) {
2578  if (write(1, result, size) == -1) {
2579  fprintf(stderr, "Can't write data\n");
2580  }
2581  xmlFree(result);
2582  } else {
2583  fprintf(stderr, "Failed to canonicalize\n");
2585  }
2586  } else if (canonical_11) {
2587  xmlChar *result = NULL;
2588  int size;
2589 
2590  size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_1, NULL, 1, &result);
2591  if (size >= 0) {
2592  if (write(1, result, size) == -1) {
2593  fprintf(stderr, "Can't write data\n");
2594  }
2595  xmlFree(result);
2596  } else {
2597  fprintf(stderr, "Failed to canonicalize\n");
2599  }
2600  } else
2601  if (exc_canonical) {
2602  xmlChar *result = NULL;
2603  int size;
2604 
2605  size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_EXCLUSIVE_1_0, NULL, 1, &result);
2606  if (size >= 0) {
2607  if (write(1, result, size) == -1) {
2608  fprintf(stderr, "Can't write data\n");
2609  }
2610  xmlFree(result);
2611  } else {
2612  fprintf(stderr, "Failed to canonicalize\n");
2614  }
2615  } else
2616 #endif
2617 #ifdef HAVE_MMAP
2618  if (memory) {
2619  xmlChar *result;
2620  int len;
2621 
2622  if (encoding != NULL) {
2623  if (format == 1) {
2624  xmlDocDumpFormatMemoryEnc(doc, &result, &len, encoding, 1);
2625  } else {
2626  xmlDocDumpMemoryEnc(doc, &result, &len, encoding);
2627  }
2628  } else {
2629  if (format == 1)
2630  xmlDocDumpFormatMemory(doc, &result, &len, 1);
2631  else
2632  xmlDocDumpMemory(doc, &result, &len);
2633  }
2634  if (result == NULL) {
2635  fprintf(stderr, "Failed to save\n");
2637  } else {
2638  if (write(1, result, len) == -1) {
2639  fprintf(stderr, "Can't write data\n");
2640  }
2641  xmlFree(result);
2642  }
2643 
2644  } else
2645 #endif /* HAVE_MMAP */
2646  if (compress) {
2647  xmlSaveFile(output ? output : "-", doc);
2648  } else if (oldout) {
2649  if (encoding != NULL) {
2650  if (format == 1) {
2651  ret = xmlSaveFormatFileEnc(output ? output : "-", doc,
2652  encoding, 1);
2653  }
2654  else {
2655  ret = xmlSaveFileEnc(output ? output : "-", doc,
2656  encoding);
2657  }
2658  if (ret < 0) {
2659  fprintf(stderr, "failed save to %s\n",
2660  output ? output : "-");
2662  }
2663  } else if (format == 1) {
2664  ret = xmlSaveFormatFile(output ? output : "-", doc, 1);
2665  if (ret < 0) {
2666  fprintf(stderr, "failed save to %s\n",
2667  output ? output : "-");
2669  }
2670  } else {
2671  FILE *out;
2672  if (output == NULL)
2673  out = stdout;
2674  else {
2675  out = fopen(output,"wb");
2676  }
2677  if (out != NULL) {
2678  if (xmlDocDump(out, doc) < 0)
2680 
2681  if (output != NULL)
2682  fclose(out);
2683  } else {
2684  fprintf(stderr, "failed to open %s\n", output);
2686  }
2687  }
2688  } else {
2689  xmlSaveCtxtPtr ctxt;
2690  int saveOpts = 0;
2691 
2692  if (format == 1)
2693  saveOpts |= XML_SAVE_FORMAT;
2694  else if (format == 2)
2695  saveOpts |= XML_SAVE_WSNONSIG;
2696 
2697 #if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
2698  if (xmlout)
2699  saveOpts |= XML_SAVE_AS_XML;
2700 #endif
2701 
2702  if (output == NULL)
2703  ctxt = xmlSaveToFd(1, encoding, saveOpts);
2704  else
2705  ctxt = xmlSaveToFilename(output, encoding, saveOpts);
2706 
2707  if (ctxt != NULL) {
2708  if (xmlSaveDoc(ctxt, doc) < 0) {
2709  fprintf(stderr, "failed save to %s\n",
2710  output ? output : "-");
2712  }
2713  xmlSaveClose(ctxt);
2714  } else {
2716  }
2717  }
2718  if ((timing) && (!repeat)) {
2719  endTimer("Saving");
2720  }
2721 #ifdef LIBXML_DEBUG_ENABLED
2722  } else {
2723  FILE *out;
2724  if (output == NULL)
2725  out = stdout;
2726  else {
2727  out = fopen(output,"wb");
2728  }
2729  if (out != NULL) {
2730  xmlDebugDumpDocument(out, doc);
2731 
2732  if (output != NULL)
2733  fclose(out);
2734  } else {
2735  fprintf(stderr, "failed to open %s\n", output);
2737  }
2738  }
2739 #endif
2740  }
2741 #endif /* LIBXML_OUTPUT_ENABLED */
2742 
2743 #ifdef LIBXML_VALID_ENABLED
2744  /*
2745  * A posteriori validation test
2746  */
2747  if ((dtdvalid != NULL) || (dtdvalidfpi != NULL)) {
2748  xmlDtdPtr dtd;
2749 
2750  if ((timing) && (!repeat)) {
2751  startTimer();
2752  }
2753  if (dtdvalid != NULL)
2754  dtd = xmlParseDTD(NULL, (const xmlChar *)dtdvalid);
2755  else
2756  dtd = xmlParseDTD((const xmlChar *)dtdvalidfpi, NULL);
2757  if ((timing) && (!repeat)) {
2758  endTimer("Parsing DTD");
2759  }
2760  if (dtd == NULL) {
2761  if (dtdvalid != NULL)
2763  "Could not parse DTD %s\n", dtdvalid);
2764  else
2766  "Could not parse DTD %s\n", dtdvalidfpi);
2768  } else {
2769  xmlValidCtxtPtr cvp;
2770 
2771  if ((cvp = xmlNewValidCtxt()) == NULL) {
2773  "Couldn't allocate validation context\n");
2774  exit(-1);
2775  }
2776  cvp->userData = NULL;
2777  cvp->error = xmlGenericError;
2778  cvp->warning = xmlGenericError;
2779 
2780  if ((timing) && (!repeat)) {
2781  startTimer();
2782  }
2783  if (!xmlValidateDtd(cvp, doc, dtd)) {
2784  if (dtdvalid != NULL)
2786  "Document %s does not validate against %s\n",
2787  filename, dtdvalid);
2788  else
2790  "Document %s does not validate against %s\n",
2791  filename, dtdvalidfpi);
2793  }
2794  if ((timing) && (!repeat)) {
2795  endTimer("Validating against DTD");
2796  }
2797  xmlFreeValidCtxt(cvp);
2798  xmlFreeDtd(dtd);
2799  }
2800  } else if (postvalid) {
2801  xmlValidCtxtPtr cvp;
2802 
2803  if ((cvp = xmlNewValidCtxt()) == NULL) {
2805  "Couldn't allocate validation context\n");
2806  exit(-1);
2807  }
2808 
2809  if ((timing) && (!repeat)) {
2810  startTimer();
2811  }
2812  cvp->userData = NULL;
2813  cvp->error = xmlGenericError;
2814  cvp->warning = xmlGenericError;
2815  if (!xmlValidateDocument(cvp, doc)) {
2817  "Document %s does not validate\n", filename);
2819  }
2820  if ((timing) && (!repeat)) {
2821  endTimer("Validating");
2822  }
2823  xmlFreeValidCtxt(cvp);
2824  }
2825 #endif /* LIBXML_VALID_ENABLED */
2826 #ifdef LIBXML_SCHEMATRON_ENABLED
2827  if (wxschematron != NULL) {
2828  xmlSchematronValidCtxtPtr ctxt;
2829  int ret;
2830  int flag;
2831 
2832  if ((timing) && (!repeat)) {
2833  startTimer();
2834  }
2835 
2836  if (debug)
2837  flag = XML_SCHEMATRON_OUT_XML;
2838  else
2839  flag = XML_SCHEMATRON_OUT_TEXT;
2840  if (noout)
2841  flag |= XML_SCHEMATRON_OUT_QUIET;
2842  ctxt = xmlSchematronNewValidCtxt(wxschematron, flag);
2843 #if 0
2844  xmlSchematronSetValidErrors(ctxt, xmlGenericError, xmlGenericError,
2845  NULL);
2846 #endif
2847  ret = xmlSchematronValidateDoc(ctxt, doc);
2848  if (ret == 0) {
2849  if (!quiet) {
2850  fprintf(stderr, "%s validates\n", filename);
2851  }
2852  } else if (ret > 0) {
2853  fprintf(stderr, "%s fails to validate\n", filename);
2855  } else {
2856  fprintf(stderr, "%s validation generated an internal error\n",
2857  filename);
2859  }
2860  xmlSchematronFreeValidCtxt(ctxt);
2861  if ((timing) && (!repeat)) {
2862  endTimer("Validating");
2863  }
2864  }
2865 #endif
2866 #ifdef LIBXML_SCHEMAS_ENABLED
2867  if (relaxngschemas != NULL) {
2868  xmlRelaxNGValidCtxtPtr ctxt;
2869  int ret;
2870 
2871  if ((timing) && (!repeat)) {
2872  startTimer();
2873  }
2874 
2875  ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas);
2876  xmlRelaxNGSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
2877  ret = xmlRelaxNGValidateDoc(ctxt, doc);
2878  if (ret == 0) {
2879  if (!quiet) {
2880  fprintf(stderr, "%s validates\n", filename);
2881  }
2882  } else if (ret > 0) {
2883  fprintf(stderr, "%s fails to validate\n", filename);
2885  } else {
2886  fprintf(stderr, "%s validation generated an internal error\n",
2887  filename);
2889  }
2890  xmlRelaxNGFreeValidCtxt(ctxt);
2891  if ((timing) && (!repeat)) {
2892  endTimer("Validating");
2893  }
2894  } else if (wxschemas != NULL) {
2895  xmlSchemaValidCtxtPtr ctxt;
2896  int ret;
2897 
2898  if ((timing) && (!repeat)) {
2899  startTimer();
2900  }
2901 
2902  ctxt = xmlSchemaNewValidCtxt(wxschemas);
2903  xmlSchemaSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
2904  ret = xmlSchemaValidateDoc(ctxt, doc);
2905  if (ret == 0) {
2906  if (!quiet) {
2907  fprintf(stderr, "%s validates\n", filename);
2908  }
2909  } else if (ret > 0) {
2910  fprintf(stderr, "%s fails to validate\n", filename);
2912  } else {
2913  fprintf(stderr, "%s validation generated an internal error\n",
2914  filename);
2916  }
2917  xmlSchemaFreeValidCtxt(ctxt);
2918  if ((timing) && (!repeat)) {
2919  endTimer("Validating");
2920  }
2921  }
2922 #endif
2923 
2924 #ifdef LIBXML_DEBUG_ENABLED
2925 #if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
2926  if ((debugent) && (!html))
2927  xmlDebugDumpEntities(stderr, doc);
2928 #endif
2929 #endif
2930 
2931  /*
2932  * free it.
2933  */
2934  if ((timing) && (!repeat)) {
2935  startTimer();
2936  }
2937  xmlFreeDoc(doc);
2938  if ((timing) && (!repeat)) {
2939  endTimer("Freeing");
2940  }
2941 }
static xmllintReturnCode progresult
Definition: xmllint.c:167
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static int htmlout
Definition: xmllint.c:149
GLuint64EXT * result
Definition: glext.h:11304
struct _xmlDtd * intSubset
Definition: tree.h:570
#define open
Definition: acwin.h:95
static int myRead(void *f, char *buf, int len)
Definition: xmllint.c:824
XMLPUBFUN xmlDocPtr XMLCALL xmlReadFd(int fd, const char *URL, const char *encoding, int options)
Definition: parser.c:15270
static char * encoding
Definition: xmllint.c:161
GLdouble n
Definition: glext.h:7729
void * next
Definition: dlist.c:360
static int dropdtd
Definition: xmllint.c:171
xmlValidityErrorFunc error
Definition: valid.h:84
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
static int fd
Definition: io.c:51
FILE * stdin
static int insert
Definition: xmllint.c:144
XMLPUBFUN xmlDocPtr XMLCALL xmlReadMemory(const char *buffer, int size, const char *URL, const char *encoding, int options)
Definition: parser.c:15245
static int generate
Definition: xmllint.c:170
const char * filename
Definition: ioapi.h:135
static char memory[1024 *256]
Definition: process.c:116
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
Definition: parser.c:15519
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
FILE * stdout
Definition: tree.h:406
struct node node
static int testIO
Definition: xmllint.c:160
#define write
Definition: acwin.h:97
static void startTimer(void)
Definition: xmllint.c:469
XMLPUBFUN xmlDocPtr XMLCALL xmlReadFile(const char *URL, const char *encoding, int options)
Definition: parser.c:15221
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
GLuint base
Definition: 3dtext.c:35
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN void XMLCALL xmlFreeDtd(xmlDtdPtr cur)
#define BAD_CAST
Definition: xmlstring.h:35
static int debug
Definition: xmllint.c:110
GLfloat f
Definition: glext.h:7540
GLsizeiptr size
Definition: glext.h:5919
int wellFormed
Definition: parser.h:190
XMLPUBFUN xmlDocPtr XMLCALL xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
Definition: parser.c:15313
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBFUN int XMLCALL xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
Definition: parser.c:15133
static FILE * out
Definition: regtests2xml.c:44
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
#define MAP_FAILED
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
Definition: stat.h:55
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
struct _xmlSAXHandler * sax
Definition: parser.h:187
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define close
Definition: acwin.h:98
BOOLEAN valid
static int repeat
Definition: xmllint.c:143
XMLPUBFUN void XMLCALL xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int quiet
Definition: xmllint.c:168
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define f
Definition: ke_i.h:83
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define NULL
Definition: types.h:112
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content)
Definition: tree.h:551
XMLPUBFUN xmlDtdPtr XMLCALL xmlGetIntSubset(const xmlDoc *doc)
static int myClose(void *context)
Definition: xmllint.c:827
GLuint res
Definition: glext.h:9613
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options)
Definition: parser.c:15394
void * userData
Definition: valid.h:83
FILE * stderr
static int recovery
Definition: xmllint.c:115
struct _xmlNode * children
Definition: tree.h:555
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
static int timing
Definition: xmllint.c:169
void exit(int exitcode)
Definition: _exit.c:33
xmlValidCtxt vctxt
Definition: parser.h:223
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc(const xmlChar *version)
xmlValidityWarningFunc warning
Definition: valid.h:85
static int noout
Definition: xmllint.c:119
Definition: dlist.c:348
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362
#define O_RDONLY
Definition: acwin.h:108
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
Definition: parser.c:15430

Referenced by main().

◆ parsePath()

static void parsePath ( const xmlChar path)
static

Definition at line 218 of file xmllint.c.

218  {
219  const xmlChar *cur;
220 
221  if (path == NULL)
222  return;
223  while (*path != 0) {
224  if (nbpaths >= MAX_PATHS) {
225  fprintf(stderr, "MAX_PATHS reached: too many paths\n");
226  return;
227  }
228  cur = path;
229  while ((*cur == ' ') || (*cur == PATH_SEPARATOR))
230  cur++;
231  path = cur;
232  while ((*cur != 0) && (*cur != ' ') && (*cur != PATH_SEPARATOR))
233  cur++;
234  if (cur != path) {
236  if (paths[nbpaths] != NULL)
237  nbpaths++;
238  path = cur;
239  }
240  }
241 }
static int nbpaths
Definition: xmllint.c:214
#define MAX_PATHS
Definition: xmllint.c:207
GLsizei const GLchar ** path
Definition: glext.h:7234
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
#define PATH_SEPARATOR
Definition: xmllint.c:211
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
unsigned char xmlChar
Definition: xmlstring.h:28
GLsizei const GLuint * paths
Definition: glext.h:11717
FxCollectionEntry * cur
#define NULL
Definition: types.h:112
FILE * stderr

Referenced by main().

◆ processingInstructionDebug()

static void processingInstructionDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar target,
const xmlChar data 
)
static

processingInstructionDebug: @ctxt: An XML parser context @target: the target name @data: the PI data's @len: the number of xmlChar

A processing instruction has been parsed.

Definition at line 1349 of file xmllint.c.

1351 {
1352  callbacks++;
1353  if (noout)
1354  return;
1355  if (data != NULL)
1356  fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
1357  (char *) target, (char *) data);
1358  else
1359  fprintf(stdout, "SAX.processingInstruction(%s, NULL)\n",
1360  (char *) target);
1361 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define NULL
Definition: types.h:112
GLenum target
Definition: glext.h:7315
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ referenceDebug()

static void referenceDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name 
)
static

Definition at line 1306 of file xmllint.c.

1307 {
1308  callbacks++;
1309  if (noout)
1310  return;
1311  fprintf(stdout, "SAX.reference(%s)\n", name);
1312 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ registerNode()

static void registerNode ( xmlNodePtr  node)
static

Definition at line 3109 of file xmllint.c.

3110 {
3111  node->_private = malloc(sizeof(long));
3112  if (node->_private == NULL) {
3113  fprintf(stderr, "Out of memory in xmllint:registerNode()\n");
3115  }
3116  *(long*)node->_private = (long) 0x81726354;
3117  nbregister++;
3118 }
static int nbregister
Definition: xmllint.c:191
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
FILE * stderr
#define malloc
Definition: debug_ros.c:4
void exit(int exitcode)
Definition: _exit.c:33
Definition: dlist.c:348

Referenced by main().

◆ resolveEntityDebug()

static xmlParserInputPtr resolveEntityDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar publicId,
const xmlChar systemId 
)
static

resolveEntityDebug: @ctxt: An XML parser context @publicId: The public ID of the entity @systemId: The system ID of the entity

Special entity resolver, better left to the parser, it has more context than the application layer. The default behaviour is to NOT resolve the entities, in that case the ENTITY_REF nodes are built in the structure (and the parameter values).

Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.

Definition at line 999 of file xmllint.c.

1000 {
1001  callbacks++;
1002  if (noout)
1003  return(NULL);
1004  /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
1005 
1006 
1007  fprintf(stdout, "SAX.resolveEntity(");
1008  if (publicId != NULL)
1009  fprintf(stdout, "%s", (char *)publicId);
1010  else
1011  fprintf(stdout, " ");
1012  if (systemId != NULL)
1013  fprintf(stdout, ", %s)\n", (char *)systemId);
1014  else
1015  fprintf(stdout, ", )\n");
1016  return(NULL);
1017 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NULL
Definition: types.h:112
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ setDocumentLocatorDebug()

static void setDocumentLocatorDebug ( void *ctx  ATTRIBUTE_UNUSED,
xmlSAXLocatorPtr loc  ATTRIBUTE_UNUSED 
)
static

setDocumentLocatorDebug: @ctxt: An XML parser context @loc: A SAX Locator

Receive the document locator at startup, actually xmlDefaultSAXLocator Everything is available on the context, so this is useless in our case.

Definition at line 1193 of file xmllint.c.

1194 {
1195  callbacks++;
1196  if (noout)
1197  return;
1198  fprintf(stdout, "SAX.setDocumentLocator()\n");
1199 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ showVersion()

static void showVersion ( const char name)
static

Definition at line 2949 of file xmllint.c.

2949  {
2950  fprintf(stderr, "%s: using libxml version %s\n", name, xmlParserVersion);
2951  fprintf(stderr, " compiled with: ");
2952  if (xmlHasFeature(XML_WITH_THREAD)) fprintf(stderr, "Threads ");
2953  if (xmlHasFeature(XML_WITH_TREE)) fprintf(stderr, "Tree ");
2954  if (xmlHasFeature(XML_WITH_OUTPUT)) fprintf(stderr, "Output ");
2955  if (xmlHasFeature(XML_WITH_PUSH)) fprintf(stderr, "Push ");
2956  if (xmlHasFeature(XML_WITH_READER)) fprintf(stderr, "Reader ");
2957  if (xmlHasFeature(XML_WITH_PATTERN)) fprintf(stderr, "Patterns ");
2958  if (xmlHasFeature(XML_WITH_WRITER)) fprintf(stderr, "Writer ");
2959  if (xmlHasFeature(XML_WITH_SAX1)) fprintf(stderr, "SAXv1 ");
2960  if (xmlHasFeature(XML_WITH_FTP)) fprintf(stderr, "FTP ");
2961  if (xmlHasFeature(XML_WITH_HTTP)) fprintf(stderr, "HTTP ");
2962  if (xmlHasFeature(XML_WITH_VALID)) fprintf(stderr, "DTDValid ");
2963  if (xmlHasFeature(XML_WITH_HTML)) fprintf(stderr, "HTML ");
2964  if (xmlHasFeature(XML_WITH_LEGACY)) fprintf(stderr, "Legacy ");
2965  if (xmlHasFeature(XML_WITH_C14N)) fprintf(stderr, "C14N ");
2966  if (xmlHasFeature(XML_WITH_CATALOG)) fprintf(stderr, "Catalog ");
2967  if (xmlHasFeature(XML_WITH_XPATH)) fprintf(stderr, "XPath ");
2968  if (xmlHasFeature(XML_WITH_XPTR)) fprintf(stderr, "XPointer ");
2969  if (xmlHasFeature(XML_WITH_XINCLUDE)) fprintf(stderr, "XInclude ");
2970  if (xmlHasFeature(XML_WITH_ICONV)) fprintf(stderr, "Iconv ");
2971  if (xmlHasFeature(XML_WITH_ICU)) fprintf(stderr, "ICU ");
2972  if (xmlHasFeature(XML_WITH_ISO8859X)) fprintf(stderr, "ISO8859X ");
2973  if (xmlHasFeature(XML_WITH_UNICODE)) fprintf(stderr, "Unicode ");
2974  if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(stderr, "Regexps ");
2975  if (xmlHasFeature(XML_WITH_AUTOMATA)) fprintf(stderr, "Automata ");
2976  if (xmlHasFeature(XML_WITH_EXPR)) fprintf(stderr, "Expr ");
2977  if (xmlHasFeature(XML_WITH_SCHEMAS)) fprintf(stderr, "Schemas ");
2978  if (xmlHasFeature(XML_WITH_SCHEMATRON)) fprintf(stderr, "Schematron ");
2979  if (xmlHasFeature(XML_WITH_MODULES)) fprintf(stderr, "Modules ");
2980  if (xmlHasFeature(XML_WITH_DEBUG)) fprintf(stderr, "Debug ");
2981  if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug ");
2982  if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug ");
2983  if (xmlHasFeature(XML_WITH_ZLIB)) fprintf(stderr, "Zlib ");
2984  if (xmlHasFeature(XML_WITH_LZMA)) fprintf(stderr, "Lzma ");
2985  fprintf(stderr, "\n");
2986 }
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
XMLPUBVAR const char * xmlParserVersion
Definition: globals.h:441
XMLPUBFUN int XMLCALL xmlHasFeature(xmlFeature feature)
Definition: parser.c:885
Definition: name.c:38
FILE * stderr

Referenced by main().

◆ startDocumentDebug()

static void startDocumentDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

startDocumentDebug: @ctxt: An XML parser context

called when the document start being processed.

Definition at line 1208 of file xmllint.c.

1209 {
1210  callbacks++;
1211  if (noout)
1212  return;
1213  fprintf(stdout, "SAX.startDocument()\n");
1214 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ startElementDebug()

static void startElementDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
const xmlChar **  atts 
)
static

Definition at line 1239 of file xmllint.c.

1240 {
1241  int i;
1242 
1243  callbacks++;
1244  if (noout)
1245  return;
1246  fprintf(stdout, "SAX.startElement(%s", (char *) name);
1247  if (atts != NULL) {
1248  for (i = 0;(atts[i] != NULL);i++) {
1249  fprintf(stdout, ", %s='", atts[i++]);
1250  if (atts[i] != NULL)
1251  fprintf(stdout, "%s'", atts[i]);
1252  }
1253  }
1254  fprintf(stdout, ")\n");
1255 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119
_In_ uint16_t _Out_ ULONG * atts
Definition: btrfs_drv.h:1109

◆ startElementNsDebug()

static void startElementNsDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar localname,
const xmlChar prefix,
const xmlChar URI,
int  nb_namespaces,
const xmlChar **  namespaces,
int  nb_attributes,
int  nb_defaulted,
const xmlChar **  attributes 
)
static

Definition at line 1514 of file xmllint.c.

1523 {
1524  int i;
1525 
1526  callbacks++;
1527  if (noout)
1528  return;
1529  fprintf(stdout, "SAX.startElementNs(%s", (char *) localname);
1530  if (prefix == NULL)
1531  fprintf(stdout, ", NULL");
1532  else
1533  fprintf(stdout, ", %s", (char *) prefix);
1534  if (URI == NULL)
1535  fprintf(stdout, ", NULL");
1536  else
1537  fprintf(stdout, ", '%s'", (char *) URI);
1538  fprintf(stdout, ", %d", nb_namespaces);
1539 
1540  if (namespaces != NULL) {
1541  for (i = 0;i < nb_namespaces * 2;i++) {
1542  fprintf(stdout, ", xmlns");
1543  if (namespaces[i] != NULL)
1544  fprintf(stdout, ":%s", namespaces[i]);
1545  i++;
1546  fprintf(stdout, "='%s'", namespaces[i]);
1547  }
1548  }
1549  fprintf(stdout, ", %d, %d", nb_attributes, nb_defaulted);
1550  if (attributes != NULL) {
1551  for (i = 0;i < nb_attributes * 5;i += 5) {
1552  if (attributes[i + 1] != NULL)
1553  fprintf(stdout, ", %s:%s='", attributes[i + 1], attributes[i]);
1554  else
1555  fprintf(stdout, ", %s='", attributes[i]);
1556  fprintf(stdout, "%.4s...', %d", attributes[i + 3],
1557  (int)(attributes[i + 4] - attributes[i + 3]));
1558  }
1559  }
1560  fprintf(stdout, ")\n");
1561 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ startTimer()

static void startTimer ( void  )
static

Definition at line 469 of file xmllint.c.

470 {
471  begin = clock();
472 }
static clock_t begin
Definition: xmllint.c:467
_Check_return_ _CRTIMP clock_t __cdecl clock(void)
Definition: clock.c:23

Referenced by main(), QMyMainWindow::mousePressEvent(), parseAndPrintFile(), FxTimer::Start(), and FxIoTarget::SubmitLocked().

◆ testSAX()

static void testSAX ( const char filename)
static

Definition at line 1628 of file xmllint.c.

1628  {
1630  const char *user_data = "user_data"; /* mostly for debugging */
1632  xmlParserInputPtr inputStream;
1633  xmlParserCtxtPtr ctxt = NULL;
1634  xmlSAXHandlerPtr old_sax = NULL;
1635 
1636  callbacks = 0;
1637 
1638  if (noout) {
1640 #ifdef LIBXML_SAX1_ENABLED
1641  } else if (sax1) {
1643 #endif
1644  } else {
1646  }
1647 
1648  /*
1649  * it's not the simplest code but the most generic in term of I/O
1650  */
1652  if (buf == NULL) {
1653  goto error;
1654  }
1655 
1656 #ifdef LIBXML_SCHEMAS_ENABLED
1657  if (wxschemas != NULL) {
1658  int ret;
1659  xmlSchemaValidCtxtPtr vctxt;
1660 
1661  vctxt = xmlSchemaNewValidCtxt(wxschemas);
1662  xmlSchemaSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL);
1663  xmlSchemaValidateSetFilename(vctxt, filename);
1664 
1665  ret = xmlSchemaValidateStream(vctxt, buf, 0, handler,
1666  (void *)user_data);
1667  if (repeat == 0) {
1668  if (ret == 0) {
1669  if (!quiet) {
1670  fprintf(stderr, "%s validates\n", filename);
1671  }
1672  } else if (ret > 0) {
1673  fprintf(stderr, "%s fails to validate\n", filename);
1675  } else {
1676  fprintf(stderr, "%s validation generated an internal error\n",
1677  filename);
1679  }
1680  }
1681  xmlSchemaFreeValidCtxt(vctxt);
1682  } else
1683 #endif
1684  {
1685  /*
1686  * Create the parser context amd hook the input
1687  */
1688  ctxt = xmlNewParserCtxt();
1689  if (ctxt == NULL) {
1691  goto error;
1692  }
1693  old_sax = ctxt->sax;
1694  ctxt->sax = handler;
1695  ctxt->userData = (void *) user_data;
1696  inputStream = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE);
1697  if (inputStream == NULL) {
1699  goto error;
1700  }
1701  inputPush(ctxt, inputStream);
1702 
1703  /* do the parsing */
1704  xmlParseDocument(ctxt);
1705 
1706  if (ctxt->myDoc != NULL) {
1707  fprintf(stderr, "SAX generated a doc !\n");
1708  xmlFreeDoc(ctxt->myDoc);
1709  ctxt->myDoc = NULL;
1710  }
1711  }
1712 
1713 error:
1714  if (ctxt != NULL) {
1715  ctxt->sax = old_sax;
1716  xmlFreeParserCtxt(ctxt);
1717  }
1718 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
static xmllintReturnCode progresult
Definition: xmllint.c:167
#define error(str)
Definition: mkdosfs.c:1605
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN int XMLCALL inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1752
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
const char * filename
Definition: ioapi.h:135
static xmlSAXHandlerPtr debugSAX2Handler
Definition: xmllint.c:1625
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static xmlSAXHandlerPtr emptySAXHandler
Definition: xmllint.c:878
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBFUN int XMLCALL xmlParseDocument(xmlParserCtxtPtr ctxt)
Definition: parser.c:10689
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc)
int ret
xmlDocPtr myDoc
Definition: parser.h:189
struct _xmlSAXHandler * sax
Definition: parser.h:187
static int repeat
Definition: xmllint.c:143
static int quiet
Definition: xmllint.c:168
#define NULL
Definition: types.h:112
FILE * stderr
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
static int callbacks
Definition: xmllint.c:880
void * userData
Definition: parser.h:188
xmlSAXHandlerPtr debugSAXHandler
Definition: xmllint.c:1501
static int noout
Definition: xmllint.c:119

Referenced by main().

◆ unparsedEntityDeclDebug()

static void unparsedEntityDeclDebug ( void *ctx  ATTRIBUTE_UNUSED,
const xmlChar name,
const xmlChar publicId,
const xmlChar systemId,
const xmlChar notationName 
)
static

Definition at line 1164 of file xmllint.c.

1167 {
1168 const xmlChar *nullstr = BAD_CAST "(null)";
1169 
1170  if (publicId == NULL)
1171  publicId = nullstr;
1172  if (systemId == NULL)
1173  systemId = nullstr;
1174  if (notationName == NULL)
1175  notationName = nullstr;
1176  callbacks++;
1177  if (noout)
1178  return;
1179  fprintf(stdout, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
1180  (char *) name, (char *) publicId, (char *) systemId,
1181  (char *) notationName);
1182 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112
Definition: name.c:38
static int callbacks
Definition: xmllint.c:880
static int noout
Definition: xmllint.c:119

◆ usage()

static void usage ( FILE f,
const char name 
)
static

Definition at line 2988 of file xmllint.c.

2988  {
2989  fprintf(f, "Usage : %s [options] XMLfiles ...\n", name);
2990 #ifdef LIBXML_OUTPUT_ENABLED
2991  fprintf(f, "\tParse the XML files and output the result of the parsing\n");
2992 #else
2993  fprintf(f, "\tParse the XML files\n");
2994 #endif /* LIBXML_OUTPUT_ENABLED */
2995  fprintf(f, "\t--version : display the version of the XML library used\n");
2996 #ifdef LIBXML_DEBUG_ENABLED
2997  fprintf(f, "\t--debug : dump a debug tree of the in-memory document\n");
2998  fprintf(f, "\t--shell : run a navigating shell\n");
2999  fprintf(f, "\t--debugent : debug the entities defined in the document\n");
3000 #else
3001 #ifdef LIBXML_READER_ENABLED
3002  fprintf(f, "\t--debug : dump the nodes content when using --stream\n");
3003 #endif /* LIBXML_READER_ENABLED */
3004 #endif
3005 #ifdef LIBXML_TREE_ENABLED
3006  fprintf(f, "\t--copy : used to test the internal copy implementation\n");
3007 #endif /* LIBXML_TREE_ENABLED */
3008  fprintf(f, "\t--recover : output what was parsable on broken XML documents\n");
3009  fprintf(f, "\t--huge : remove any internal arbitrary parser limits\n");
3010  fprintf(f, "\t--noent : substitute entity references by their value\n");
3011  fprintf(f, "\t--noenc : ignore any encoding specified inside the document\n");
3012  fprintf(f, "\t--noout : don't output the result tree\n");
3013  fprintf(f, "\t--path 'paths': provide a set of paths for resources\n");
3014  fprintf(f, "\t--load-trace : print trace of all external entities loaded\n");
3015  fprintf(f, "\t--nonet : refuse to fetch DTDs or entities over network\n");
3016  fprintf(f, "\t--nocompact : do not generate compact text nodes\n");
3017  fprintf(f, "\t--htmlout : output results as HTML\n");
3018  fprintf(f, "\t--nowrap : do not put HTML doc wrapper\n");
3019 #ifdef LIBXML_VALID_ENABLED
3020  fprintf(f, "\t--valid : validate the document in addition to std well-formed check\n");
3021  fprintf(f, "\t--postvalid : do a posteriori validation, i.e after parsing\n");
3022  fprintf(f, "\t--dtdvalid URL : do a posteriori validation against a given DTD\n");
3023  fprintf(f, "\t--dtdvalidfpi FPI : same but name the DTD with a Public Identifier\n");
3024 #endif /* LIBXML_VALID_ENABLED */
3025  fprintf(f, "\t--quiet : be quiet when succeeded\n");
3026  fprintf(f, "\t--timing : print some timings\n");
3027  fprintf(f, "\t--output file or -o file: save to a given file\n");
3028  fprintf(f, "\t--repeat : repeat 100 times, for timing or profiling\n");
3029  fprintf(f, "\t--insert : ad-hoc test for valid insertions\n");
3030 #ifdef LIBXML_OUTPUT_ENABLED
3031 #ifdef LIBXML_ZLIB_ENABLED
3032  fprintf(f, "\t--compress : turn on gzip compression of output\n");
3033 #endif
3034 #endif /* LIBXML_OUTPUT_ENABLED */
3035 #ifdef LIBXML_HTML_ENABLED
3036  fprintf(f, "\t--html : use the HTML parser\n");
3037  fprintf(f, "\t--xmlout : force to use the XML serializer when using --html\n");
3038  fprintf(f, "\t--nodefdtd : do not default HTML doctype\n");
3039 #endif
3040 #ifdef LIBXML_PUSH_ENABLED
3041  fprintf(f, "\t--push : use the push mode of the parser\n");
3042  fprintf(f, "\t--pushsmall : use the push mode of the parser using tiny increments\n");
3043 #endif /* LIBXML_PUSH_ENABLED */
3044 #ifdef HAVE_MMAP
3045  fprintf(f, "\t--memory : parse from memory\n");
3046 #endif
3047  fprintf(f, "\t--maxmem nbbytes : limits memory allocation to nbbytes bytes\n");
3048  fprintf(f, "\t--nowarning : do not emit warnings from parser/validator\n");
3049  fprintf(f, "\t--noblanks : drop (ignorable?) blanks spaces\n");
3050  fprintf(f, "\t--nocdata : replace cdata section with text nodes\n");
3051 #ifdef LIBXML_OUTPUT_ENABLED
3052  fprintf(f, "\t--format : reformat/reindent the output\n");
3053  fprintf(f, "\t--encode encoding : output in the given encoding\n");
3054  fprintf(f, "\t--dropdtd : remove the DOCTYPE of the input docs\n");
3055  fprintf(f, "\t--pretty STYLE : pretty-print in a particular style\n");
3056  fprintf(f, "\t 0 Do not pretty print\n");
3057  fprintf(f, "\t 1 Format the XML content, as --format\n");
3058  fprintf(f, "\t 2 Add whitespace inside tags, preserving content\n");
3059 #endif /* LIBXML_OUTPUT_ENABLED */
3060  fprintf(f, "\t--c14n : save in W3C canonical format v1.0 (with comments)\n");
3061  fprintf(f, "\t--c14n11 : save in W3C canonical format v1.1 (with comments)\n");
3062  fprintf(f, "\t--exc-c14n : save in W3C exclusive canonical format (with comments)\n");
3063 #ifdef LIBXML_C14N_ENABLED
3064 #endif /* LIBXML_C14N_ENABLED */
3065  fprintf(f, "\t--nsclean : remove redundant namespace declarations\n");
3066  fprintf(f, "\t--testIO : test user I/O support\n");
3067 #ifdef LIBXML_CATALOG_ENABLED
3068  fprintf(f, "\t--catalogs : use SGML catalogs from $SGML_CATALOG_FILES\n");
3069  fprintf(f, "\t otherwise XML Catalogs starting from \n");
3070  fprintf(f, "\t %s are activated by default\n", XML_XML_DEFAULT_CATALOG);
3071  fprintf(f, "\t--nocatalogs: deactivate all catalogs\n");
3072 #endif
3073  fprintf(f, "\t--auto : generate a small doc on the fly\n");
3074 #ifdef LIBXML_XINCLUDE_ENABLED
3075  fprintf(f, "\t--xinclude : do XInclude processing\n");
3076  fprintf(f, "\t--noxincludenode : same but do not generate XInclude nodes\n");
3077  fprintf(f, "\t--nofixup-base-uris : do not fixup xml:base uris\n");
3078 #endif
3079  fprintf(f, "\t--loaddtd : fetch external DTD\n");
3080  fprintf(f, "\t--dtdattr : loaddtd + populate the tree with inherited attributes \n");
3081 #ifdef LIBXML_READER_ENABLED
3082  fprintf(f, "\t--stream : use the streaming interface to process very large files\n");
3083  fprintf(f, "\t--walker : create a reader and walk though the resulting doc\n");
3084 #ifdef LIBXML_PATTERN_ENABLED
3085  fprintf(f, "\t--pattern pattern_value : test the pattern support\n");
3086 #endif
3087 #endif /* LIBXML_READER_ENABLED */
3088  fprintf(f, "\t--chkregister : verify the node registration code\n");
3089 #ifdef LIBXML_SCHEMAS_ENABLED
3090  fprintf(f, "\t--relaxng schema : do RelaxNG validation against the schema\n");
3091  fprintf(f, "\t--schema schema : do validation against the WXS schema\n");
3092 #endif
3093 #ifdef LIBXML_SCHEMATRON_ENABLED
3094  fprintf(f, "\t--schematron schema : do validation against a schematron\n");
3095 #endif
3096 #ifdef LIBXML_SAX1_ENABLED
3097  fprintf(f, "\t--sax1: use the old SAX1 interfaces for processing\n");
3098 #endif
3099  fprintf(f, "\t--sax: do not build a tree but work just at the SAX level\n");
3100  fprintf(f, "\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n");
3101 #ifdef LIBXML_XPATH_ENABLED
3102  fprintf(f, "\t--xpath expr: evaluate the XPath expression, imply --noout\n");
3103 #endif
3104 
3105  fprintf(f, "\nLibxml project home page: http://xmlsoft.org/\n");
3106  fprintf(f, "To report bugs or get some help check: http://xmlsoft.org/bugs.html\n");
3107 }
#define XML_XML_DEFAULT_CATALOG
Definition: xmllint.c:90
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLfloat f
Definition: glext.h:7540
Definition: name.c:38

Referenced by main().

◆ xmlHTMLEncodeSend()

static void xmlHTMLEncodeSend ( void  )
static

Definition at line 529 of file xmllint.c.

529  {
530  char *result;
531 
532  /*
533  * xmlEncodeEntitiesReentrant assumes valid UTF-8, but the buffer might
534  * end with a truncated UTF-8 sequence. This is a hack to at least avoid
535  * an out-of-bounds read.
536  */
537  memset(&buffer[sizeof(buffer)-4], 0, 4);
539  if (result) {
541  xmlFree(result);
542  }
543  buffer[0] = 0;
544 }
GLuint64EXT * result
Definition: glext.h:11304
GLuint buffer
Definition: glext.h:5915
XMLPUBFUN xmlChar *XMLCALL xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
#define NULL
Definition: types.h:112
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by LIBXML_ATTR_FORMAT(), xmlHTMLPrintFileContext(), and xmlHTMLPrintFileInfo().

◆ xmlHTMLPrintFileContext()

static void xmlHTMLPrintFileContext ( xmlParserInputPtr  input)
static

xmlHTMLPrintFileContext: @input: an xmlParserInputPtr input

Displays current context within the input content for error tracking

Definition at line 578 of file xmllint.c.

578  {
579  const xmlChar *cur, *base;
580  int len;
581  int n;
582 
583  if (input == NULL) return;
585  cur = input->cur;
586  base = input->base;
587  while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
588  cur--;
589  }
590  n = 0;
591  while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
592  cur--;
593  if ((*cur == '\n') || (*cur == '\r')) cur++;
594  base = cur;
595  n = 0;
596  while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
597  len = strlen(buffer);
598  snprintf(&buffer[len], sizeof(buffer) - len, "%c",
599  (unsigned char) *cur++);
600  n++;
601  }
602  len = strlen(buffer);
603  snprintf(&buffer[len], sizeof(buffer) - len, "\n");
604  cur = input->cur;
605  while ((*cur == '\n') || (*cur == '\r'))
606  cur--;
607  n = 0;
608  while ((cur != base) && (n++ < 80)) {
609  len = strlen(buffer);
610  snprintf(&buffer[len], sizeof(buffer) - len, " ");
611  base++;
612  }
613  len = strlen(buffer);
614  snprintf(&buffer[len], sizeof(buffer) - len, "^\n");
617 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void xmlHTMLEncodeSend(void)
Definition: xmllint.c:529
GLdouble n
Definition: glext.h:7729
#define snprintf
Definition: wintirpc.h:48
GLuint buffer
Definition: glext.h:5915
GLuint base
Definition: 3dtext.c:35
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by LIBXML_ATTR_FORMAT().

◆ xmlHTMLPrintFileInfo()

static void xmlHTMLPrintFileInfo ( xmlParserInputPtr  input)
static

xmlHTMLPrintFileInfo: @input: an xmlParserInputPtr input

Displays the associated file and line information for the current input

Definition at line 554 of file xmllint.c.

554  {
555  int len;
557 
558  len = strlen(buffer);
559  if (input != NULL) {
560  if (input->filename) {
561  snprintf(&buffer[len], sizeof(buffer) - len, "%s:%d: ", input->filename,
562  input->line);
563  } else {
564  snprintf(&buffer[len], sizeof(buffer) - len, "Entity: line %d: ", input->line);
565  }
566  }
568 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void xmlHTMLEncodeSend(void)
Definition: xmllint.c:529
#define snprintf
Definition: wintirpc.h:48
GLuint buffer
Definition: glext.h:5915
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define NULL
Definition: types.h:112
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by LIBXML_ATTR_FORMAT().

◆ xmllintExternalEntityLoader()

static xmlParserInputPtr xmllintExternalEntityLoader ( const char URL,
const char ID,
xmlParserCtxtPtr  ctxt 
)
static

Definition at line 246 of file xmllint.c.

247  {
250  errorSAXFunc err = NULL;
251 
252  int i;
253  const char *lastsegment = URL;
254  const char *iter = URL;
255 
256  if ((nbpaths > 0) && (iter != NULL)) {
257  while (*iter != 0) {
258  if (*iter == '/')
259  lastsegment = iter + 1;
260  iter++;
261  }
262  }
263 
264  if ((ctxt != NULL) && (ctxt->sax != NULL)) {
265  warning = ctxt->sax->warning;
266  err = ctxt->sax->error;
267  ctxt->sax->warning = NULL;
268  ctxt->sax->error = NULL;
269  }
270 
271  if (defaultEntityLoader != NULL) {
272  ret = defaultEntityLoader(URL, ID, ctxt);
273  if (ret != NULL) {
274  if (warning != NULL)
275  ctxt->sax->warning = warning;
276  if (err != NULL)
277  ctxt->sax->error = err;
278  if (load_trace) {
279  fprintf \
280  (stderr,
281  "Loaded URL=\"%s\" ID=\"%s\"\n",
282  URL ? URL : "(null)",
283  ID ? ID : "(null)");
284  }
285  return(ret);
286  }
287  }
288  for (i = 0;i < nbpaths;i++) {
289  xmlChar *newURL;
290 
291  newURL = xmlStrdup((const xmlChar *) paths[i]);
292  newURL = xmlStrcat(newURL, (const xmlChar *) "/");
293  newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment);
294  if (newURL != NULL) {
295  ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
296  if (ret != NULL) {
297  if (warning != NULL)
298  ctxt->sax->warning = warning;
299  if (err != NULL)
300  ctxt->sax->error = err;
301  if (load_trace) {
302  fprintf \
303  (stderr,
304  "Loaded URL=\"%s\" ID=\"%s\"\n",
305  newURL,
306  ID ? ID : "(null)");
307  }
308  xmlFree(newURL);
309  return(ret);
310  }
311  xmlFree(newURL);
312  }
313  }
314  if (err != NULL)
315  ctxt->sax->error = err;
316  if (warning != NULL) {
317  ctxt->sax->warning = warning;
318  if (URL != NULL)
319  warning(ctxt, "failed to load external entity \"%s\"\n", URL);
320  else if (ID != NULL)
321  warning(ctxt, "failed to load external entity \"%s\"\n", ID);
322  }
323  return(NULL);
324 }
static int nbpaths
Definition: xmllint.c:214
void(XMLCDECL * warningSAXFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: parser.h:610
static int load_trace
Definition: xmllint.c:215
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
Definition: xmlstring.c:529
static xmlExternalEntityLoader defaultEntityLoader
Definition: xmllint.c:243
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
#define ID
Definition: ruserpass.c:36
#define err(...)
GLsizei const GLuint * paths
Definition: glext.h:11717
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
FILE * stderr
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
#define warning(s)
Definition: debug.h:83

Referenced by main().

Variable Documentation

◆ begin

clock_t begin
static

Definition at line 467 of file xmllint.c.

Referenced by basic_string< char, char_traits< char >, allocator< char > >::_M_assign(), vector< CTestInfo >::_M_fill_assign(), list< BookmarkNode >::_M_fill_assign(), TArrayAsVector< KeyMap >::AddAt(), adns__findtype(), basic_string< char, char_traits< char >, allocator< char > >::assign(), checkMiddle(), _Rb_tree< key_type, key_compare, value_type, _STLP_SELECT1ST(value_type, void), _MapTraits, _Alloc >::clear(), copy_char_to_wchar_sz(), DBG_cutIntersectionPoly(), DBG_edgeIntersectChainD(), DecompressBitmap(), directedLine::deleteChain(), TArrayAsVector< KeyMap >::Destroy(), TArrayAsVector< KeyMap >::Detach(), Window::dispatch_dialog_msg(), _Rb_tree< key_type, key_compare, value_type, _STLP_SELECT1ST(value_type, void), _MapTraits, _Alloc >::erase(), TArrayAsVector< KeyMap >::Find(), basic_string< char, char_traits< char >, allocator< char > >::find_first_of(), basic_string< char, char_traits< char >, allocator< char > >::find_last_not_of(), basic_string< char, char_traits< char >, allocator< char > >::find_last_of(), vertexArray::findDecreaseChainFromEnd(), findIncreaseChainFromBegin(), list< BookmarkNode >::front(), slist< value_type, _All >::front(), ResizeManager::HandleSize(), anonymous_namespace{mstscax.cpp}::init(), ATL::CComEnumImpl< Base, piid, T, Copy >::Init(), vector< CTestInfo >::insert(), _Rb_tree< key_type, key_compare, value_type, _STLP_SELECT1ST(value_type, void), _MapTraits, _Alloc >::insert_unique(), LIBXML_ATTR_FORMAT(), main(), msi_dialog_edit_control(), msi_dialog_vcl_add_columns(), _Rb_tree< key_type, key_compare, value_type, _STLP_SELECT1ST(value_type, void), _MapTraits, _Alloc >::operator=(), list< BookmarkNode >::operator=(), parse_hex_literal(), Window::pretranslate_msg(), print_tokens(), TArrayAsVector< KeyMap >::Reallocate(), XMLStorage::XMLNode::Children::remove(), vector< CTestInfo >::rend(), deque< IncompleteClass >::rend(), list< BookmarkNode >::rend(), _Rb_tree< key_type, key_compare, value_type, _STLP_SELECT1ST(value_type, void), _MapTraits, _Alloc >::rend(), basic_string< char, char_traits< char >, allocator< char > >::rfind(), ShowDiff(), startTimer(), XMLStorage::XMLErrorList::str(), String_trim(), Desktops::SwitchToDesktop(), and Desktops::~Desktops().

◆ buffer

char buffer[50000]
static

Definition at line 526 of file xmllint.c.

◆ callbacks

◆ chkregister

int chkregister = 0
static

Definition at line 190 of file xmllint.c.

Referenced by main().

◆ debug

int debug = 0
static

Definition at line 110 of file xmllint.c.

Referenced by main(), and parseAndPrintFile().

◆ debugSAX2Handler

xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct
static

Definition at line 1625 of file xmllint.c.

Referenced by testSAX().

◆ debugSAX2HandlerStruct

xmlSAXHandler debugSAX2HandlerStruct
static

Definition at line 1590 of file xmllint.c.

◆ debugSAXHandler

Definition at line 1501 of file xmllint.c.

Referenced by testSAX().

◆ debugSAXHandlerStruct

xmlSAXHandler debugSAXHandlerStruct
static

Definition at line 1466 of file xmllint.c.

◆ defaultEntityLoader

xmlExternalEntityLoader defaultEntityLoader = NULL
static

Definition at line 243 of file xmllint.c.

Referenced by main(), and xmllintExternalEntityLoader().

◆ dropdtd

int dropdtd = 0
static

Definition at line 171 of file xmllint.c.

Referenced by main(), and parseAndPrintFile().

◆ dtdattrs

int dtdattrs = 0
static

Definition at line 165 of file xmllint.c.

Referenced by main().

◆ emptySAXHandler

xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct
static

Definition at line 878 of file xmllint.c.

Referenced by testSAX().

◆ emptySAXHandlerStruct

xmlSAXHandler emptySAXHandlerStruct
static

Definition at line 843 of file xmllint.c.

◆ encoding

char* encoding = NULL
static

Definition at line 161 of file xmllint.c.

Referenced by main(), and parseAndPrintFile().

◆ end

clock_t end
static

Definition at line 467 of file xmllint.c.

◆ generate

int generate = 0
static

Definition at line 170 of file xmllint.c.

Referenced by main(), and parseAndPrintFile().

◆ htmlout

int htmlout = 0
static

Definition at line 149 of file xmllint.c.

Referenced by main(), and parseAndPrintFile().

◆ insert

◆ load_trace

int load_trace = 0
static

Definition at line 215 of file xmllint.c.

Referenced by main(), and xmllintExternalEntityLoader().

◆ loaddtd

int loaddtd = 0
static

Definition at line 166 of file xmllint.c.

Referenced by main().

◆ maxmem

int maxmem = 0
static

Definition at line 111 of file xmllint.c.

Referenced by main(), myMallocFunc(), myReallocFunc(), myStrdupFunc(), and OOM().

◆ nbpaths

int nbpaths = 0
static

Definition at line 214 of file xmllint.c.

Referenced by parsePath(), and xmllintExternalEntityLoader().

◆ nbregister

int nbregister = 0
static

Definition at line 191 of file xmllint.c.

Referenced by deregisterNode(), main(), and registerNode().

◆ noblanks

int noblanks = 0
static

Definition at line 118 of file xmllint.c.

Referenced by main().

◆ noenc

int noenc = 0
static

Definition at line 117 of file xmllint.c.

Referenced by main(), and xsltCopyTree().

◆ noent

int noent = 0
static

Definition at line 116 of file xmllint.c.

Referenced by main().

◆ noout

◆ nowrap

int nowrap = 0
static

Definition at line 120 of file xmllint.c.

Referenced by