ReactOS  0.4.15-dev-489-g75a0787
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 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 463 of file xmllint.c.

◆ MAX_PATHS

#define MAX_PATHS   64

Definition at line 206 of file xmllint.c.

◆ PATH_SEPARATOR

#define PATH_SEPARATOR   ':'

Definition at line 210 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 1090 of file xmllint.c.

1093 {
1094  callbacks++;
1095  if (noout)
1096  return;
1097  if (defaultValue == NULL)
1098  fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n",
1099  elem, name, type, def);
1100  else
1101  fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
1102  elem, name, type, def, defaultValue);
1104 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
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 1365 of file xmllint.c.

1366 {
1367  callbacks++;
1368  if (noout)
1369  return;
1370  fprintf(stdout, "SAX.pcdata(%.20s, %d)\n",
1371  (char *) value, len);
1372 }
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:873
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 1276 of file xmllint.c.

1277 {
1278  char out[40];
1279  int i;
1280 
1281  callbacks++;
1282  if (noout)
1283  return;
1284  for (i = 0;(i<len) && (i < 30);i++)
1285  out[i] = ch[i];
1286  out[i] = 0;
1287 
1288  fprintf(stdout, "SAX.characters(%s, %d)\n", out, len);
1289 }
FILE * stdout
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
_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
static int callbacks
Definition: xmllint.c:873
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 1382 of file xmllint.c.

1383 {
1384  callbacks++;
1385  if (noout)
1386  return;
1387  fprintf(stdout, "SAX.comment(%s)\n", value);
1388 }
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:873
static int noout
Definition: xmllint.c:119

◆ deregisterNode()

static void deregisterNode ( xmlNodePtr  node)
static

Definition at line 3097 of file xmllint.c.

3098 {
3099  assert(node->_private != NULL);
3100  assert(*(long*)node->_private == (long) 0x81726354);
3101  free(node->_private);
3102  nbregister--;
3103 }
static int nbregister
Definition: xmllint.c:190
#define free
Definition: debug_ros.c:5
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
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 1116 of file xmllint.c.

1118 {
1119  callbacks++;
1120  if (noout)
1121  return;
1122  fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
1123  name, type);
1124 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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:873
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 1216 of file xmllint.c.

1217 {
1218  callbacks++;
1219  if (noout)
1220  return;
1221  fprintf(stdout, "SAX.endDocument()\n");
1222 }
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:873
static int noout
Definition: xmllint.c:119

◆ endElementDebug()

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

Definition at line 1258 of file xmllint.c.

1259 {
1260  callbacks++;
1261  if (noout)
1262  return;
1263  fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
1264 }
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:873
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 1564 of file xmllint.c.

