ReactOS  0.4.12-dev-918-g6c6e7b8
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:36
static int callbacks
Definition: xmllint.c:873
XMLPUBFUN void XMLCALL xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c:1788
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 3107 of file xmllint.c.

3108 {
3109  assert(node->_private != NULL);
3110  assert(*(long*)node->_private == (long) 0x81726354);
3111  free(node->_private);
3112  nbregister--;
3113 }
static int nbregister
Definition: xmllint.c:185
#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:36
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:36
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:994
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:36
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:36
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:36
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:36
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:36
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:408
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:347
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:363
static void xmlHTMLPrintFileInfo(xmlParserInputPtr input)
Definition: xmllint.c:547

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 3116 of file xmllint.c.

3116  {
3117  int i, acount;
3118  int files = 0;
3119  int version = 0;
3120  const char* indent;
3121 
3122  if (argc <= 1) {
3123  usage(stderr, argv[0]);
3124  return(1);
3125  }
3127  for (i = 1; i < argc ; i++) {
3128  if (!strcmp(argv[i], "-"))
3129  break;
3130 
3131  if (argv[i][0] != '-')
3132  continue;
3133  if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
3134  debug++;
3135  else
3136 #ifdef LIBXML_DEBUG_ENABLED
3137  if ((!strcmp(argv[i], "-shell")) ||
3138  (!strcmp(argv[i], "--shell"))) {
3139  shell++;
3140  noout = 1;
3141  } else
3142 #endif
3143 #ifdef LIBXML_TREE_ENABLED
3144  if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
3145  copy++;
3146  else
3147 #endif /* LIBXML_TREE_ENABLED */
3148  if ((!strcmp(argv[i], "-recover")) ||
3149  (!strcmp(argv[i], "--recover"))) {
3150  recovery++;
3152  } else if ((!strcmp(argv[i], "-huge")) ||
3153  (!strcmp(argv[i], "--huge"))) {
3155  } else if ((!strcmp(argv[i], "-noent")) ||
3156  (!strcmp(argv[i], "--noent"))) {
3157  noent++;
3159  } else if ((!strcmp(argv[i], "-noenc")) ||
3160  (!strcmp(argv[i], "--noenc"))) {
3161  noenc++;
3163  } else if ((!strcmp(argv[i], "-nsclean")) ||
3164  (!strcmp(argv[i], "--nsclean"))) {
3166  } else if ((!strcmp(argv[i], "-nocdata")) ||
3167  (!strcmp(argv[i], "--nocdata"))) {
3169  } else if ((!strcmp(argv[i], "-nodict")) ||
3170  (!strcmp(argv[i], "--nodict"))) {
3172  } else if ((!strcmp(argv[i], "-version")) ||
3173  (!strcmp(argv[i], "--version"))) {
3174  showVersion(argv[0]);
3175  version = 1;
3176  } else if ((!strcmp(argv[i], "-noout")) ||
3177  (!strcmp(argv[i], "--noout")))
3178  noout++;
3179 #ifdef LIBXML_OUTPUT_ENABLED
3180  else if ((!strcmp(argv[i], "-o")) ||
3181  (!strcmp(argv[i], "-output")) ||
3182  (!strcmp(argv[i], "--output"))) {
3183  i++;
3184  output = argv[i];
3185  }
3186 #endif /* LIBXML_OUTPUT_ENABLED */
3187  else if ((!strcmp(argv[i], "-htmlout")) ||
3188  (!strcmp(argv[i], "--htmlout")))
3189  htmlout++;
3190  else if ((!strcmp(argv[i], "-nowrap")) ||
3191  (!strcmp(argv[i], "--nowrap")))
3192  nowrap++;
3193 #ifdef LIBXML_HTML_ENABLED
3194  else if ((!strcmp(argv[i], "-html")) ||
3195  (!strcmp(argv[i], "--html"))) {
3196  html++;
3197  }
3198  else if ((!strcmp(argv[i], "-xmlout")) ||
3199  (!strcmp(argv[i], "--xmlout"))) {
3200  xmlout++;
3201  } else if ((!strcmp(argv[i], "-nodefdtd")) ||
3202  (!strcmp(argv[i], "--nodefdtd"))) {
3203  nodefdtd++;
3204  options |= HTML_PARSE_NODEFDTD;
3205  }
3206 #endif /* LIBXML_HTML_ENABLED */
3207  else if ((!strcmp(argv[i], "-loaddtd")) ||
3208  (!strcmp(argv[i], "--loaddtd"))) {
3209  loaddtd++;
3211  } else if ((!strcmp(argv[i], "-dtdattr")) ||
3212  (!strcmp(argv[i], "--dtdattr"))) {
3213  loaddtd++;
3214  dtdattrs++;
3216  }
3217 #ifdef LIBXML_VALID_ENABLED
3218  else if ((!strcmp(argv[i], "-valid")) ||
3219  (!strcmp(argv[i], "--valid"))) {
3220  valid++;
3222  } else if ((!strcmp(argv[i], "-postvalid")) ||
3223  (!strcmp(argv[i], "--postvalid"))) {
3224  postvalid++;
3225  loaddtd++;
3227  } else if ((!strcmp(argv[i], "-dtdvalid")) ||
3228  (!strcmp(argv[i], "--dtdvalid"))) {
3229  i++;
3230  dtdvalid = argv[i];
3231  loaddtd++;
3233  } else if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
3234  (!strcmp(argv[i], "--dtdvalidfpi"))) {
3235  i++;
3236  dtdvalidfpi = argv[i];
3237  loaddtd++;
3239  }
3240 #endif /* LIBXML_VALID_ENABLED */
3241  else if ((!strcmp(argv[i], "-dropdtd")) ||
3242  (!strcmp(argv[i], "--dropdtd")))
3243  dropdtd++;
3244  else if ((!strcmp(argv[i], "-insert")) ||
3245  (!strcmp(argv[i], "--insert")))
3246  insert++;
3247  else if ((!strcmp(argv[i], "-timing")) ||
3248  (!strcmp(argv[i], "--timing")))
3249  timing++;
3250  else if ((!strcmp(argv[i], "-auto")) ||
3251  (!strcmp(argv[i], "--auto")))
3252  generate++;
3253  else if ((!strcmp(argv[i], "-repeat")) ||
3254  (!strcmp(argv[i], "--repeat"))) {
3255  if (repeat)
3256  repeat *= 10;
3257  else
3258  repeat = 100;
3259  }
3260 #ifdef LIBXML_PUSH_ENABLED
3261  else if ((!strcmp(argv[i], "-push")) ||
3262  (!strcmp(argv[i], "--push")))
3263  push++;
3264  else if ((!strcmp(argv[i], "-pushsmall")) ||
3265  (!strcmp(argv[i], "--pushsmall"))) {
3266  push++;
3267  pushsize = 10;
3268  }
3269 #endif /* LIBXML_PUSH_ENABLED */
3270 #ifdef HAVE_MMAP
3271  else if ((!strcmp(argv[i], "-memory")) ||
3272  (!strcmp(argv[i], "--memory")))
3273  memory++;
3274 #endif
3275  else if ((!strcmp(argv[i], "-testIO")) ||
3276  (!strcmp(argv[i], "--testIO")))
3277  testIO++;
3278 #ifdef LIBXML_XINCLUDE_ENABLED
3279  else if ((!strcmp(argv[i], "-xinclude")) ||
3280  (!strcmp(argv[i], "--xinclude"))) {
3281  xinclude++;
3283  }
3284  else if ((!strcmp(argv[i], "-noxincludenode")) ||
3285  (!strcmp(argv[i], "--noxincludenode"))) {
3286  xinclude++;
3289  }
3290  else if ((!strcmp(argv[i], "-nofixup-base-uris")) ||
3291  (!strcmp(argv[i], "--nofixup-base-uris"))) {
3292  xinclude++;
3295  }
3296 #endif
3297 #ifdef LIBXML_OUTPUT_ENABLED
3298 #ifdef LIBXML_ZLIB_ENABLED
3299  else if ((!strcmp(argv[i], "-compress")) ||
3300  (!strcmp(argv[i], "--compress"))) {
3301  compress++;
3302  xmlSetCompressMode(9);
3303  }
3304 #endif
3305 #endif /* LIBXML_OUTPUT_ENABLED */
3306  else if ((!strcmp(argv[i], "-nowarning")) ||
3307  (!strcmp(argv[i], "--nowarning"))) {
3311  }
3312  else if ((!strcmp(argv[i], "-pedantic")) ||
3313  (!strcmp(argv[i], "--pedantic"))) {
3317  }
3318 #ifdef LIBXML_DEBUG_ENABLED
3319  else if ((!strcmp(argv[i], "-debugent")) ||
3320  (!strcmp(argv[i], "--debugent"))) {
3321  debugent++;
3323  }
3324 #endif
3325 #ifdef LIBXML_C14N_ENABLED
3326  else if ((!strcmp(argv[i], "-c14n")) ||
3327  (!strcmp(argv[i], "--c14n"))) {
3328  canonical++;
3330  }
3331  else if ((!strcmp(argv[i], "-c14n11")) ||
3332  (!strcmp(argv[i], "--c14n11"))) {
3333  canonical_11++;
3335  }
3336  else if ((!strcmp(argv[i], "-exc-c14n")) ||
3337  (!strcmp(argv[i], "--exc-c14n"))) {
3338  exc_canonical++;
3340  }
3341 #endif
3342 #ifdef LIBXML_CATALOG_ENABLED
3343  else if ((!strcmp(argv[i], "-catalogs")) ||
3344  (!strcmp(argv[i], "--catalogs"))) {
3345  catalogs++;
3346  } else if ((!strcmp(argv[i], "-nocatalogs")) ||
3347  (!strcmp(argv[i], "--nocatalogs"))) {
3348  nocatalogs++;
3349  }
3350 #endif
3351  else if ((!strcmp(argv[i], "-encode")) ||
3352  (!strcmp(argv[i], "--encode"))) {
3353  i++;
3354  encoding = argv[i];
3355  /*
3356  * OK it's for testing purposes
3357  */
3358  xmlAddEncodingAlias("UTF-8", "DVEnc");
3359  }
3360  else if ((!strcmp(argv[i], "-noblanks")) ||
3361  (!strcmp(argv[i], "--noblanks"))) {
3362  noblanks++;
3365  }
3366  else if ((!strcmp(argv[i], "-maxmem")) ||
3367  (!strcmp(argv[i], "--maxmem"))) {
3368  i++;
3369  if (sscanf(argv[i], "%d", &maxmem) == 1) {
3371  myStrdupFunc);
3372  } else {
3373  maxmem = 0;
3374  }
3375  }
3376  else if ((!strcmp(argv[i], "-format")) ||
3377  (!strcmp(argv[i], "--format"))) {
3378  noblanks++;
3379 #ifdef LIBXML_OUTPUT_ENABLED
3380  format = 1;
3381 #endif /* LIBXML_OUTPUT_ENABLED */
3383  }
3384  else if ((!strcmp(argv[i], "-pretty")) ||
3385  (!strcmp(argv[i], "--pretty"))) {
3386  i++;
3387 #ifdef LIBXML_OUTPUT_ENABLED
3388  if (argv[i] != NULL) {
3389  format = atoi(argv[i]);
3390  if (format == 1) {
3391  noblanks++;
3393  }
3394  }
3395 #endif /* LIBXML_OUTPUT_ENABLED */
3396  }
3397 #ifdef LIBXML_READER_ENABLED
3398  else if ((!strcmp(argv[i], "-stream")) ||
3399  (!strcmp(argv[i], "--stream"))) {
3400  stream++;
3401  }
3402  else if ((!strcmp(argv[i], "-walker")) ||
3403  (!strcmp(argv[i], "--walker"))) {
3404  walker++;
3405  noout++;
3406  }
3407 #endif /* LIBXML_READER_ENABLED */
3408 #ifdef LIBXML_SAX1_ENABLED
3409  else if ((!strcmp(argv[i], "-sax1")) ||
3410  (!strcmp(argv[i], "--sax1"))) {
3411  sax1++;
3413  }
3414 #endif /* LIBXML_SAX1_ENABLED */
3415  else if ((!strcmp(argv[i], "-sax")) ||
3416  (!strcmp(argv[i], "--sax"))) {
3417  sax++;
3418  }
3419  else if ((!strcmp(argv[i], "-chkregister")) ||
3420  (!strcmp(argv[i], "--chkregister"))) {
3421  chkregister++;
3422 #ifdef LIBXML_SCHEMAS_ENABLED
3423  } else if ((!strcmp(argv[i], "-relaxng")) ||
3424  (!strcmp(argv[i], "--relaxng"))) {
3425  i++;
3426  relaxng = argv[i];
3427  noent++;
3429  } else if ((!strcmp(argv[i], "-schema")) ||
3430  (!strcmp(argv[i], "--schema"))) {
3431  i++;
3432  schema = argv[i];
3433  noent++;
3434 #endif
3435 #ifdef LIBXML_SCHEMATRON_ENABLED
3436  } else if ((!strcmp(argv[i], "-schematron")) ||
3437  (!strcmp(argv[i], "--schematron"))) {
3438  i++;
3439  schematron = argv[i];
3440  noent++;
3441 #endif
3442  } else if ((!strcmp(argv[i], "-nonet")) ||
3443  (!strcmp(argv[i], "--nonet"))) {
3446  } else if ((!strcmp(argv[i], "-nocompact")) ||
3447  (!strcmp(argv[i], "--nocompact"))) {
3449  } else if ((!strcmp(argv[i], "-load-trace")) ||
3450  (!strcmp(argv[i], "--load-trace"))) {
3451  load_trace++;
3452  } else if ((!strcmp(argv[i], "-path")) ||
3453  (!strcmp(argv[i], "--path"))) {
3454  i++;
3456 #ifdef LIBXML_PATTERN_ENABLED
3457  } else if ((!strcmp(argv[i], "-pattern")) ||
3458  (!strcmp(argv[i], "--pattern"))) {
3459  i++;
3460  pattern = argv[i];
3461 #endif
3462 #ifdef LIBXML_XPATH_ENABLED
3463  } else if ((!strcmp(argv[i], "-xpath")) ||
3464  (!strcmp(argv[i], "--xpath"))) {
3465  i++;
3466  noout++;
3467  xpathquery = argv[i];
3468 #endif
3469  } else if ((!strcmp(argv[i], "-oldxml10")) ||
3470  (!strcmp(argv[i], "--oldxml10"))) {
3471  oldxml10++;
3473  } else {
3474  fprintf(stderr, "Unknown option %s\n", argv[i]);
3475  usage(stderr, argv[0]);
3476  return(1);
3477  }
3478  }
3479 
3480 #ifdef LIBXML_CATALOG_ENABLED
3481  if (nocatalogs == 0) {
3482  if (catalogs) {
3483  const char *catal;
3484 
3485  catal = getenv("SGML_CATALOG_FILES");
3486  if (catal != NULL) {
3487  xmlLoadCatalogs(catal);
3488  } else {
3489  fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n");
3490  }
3491  }
3492  }
3493 #endif
3494 
3495 #ifdef LIBXML_SAX1_ENABLED
3496  if (sax1)
3497  xmlSAXDefaultVersion(1);
3498  else
3499  xmlSAXDefaultVersion(2);
3500 #endif /* LIBXML_SAX1_ENABLED */
3501 
3502  if (chkregister) {
3505  }
3506 
3507  indent = getenv("XMLLINT_INDENT");
3508  if(indent != NULL) {
3510  }
3511 
3512 
3515 
3517  if (loaddtd != 0)
3519  if (dtdattrs)
3521  if (noent != 0) xmlSubstituteEntitiesDefault(1);
3522 #ifdef LIBXML_VALID_ENABLED
3523  if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;
3524 #endif /* LIBXML_VALID_ENABLED */
3525  if ((htmlout) && (!nowrap)) {
3527  "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n");
3529  "\t\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n");
3531  "<html><head><title>%s output</title></head>\n",
3532  argv[0]);
3534  "<body bgcolor=\"#ffffff\"><h1 align=\"center\">%s output</h1>\n",
3535  argv[0]);
3536  }
3537 
3538 #ifdef LIBXML_SCHEMATRON_ENABLED
3539  if ((schematron != NULL) && (sax == 0)
3540 #ifdef LIBXML_READER_ENABLED
3541  && (stream == 0)
3542 #endif /* LIBXML_READER_ENABLED */
3543  ) {
3544  xmlSchematronParserCtxtPtr ctxt;
3545 
3546  /* forces loading the DTDs */
3549  if (timing) {
3550  startTimer();
3551  }
3552  ctxt = xmlSchematronNewParserCtxt(schematron);
3553 #if 0
3554  xmlSchematronSetParserErrors(ctxt,
3555  (xmlSchematronValidityErrorFunc) fprintf,
3556  (xmlSchematronValidityWarningFunc) fprintf,
3557  stderr);
3558 #endif
3559  wxschematron = xmlSchematronParse(ctxt);
3560  if (wxschematron == NULL) {
3562  "Schematron schema %s failed to compile\n", schematron);
3564  schematron = NULL;
3565  }
3566  xmlSchematronFreeParserCtxt(ctxt);
3567  if (timing) {
3568  endTimer("Compiling the schemas");
3569  }
3570  }
3571 #endif
3572 #ifdef LIBXML_SCHEMAS_ENABLED
3573  if ((relaxng != NULL) && (sax == 0)
3574 #ifdef LIBXML_READER_ENABLED
3575  && (stream == 0)
3576 #endif /* LIBXML_READER_ENABLED */
3577  ) {
3578  xmlRelaxNGParserCtxtPtr ctxt;
3579 
3580  /* forces loading the DTDs */
3583  if (timing) {
3584  startTimer();
3585  }
3586  ctxt = xmlRelaxNGNewParserCtxt(relaxng);
3587  xmlRelaxNGSetParserErrors(ctxt,
3588  (xmlRelaxNGValidityErrorFunc) fprintf,
3589  (xmlRelaxNGValidityWarningFunc) fprintf,
3590  stderr);
3591  relaxngschemas = xmlRelaxNGParse(ctxt);
3592  if (relaxngschemas == NULL) {
3594  "Relax-NG schema %s failed to compile\n", relaxng);
3596  relaxng = NULL;
3597  }
3598  xmlRelaxNGFreeParserCtxt(ctxt);
3599  if (timing) {
3600  endTimer("Compiling the schemas");
3601  }
3602  } else if ((schema != NULL)
3603 #ifdef LIBXML_READER_ENABLED
3604  && (stream == 0)
3605 #endif
3606  ) {
3607  xmlSchemaParserCtxtPtr ctxt;
3608 
3609  if (timing) {
3610  startTimer();
3611  }
3612  ctxt = xmlSchemaNewParserCtxt(schema);
3613  xmlSchemaSetParserErrors(ctxt,
3614  (xmlSchemaValidityErrorFunc) fprintf,
3615  (xmlSchemaValidityWarningFunc) fprintf,
3616  stderr);
3617  wxschemas = xmlSchemaParse(ctxt);
3618  if (wxschemas == NULL) {
3620  "WXS schema %s failed to compile\n", schema);
3622  schema = NULL;
3623  }
3624  xmlSchemaFreeParserCtxt(ctxt);
3625  if (timing) {
3626  endTimer("Compiling the schemas");
3627  }
3628  }
3629 #endif /* LIBXML_SCHEMAS_ENABLED */
3630 #ifdef LIBXML_PATTERN_ENABLED
3631  if ((pattern != NULL)
3632 #ifdef LIBXML_READER_ENABLED
3633  && (walker == 0)
3634 #endif
3635  ) {
3636  patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL);
3637  if (patternc == NULL) {
3639  "Pattern %s failed to compile\n", pattern);
3641  pattern = NULL;
3642  }
3643  }
3644 #endif /* LIBXML_PATTERN_ENABLED */
3645  for (i = 1; i < argc ; i++) {
3646  if ((!strcmp(argv[i], "-encode")) ||
3647  (!strcmp(argv[i], "--encode"))) {
3648  i++;
3649  continue;
3650  } else if ((!strcmp(argv[i], "-o")) ||
3651  (!strcmp(argv[i], "-output")) ||
3652  (!strcmp(argv[i], "--output"))) {
3653  i++;
3654  continue;
3655  }
3656 #ifdef LIBXML_VALID_ENABLED
3657  if ((!strcmp(argv[i], "-dtdvalid")) ||
3658  (!strcmp(argv[i], "--dtdvalid"))) {
3659  i++;
3660  continue;
3661  }
3662  if ((!strcmp(argv[i], "-path")) ||
3663  (!strcmp(argv[i], "--path"))) {
3664  i++;
3665  continue;
3666  }
3667  if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
3668  (!strcmp(argv[i], "--dtdvalidfpi"))) {
3669  i++;
3670  continue;
3671  }
3672 #endif /* LIBXML_VALID_ENABLED */
3673  if ((!strcmp(argv[i], "-relaxng")) ||
3674  (!strcmp(argv[i], "--relaxng"))) {
3675  i++;
3676  continue;
3677  }
3678  if ((!strcmp(argv[i], "-maxmem")) ||
3679  (!strcmp(argv[i], "--maxmem"))) {
3680  i++;
3681  continue;
3682  }
3683  if ((!strcmp(argv[i], "-pretty")) ||
3684  (!strcmp(argv[i], "--pretty"))) {
3685  i++;
3686  continue;
3687  }
3688  if ((!strcmp(argv[i], "-schema")) ||
3689  (!strcmp(argv[i], "--schema"))) {
3690  i++;
3691  continue;
3692  }
3693  if ((!strcmp(argv[i], "-schematron")) ||
3694  (!strcmp(argv[i], "--schematron"))) {
3695  i++;
3696  continue;
3697  }
3698 #ifdef LIBXML_PATTERN_ENABLED
3699  if ((!strcmp(argv[i], "-pattern")) ||
3700  (!strcmp(argv[i], "--pattern"))) {
3701  i++;
3702  continue;
3703  }
3704 #endif
3705 #ifdef LIBXML_XPATH_ENABLED
3706  if ((!strcmp(argv[i], "-xpath")) ||
3707  (!strcmp(argv[i], "--xpath"))) {
3708  i++;
3709  continue;
3710  }
3711 #endif
3712  if ((timing) && (repeat))
3713  startTimer();
3714  /* Remember file names. "-" means stdin. <sven@zen.org> */
3715  if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
3716  if (repeat) {
3717  xmlParserCtxtPtr ctxt = NULL;
3718 
3719  for (acount = 0;acount < repeat;acount++) {
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 {
3728  if (ctxt == NULL)
3729  ctxt = xmlNewParserCtxt();
3730  parseAndPrintFile(argv[i], ctxt);
3731  }
3732 #ifdef LIBXML_READER_ENABLED
3733  }
3734 #endif /* LIBXML_READER_ENABLED */
3735  }
3736  if (ctxt != NULL)
3737  xmlFreeParserCtxt(ctxt);
3738  } else {
3739  nbregister = 0;
3740 
3741 #ifdef LIBXML_READER_ENABLED
3742  if (stream != 0)
3743  streamFile(argv[i]);
3744  else
3745 #endif /* LIBXML_READER_ENABLED */
3746  if (sax) {
3747  testSAX(argv[i]);
3748  } else {
3750  }
3751 
3752  if ((chkregister) && (nbregister != 0)) {
3753  fprintf(stderr, "Registration count off: %d\n", nbregister);
3755  }
3756  }
3757  files ++;
3758  if ((timing) && (repeat)) {
3759  endTimer("%d iterations", repeat);
3760  }
3761  }
3762  }
3763  if (generate)
3765  if ((htmlout) && (!nowrap)) {
3766  xmlGenericError(xmlGenericErrorContext, "</body></html>\n");
3767  }
3768  if ((files == 0) && (!generate) && (version == 0)) {
3769  usage(stderr, argv[0]);
3770  }
3771 #ifdef LIBXML_SCHEMATRON_ENABLED
3772  if (wxschematron != NULL)
3773  xmlSchematronFree(wxschematron);
3774 #endif
3775 #ifdef LIBXML_SCHEMAS_ENABLED
3776  if (relaxngschemas != NULL)
3777  xmlRelaxNGFree(relaxngschemas);
3778  if (wxschemas != NULL)
3779  xmlSchemaFree(wxschemas);
3780  xmlRelaxNGCleanupTypes();
3781 #endif
3782 #ifdef LIBXML_PATTERN_ENABLED
3783  if (patternc != NULL)
3784  xmlFreePattern(patternc);
3785 #endif
3786  xmlCleanupParser();
3787  xmlMemoryDump();
3788 
3789  return(progresult);
3790 }
static xmllintReturnCode progresult
Definition: xmllint.c:167
static void deregisterNode(xmlNodePtr node)
Definition: xmllint.c:3107
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:379
static const WCHAR indent[]
Definition: object.c:1156
static int nbregister
Definition: xmllint.c:185
#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:424
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:347
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
#define LIBXML_READER_ENABLED
Definition: xmlversion.h:142
#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:397
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:338
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:433
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:184
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt)
Definition: xmllint.c:2160
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:2976
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:14759
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
static void showVersion(const char *name)
Definition: xmllint.c:2937
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:363
static int dtdattrs
Definition: xmllint.c:165
static void registerNode(xmlNodePtr node)
Definition: xmllint.c:3096

