1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-14 19:24:06 +03:00

fixed warning message from IRIX (bug 125182) removed tabs, replaced with

* xmllint.c: fixed warning message from IRIX (bug 125182)
* python/libxml.py: removed tabs, replaced with spaces
  (bug 125572)
This commit is contained in:
William M. Brack 2003-10-27 13:48:16 +00:00
parent e8039dfec7
commit 1d75c8a822
3 changed files with 111 additions and 108 deletions

View File

@ -1,3 +1,9 @@
Mon Oct 27 21:12:27 HKT 2003 William Brack <wbrack@mmm.com.hk>
* xmllint.c: fixed warning message from IRIX (bug 125182)
* python/libxml.py: removed tabs, replaced with spaces
(bug 125572)
Mon Oct 27 06:17:30 EST 2003 Daniel Veillard <daniel@veillard.com>
* libxml.h parserInternals.c xmlIO.c: make sure we report errors

View File

@ -34,30 +34,30 @@ class ioWrapper:
def io_close(self):
if self.__io == None:
return(-1)
self.__io.close()
self.__io = None
return(0)
return(-1)
self.__io.close()
self.__io = None
return(0)
def io_flush(self):
if self.__io == None:
return(-1)
self.__io.flush()
return(0)
return(-1)
self.__io.flush()
return(0)
def io_read(self, len = -1):
if self.__io == None:
return(-1)
return(-1)
if len < 0:
return(self.__io.read())
return(self.__io.read(len))
return(self.__io.read())
return(self.__io.read(len))
def io_write(self, str, len = -1):
if self.__io == None:
return(-1)
return(-1)
if len < 0:
return(self.__io.write(str))
return(self.__io.write(str, len))
return(self.__io.write(str))
return(self.__io.write(str, len))
class ioReadWrapper(ioWrapper):
def __init__(self, _obj, enc = ""):
@ -110,24 +110,24 @@ class SAXCallback:
def startElement(self, tag, attrs):
"""called at the start of every element, tag is the name of
the element, attrs is a dictionary of the element's attributes"""
the element, attrs is a dictionary of the element's attributes"""
pass
def endElement(self, tag):
"""called at the start of every element, tag is the name of
the element"""
the element"""
pass
def characters(self, data):
"""called when character data have been read, data is the string
containing the data, multiple consecutive characters() callback
are possible."""
containing the data, multiple consecutive characters() callback
are possible."""
pass
def cdataBlock(self, data):
"""called when CDATA section have been read, data is the string
containing the data, multiple consecutive cdataBlock() callback
are possible."""
containing the data, multiple consecutive cdataBlock() callback
are possible."""
pass
def reference(self, name):
@ -140,7 +140,7 @@ class SAXCallback:
def processingInstruction(self, target, data):
"""called when a PI has been found, target contains the PI name and
data is the associated data in the PI"""
data is the associated data in the PI"""
pass
def comment(self, content):
@ -149,42 +149,42 @@ class SAXCallback:
def externalSubset(self, name, externalID, systemID):
"""called when a DOCTYPE declaration has been found, name is the
DTD name and externalID, systemID are the DTD public and system
identifier for that DTd if available"""
DTD name and externalID, systemID are the DTD public and system
identifier for that DTd if available"""
pass
def internalSubset(self, name, externalID, systemID):
"""called when a DOCTYPE declaration has been found, name is the
DTD name and externalID, systemID are the DTD public and system
identifier for that DTD if available"""
DTD name and externalID, systemID are the DTD public and system
identifier for that DTD if available"""
pass
def entityDecl(self, name, type, externalID, systemID, content):
"""called when an ENTITY declaration has been found, name is the
entity name and externalID, systemID are the entity public and
system identifier for that entity if available, type indicates
the entity type, and content reports it's string content"""
entity name and externalID, systemID are the entity public and
system identifier for that entity if available, type indicates
the entity type, and content reports it's string content"""
pass
def notationDecl(self, name, externalID, systemID):
"""called when an NOTATION declaration has been found, name is the
notation name and externalID, systemID are the notation public and
system identifier for that notation if available"""
notation name and externalID, systemID are the notation public and
system identifier for that notation if available"""
pass
def attributeDecl(self, elem, name, type, defi, defaultValue, nameList):
"""called when an ATTRIBUTE definition has been found"""
pass
pass
def elementDecl(self, name, type, content):
"""called when an ELEMENT definition has been found"""
pass
pass
def entityDecl(self, name, publicId, systemID, notationName):
"""called when an unparsed ENTITY declaration has been found,
name is the entity name and publicId,, systemID are the entity
public and system identifier for that entity if available,
and notationName indicate the associated NOTATION"""
name is the entity name and publicId,, systemID are the entity
public and system identifier for that entity if available,
and notationName indicate the associated NOTATION"""
pass
def warning(self, msg):
@ -259,63 +259,63 @@ class xmlCore:
#
import sys
if float(sys.version[0:3]) < 2.2:
def __getattr__(self, attr):
if attr == "parent":
ret = libxml2mod.parent(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "properties":
ret = libxml2mod.properties(self._o)
if ret == None:
return None
return xmlAttr(_obj=ret)
elif attr == "children":
ret = libxml2mod.children(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "last":
ret = libxml2mod.last(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "next":
ret = libxml2mod.next(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "prev":
ret = libxml2mod.prev(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "content":
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":
return libxml2mod.name(self._o)
elif attr == "type":
return libxml2mod.type(self._o)
elif attr == "doc":
ret = libxml2mod.doc(self._o)
if ret == None:
if self.type == "document_xml" or self.type == "document_html":
return xmlDoc(_obj=self._o)
else:
return None
return xmlDoc(_obj=ret)
raise AttributeError,attr
def __getattr__(self, attr):
if attr == "parent":
ret = libxml2mod.parent(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "properties":
ret = libxml2mod.properties(self._o)
if ret == None:
return None
return xmlAttr(_obj=ret)
elif attr == "children":
ret = libxml2mod.children(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "last":
ret = libxml2mod.last(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "next":
ret = libxml2mod.next(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "prev":
ret = libxml2mod.prev(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "content":
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":
return libxml2mod.name(self._o)
elif attr == "type":
return libxml2mod.type(self._o)
elif attr == "doc":
ret = libxml2mod.doc(self._o)
if ret == None:
if self.type == "document_xml" or self.type == "document_html":
return xmlDoc(_obj=self._o)
else:
return None
return xmlDoc(_obj=ret)
raise AttributeError,attr
else:
parent = property(get_parent, None, None, "Parent node")
children = property(get_children, None, None, "First child node")
last = property(get_last, None, None, "Last sibling node")
next = property(get_next, None, None, "Next sibling node")
prev = property(get_prev, None, None, "Previous sibling node")
properties = property(get_properties, None, None, "List of properies")
content = property(get_content, None, None, "Content of this node")
name = property(get_name, None, None, "Node name")
type = property(get_type, None, None, "Node type")
doc = property(get_doc, None, None, "The document this node belongs to")
parent = property(get_parent, None, None, "Parent node")
children = property(get_children, None, None, "First child node")
last = property(get_last, None, None, "Last sibling node")
next = property(get_next, None, None, "Next sibling node")
prev = property(get_prev, None, None, "Previous sibling node")
properties = property(get_properties, None, None, "List of properies")
content = property(get_content, None, None, "Content of this node")
name = property(get_name, None, None, "Node name")
type = property(get_type, None, None, "Node type")
doc = property(get_doc, None, None, "The document this node belongs to")
#
# Serialization routines, the optional arguments have the following
@ -333,30 +333,30 @@ class xmlCore:
# is allocated/freed every time but convenient.
#
def xpathEval(self, expr):
doc = self.doc
if doc == None:
return None
ctxt = doc.xpathNewContext()
ctxt.setContextNode(self)
res = ctxt.xpathEval(expr)
ctxt.xpathFreeContext()
return res
doc = self.doc
if doc == None:
return None
ctxt = doc.xpathNewContext()
ctxt.setContextNode(self)
res = ctxt.xpathEval(expr)
ctxt.xpathFreeContext()
return res
#
# Selecting nodes using XPath, faster because the context
# is allocated just once per xmlDoc.
#
def xpathEval2(self, expr):
doc = self.doc
if doc == None:
return None
doc = self.doc
if doc == None:
return None
try:
doc._ctxt.setContextNode(self)
except:
doc._ctxt = doc.xpathNewContext()
doc._ctxt.setContextNode(self)
res = doc._ctxt.xpathEval(expr)
return res
res = doc._ctxt.xpathEval(expr)
return res
# support for python2 iterators
def walk_depth_first(self):
@ -497,7 +497,7 @@ class parserCtxtCore:
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeParserCtxt(self._o)
self._o = None
self._o = None
def setErrorHandler(self,f,arg):
"""Register an error handler that will be called back as

View File

@ -779,7 +779,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
res = fread(chars, 1, 4, f);
if (res > 0) {
ctxt = htmlCreatePushParserCtxt(NULL, NULL,
chars, res, filename, 0);
chars, res, filename, XML_CHAR_ENCODING_NONE);
while ((res = fread(chars, 1, size, f)) > 0) {
htmlParseChunk(ctxt, chars, res, 0);
}
@ -1801,9 +1801,6 @@ main(int argc, char **argv) {
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
if (repeat) {
xmlParserCtxtPtr ctxt = NULL;
#ifdef LIBXML_READER_ENABLED
xmlTextReaderPtr reader = NULL;
#endif /* LIBXML_READER_ENABLED */
for (acount = 0;acount < repeat;acount++) {
#ifdef LIBXML_READER_ENABLED