1568 {
1569  callbacks++;
1570  if (noout)
1571  return;
1572  fprintf(stdout, "SAX.endElementNs(%s", (char *) localname);
1573  if (prefix == NULL)
1574  fprintf(stdout, ", NULL");
1575  else
1576  fprintf(stdout, ", %s", (char *) prefix);
1577  if (URI == NULL)
1578  fprintf(stdout, ", NULL)\n");
1579  else
1580  fprintf(stdout, ", '%s')\n", (char *) URI);
1581 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
static int callbacks
Definition: xmllint.c:873
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 1063 of file xmllint.c.

1065 {
1066 const xmlChar *nullstr = BAD_CAST "(null)";
1067  /* not all libraries handle printing null pointers nicely */
1068  if (publicId == NULL)
1069  publicId = nullstr;
1070  if (systemId == NULL)
1071  systemId = nullstr;
1072  if (content == NULL)
1073  content = (xmlChar *)nullstr;
1074  callbacks++;
1075  if (noout)
1076  return;
1077  fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
1078  name, type, publicId, systemId, content);
1079 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
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 960 of file xmllint.c.

962 {
963  callbacks++;
964  if (noout)
965  return;
966  fprintf(stdout, "SAX.externalSubset(%s,", name);
967  if (ExternalID == NULL)
968  fprintf(stdout, " ,");
969  else
970  fprintf(stdout, " %s,", ExternalID);
971  if (SystemID == NULL)
972  fprintf(stdout, " )\n");
973  else
974  fprintf(stdout, " %s)\n", SystemID);
975 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ getEntityDebug()

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

Definition at line 1022 of file xmllint.c.

1023 {
1024  callbacks++;
1025  if (noout)
1026  return(NULL);
1027  fprintf(stdout, "SAX.getEntity(%s)\n", name);
1028  return(NULL);
1029 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ getParameterEntityDebug()

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

Definition at line 1041 of file xmllint.c.

1042 {
1043  callbacks++;
1044  if (noout)
1045  return(NULL);
1046  fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
1047  return(NULL);
1048 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
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 920 of file xmllint.c.

921 {
922  callbacks++;
923  if (noout)
924  return(0);
925  fprintf(stdout, "SAX.hasExternalSubset()\n");
926  return(0);
927 }
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:873
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 902 of file xmllint.c.

903 {
904  callbacks++;
905  if (noout)
906  return(0);
907  fprintf(stdout, "SAX.hasInternalSubset()\n");
908  return(0);
909 }
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:873
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 1318 of file xmllint.c.

1319 {
1320  char out[40];
1321  int i;
1322 
1323  callbacks++;
1324  if (noout)
1325  return;
1326  for (i = 0;(i<len) && (i < 30);i++)
1327  out[i] = ch[i];
1328  out[i] = 0;
1329  fprintf(stdout, "SAX.ignorableWhitespace(%s, %d)\n", out, len);
1330 }
FILE * stdout
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
_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
static int callbacks
Definition: xmllint.c:873
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 936 of file xmllint.c.

938 {
939  callbacks++;
940  if (noout)
941  return;
942  fprintf(stdout, "SAX.internalSubset(%s,", name);
943  if (ExternalID == NULL)
944  fprintf(stdout, " ,");
945  else
946  fprintf(stdout, " %s,", ExternalID);
947  if (SystemID == NULL)
948  fprintf(stdout, " )\n");
949  else
950  fprintf(stdout, " %s)\n", SystemID);
951 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
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 884 of file xmllint.c.

885 {
886  callbacks++;
887  if (noout)
888  return(0);
889  fprintf(stdout, "SAX.isStandalone()\n");
890  return(0);
891 }
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:873
static int noout
Definition: xmllint.c:119

◆ LIBXML_ATTR_FORMAT() [1/2]

static void XMLCDECL LIBXML_ATTR_FORMAT ( ,
 
)
static

Definition at line 472 of file xmllint.c.

474 {
475  long msec;
476  va_list ap;
477 
478  end = clock();
479  msec = ((end - begin) * 1000) / CLOCKS_PER_SEC;
480 
481 #ifndef HAVE_STDARG_H
482 #error "endTimer required stdarg functions"
483 #endif
484  va_start(ap, fmt);
485  vfprintf(stderr, fmt, ap);
486  va_end(ap);
487  fprintf(stderr, " took %ld ms\n", msec);
488 }
#define CLOCKS_PER_SEC
Definition: xmllint.c:463
GLuint GLuint end
Definition: gl.h:1545
#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:466
#define va_start(ap, A)
Definition: acmsvcex.h:91
_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 621 of file xmllint.c.

623 {
624  xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
626  va_list args;
627  int len;
628 
629  buffer[0] = 0;
630  input = ctxt->input;
631  if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
632  input = ctxt->inputTab[ctxt->inputNr - 2];
633  }
634 
636 
637  xmlGenericError(xmlGenericErrorContext, "<b>error</b>: ");
638  va_start(args, msg);
639  len = strlen(buffer);
640  vsnprintf(&buffer[len], sizeof(buffer) - len, msg, args);
641  va_end(args);
644 
647 }
#define vsnprintf
Definition: tif_win32.c:406
xmlParserInputPtr * inputTab
Definition: parser.h:202
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void xmlHTMLEncodeSend(void)
Definition: xmllint.c:528
GLuint buffer
Definition: glext.h:5915
Definition: match.c:390
xmlParserInputPtr input
Definition: parser.h:199
#define va_end(ap)
Definition: acmsvcex.h:90
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
#define va_start(ap, A)
Definition: acmsvcex.h:91
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
#define msg(x)
Definition: auth_time.c:54
#define args
Definition: format.c:66
static void xmlHTMLPrintFileContext(xmlParserInputPtr input)
Definition: xmllint.c:571
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362
static void xmlHTMLPrintFileInfo(xmlParserInputPtr input)
Definition: xmllint.c:547

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 3106 of file xmllint.c.

3106  {
3107  int i, acount;
3108  int files = 0;
3109  int version = 0;
3110  const char* indent;
3111 
3112  if (argc <= 1) {
3113  usage(stderr, argv[0]);
3114  return(1);
3115  }
3117  for (i = 1; i < argc ; i++) {
3118  if (!strcmp(argv[i], "-"))
3119  break;
3120 
3121  if (argv[i][0] != '-')
3122  continue;
3123  if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
3124  debug++;
3125  else
3126 #ifdef LIBXML_DEBUG_ENABLED
3127  if ((!strcmp(argv[i], "-shell")) ||
3128  (!strcmp(argv[i], "--shell"))) {
3129  shell++;
3130  noout = 1;
3131  } else
3132 #endif
3133 #ifdef LIBXML_TREE_ENABLED
3134  if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
3135  copy++;
3136  else
3137 #endif /* LIBXML_TREE_ENABLED */
3138  if ((!strcmp(argv[i], "-recover")) ||
3139  (!strcmp(argv[i], "--recover"))) {
3140  recovery++;
3142  } else if ((!strcmp(argv[i], "-huge")) ||
3143  (!strcmp(argv[i], "--huge"))) {
3145  } else if ((!strcmp(argv[i], "-noent")) ||
3146  (!strcmp(argv[i], "--noent"))) {
3147  noent++;
3149  } else if ((!strcmp(argv[i], "-noenc")) ||
3150  (!strcmp(argv[i], "--noenc"))) {
3151  noenc++;
3153  } else if ((!strcmp(argv[i], "-nsclean")) ||
3154  (!strcmp(argv[i], "--nsclean"))) {
3156  } else if ((!strcmp(argv[i], "-nocdata")) ||
3157  (!strcmp(argv[i], "--nocdata"))) {
3159  } else if ((!strcmp(argv[i], "-nodict")) ||
3160  (!strcmp(argv[i], "--nodict"))) {
3162  } else if ((!strcmp(argv[i], "-version")) ||
3163  (!strcmp(argv[i], "--version"))) {
3164  showVersion(argv[0]);
3165  version = 1;
3166  } else if ((!strcmp(argv[i], "-noout")) ||
3167  (!strcmp(argv[i], "--noout")))
3168  noout++;
3169 #ifdef LIBXML_OUTPUT_ENABLED
3170  else if ((!strcmp(argv[i], "-o")) ||
3171  (!strcmp(argv[i], "-output")) ||
3172  (!strcmp(argv[i], "--output"))) {
3173  i++;
3174  output = argv[i];
3175  }
3176 #endif /* LIBXML_OUTPUT_ENABLED */
3177  else if ((!strcmp(argv[i], "-htmlout")) ||
3178  (!strcmp(argv[i], "--htmlout")))
3179  htmlout++;
3180  else if ((!strcmp(argv[i], "-nowrap")) ||
3181  (!strcmp(argv[i], "--nowrap")))
3182  nowrap++;
3183 #ifdef LIBXML_HTML_ENABLED
3184  else if ((!strcmp(argv[i], "-html")) ||
3185  (!strcmp(argv[i], "--html"))) {
3186  html++;
3187  }
3188  else if ((!strcmp(argv[i], "-xmlout")) ||
3189  (!strcmp(argv[i], "--xmlout"))) {
3190  xmlout++;
3191  } else if ((!strcmp(argv[i], "-nodefdtd")) ||
3192  (!strcmp(argv[i], "--nodefdtd"))) {
3193  nodefdtd++;
3194  options |= HTML_PARSE_NODEFDTD;
3195  }
3196 #endif /* LIBXML_HTML_ENABLED */
3197  else if ((!strcmp(argv[i], "-loaddtd")) ||
3198  (!strcmp(argv[i], "--loaddtd"))) {
3199  loaddtd++;
3201  } else if ((!strcmp(argv[i], "-dtdattr")) ||
3202  (!strcmp(argv[i], "--dtdattr"))) {
3203  loaddtd++;
3204  dtdattrs++;
3206  }
3207 #ifdef LIBXML_VALID_ENABLED
3208  else if ((!strcmp(argv[i], "-valid")) ||
3209  (!strcmp(argv[i], "--valid"))) {
3210  valid++;
3212  } else if ((!strcmp(argv[i], "-postvalid")) ||
3213  (!strcmp(argv[i], "--postvalid"))) {
3214  postvalid++;
3215  loaddtd++;
3217  } else if ((!strcmp(argv[i], "-dtdvalid")) ||
3218  (!strcmp(argv[i], "--dtdvalid"))) {
3219  i++;
3220  dtdvalid = argv[i];
3221  loaddtd++;
3223  } else if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
3224  (!strcmp(argv[i], "--dtdvalidfpi"))) {
3225  i++;
3226  dtdvalidfpi = argv[i];
3227  loaddtd++;
3229  }
3230 #endif /* LIBXML_VALID_ENABLED */
3231  else if ((!strcmp(argv[i], "-dropdtd")) ||
3232  (!strcmp(argv[i], "--dropdtd")))
3233  dropdtd++;
3234  else if ((!strcmp(argv[i], "-insert")) ||
3235  (!strcmp(argv[i], "--insert")))
3236  insert++;
3237  else if ((!strcmp(argv[i], "-timing")) ||
3238  (!strcmp(argv[i], "--timing")))
3239  timing++;
3240  else if ((!strcmp(argv[i], "-auto")) ||
3241  (!strcmp(argv[i], "--auto")))
3242  generate++;
3243  else if ((!strcmp(argv[i], "-repeat")) ||
3244  (!strcmp(argv[i], "--repeat"))) {
3245  if (repeat)
3246  repeat *= 10;
3247  else
3248  repeat = 100;
3249  }
3250 #ifdef LIBXML_PUSH_ENABLED
3251  else if ((!strcmp(argv[i], "-push")) ||
3252  (!strcmp(argv[i], "--push")))
3253  push++;
3254  else if ((!strcmp(argv[i], "-pushsmall")) ||
3255  (!strcmp(argv[i], "--pushsmall"))) {
3256  push++;
3257  pushsize = 10;
3258  }
3259 #endif /* LIBXML_PUSH_ENABLED */
3260 #ifdef HAVE_MMAP
3261  else if ((!strcmp(argv[i], "-memory")) ||
3262  (!strcmp(argv[i], "--memory")))
3263  memory++;
3264 #endif
3265  else if ((!strcmp(argv[i], "-testIO")) ||
3266  (!strcmp(argv[i], "--testIO")))
3267  testIO++;
3268 #ifdef LIBXML_XINCLUDE_ENABLED
3269  else if ((!strcmp(argv[i], "-xinclude")) ||
3270  (!strcmp(argv[i], "--xinclude"))) {
3271  xinclude++;
3273  }
3274  else if ((!strcmp(argv[i], "-noxincludenode")) ||
3275  (!strcmp(argv[i], "--noxincludenode"))) {
3276  xinclude++;
3279  }
3280  else if ((!strcmp(argv[i], "-nofixup-base-uris")) ||
3281  (!strcmp(argv[i], "--nofixup-base-uris"))) {
3282  xinclude++;
3285  }
3286 #endif
3287 #ifdef LIBXML_OUTPUT_ENABLED
3288 #ifdef LIBXML_ZLIB_ENABLED
3289  else if ((!strcmp(argv[i], "-compress")) ||
3290  (!strcmp(argv[i], "--compress"))) {
3291  compress++;
3292  xmlSetCompressMode(9);
3293  }
3294 #endif
3295 #endif /* LIBXML_OUTPUT_ENABLED */
3296  else if ((!strcmp(argv[i], "-nowarning")) ||
3297  (!strcmp(argv[i], "--nowarning"))) {
3301  }
3302  else if ((!strcmp(argv[i], "-pedantic")) ||
3303  (!strcmp(argv[i], "--pedantic"))) {
3307  }
3308 #ifdef LIBXML_DEBUG_ENABLED
3309  else if ((!strcmp(argv[i], "-debugent")) ||
3310  (!strcmp(argv[i], "--debugent"))) {
3311  debugent++;
3313  }
3314 #endif
3315 #ifdef LIBXML_C14N_ENABLED
3316  else if ((!strcmp(argv[i], "-c14n")) ||
3317  (!strcmp(argv[i], "--c14n"))) {
3318  canonical++;
3320  }
3321  else if ((!strcmp(argv[i], "-c14n11")) ||
3322  (!strcmp(argv[i], "--c14n11"))) {
3323  canonical_11++;
3325  }
3326  else if ((!strcmp(argv[i], "-exc-c14n")) ||
3327  (!strcmp(argv[i], "--exc-c14n"))) {
3328  exc_canonical++;
3330  }
3331 #endif
3332 #ifdef LIBXML_CATALOG_ENABLED
3333  else if ((!strcmp(argv[i], "-catalogs")) ||
3334  (!strcmp(argv[i], "--catalogs"))) {
3335  catalogs++;
3336  } else if ((!strcmp(argv[i], "-nocatalogs")) ||
3337  (!strcmp(argv[i], "--nocatalogs"))) {
3338  nocatalogs++;
3339  }
3340 #endif
3341  else if ((!strcmp(argv[i], "-encode")) ||
3342  (!strcmp(argv[i], "--encode"))) {
3343  i++;
3344  encoding = argv[i];
3345  /*
3346  * OK it's for testing purposes
3347  */
3348  xmlAddEncodingAlias("UTF-8", "DVEnc");
3349  }
3350  else if ((!strcmp(argv[i], "-noblanks")) ||
3351  (!strcmp(argv[i], "--noblanks"))) {
3352  noblanks++;
3355  }
3356  else if ((!strcmp(argv[i], "-maxmem")) ||
3357  (!strcmp(argv[i], "--maxmem"))) {
3358  i++;
3359  if (sscanf(argv[i], "%d", &maxmem) == 1) {
3361  myStrdupFunc);
3362  } else {
3363  maxmem = 0;
3364  }
3365  }
3366  else if ((!strcmp(argv[i], "-format")) ||
3367  (!strcmp(argv[i], "--format"))) {
3368  noblanks++;
3369 #ifdef LIBXML_OUTPUT_ENABLED
3370  format = 1;
3371 #endif /* LIBXML_OUTPUT_ENABLED */
3373  }
3374  else if ((!strcmp(argv[i], "-pretty")) ||
3375  (!strcmp(argv[i], "--pretty"))) {
3376  i++;
3377 #ifdef LIBXML_OUTPUT_ENABLED
3378  if (argv[i] != NULL) {
3379  format = atoi(argv[i]);
3380  if (format == 1) {
3381  noblanks++;
3383  }
3384  }
3385 #endif /* LIBXML_OUTPUT_ENABLED */
3386  }
3387 #ifdef LIBXML_READER_ENABLED
3388  else if ((!strcmp(argv[i], "-stream")) ||
3389  (!strcmp(argv[i], "--stream"))) {
3390  stream++;
3391  }
3392  else if ((!strcmp(argv[i], "-walker")) ||
3393  (!strcmp(argv[i], "--walker"))) {
3394  walker++;
3395  noout++;
3396 #ifdef LIBXML_PATTERN_ENABLED
3397  } else if ((!strcmp(argv[i], "-pattern")) ||
3398  (!strcmp(argv[i], "--pattern"))) {
3399  i++;
3400  pattern = argv[i];
3401 #endif
3402  }
3403 #endif /* LIBXML_READER_ENABLED */
3404 #ifdef LIBXML_SAX1_ENABLED
3405  else if ((!strcmp(argv[i], "-sax1")) ||
3406  (!strcmp(argv[i], "--sax1"))) {
3407  sax1++;
3409  }
3410 #endif /* LIBXML_SAX1_ENABLED */
3411  else if ((!strcmp(argv[i], "-sax")) ||
3412  (!strcmp(argv[i], "--sax"))) {
3413  sax++;
3414  }
3415  else if ((!strcmp(argv[i], "-chkregister")) ||
3416  (!strcmp(argv[i], "--chkregister"))) {
3417  chkregister++;
3418 #ifdef LIBXML_SCHEMAS_ENABLED
3419  } else if ((!strcmp(argv[i], "-relaxng")) ||
3420  (!strcmp(argv[i], "--relaxng"))) {
3421  i++;
3422  relaxng = argv[i];
3423  noent++;
3425  } else if ((!strcmp(argv[i], "-schema")) ||
3426  (!strcmp(argv[i], "--schema"))) {
3427  i++;
3428  schema = argv[i];
3429  noent++;
3430 #endif
3431 #ifdef LIBXML_SCHEMATRON_ENABLED
3432  } else if ((!strcmp(argv[i], "-schematron")) ||
3433  (!strcmp(argv[i], "--schematron"))) {
3434  i++;
3435  schematron = argv[i];
3436  noent++;
3437 #endif
3438  } else if ((!strcmp(argv[i], "-nonet")) ||
3439  (!strcmp(argv[i], "--nonet"))) {
3442  } else if ((!strcmp(argv[i], "-nocompact")) ||
3443  (!strcmp(argv[i], "--nocompact"))) {
3445  } else if ((!strcmp(argv[i], "-load-trace")) ||
3446  (!strcmp(argv[i], "--load-trace"))) {
3447  load_trace++;
3448  } else if ((!strcmp(argv[i], "-path")) ||
3449  (!strcmp(argv[i], "--path"))) {
3450  i++;
3452 #ifdef LIBXML_XPATH_ENABLED
3453  } else if ((!strcmp(argv[i], "-xpath")) ||
3454  (!strcmp(argv[i], "--xpath"))) {
3455  i++;
3456  noout++;
3457  xpathquery = argv[i];
3458 #endif
3459  } else if ((!strcmp(argv[i], "-oldxml10")) ||
3460  (!strcmp(argv[i], "--oldxml10"))) {
3461  oldxml10++;
3463  } else {
3464  fprintf(stderr, "Unknown option %s\n", argv[i]);
3465  usage(stderr, argv[0]);
3466  return(1);
3467  }
3468  }
3469 
3470 #ifdef LIBXML_CATALOG_ENABLED
3471  if (nocatalogs == 0) {
3472  if (catalogs) {
3473  const char *catal;
3474 
3475  catal = getenv("SGML_CATALOG_FILES");
3476  if (catal != NULL) {
3477  xmlLoadCatalogs(catal);
3478  } else {
3479  fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n");
3480  }
3481  }
3482  }
3483 #endif
3484 
3485 #ifdef LIBXML_SAX1_ENABLED
3486  if (sax1)
3487  xmlSAXDefaultVersion(1);
3488  else
3489  xmlSAXDefaultVersion(2);
3490 #endif /* LIBXML_SAX1_ENABLED */
3491 
3492  if (chkregister) {
3495  }
3496 
3497  indent = getenv("XMLLINT_INDENT");
3498  if(indent != NULL) {
3500  }
3501 
3502 
3505 
3507  if (loaddtd != 0)
3509  if (dtdattrs)
3511  if (noent != 0) xmlSubstituteEntitiesDefault(1);
3512 #ifdef LIBXML_VALID_ENABLED
3513  if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;
3514 #endif /* LIBXML_VALID_ENABLED */
3515  if ((htmlout) && (!nowrap)) {
3517  "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n");
3519  "\t\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n");
3521  "<html><head><title>%s output</title></head>\n",
3522  argv[0]);
3524  "<body bgcolor=\"#ffffff\"><h1 align=\"center\">%s output</h1>\n",
3525  argv[0]);
3526  }
3527 
3528 #ifdef LIBXML_SCHEMATRON_ENABLED
3529  if ((schematron != NULL) && (sax == 0)
3530 #ifdef LIBXML_READER_ENABLED
3531  && (stream == 0)
3532 #endif /* LIBXML_READER_ENABLED */
3533  ) {
3534  xmlSchematronParserCtxtPtr ctxt;
3535 
3536  /* forces loading the DTDs */
3539  if (timing) {
3540  startTimer();
3541  }
3542  ctxt = xmlSchematronNewParserCtxt(schematron);
3543 #if 0
3544  xmlSchematronSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
3545  NULL);
3546 #endif
3547  wxschematron = xmlSchematronParse(ctxt);
3548  if (wxschematron == NULL) {
3550  "Schematron schema %s failed to compile\n", schematron);
3552  schematron = NULL;
3553  }
3554  xmlSchematronFreeParserCtxt(ctxt);
3555  if (timing) {
3556  endTimer("Compiling the schemas");
3557  }
3558  }
3559 #endif
3560 #ifdef LIBXML_SCHEMAS_ENABLED
3561  if ((relaxng != NULL) && (sax == 0)
3562 #ifdef LIBXML_READER_ENABLED
3563  && (stream == 0)
3564 #endif /* LIBXML_READER_ENABLED */
3565  ) {
3566  xmlRelaxNGParserCtxtPtr ctxt;
3567 
3568  /* forces loading the DTDs */
3571  if (timing) {
3572  startTimer();
3573  }
3574  ctxt = xmlRelaxNGNewParserCtxt(relaxng);
3575  xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
3576  NULL);
3577  relaxngschemas = xmlRelaxNGParse(ctxt);
3578  if (relaxngschemas == NULL) {
3580  "Relax-NG schema %s failed to compile\n", relaxng);
3582  relaxng = NULL;
3583  }
3584  xmlRelaxNGFreeParserCtxt(ctxt);
3585  if (timing) {
3586  endTimer("Compiling the schemas");
3587  }
3588  } else if ((schema != NULL)
3589 #ifdef LIBXML_READER_ENABLED
3590  && (stream == 0)
3591 #endif
3592  ) {
3593  xmlSchemaParserCtxtPtr ctxt;
3594 
3595  if (timing) {
3596  startTimer();
3597  }
3598  ctxt = xmlSchemaNewParserCtxt(schema);
3599  xmlSchemaSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
3600  wxschemas = xmlSchemaParse(ctxt);
3601  if (wxschemas == NULL) {
3603  "WXS schema %s failed to compile\n", schema);
3605  schema = NULL;
3606  }
3607  xmlSchemaFreeParserCtxt(ctxt);
3608  if (timing) {
3609  endTimer("Compiling the schemas");
3610  }
3611  }
3612 #endif /* LIBXML_SCHEMAS_ENABLED */
3613 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
3614  if ((pattern != NULL) && (walker == 0)) {
3615  patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL);
3616  if (patternc == NULL) {
3618  "Pattern %s failed to compile\n", pattern);
3620  pattern = NULL;
3621  }
3622  }
3623 #endif /* LIBXML_READER_ENABLED && LIBXML_PATTERN_ENABLED */
3624  for (i = 1; i < argc ; i++) {
3625  if ((!strcmp(argv[i], "-encode")) ||
3626  (!strcmp(argv[i], "--encode"))) {
3627  i++;
3628  continue;
3629  } else if ((!strcmp(argv[i], "-o")) ||
3630  (!strcmp(argv[i], "-output")) ||
3631  (!strcmp(argv[i], "--output"))) {
3632  i++;
3633  continue;
3634  }
3635 #ifdef LIBXML_VALID_ENABLED
3636  if ((!strcmp(argv[i], "-dtdvalid")) ||
3637  (!strcmp(argv[i], "--dtdvalid"))) {
3638  i++;
3639  continue;
3640  }
3641  if ((!strcmp(argv[i], "-path")) ||
3642  (!strcmp(argv[i], "--path"))) {
3643  i++;
3644  continue;
3645  }
3646  if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
3647  (!strcmp(argv[i], "--dtdvalidfpi"))) {
3648  i++;
3649  continue;
3650  }
3651 #endif /* LIBXML_VALID_ENABLED */
3652  if ((!strcmp(argv[i], "-relaxng")) ||
3653  (!strcmp(argv[i], "--relaxng"))) {
3654  i++;
3655  continue;
3656  }
3657  if ((!strcmp(argv[i], "-maxmem")) ||
3658  (!strcmp(argv[i], "--maxmem"))) {
3659  i++;
3660  continue;
3661  }
3662  if ((!strcmp(argv[i], "-pretty")) ||
3663  (!strcmp(argv[i], "--pretty"))) {
3664  i++;
3665  continue;
3666  }
3667  if ((!strcmp(argv[i], "-schema")) ||
3668  (!strcmp(argv[i], "--schema"))) {
3669  i++;
3670  continue;
3671  }
3672  if ((!strcmp(argv[i], "-schematron")) ||
3673  (!strcmp(argv[i], "--schematron"))) {
3674  i++;
3675  continue;
3676  }
3677 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
3678  if ((!strcmp(argv[i], "-pattern")) ||
3679  (!strcmp(argv[i], "--pattern"))) {
3680  i++;
3681  continue;
3682  }
3683 #endif
3684 #ifdef LIBXML_XPATH_ENABLED
3685  if ((!strcmp(argv[i], "-xpath")) ||
3686  (!strcmp(argv[i], "--xpath"))) {
3687  i++;
3688  continue;
3689  }
3690 #endif
3691  if ((timing) && (repeat))
3692  startTimer();
3693  /* Remember file names. "-" means stdin. <sven@zen.org> */
3694  if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
3695  if (repeat) {
3696  xmlParserCtxtPtr ctxt = NULL;
3697 
3698  for (acount = 0;acount < repeat;acount++) {
3699 #ifdef LIBXML_READER_ENABLED
3700  if (stream != 0) {
3701  streamFile(argv[i]);
3702  } else {
3703 #endif /* LIBXML_READER_ENABLED */
3704  if (sax) {
3705  testSAX(argv[i]);
3706  } else {
3707  if (ctxt == NULL)
3708  ctxt = xmlNewParserCtxt();
3709  parseAndPrintFile(argv[i], ctxt);
3710  }
3711 #ifdef LIBXML_READER_ENABLED
3712  }
3713 #endif /* LIBXML_READER_ENABLED */
3714  }
3715  if (ctxt != NULL)
3716  xmlFreeParserCtxt(ctxt);
3717  } else {
3718  nbregister = 0;
3719 
3720 #ifdef LIBXML_READER_ENABLED
3721  if (stream != 0)
3722  streamFile(argv[i]);
3723  else
3724 #endif /* LIBXML_READER_ENABLED */
3725  if (sax) {
3726  testSAX(argv[i]);
3727  } else {
3729  }
3730 
3731  if ((chkregister) && (nbregister != 0)) {
3732  fprintf(stderr, "Registration count off: %d\n", nbregister);
3734  }
3735  }
3736  files ++;
3737  if ((timing) && (repeat)) {
3738  endTimer("%d iterations", repeat);
3739  }
3740  }
3741  }
3742  if (generate)
3744  if ((htmlout) && (!nowrap)) {
3745  xmlGenericError(xmlGenericErrorContext, "</body></html>\n");
3746  }
3747  if ((files == 0) && (!generate) && (version == 0)) {
3748  usage(stderr, argv[0]);
3749  }
3750 #ifdef LIBXML_SCHEMATRON_ENABLED
3751  if (wxschematron != NULL)
3752  xmlSchematronFree(wxschematron);
3753 #endif
3754 #ifdef LIBXML_SCHEMAS_ENABLED
3755  if (relaxngschemas != NULL)
3756  xmlRelaxNGFree(relaxngschemas);
3757  if (wxschemas != NULL)
3758  xmlSchemaFree(wxschemas);
3759  xmlRelaxNGCleanupTypes();
3760 #endif
3761 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
3762  if (patternc != NULL)
3763  xmlFreePattern(patternc);
3764 #endif
3765  xmlCleanupParser();
3766  xmlMemoryDump();
3767 
3768  return(progresult);
3769 }
static xmllintReturnCode progresult
Definition: xmllint.c:167
static void deregisterNode(xmlNodePtr node)
Definition: xmllint.c:3097
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:190
#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:170
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader(void)
static int insert
Definition: xmllint.c:144
static int generate
Definition: xmllint.c:169
#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:198
static int nowrap
Definition: xmllint.c:120
static void * myReallocFunc(void *mem, size_t size)
Definition: xmllint.c:358
static int testIO
Definition: xmllint.c:160
static int load_trace
Definition: xmllint.c:214
static int maxmem
Definition: xmllint.c:111
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 void startTimer(void)
Definition: xmllint.c:468
XMLPUBFUN int XMLCALL xmlAddEncodingAlias(const char *name, const char *alias)
Definition: encoding.c:1057
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
smooth NULL
Definition: ftsmooth.c:416
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:245
XMLPUBVAR const char * xmlTreeIndentString
Definition: globals.h:396
static void myFreeFunc(void *mem)
Definition: xmllint.c:338
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:242
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:343
static void parsePath(const xmlChar *path)
Definition: xmllint.c:217
static void testSAX(const char *filename)
Definition: xmllint.c:1621
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)
#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
const WCHAR * schema
static int oldxml10
Definition: xmllint.c:199
static char * myStrdupFunc(const char *str)
Definition: xmllint.c:373
static int chkregister
Definition: xmllint.c:189
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt)
Definition: xmllint.c:2158
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:2966
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:168
XMLPUBFUN void XMLCALL xmlCleanupParser(void)
Definition: parser.c:14798
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
static void showVersion(const char *name)
Definition: xmllint.c:2927
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:3086