◆ 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:6587
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:251
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:36
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 2160 of file xmllint.c.

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

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
Definition: services.c:325
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:36
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ registerNode()

static void registerNode ( xmlNodePtr  node)
static

Definition at line 3096 of file xmllint.c.

3097 {
3098  node->_private = malloc(sizeof(long));
3099  if (node->_private == NULL) {
3100  fprintf(stderr, "Out of memory in xmllint:registerNode()\n");
3102  }
3103  *(long*)node->_private = (long) 0x81726354;
3104  nbregister++;
3105 }
static int nbregister
Definition: xmllint.c:185
_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 2937 of file xmllint.c.

2937  {
2938  fprintf(stderr, "%s: using libxml version %s\n", name, xmlParserVersion);
2939  fprintf(stderr, " compiled with: ");
2940  if (xmlHasFeature(XML_WITH_THREAD)) fprintf(stderr, "Threads ");
2941  if (xmlHasFeature(XML_WITH_TREE)) fprintf(stderr, "Tree ");
2942  if (xmlHasFeature(XML_WITH_OUTPUT)) fprintf(stderr, "Output ");
2943  if (xmlHasFeature(XML_WITH_PUSH)) fprintf(stderr, "Push ");
2944  if (xmlHasFeature(XML_WITH_READER)) fprintf(stderr, "Reader ");
2945  if (xmlHasFeature(XML_WITH_PATTERN)) fprintf(stderr, "Patterns ");
2946  if (xmlHasFeature(XML_WITH_WRITER)) fprintf(stderr, "Writer ");
2947  if (xmlHasFeature(XML_WITH_SAX1)) fprintf(stderr, "SAXv1 ");
2948  if (xmlHasFeature(XML_WITH_FTP)) fprintf(stderr, "FTP ");
2949  if (xmlHasFeature(XML_WITH_HTTP)) fprintf(stderr, "HTTP ");
2950  if (xmlHasFeature(XML_WITH_VALID)) fprintf(stderr, "DTDValid ");
2951  if (xmlHasFeature(XML_WITH_HTML)) fprintf(stderr, "HTML ");
2952  if (xmlHasFeature(XML_WITH_LEGACY)) fprintf(stderr, "Legacy ");
2953  if (xmlHasFeature(XML_WITH_C14N)) fprintf(stderr, "C14N ");
2954  if (xmlHasFeature(XML_WITH_CATALOG)) fprintf(stderr, "Catalog ");
2955  if (xmlHasFeature(XML_WITH_XPATH)) fprintf(stderr, "XPath ");
2956  if (xmlHasFeature(XML_WITH_XPTR)) fprintf(stderr, "XPointer ");
2957  if (xmlHasFeature(XML_WITH_XINCLUDE)) fprintf(stderr, "XInclude ");
2958  if (xmlHasFeature(XML_WITH_ICONV)) fprintf(stderr, "Iconv ");
2959  if (xmlHasFeature(XML_WITH_ICU)) fprintf(stderr, "ICU ");
2960  if (xmlHasFeature(XML_WITH_ISO8859X)) fprintf(stderr, "ISO8859X ");
2961  if (xmlHasFeature(XML_WITH_UNICODE)) fprintf(stderr, "Unicode ");
2962  if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(stderr, "Regexps ");
2963  if (xmlHasFeature(XML_WITH_AUTOMATA)) fprintf(stderr, "Automata ");
2964  if (xmlHasFeature(XML_WITH_EXPR)) fprintf(stderr, "Expr ");
2965  if (xmlHasFeature(XML_WITH_SCHEMAS)) fprintf(stderr, "Schemas ");
2966  if (xmlHasFeature(XML_WITH_SCHEMATRON)) fprintf(stderr, "Schematron ");
2967  if (xmlHasFeature(XML_WITH_MODULES)) fprintf(stderr, "Modules ");
2968  if (xmlHasFeature(XML_WITH_DEBUG)) fprintf(stderr, "Debug ");
2969  if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug ");
2970  if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug ");
2971  if (xmlHasFeature(XML_WITH_ZLIB)) fprintf(stderr, "Zlib ");
2972  if (xmlHasFeature(XML_WITH_LZMA)) fprintf(stderr, "Lzma ");
2973  fprintf(stderr, "\n");
2974 }
_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:442
XMLPUBFUN int XMLCALL xmlHasFeature(xmlFeature feature)
Definition: parser.c:846
Definition: name.c:36
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:36
static int callbacks
Definition: xmllint.c:873
_In_ UINT16 _Out_ ULONG * atts
Definition: btrfs_drv.h:1080
static int noout
Definition: xmllint.c:119

