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

Go to the source code of this file.

Macros

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

Enumerations

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

Functions

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

getParameterEntityDebug: @ctxt: An XML parser context

Get a parameter entity by name

Returns the xmlParserInputPtr

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

attributeDeclDebug: @ctxt: An XML parser context

@type: the attribute type

An attribute definition has been parsed

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

notationDeclDebug: @ctxt: An XML parser context

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

What to do when a notation declaration has been parsed.

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

unparsedEntityDeclDebug: @ctxt: An XML parser context

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

What to do when an unparsed entity declaration is parsed

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

Variables

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

: The entity name

referenceDebug: @ctxt: An XML parser context

called when an entity reference is detected.

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

: The element name

endElementDebug: @ctxt: An XML parser context

called when the end of an element has been detected.

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

Macro Definition Documentation

◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC   100

Definition at line 463 of file xmllint.c.

◆ MAX_PATHS

#define MAX_PATHS   64

Definition at line 206 of file xmllint.c.

◆ PATH_SEPARATOR

#define PATH_SEPARATOR   ':'

Definition at line 210 of file xmllint.c.

◆ XML_XML_DEFAULT_CATALOG

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

Definition at line 90 of file xmllint.c.

Enumeration Type Documentation

◆ xmllintReturnCode

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

Definition at line 93 of file xmllint.c.

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

Function Documentation

◆ attributeDeclDebug()

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

Definition at line 1090 of file xmllint.c.

1093 {
1094  callbacks++;
1095  if (noout)
1096  return;
1097  if (defaultValue == NULL)
1098  fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n",
1099  elem, name, type, def);
1100  else
1101  fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
1102  elem, name, type, def, defaultValue);
1104 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
XMLPUBFUN void XMLCALL xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c: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 3108 of file xmllint.c.

3109 {
3110  assert(node->_private != NULL);
3111  assert(*(long*)node->_private == (long) 0x81726354);
3112  free(node->_private);
3113  nbregister--;
3114 }
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:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ endDocumentDebug()

static void endDocumentDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

endDocumentDebug: @ctxt: An XML parser context

called when the document end has been detected.

Definition at line 1216 of file xmllint.c.