◆ myClose()

static int myClose ( void context)
static

Definition at line 820 of file xmllint.c.

820  {
821  FILE *f = (FILE *) context;
822  if (f == stdin)
823  return(0);
824  return(fclose(f));
825 }
Definition: http.c:7094
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 338 of file xmllint.c.

339 {
340  xmlMemFree(mem);
341 }
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 343 of file xmllint.c.

344 {
345  void *ret;
346 
347  ret = xmlMemMalloc(size);
348  if (ret != NULL) {
349  if (xmlMemUsed() > maxmem) {
350  OOM();
351  xmlMemFree(ret);
352  return (NULL);
353  }
354  }
355  return (ret);
356 }
static void OOM(void)
Definition: xmllint.c:331
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
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlMemFree(void *ptr)
Definition: xmlmemory.c:431
GLsizeiptr size
Definition: glext.h:5919
int ret

Referenced by main().

◆ myRead()

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

Definition at line 817 of file xmllint.c.

817  {
818  return(fread(buf, 1, len, (FILE *) f));
819 }
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 358 of file xmllint.c.

359 {
360  void *ret;
361 
363  if (ret != NULL) {
364  if (xmlMemUsed() > maxmem) {
365  OOM();
366  xmlMemFree(ret);
367  return (NULL);
368  }
369  }
370  return (ret);
371 }
static void OOM(void)
Definition: xmllint.c:331
XMLPUBFUN int XMLCALL xmlMemUsed(void)
Definition: xmlmemory.c:585
static int maxmem
Definition: xmllint.c:111
smooth NULL
Definition: ftsmooth.c:416
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
Definition: mem.c:156