◆ 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,
1656  (xmlSchemaValidityErrorFunc) fprintf,
1657  (xmlSchemaValidityWarningFunc) fprintf,
1658  stderr);
1659  xmlSchemaValidateSetFilename(vctxt, filename);
1660 
1661  ret = xmlSchemaValidateStream(vctxt, buf, 0, handler,
1662  (void *)user_data);
1663  if (repeat == 0) {
1664  if (ret == 0) {
1665  fprintf(stderr, "%s validates\n", filename);
1666  } else if (ret > 0) {
1667  fprintf(stderr, "%s fails to validate\n", filename);
1669  } else {
1670  fprintf(stderr, "%s validation generated an internal error\n",
1671  filename);
1673  }
1674  }
1675  xmlSchemaFreeValidCtxt(vctxt);
1676  } else
1677 #endif
1678  {
1679  /*
1680  * Create the parser context amd hook the input
1681  */
1682  ctxt = xmlNewParserCtxt();
1683  if (ctxt == NULL) {
1685  goto error;
1686  }
1687  old_sax = ctxt->sax;
1688  ctxt->sax = handler;
1689  ctxt->userData = (void *) user_data;
1690  inputStream = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE);
1691  if (inputStream == NULL) {
1693  goto error;
1694  }
1695  inputPush(ctxt, inputStream);
1696 
1697  /* do the parsing */
1698  xmlParseDocument(ctxt);
1699 
1700  if (ctxt->myDoc != NULL) {
1701  fprintf(stderr, "SAX generated a doc !\n");
1702  xmlFreeDoc(ctxt->myDoc);
1703  ctxt->myDoc = NULL;
1704  }
1705  }
1706 
1707 error:
1708  if (ctxt != NULL) {
1709  ctxt->sax = old_sax;
1710  xmlFreeParserCtxt(ctxt);
1711  }
1712 }
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:1709
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,...)
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBFUN int XMLCALL xmlParseDocument(xmlParserCtxtPtr ctxt)
Definition: parser.c:10579
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:36
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 2976 of file xmllint.c.

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

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:347
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:251
GLuint64EXT * result
Definition: glext.h:11304
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:363

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:347
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:363

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:347
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:363

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:251
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:71

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 184 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 185 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().