1217 {
1218  callbacks++;
1219  if (noout)
1220  return;
1221  fprintf(stdout, "SAX.endDocument()\n");
1222 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ endElementDebug()

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

Definition at line 1258 of file xmllint.c.

1259 {
1260  callbacks++;
1261  if (noout)
1262  return;
1263  fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
1264 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ endElementNsDebug()

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

Definition at line 1564 of file xmllint.c.

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

◆ entityDeclDebug()

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

Definition at line 1063 of file xmllint.c.

1065 {
1066 const xmlChar *nullstr = BAD_CAST "(null)";
1067  /* not all libraries handle printing null pointers nicely */
1068  if (publicId == NULL)
1069  publicId = nullstr;
1070  if (systemId == NULL)
1071  systemId = nullstr;
1072  if (content == NULL)
1073  content = (xmlChar *)nullstr;
1074  callbacks++;
1075  if (noout)
1076  return;
1077  fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
1078  name, type, publicId, systemId, content);
1079 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
content
Definition: atl_ax.c:993
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ externalSubsetDebug()

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

externalSubsetDebug: @ctxt: An XML parser context

Does this document has an external subset

Definition at line 960 of file xmllint.c.

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

◆ getEntityDebug()

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

Definition at line 1022 of file xmllint.c.

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

◆ getParameterEntityDebug()

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

Definition at line 1041 of file xmllint.c.

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

◆ hasExternalSubsetDebug()

static int hasExternalSubsetDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

hasExternalSubsetDebug: @ctxt: An XML parser context

Does this document has an external subset

Returns 1 if true

Definition at line 920 of file xmllint.c.

921 {
922  callbacks++;
923  if (noout)
924  return(0);
925  fprintf(stdout, "SAX.hasExternalSubset()\n");
926  return(0);
927 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ hasInternalSubsetDebug()

static int hasInternalSubsetDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

hasInternalSubsetDebug: @ctxt: An XML parser context

Does this document has an internal subset

Returns 1 if true

Definition at line 902 of file xmllint.c.

903 {
904  callbacks++;
905  if (noout)
906  return(0);
907  fprintf(stdout, "SAX.hasInternalSubset()\n");
908  return(0);
909 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ ignorableWhitespaceDebug()

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

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

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

Definition at line 1318 of file xmllint.c.

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

◆ internalSubsetDebug()

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

internalSubsetDebug: @ctxt: An XML parser context

Does this document has an internal subset

Definition at line 936 of file xmllint.c.

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

◆ isStandaloneDebug()

static int isStandaloneDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

isStandaloneDebug: @ctxt: An XML parser context

Is this document tagged standalone ?

Returns 1 if true

Definition at line 884 of file xmllint.c.

885 {
886  callbacks++;
887  if (noout)
888  return(0);
889  fprintf(stdout, "SAX.isStandalone()\n");
890  return(0);
891 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ LIBXML_ATTR_FORMAT() [1/2]

static void XMLCDECL LIBXML_ATTR_FORMAT ( ,
 
)
static

Definition at line 472 of file xmllint.c.

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

◆ LIBXML_ATTR_FORMAT() [2/2]

static void XMLCDECL LIBXML_ATTR_FORMAT ( ,
 
)
static

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Definition at line 621 of file xmllint.c.

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

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 3117 of file xmllint.c.

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

◆ 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:7098
FILE * stdin
GLfloat f
Definition: glext.h:7540
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)

Referenced by parseAndPrintFile().

◆ myFreeFunc()

static void myFreeFunc ( void mem)
static

Definition at line 338 of file xmllint.c.

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

Referenced by main().

◆ myMallocFunc()

static void* myMallocFunc ( size_t  size)
static

Definition at line 343 of file xmllint.c.

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

Referenced by main().

◆ myRead()

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

Definition at line 817 of file xmllint.c.

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

Referenced by parseAndPrintFile().

◆ myReallocFunc()

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

Definition at line 358 of file xmllint.c.

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

Referenced by main().

◆ myStrdupFunc()

static char* myStrdupFunc ( const char str)
static

Definition at line 373 of file xmllint.c.

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

Referenced by main().

◆ notationDeclDebug()

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

Definition at line 1136 of file xmllint.c.

1138 {
1139  callbacks++;
1140  if (noout)
1141  return;
1142  fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
1143  (char *) name, (char *) publicId, (char *) systemId);
1144 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ OOM()

static void OOM ( void  )
static

Definition at line 331 of file xmllint.c.

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

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

◆ parseAndPrintFile()

static void parseAndPrintFile ( char filename,
xmlParserCtxtPtr  rectxt 
)
static

Definition at line 2161 of file xmllint.c.

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

Referenced by main().

◆ parsePath()

static void parsePath ( const xmlChar path)
static

Definition at line 217 of file xmllint.c.

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

Referenced by main().

◆ processingInstructionDebug()

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

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

A processing instruction has been parsed.

Definition at line 1342 of file xmllint.c.

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

◆ referenceDebug()

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

Definition at line 1299 of file xmllint.c.

1300 {
1301  callbacks++;
1302  if (noout)
1303  return;
1304  fprintf(stdout, "SAX.reference(%s)\n", name);
1305 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ registerNode()

static void registerNode ( xmlNodePtr  node)
static

Definition at line 3097 of file xmllint.c.

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

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

Referenced by main().

◆ startDocumentDebug()

static void startDocumentDebug ( void *ctx  ATTRIBUTE_UNUSED)
static

startDocumentDebug: @ctxt: An XML parser context

called when the document start being processed.

Definition at line 1201 of file xmllint.c.

1202 {
1203  callbacks++;
1204  if (noout)
1205  return;
1206  fprintf(stdout, "SAX.startDocument()\n");
1207 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ startElementDebug()

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

Definition at line 1232 of file xmllint.c.

1233 {
1234  int i;
1235 
1236  callbacks++;
1237  if (noout)
1238  return;
1239  fprintf(stdout, "SAX.startElement(%s", (char *) name);
1240  if (atts != NULL) {
1241  for (i = 0;(atts[i] != NULL);i++) {
1242  fprintf(stdout, ", %s='", atts[i++]);
1243  if (atts[i] != NULL)
1244  fprintf(stdout, "%s'", atts[i]);
1245  }
1246  }
1247  fprintf(stdout, ")\n");
1248 }
FILE * stdout
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119
_In_ uint16_t _Out_ ULONG * atts
Definition: btrfs_drv.h:1076

◆ 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:38
static int callbacks
Definition: xmllint.c:873
static int noout
Definition: xmllint.c:119

◆ usage()

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

Definition at line 2977 of file xmllint.c.

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

Referenced by main().

◆ xmlHTMLEncodeSend()

static void xmlHTMLEncodeSend ( void  )
static

Definition at line 528 of file xmllint.c.

528  {
529  char *result;
530 
532  if (result) {
534  xmlFree(result);
535  }
536  buffer[0] = 0;
537 }
GLuint buffer
Definition: glext.h:5915
XMLPUBFUN xmlChar *XMLCALL xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
GLuint64EXT * result
Definition: glext.h:11304
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

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

◆ xmlHTMLPrintFileContext()

static void xmlHTMLPrintFileContext ( xmlParserInputPtr  input)
static

xmlHTMLPrintFileContext: @input: an xmlParserInputPtr input

Displays current context within the input content for error tracking

Definition at line 571 of file xmllint.c.

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

Referenced by LIBXML_ATTR_FORMAT().

◆ xmlHTMLPrintFileInfo()

static void xmlHTMLPrintFileInfo ( xmlParserInputPtr  input)
static

xmlHTMLPrintFileInfo: @input: an xmlParserInputPtr input

Displays the associated file and line informations for the current input

Definition at line 547 of file xmllint.c.

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

Referenced by LIBXML_ATTR_FORMAT().

◆ xmllintExternalEntityLoader()

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

Definition at line 245 of file xmllint.c.

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