Referenced by main().

◆ myStrdupFunc()

static char* myStrdupFunc ( const char str)
static

Definition at line 373 of file xmllint.c.

374 {
375  char *ret;
376 
378  if (ret != NULL) {
379  if (xmlMemUsed() > maxmem) {
380  OOM();
381  xmlFree(ret);
382  return (NULL);
383  }
384  }
385  return (ret);
386 }
static void OOM(void)
Definition: xmllint.c:331
XMLPUBFUN int XMLCALL xmlMemUsed(void)
Definition: xmlmemory.c:585
static int maxmem
Definition: xmllint.c:111
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
int ret
XMLPUBFUN char *XMLCALL xmlMemoryStrdup(const char *str)
Definition: xmlmemory.c:572

Referenced by main().

◆ notationDeclDebug()

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

Definition at line 1136 of file xmllint.c.

1138 {
1139  callbacks++;
1140  if (noout)
1141  return;
1142  fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
1143  (char *) name, (char *) publicId, (char *) systemId);
1144 }
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:873
static int noout
Definition: xmllint.c:119

◆ OOM()

static void OOM ( void  )
static

Definition at line 331 of file xmllint.c.

332 {
333  fprintf(stderr, "Ran out of memory needs > %d bytes\n", maxmem);
335 }
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 2158 of file xmllint.c.

2158  {
2159  xmlDocPtr doc = NULL;
2160 #ifdef LIBXML_TREE_ENABLED
2161  xmlDocPtr tmp;
2162 #endif /* LIBXML_TREE_ENABLED */
2163 
2164  if ((timing) && (!repeat))
2165  startTimer();
2166 
2167 
2168 #ifdef LIBXML_TREE_ENABLED
2169  if (filename == NULL) {
2170  if (generate) {
2171  xmlNodePtr n;
2172 
2173  doc = xmlNewDoc(BAD_CAST "1.0");
2174  n = xmlNewDocNode(doc, NULL, BAD_CAST "info", NULL);
2175  xmlNodeSetContent(n, BAD_CAST "abc");
2176  xmlDocSetRootElement(doc, n);
2177  }
2178  }
2179 #endif /* LIBXML_TREE_ENABLED */
2180 #ifdef LIBXML_HTML_ENABLED
2181 #ifdef LIBXML_PUSH_ENABLED
2182  else if ((html) && (push)) {
2183  FILE *f;
2184 
2185 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2186  f = fopen(filename, "rb");
2187 #elif defined(__OS400__)
2188  f = fopen(filename, "rb");
2189 #else
2190  f = fopen(filename, "r");
2191 #endif
2192  if (f != NULL) {
2193  int res;
2194  char chars[4096];
2195  htmlParserCtxtPtr ctxt;
2196 
2197  res = fread(chars, 1, 4, f);
2198  if (res > 0) {
2199  ctxt = htmlCreatePushParserCtxt(NULL, NULL,
2201  xmlCtxtUseOptions(ctxt, options);
2202  while ((res = fread(chars, 1, pushsize, f)) > 0) {
2203  htmlParseChunk(ctxt, chars, res, 0);
2204  }
2205  htmlParseChunk(ctxt, chars, 0, 1);
2206  doc = ctxt->myDoc;
2207  htmlFreeParserCtxt(ctxt);
2208  }
2209  fclose(f);
2210  }
2211  }
2212 #endif /* LIBXML_PUSH_ENABLED */
2213 #ifdef HAVE_MMAP
2214  else if ((html) && (memory)) {
2215  int fd;
2216  struct stat info;
2217  const char *base;
2218  if (stat(filename, &info) < 0)
2219  return;
2220  if ((fd = open(filename, O_RDONLY)) < 0)
2221  return;
2222  base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
2223  if (base == (void *) MAP_FAILED) {
2224  close(fd);
2225  fprintf(stderr, "mmap failure for file %s\n", filename);
2227  return;
2228  }
2229 
2230  doc = htmlReadMemory((char *) base, info.st_size, filename,
2231  NULL, options);
2232 
2233  munmap((char *) base, info.st_size);
2234  close(fd);
2235  }
2236 #endif
2237  else if (html) {
2238  doc = htmlReadFile(filename, NULL, options);
2239  }
2240 #endif /* LIBXML_HTML_ENABLED */
2241  else {
2242 #ifdef LIBXML_PUSH_ENABLED
2243  /*
2244  * build an XML tree from a string;
2245  */
2246  if (push) {
2247  FILE *f;
2248 
2249  /* '-' Usually means stdin -<sven@zen.org> */
2250  if ((filename[0] == '-') && (filename[1] == 0)) {
2251  f = stdin;
2252  } else {
2253 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2254  f = fopen(filename, "rb");
2255 #elif defined(__OS400__)
2256  f = fopen(filename, "rb");
2257 #else
2258  f = fopen(filename, "r");
2259 #endif
2260  }
2261  if (f != NULL) {
2262  int ret;
2263  int res, size = 1024;
2264  char chars[1024];
2265  xmlParserCtxtPtr ctxt;
2266 
2267  /* if (repeat) size = 1024; */
2268  res = fread(chars, 1, 4, f);
2269  if (res > 0) {
2270  ctxt = xmlCreatePushParserCtxt(NULL, NULL,
2271  chars, res, filename);
2272  xmlCtxtUseOptions(ctxt, options);
2273  while ((res = fread(chars, 1, size, f)) > 0) {
2274  xmlParseChunk(ctxt, chars, res, 0);
2275  }
2276  xmlParseChunk(ctxt, chars, 0, 1);
2277  doc = ctxt->myDoc;
2278  ret = ctxt->wellFormed;
2279  xmlFreeParserCtxt(ctxt);
2280  if (!ret) {
2281  xmlFreeDoc(doc);
2282  doc = NULL;
2283  }
2284  }
2285  if (f != stdin)
2286  fclose(f);
2287  }
2288  } else
2289 #endif /* LIBXML_PUSH_ENABLED */
2290  if (testIO) {
2291  if ((filename[0] == '-') && (filename[1] == 0)) {
2292  doc = xmlReadFd(0, NULL, NULL, options);
2293  } else {
2294  FILE *f;
2295 
2296 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2297  f = fopen(filename, "rb");
2298 #elif defined(__OS400__)
2299  f = fopen(filename, "rb");
2300 #else
2301  f = fopen(filename, "r");
2302 #endif
2303  if (f != NULL) {
2304  if (rectxt == NULL)
2305  doc = xmlReadIO(myRead, myClose, f, filename, NULL,
2306  options);
2307  else
2308  doc = xmlCtxtReadIO(rectxt, myRead, myClose, f,
2309  filename, NULL, options);
2310  } else
2311  doc = NULL;
2312  }
2313  } else if (htmlout) {
2314  xmlParserCtxtPtr ctxt;
2315 
2316  if (rectxt == NULL)
2317  ctxt = xmlNewParserCtxt();
2318  else
2319  ctxt = rectxt;
2320  if (ctxt == NULL) {
2321  doc = NULL;
2322  } else {
2323  ctxt->sax->error = xmlHTMLError;
2324  ctxt->sax->warning = xmlHTMLWarning;
2325  ctxt->vctxt.error = xmlHTMLValidityError;
2326  ctxt->vctxt.warning = xmlHTMLValidityWarning;
2327 
2328  doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
2329 
2330  if (rectxt == NULL)
2331  xmlFreeParserCtxt(ctxt);
2332  }
2333 #ifdef HAVE_MMAP
2334  } else if (memory) {
2335  int fd;
2336  struct stat info;
2337  const char *base;
2338  if (stat(filename, &info) < 0)
2339  return;
2340  if ((fd = open(filename, O_RDONLY)) < 0)
2341  return;
2342  base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
2343  if (base == (void *) MAP_FAILED) {
2344  close(fd);
2345  fprintf(stderr, "mmap failure for file %s\n", filename);
2347  return;
2348  }
2349 
2350  if (rectxt == NULL)
2351  doc = xmlReadMemory((char *) base, info.st_size,
2352  filename, NULL, options);
2353  else
2354  doc = xmlCtxtReadMemory(rectxt, (char *) base, info.st_size,
2355  filename, NULL, options);
2356 
2357  munmap((char *) base, info.st_size);
2358  close(fd);
2359 #endif
2360 #ifdef LIBXML_VALID_ENABLED
2361  } else if (valid) {
2362  xmlParserCtxtPtr ctxt = NULL;
2363 
2364  if (rectxt == NULL)
2365  ctxt = xmlNewParserCtxt();
2366  else
2367  ctxt = rectxt;
2368  if (ctxt == NULL) {
2369  doc = NULL;
2370  } else {
2371  doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
2372 
2373  if (ctxt->valid == 0)
2375  if (rectxt == NULL)
2376  xmlFreeParserCtxt(ctxt);
2377  }
2378 #endif /* LIBXML_VALID_ENABLED */
2379  } else {
2380  if (rectxt != NULL)
2381  doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
2382  else {
2383 #ifdef LIBXML_SAX1_ENABLED
2384  if (sax1)
2385  doc = xmlParseFile(filename);
2386  else
2387 #endif /* LIBXML_SAX1_ENABLED */
2388  doc = xmlReadFile(filename, NULL, options);
2389  }
2390  }
2391  }
2392 
2393  /*
2394  * If we don't have a document we might as well give up. Do we
2395  * want an error message here? <sven@zen.org> */
2396  if (doc == NULL) {
2398  return;
2399  }
2400 
2401  if ((timing) && (!repeat)) {
2402  endTimer("Parsing");
2403  }
2404 
2405  /*
2406  * Remove DOCTYPE nodes
2407  */
2408  if (dropdtd) {
2409  xmlDtdPtr dtd;
2410 
2411  dtd = xmlGetIntSubset(doc);
2412  if (dtd != NULL) {
2413  xmlUnlinkNode((xmlNodePtr)dtd);
2414  xmlFreeDtd(dtd);
2415  }
2416  }
2417 
2418 #ifdef LIBXML_XINCLUDE_ENABLED
2419  if (xinclude) {
2420  if ((timing) && (!repeat)) {
2421  startTimer();
2422  }
2423  if (xmlXIncludeProcessFlags(doc, options) < 0)
2425  if ((timing) && (!repeat)) {
2426  endTimer("Xinclude processing");
2427  }
2428  }
2429 #endif
2430 
2431 #ifdef LIBXML_XPATH_ENABLED
2432  if (xpathquery != NULL) {
2433  doXPathQuery(doc, xpathquery);
2434  }
2435 #endif
2436 
2437 #ifdef LIBXML_DEBUG_ENABLED
2438 #ifdef LIBXML_XPATH_ENABLED
2439  /*
2440  * shell interaction
2441  */
2442  if (shell) {
2443  xmlXPathOrderDocElems(doc);
2444  xmlShell(doc, filename, xmlShellReadline, stdout);
2445  }
2446 #endif
2447 #endif
2448 
2449 #ifdef LIBXML_TREE_ENABLED
2450  /*
2451  * test intermediate copy if needed.
2452  */
2453  if (copy) {
2454  tmp = doc;
2455  if (timing) {
2456  startTimer();
2457  }
2458  doc = xmlCopyDoc(doc, 1);
2459  if (timing) {
2460  endTimer("Copying");
2461  }
2462  if (timing) {
2463  startTimer();
2464  }
2465  xmlFreeDoc(tmp);
2466  if (timing) {
2467  endTimer("Freeing original");
2468  }
2469  }
2470 #endif /* LIBXML_TREE_ENABLED */
2471 
2472 #ifdef LIBXML_VALID_ENABLED
2473  if ((insert) && (!html)) {
2474  const xmlChar* list[256];
2475  int nb, i;
2476  xmlNodePtr node;
2477 
2478  if (doc->children != NULL) {
2479  node = doc->children;
2480  while ((node != NULL) && (node->last == NULL)) node = node->next;
2481  if (node != NULL) {
2482  nb = xmlValidGetValidElements(node->last, NULL, list, 256);
2483  if (nb < 0) {
2484  fprintf(stderr, "could not get valid list of elements\n");
2485  } else if (nb == 0) {
2486  fprintf(stderr, "No element can be inserted under root\n");
2487  } else {
2488  fprintf(stderr, "%d element types can be inserted under root:\n",
2489  nb);
2490  for (i = 0;i < nb;i++) {
2491  fprintf(stderr, "%s\n", (char *) list[i]);
2492  }
2493  }
2494  }
2495  }
2496  }else
2497 #endif /* LIBXML_VALID_ENABLED */
2498 #ifdef LIBXML_READER_ENABLED
2499  if (walker) {
2500  walkDoc(doc);
2501  }
2502 #endif /* LIBXML_READER_ENABLED */
2503 #ifdef LIBXML_OUTPUT_ENABLED
2504  if (noout == 0) {
2505  int ret;
2506 
2507  /*
2508  * print it.
2509  */
2510 #ifdef LIBXML_DEBUG_ENABLED
2511  if (!debug) {
2512 #endif
2513  if ((timing) && (!repeat)) {
2514  startTimer();
2515  }
2516 #ifdef LIBXML_HTML_ENABLED
2517  if ((html) && (!xmlout)) {
2518  if (compress) {
2519  htmlSaveFile(output ? output : "-", doc);
2520  }
2521  else if (encoding != NULL) {
2522  if (format == 1) {
2523  htmlSaveFileFormat(output ? output : "-", doc, encoding, 1);
2524  }
2525  else {
2526  htmlSaveFileFormat(output ? output : "-", doc, encoding, 0);
2527  }
2528  }
2529  else if (format == 1) {
2530  htmlSaveFileFormat(output ? output : "-", doc, NULL, 1);
2531  }
2532  else {
2533  FILE *out;
2534  if (output == NULL)
2535  out = stdout;
2536  else {
2537  out = fopen(output,"wb");
2538  }
2539  if (out != NULL) {
2540  if (htmlDocDump(out, doc) < 0)
2542 
2543  if (output != NULL)
2544  fclose(out);
2545  } else {
2546  fprintf(stderr, "failed to open %s\n", output);
2548  }
2549  }
2550  if ((timing) && (!repeat)) {
2551  endTimer("Saving");
2552  }
2553  } else
2554 #endif
2555 #ifdef LIBXML_C14N_ENABLED
2556  if (canonical) {
2557  xmlChar *result = NULL;
2558  int size;
2559 
2560  size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_0, NULL, 1, &result);
2561  if (size >= 0) {
2562  if (write(1, result, size) == -1) {
2563  fprintf(stderr, "Can't write data\n");
2564  }
2565  xmlFree(result);
2566  } else {
2567  fprintf(stderr, "Failed to canonicalize\n");
2569  }
2570  } else if (canonical_11) {
2571  xmlChar *result = NULL;
2572  int size;
2573 
2574  size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_1, NULL, 1, &result);
2575  if (size >= 0) {
2576  if (write(1, result, size) == -1) {
2577  fprintf(stderr, "Can't write data\n");
2578  }
2579  xmlFree(result);
2580  } else {
2581  fprintf(stderr, "Failed to canonicalize\n");
2583  }
2584  } else
2585  if (exc_canonical) {
2586  xmlChar *result = NULL;
2587  int size;
2588 
2589  size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_EXCLUSIVE_1_0, NULL, 1, &result);
2590  if (size >= 0) {
2591  if (write(1, result, size) == -1) {
2592  fprintf(stderr, "Can't write data\n");
2593  }
2594  xmlFree(result);
2595  } else {
2596  fprintf(stderr, "Failed to canonicalize\n");
2598  }
2599  } else
2600 #endif
2601 #ifdef HAVE_MMAP
2602  if (memory) {
2603  xmlChar *result;
2604  int len;
2605 
2606  if (encoding != NULL) {
2607  if (format == 1) {
2608  xmlDocDumpFormatMemoryEnc(doc, &result, &len, encoding, 1);
2609  } else {
2610  xmlDocDumpMemoryEnc(doc, &result, &len, encoding);
2611  }
2612  } else {
2613  if (format == 1)
2614  xmlDocDumpFormatMemory(doc, &result, &len, 1);
2615  else
2616  xmlDocDumpMemory(doc, &result, &len);
2617  }
2618  if (result == NULL) {
2619  fprintf(stderr, "Failed to save\n");
2621  } else {
2622  if (write(1, result, len) == -1) {
2623  fprintf(stderr, "Can't write data\n");
2624  }
2625  xmlFree(result);
2626  }
2627 
2628  } else
2629 #endif /* HAVE_MMAP */
2630  if (compress) {
2631  xmlSaveFile(output ? output : "-", doc);
2632  } else if (oldout) {
2633  if (encoding != NULL) {
2634  if (format == 1) {
2635  ret = xmlSaveFormatFileEnc(output ? output : "-", doc,
2636  encoding, 1);
2637  }
2638  else {
2639  ret = xmlSaveFileEnc(output ? output : "-", doc,
2640  encoding);
2641  }
2642  if (ret < 0) {
2643  fprintf(stderr, "failed save to %s\n",
2644  output ? output : "-");
2646  }
2647  } else if (format == 1) {
2648  ret = xmlSaveFormatFile(output ? output : "-", doc, 1);
2649  if (ret < 0) {
2650  fprintf(stderr, "failed save to %s\n",
2651  output ? output : "-");
2653  }
2654  } else {
2655  FILE *out;
2656  if (output == NULL)
2657  out = stdout;
2658  else {
2659  out = fopen(output,"wb");
2660  }
2661  if (out != NULL) {
2662  if (xmlDocDump(out, doc) < 0)
2664 
2665  if (output != NULL)
2666  fclose(out);
2667  } else {
2668  fprintf(stderr, "failed to open %s\n", output);
2670  }
2671  }
2672  } else {
2673  xmlSaveCtxtPtr ctxt;
2674  int saveOpts = 0;
2675 
2676  if (format == 1)
2677  saveOpts |= XML_SAVE_FORMAT;
2678  else if (format == 2)
2679  saveOpts |= XML_SAVE_WSNONSIG;
2680 
2681 #if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
2682  if (xmlout)
2683  saveOpts |= XML_SAVE_AS_XML;
2684 #endif
2685 
2686  if (output == NULL)
2687  ctxt = xmlSaveToFd(1, encoding, saveOpts);
2688  else
2689  ctxt = xmlSaveToFilename(output, encoding, saveOpts);
2690 
2691  if (ctxt != NULL) {
2692  if (xmlSaveDoc(ctxt, doc) < 0) {
2693  fprintf(stderr, "failed save to %s\n",
2694  output ? output : "-");
2696  }
2697  xmlSaveClose(ctxt);
2698  } else {
2700  }
2701  }
2702  if ((timing) && (!repeat)) {
2703  endTimer("Saving");
2704  }
2705 #ifdef LIBXML_DEBUG_ENABLED
2706  } else {
2707  FILE *out;
2708  if (output == NULL)
2709  out = stdout;
2710  else {
2711  out = fopen(output,"wb");
2712  }
2713  if (out != NULL) {
2714  xmlDebugDumpDocument(out, doc);
2715 
2716  if (output != NULL)
2717  fclose(out);
2718  } else {
2719  fprintf(stderr, "failed to open %s\n", output);
2721  }
2722  }
2723 #endif
2724  }
2725 #endif /* LIBXML_OUTPUT_ENABLED */
2726 
2727 #ifdef LIBXML_VALID_ENABLED
2728  /*
2729  * A posteriori validation test
2730  */
2731  if ((dtdvalid != NULL) || (dtdvalidfpi != NULL)) {
2732  xmlDtdPtr dtd;
2733 
2734  if ((timing) && (!repeat)) {
2735  startTimer();
2736  }
2737  if (dtdvalid != NULL)
2738  dtd = xmlParseDTD(NULL, (const xmlChar *)dtdvalid);
2739  else
2740  dtd = xmlParseDTD((const xmlChar *)dtdvalidfpi, NULL);
2741  if ((timing) && (!repeat)) {
2742  endTimer("Parsing DTD");
2743  }
2744  if (dtd == NULL) {
2745  if (dtdvalid != NULL)
2747  "Could not parse DTD %s\n", dtdvalid);
2748  else
2750  "Could not parse DTD %s\n", dtdvalidfpi);
2752  } else {
2753  xmlValidCtxtPtr cvp;
2754 
2755  if ((cvp = xmlNewValidCtxt()) == NULL) {
2757  "Couldn't allocate validation context\n");
2758  exit(-1);
2759  }
2760  cvp->userData = NULL;
2761  cvp->error = xmlGenericError;
2762  cvp->warning = xmlGenericError;
2763 
2764  if ((timing) && (!repeat)) {
2765  startTimer();
2766  }
2767  if (!xmlValidateDtd(cvp, doc, dtd)) {
2768  if (dtdvalid != NULL)
2770  "Document %s does not validate against %s\n",
2771  filename, dtdvalid);
2772  else
2774  "Document %s does not validate against %s\n",
2775  filename, dtdvalidfpi);
2777  }
2778  if ((timing) && (!repeat)) {
2779  endTimer("Validating against DTD");
2780  }
2781  xmlFreeValidCtxt(cvp);
2782  xmlFreeDtd(dtd);
2783  }
2784  } else if (postvalid) {
2785  xmlValidCtxtPtr cvp;
2786 
2787  if ((cvp = xmlNewValidCtxt()) == NULL) {
2789  "Couldn't allocate validation context\n");
2790  exit(-1);
2791  }
2792 
2793  if ((timing) && (!repeat)) {
2794  startTimer();
2795  }
2796  cvp->userData = NULL;
2797  cvp->error = xmlGenericError;
2798  cvp->warning = xmlGenericError;
2799  if (!xmlValidateDocument(cvp, doc)) {
2801  "Document %s does not validate\n", filename);
2803  }
2804  if ((timing) && (!repeat)) {
2805  endTimer("Validating");
2806  }
2807  xmlFreeValidCtxt(cvp);
2808  }
2809 #endif /* LIBXML_VALID_ENABLED */
2810 #ifdef LIBXML_SCHEMATRON_ENABLED
2811  if (wxschematron != NULL) {
2812  xmlSchematronValidCtxtPtr ctxt;
2813  int ret;
2814  int flag;
2815 
2816  if ((timing) && (!repeat)) {
2817  startTimer();
2818  }
2819 
2820  if (debug)
2821  flag = XML_SCHEMATRON_OUT_XML;
2822  else
2823  flag = XML_SCHEMATRON_OUT_TEXT;
2824  if (noout)
2825  flag |= XML_SCHEMATRON_OUT_QUIET;
2826  ctxt = xmlSchematronNewValidCtxt(wxschematron, flag);
2827 #if 0
2828  xmlSchematronSetValidErrors(ctxt, xmlGenericError, xmlGenericError,
2829  NULL);
2830 #endif
2831  ret = xmlSchematronValidateDoc(ctxt, doc);
2832  if (ret == 0) {
2833  fprintf(stderr, "%s validates\n", filename);
2834  } else if (ret > 0) {
2835  fprintf(stderr, "%s fails to validate\n", filename);
2837  } else {
2838  fprintf(stderr, "%s validation generated an internal error\n",
2839  filename);
2841  }
2842  xmlSchematronFreeValidCtxt(ctxt);
2843  if ((timing) && (!repeat)) {
2844  endTimer("Validating");
2845  }
2846  }
2847 #endif
2848 #ifdef LIBXML_SCHEMAS_ENABLED
2849  if (relaxngschemas != NULL) {
2850  xmlRelaxNGValidCtxtPtr ctxt;
2851  int ret;
2852 
2853  if ((timing) && (!repeat)) {
2854  startTimer();
2855  }
2856 
2857  ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas);
2858  xmlRelaxNGSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
2859  ret = xmlRelaxNGValidateDoc(ctxt, doc);
2860  if (ret == 0) {
2861  fprintf(stderr, "%s validates\n", filename);
2862  } else if (ret > 0) {
2863  fprintf(stderr, "%s fails to validate\n", filename);
2865  } else {
2866  fprintf(stderr, "%s validation generated an internal error\n",
2867  filename);
2869  }
2870  xmlRelaxNGFreeValidCtxt(ctxt);
2871  if ((timing) && (!repeat)) {
2872  endTimer("Validating");
2873  }
2874  } else if (wxschemas != NULL) {
2875  xmlSchemaValidCtxtPtr ctxt;
2876  int ret;
2877 
2878  if ((timing) && (!repeat)) {
2879  startTimer();
2880  }
2881 
2882  ctxt = xmlSchemaNewValidCtxt(wxschemas);
2883  xmlSchemaSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
2884  ret = xmlSchemaValidateDoc(ctxt, doc);
2885  if (ret == 0) {
2886  fprintf(stderr, "%s validates\n", filename);
2887  } else if (ret > 0) {
2888  fprintf(stderr, "%s fails to validate\n", filename);
2890  } else {
2891  fprintf(stderr, "%s validation generated an internal error\n",
2892  filename);
2894  }
2895  xmlSchemaFreeValidCtxt(ctxt);
2896  if ((timing) && (!repeat)) {
2897  endTimer("Validating");
2898  }
2899  }
2900 #endif
2901 
2902 #ifdef LIBXML_DEBUG_ENABLED
2903 #if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
2904  if ((debugent) && (!html))
2905  xmlDebugDumpEntities(stderr, doc);
2906 #endif
2907 #endif
2908 
2909  /*
2910  * free it.
2911  */
2912  if ((timing) && (!repeat)) {
2913  startTimer();
2914  }
2915  xmlFreeDoc(doc);
2916  if ((timing) && (!repeat)) {
2917  endTimer("Freeing");
2918  }
2919 }
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
#define open
Definition: acwin.h:95
static int myRead(void *f, char *buf, int len)
Definition: xmllint.c:817
XMLPUBFUN xmlDocPtr XMLCALL xmlReadFd(int fd, const char *URL, const char *encoding, int options)
Definition: parser.c:15323
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:170
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:15298
static int generate
Definition: xmllint.c:169
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:15572
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
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 void startTimer(void)
Definition: xmllint.c:468
XMLPUBFUN xmlDocPtr XMLCALL xmlReadFile(const char *URL, const char *encoding, int options)
Definition: parser.c:15274
_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
smooth NULL
Definition: ftsmooth.c:416
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:188
XMLPUBFUN xmlDocPtr XMLCALL xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
Definition: parser.c:15366
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:15186
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:187
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:185
_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
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
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
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:820
GLuint res
Definition: glext.h:9613
XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options)
Definition: parser.c:15447
void * userData
Definition: valid.h:83
FILE * stderr
struct _xmlNode * children
Definition: tree.h:555
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
static int timing
Definition: xmllint.c:168
void exit(int exitcode)
Definition: _exit.c:33
xmlValidCtxt vctxt
Definition: parser.h:221
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
GLuint64EXT * result
Definition: glext.h:11304
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:15483

Referenced by main().

◆ parsePath()

static void parsePath ( const xmlChar path)
static

Definition at line 217 of file xmllint.c.

217  {
218  const xmlChar *cur;
219 
220  if (path == NULL)
221  return;
222  while (*path != 0) {
223  if (nbpaths >= MAX_PATHS) {
224  fprintf(stderr, "MAX_PATHS reached: too many paths\n");
225  return;
226  }
227  cur = path;
228  while ((*cur == ' ') || (*cur == PATH_SEPARATOR))
229  cur++;
230  path = cur;
231  while ((*cur != 0) && (*cur != ' ') && (*cur != PATH_SEPARATOR))
232  cur++;
233  if (cur != path) {
234  paths[nbpaths] = xmlStrndup(path, cur - path);
235  if (paths[nbpaths] != NULL)
236  nbpaths++;
237  path = cur;
238  }
239  }
240 }
static int nbpaths
Definition: xmllint.c:213
#define MAX_PATHS
Definition: xmllint.c:206
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:210
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned char xmlChar
Definition: xmlstring.h:28
GLsizei const GLuint * paths
Definition: glext.h:11717
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 1342 of file xmllint.c.

1344 {
1345  callbacks++;
1346  if (noout)
1347  return;
1348  if (data != NULL)
1349  fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
1350  (char *) target, (char *) data);
1351  else
1352  fprintf(stdout, "SAX.processingInstruction(%s, NULL)\n",
1353  (char *) target);
1354 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum target
Definition: glext.h:7315
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ referenceDebug()

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

Definition at line 1299 of file xmllint.c.

1300 {
1301  callbacks++;
1302  if (noout)
1303  return;
1304  fprintf(stdout, "SAX.reference(%s)\n", name);
1305 }
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:873
static int noout
Definition: xmllint.c:119

◆ registerNode()

static void registerNode ( xmlNodePtr  node)
static

Definition at line 3086 of file xmllint.c.

3087 {
3088  node->_private = malloc(sizeof(long));
3089  if (node->_private == NULL) {
3090  fprintf(stderr, "Out of memory in xmllint:registerNode()\n");
3092  }
3093  *(long*)node->_private = (long) 0x81726354;
3094  nbregister++;
3095 }
static int nbregister
Definition: xmllint.c:190
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
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 992 of file xmllint.c.

993 {
994  callbacks++;
995  if (noout)
996  return(NULL);
997  /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
998 
999 
1000  fprintf(stdout, "SAX.resolveEntity(");
1001  if (publicId != NULL)
1002  fprintf(stdout, "%s", (char *)publicId);
1003  else
1004  fprintf(stdout, " ");
1005  if (systemId != NULL)
1006  fprintf(stdout, ", %s)\n", (char *)systemId);
1007  else
1008  fprintf(stdout, ", )\n");
1009  return(NULL);
1010 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
static int callbacks
Definition: xmllint.c:873
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 1186 of file xmllint.c.

1187 {
1188  callbacks++;
1189  if (noout)
1190  return;
1191  fprintf(stdout, "SAX.setDocumentLocator()\n");
1192 }
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:873
static int noout
Definition: xmllint.c:119

◆ showVersion()

static void showVersion ( const char name)
static

Definition at line 2927 of file xmllint.c.

2927  {
2928  fprintf(stderr, "%s: using libxml version %s\n", name, xmlParserVersion);
2929  fprintf(stderr, " compiled with: ");
2930  if (xmlHasFeature(XML_WITH_THREAD)) fprintf(stderr, "Threads ");
2931  if (xmlHasFeature(XML_WITH_TREE)) fprintf(stderr, "Tree ");
2932  if (xmlHasFeature(XML_WITH_OUTPUT)) fprintf(stderr, "Output ");
2933  if (xmlHasFeature(XML_WITH_PUSH)) fprintf(stderr, "Push ");
2934  if (xmlHasFeature(XML_WITH_READER)) fprintf(stderr, "Reader ");
2935  if (xmlHasFeature(XML_WITH_PATTERN)) fprintf(stderr, "Patterns ");
2936  if (xmlHasFeature(XML_WITH_WRITER)) fprintf(stderr, "Writer ");
2937  if (xmlHasFeature(XML_WITH_SAX1)) fprintf(stderr, "SAXv1 ");
2938  if (xmlHasFeature(XML_WITH_FTP)) fprintf(stderr, "FTP ");
2939  if (xmlHasFeature(XML_WITH_HTTP)) fprintf(stderr, "HTTP ");
2940  if (xmlHasFeature(XML_WITH_VALID)) fprintf(stderr, "DTDValid ");
2941  if (xmlHasFeature(XML_WITH_HTML)) fprintf(stderr, "HTML ");
2942  if (xmlHasFeature(XML_WITH_LEGACY)) fprintf(stderr, "Legacy ");
2943  if (xmlHasFeature(XML_WITH_C14N)) fprintf(stderr, "C14N ");
2944  if (xmlHasFeature(XML_WITH_CATALOG)) fprintf(stderr, "Catalog ");
2945  if (xmlHasFeature(XML_WITH_XPATH)) fprintf(stderr, "XPath ");
2946  if (xmlHasFeature(XML_WITH_XPTR)) fprintf(stderr, "XPointer ");
2947  if (xmlHasFeature(XML_WITH_XINCLUDE)) fprintf(stderr, "XInclude ");
2948  if (xmlHasFeature(XML_WITH_ICONV)) fprintf(stderr, "Iconv ");
2949  if (xmlHasFeature(XML_WITH_ICU)) fprintf(stderr, "ICU ");
2950  if (xmlHasFeature(XML_WITH_ISO8859X)) fprintf(stderr, "ISO8859X ");
2951  if (xmlHasFeature(XML_WITH_UNICODE)) fprintf(stderr, "Unicode ");
2952  if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(stderr, "Regexps ");
2953  if (xmlHasFeature(XML_WITH_AUTOMATA)) fprintf(stderr, "Automata ");
2954  if (xmlHasFeature(XML_WITH_EXPR)) fprintf(stderr, "Expr ");
2955  if (xmlHasFeature(XML_WITH_SCHEMAS)) fprintf(stderr, "Schemas ");
2956  if (xmlHasFeature(XML_WITH_SCHEMATRON)) fprintf(stderr, "Schematron ");
2957  if (xmlHasFeature(XML_WITH_MODULES)) fprintf(stderr, "Modules ");
2958  if (xmlHasFeature(XML_WITH_DEBUG)) fprintf(stderr, "Debug ");
2959  if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug ");
2960  if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug ");
2961  if (xmlHasFeature(XML_WITH_ZLIB)) fprintf(stderr, "Zlib ");
2962  if (xmlHasFeature(XML_WITH_LZMA)) fprintf(stderr, "Lzma ");
2963  fprintf(stderr, "\n");
2964 }
_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:855
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 1201 of file xmllint.c.

1202 {
1203  callbacks++;
1204  if (noout)
1205  return;
1206  fprintf(stdout, "SAX.startDocument()\n");
1207 }
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:873
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 1232 of file xmllint.c.

1233 {
1234  int i;
1235 
1236  callbacks++;
1237  if (noout)
1238  return;
1239  fprintf(stdout, "SAX.startElement(%s", (char *) name);
1240  if (atts != NULL) {
1241  for (i = 0;(atts[i] != NULL);i++) {
1242  fprintf(stdout, ", %s='", atts[i++]);
1243  if (atts[i] != NULL)
1244  fprintf(stdout, "%s'", atts[i]);
1245  }
1246  }
1247  fprintf(stdout, ")\n");
1248 }
FILE * stdout
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
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
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 1507 of file xmllint.c.

1516 {
1517  int i;
1518 
1519  callbacks++;
1520  if (noout)
1521  return;
1522  fprintf(stdout, "SAX.startElementNs(%s", (char *) localname);
1523  if (prefix == NULL)
1524  fprintf(stdout, ", NULL");
1525  else
1526  fprintf(stdout, ", %s", (char *) prefix);
1527  if (URI == NULL)
1528  fprintf(stdout, ", NULL");
1529  else
1530  fprintf(stdout, ", '%s'", (char *) URI);
1531  fprintf(stdout, ", %d", nb_namespaces);
1532 
1533  if (namespaces != NULL) {
1534  for (i = 0;i < nb_namespaces * 2;i++) {
1535  fprintf(stdout, ", xmlns");
1536  if (namespaces[i] != NULL)
1537  fprintf(stdout, ":%s", namespaces[i]);
1538  i++;
1539  fprintf(stdout, "='%s'", namespaces[i]);
1540  }
1541  }
1542  fprintf(stdout, ", %d, %d", nb_attributes, nb_defaulted);
1543  if (attributes != NULL) {
1544  for (i = 0;i < nb_attributes * 5;i += 5) {
1545  if (attributes[i + 1] != NULL)
1546  fprintf(stdout, ", %s:%s='", attributes[i + 1], attributes[i]);
1547  else
1548  fprintf(stdout, ", %s='", attributes[i]);
1549  fprintf(stdout, "%.4s...', %d", attributes[i + 3],
1550  (int)(attributes[i + 4] - attributes[i + 3]));
1551  }
1552  }
1553  fprintf(stdout, ")\n");
1554 }
FILE * stdout
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
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ startTimer()

static void startTimer ( void  )
static

Definition at line 468 of file xmllint.c.

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

Referenced by main(), QMyMainWindow::mousePressEvent(), and parseAndPrintFile().

◆ testSAX()

static void testSAX ( const char filename)
static

Definition at line 1621 of file xmllint.c.

1621  {
1623  const char *user_data = "user_data"; /* mostly for debugging */
1625  xmlParserInputPtr inputStream;
1626  xmlParserCtxtPtr ctxt = NULL;
1627  xmlSAXHandlerPtr old_sax = NULL;
1628 
1629  callbacks = 0;
1630 
1631  if (noout) {
1633 #ifdef LIBXML_SAX1_ENABLED
1634  } else if (sax1) {
1636 #endif
1637  } else {
1639  }
1640 
1641  /*
1642  * it's not the simplest code but the most generic in term of I/O
1643  */
1645  if (buf == NULL) {
1646  goto error;
1647  }
1648 
1649 #ifdef LIBXML_SCHEMAS_ENABLED
1650  if (wxschemas != NULL) {
1651  int ret;
1652  xmlSchemaValidCtxtPtr vctxt;
1653 
1654  vctxt = xmlSchemaNewValidCtxt(wxschemas);
1655  xmlSchemaSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL);
1656  xmlSchemaValidateSetFilename(vctxt, filename);
1657 
1658  ret = xmlSchemaValidateStream(vctxt, buf, 0, handler,
1659  (void *)user_data);
1660  if (repeat == 0) {
1661  if (ret == 0) {
1662  fprintf(stderr, "%s validates\n", filename);
1663  } else if (ret > 0) {
1664  fprintf(stderr, "%s fails to validate\n", filename);
1666  } else {
1667  fprintf(stderr, "%s validation generated an internal error\n",
1668  filename);
1670  }
1671  }
1672  xmlSchemaFreeValidCtxt(vctxt);
1673  } else
1674 #endif
1675  {
1676  /*
1677  * Create the parser context amd hook the input
1678  */
1679  ctxt = xmlNewParserCtxt();
1680  if (ctxt == NULL) {
1682  goto error;
1683  }
1684  old_sax = ctxt->sax;
1685  ctxt->sax = handler;
1686  ctxt->userData = (void *) user_data;
1687  inputStream = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE);
1688  if (inputStream == NULL) {
1690  goto error;
1691  }
1692  inputPush(ctxt, inputStream);
1693 
1694  /* do the parsing */
1695  xmlParseDocument(ctxt);
1696 
1697  if (ctxt->myDoc != NULL) {
1698  fprintf(stderr, "SAX generated a doc !\n");
1699  xmlFreeDoc(ctxt->myDoc);
1700  ctxt->myDoc = NULL;
1701  }
1702  }
1703 
1704 error:
1705  if (ctxt != NULL) {
1706  ctxt->sax = old_sax;
1707  xmlFreeParserCtxt(ctxt);
1708  }
1709 }
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
static xmllintReturnCode progresult
Definition: xmllint.c:167
#define error(str)
Definition: mkdosfs.c:1605
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN int XMLCALL inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
Definition: parser.c:1718
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
const char * filename
Definition: ioapi.h:135
static xmlSAXHandlerPtr debugSAX2Handler
Definition: xmllint.c:1618
static xmlSAXHandlerPtr emptySAXHandler
Definition: xmllint.c:871
_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
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBFUN int XMLCALL xmlParseDocument(xmlParserCtxtPtr ctxt)
Definition: parser.c:10615
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc)
int ret
xmlDocPtr myDoc
Definition: parser.h:187
struct _xmlSAXHandler * sax
Definition: parser.h:185
static int repeat
Definition: xmllint.c:143
FILE * stderr
XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt(void)
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
static int callbacks
Definition: xmllint.c:873
void * userData
Definition: parser.h:186
xmlSAXHandlerPtr debugSAXHandler
Definition: xmllint.c:1494
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 1157 of file xmllint.c.

1160 {
1161 const xmlChar *nullstr = BAD_CAST "(null)";
1162 
1163  if (publicId == NULL)
1164  publicId = nullstr;
1165  if (systemId == NULL)
1166  systemId = nullstr;
1167  if (notationName == NULL)
1168  notationName = nullstr;
1169  callbacks++;
1170  if (noout)
1171  return;
1172  fprintf(stdout, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
1173  (char *) name, (char *) publicId, (char *) systemId,
1174  (char *) notationName);
1175 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ usage()

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

Definition at line 2966 of file xmllint.c.

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

528  {
529  char *result;
530 
532  if (result) {
534  xmlFree(result);
535  }
536  buffer[0] = 0;
537 }
GLuint buffer
Definition: glext.h:5915
XMLPUBFUN xmlChar *XMLCALL xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
GLuint64EXT * result
Definition: glext.h:11304
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 571 of file xmllint.c.

571  {
572  const xmlChar *cur, *base;
573  int len;
574  int n;
575 
576  if (input == NULL) return;
578  cur = input->cur;
579  base = input->base;
580  while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
581  cur--;
582  }
583  n = 0;
584  while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
585  cur--;
586  if ((*cur == '\n') || (*cur == '\r')) cur++;
587  base = cur;
588  n = 0;
589  while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
590  len = strlen(buffer);
591  snprintf(&buffer[len], sizeof(buffer) - len, "%c",
592  (unsigned char) *cur++);
593  n++;
594  }
595  len = strlen(buffer);
596  snprintf(&buffer[len], sizeof(buffer) - len, "\n");
597  cur = input->cur;
598  while ((*cur == '\n') || (*cur == '\r'))
599  cur--;
600  n = 0;
601  while ((cur != base) && (n++ < 80)) {
602  len = strlen(buffer);
603  snprintf(&buffer[len], sizeof(buffer) - len, " ");
604  base++;
605  }
606  len = strlen(buffer);
607  snprintf(&buffer[len], sizeof(buffer) - len, "^\n");
610 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void xmlHTMLEncodeSend(void)
Definition: xmllint.c:528
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
smooth NULL
Definition: ftsmooth.c:416
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
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 informations for the current input

Definition at line 547 of file xmllint.c.

547  {
548  int len;
550 
551  len = strlen(buffer);
552  if (input != NULL) {
553  if (input->filename) {
554  snprintf(&buffer[len], sizeof(buffer) - len, "%s:%d: ", input->filename,
555  input->line);
556  } else {
557  snprintf(&buffer[len], sizeof(buffer) - len, "Entity: line %d: ", input->line);
558  }
559  }
561 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void xmlHTMLEncodeSend(void)
Definition: xmllint.c:528
#define snprintf
Definition: wintirpc.h:48
GLuint buffer
Definition: glext.h:5915
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
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 245 of file xmllint.c.

246  {
249  errorSAXFunc err = NULL;
250 
251  int i;
252  const char *lastsegment = URL;
253  const char *iter = URL;
254 
255  if ((nbpaths > 0) && (iter != NULL)) {
256  while (*iter != 0) {
257  if (*iter == '/')
258  lastsegment = iter + 1;
259  iter++;
260  }
261  }
262 
263  if ((ctxt != NULL) && (ctxt->sax != NULL)) {
264  warning = ctxt->sax->warning;
265  err = ctxt->sax->error;
266  ctxt->sax->warning = NULL;
267  ctxt->sax->error = NULL;
268  }
269 
270  if (defaultEntityLoader != NULL) {
271  ret = defaultEntityLoader(URL, ID, ctxt);
272  if (ret != NULL) {
273  if (warning != NULL)
274  ctxt->sax->warning = warning;
275  if (err != NULL)
276  ctxt->sax->error = err;
277  if (load_trace) {
278  fprintf \
279  (stderr,
280  "Loaded URL=\"%s\" ID=\"%s\"\n",
281  URL ? URL : "(null)",
282  ID ? ID : "(null)");
283  }
284  return(ret);
285  }
286  }
287  for (i = 0;i < nbpaths;i++) {
288  xmlChar *newURL;
289 
290  newURL = xmlStrdup((const xmlChar *) paths[i]);
291  newURL = xmlStrcat(newURL, (const xmlChar *) "/");
292  newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment);
293  if (newURL != NULL) {
294  ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
295  if (ret != NULL) {
296  if (warning != NULL)
297  ctxt->sax->warning = warning;
298  if (err != NULL)
299  ctxt->sax->error = err;
300  if (load_trace) {
301  fprintf \
302  (stderr,
303  "Loaded URL=\"%s\" ID=\"%s\"\n",
304  newURL,
305  ID ? ID : "(null)");
306  }
307  xmlFree(newURL);
308  return(ret);
309  }
310  xmlFree(newURL);
311  }
312  }
313  if (err != NULL)
314  ctxt->sax->error = err;
315  if (warning != NULL) {
316  ctxt->sax->warning = warning;
317  if (URL != NULL)
318  warning(ctxt, "failed to load external entity \"%s\"\n", URL);
319  else if (ID != NULL)
320  warning(ctxt, "failed to load external entity \"%s\"\n", ID);
321  }
322  return(NULL);
323 }
static int nbpaths
Definition: xmllint.c:213
void(XMLCDECL * warningSAXFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: parser.h:608
static int load_trace
Definition: xmllint.c:214
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
_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:526
smooth NULL
Definition: ftsmooth.c:416
static xmlExternalEntityLoader defaultEntityLoader
Definition: xmllint.c:242
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:185
#define ID
Definition: ruserpass.c:36
#define err(...)
GLsizei const GLuint * paths
Definition: glext.h:11717
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 466 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(), startTimer(), XMLStorage::XMLErrorList::str(), String_trim(), Desktops::SwitchToDesktop(), and Desktops::~Desktops().

◆ buffer

char buffer[50000]
static

Definition at line 525 of file xmllint.c.

◆ callbacks

◆ chkregister

int chkregister = 0
static

Definition at line 189 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 1618 of file xmllint.c.

Referenced by testSAX().

◆ debugSAX2HandlerStruct

xmlSAXHandler debugSAX2HandlerStruct
static

Definition at line 1583 of file xmllint.c.

◆ debugSAXHandler

Definition at line 1494 of file xmllint.c.

Referenced by testSAX().

◆ debugSAXHandlerStruct

xmlSAXHandler debugSAXHandlerStruct
static

Definition at line 1459 of file xmllint.c.

◆ defaultEntityLoader

xmlExternalEntityLoader defaultEntityLoader = NULL
static

Definition at line 242 of file xmllint.c.

Referenced by main(), and xmllintExternalEntityLoader().

◆ dropdtd

int dropdtd = 0
static

Definition at line 170 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 871 of file xmllint.c.

Referenced by testSAX().

◆ emptySAXHandlerStruct

xmlSAXHandler emptySAXHandlerStruct
static

Definition at line 836 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 466 of file xmllint.c.

◆ generate

int generate = 0
static

Definition at line 169 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 214 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 213 of file xmllint.c.

Referenced by parsePath(), and xmllintExternalEntityLoader().

◆ nbregister

int nbregister = 0
static

Definition at line 190 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 main().

◆ oldxml10

int oldxml10 = 0
static

Definition at line 199 of file xmllint.c.

Referenced by main().

◆ options

Definition at line 197 of file xmllint.c.

◆ paths

xmlChar* paths[MAX_PATHS+1]
static

Definition at line 212 of file xmllint.c.

◆ progresult

xmllintReturnCode progresult = XMLLINT_RETURN_OK
static

Definition at line 167 of file xmllint.c.

Referenced by main(), OOM(), parseAndPrintFile(), and testSAX().

◆ recovery

int recovery = 0
static

Definition at line 115 of file xmllint.c.

Referenced by main().

◆ repeat

◆ sax

int sax = 0
static

Definition at line 198 of file xmllint.c.

Referenced by main(), xmlCreateIOParserCtxt(), and xmlParseExternalEntityPrivate().

◆ testIO

int testIO = 0
static

Definition at line 160 of file xmllint.c.

Referenced by main(), and parseAndPrintFile().

◆ timing

int timing = 0
static

Definition at line 168 of file xmllint.c.

Referenced by AtapiDmaInit(), hpt_timing(), main(), parseAndPrintFile(), and promise_timing().