<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://blog.gmane.org/gmane.comp.python.lxml.devel">
    <title>gmane.comp.python.lxml.devel</title>
    <link>http://blog.gmane.org/gmane.comp.python.lxml.devel</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3991"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3990"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3989"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3988"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3987"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3986"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3985"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3984"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3983"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3982"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3981"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3980"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3979"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3978"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3977"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3976"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3975"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3974"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3973"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3972"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3991">
    <title>Re: Undefined preference when buildinglxmlxsltLibxsltVersion</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3991</link>
    <description>Hi,

Nguyễn Khánh Duy wrote:

You need to have the "xslt-config" script in your PATH. It comes with libxslt,
but in your case, lxml's setup.py script can't find it.

Stefan

_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-21T17:11:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3990">
    <title>Undefined preference when building lxmlxsltLibxsltVersion</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3990</link>
    <description>I am trying to build lxml for python 2.3 on windows, using mingw32.
I've successfully downloaded and installed libxslt and libxml2, put
the include header files and the lib files where they need to be, but
when I build lxml the following error appears:

Am I missing any .lib files? libxslt, libxml2, libexslt, iconv and
zlib are all in the python 2.3 libs folder.

D:\LXML\lxml-2.1.1&gt;python setup.py build -cmingw32
Building lxml version 2.1.1.
NOTE: Trying to build without Cython, pre-generated
'src/lxml/lxml.etree.c' needs to be available.
ERROR: 'xslt-config' is not recognized as an internal or external
command, operable program or batch file.

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt
running build
running build_py
running build_ext
building 'lxml.etree' extension
writing build\temp.win32-2.3\Release\src\lxml\etree.def
C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.3\Release\src\lxm
l\lxml.etree.o build\temp.win32-2.3\Release\src\lxml\etree.def -LD:\Python23\lib
s -LD:\Python23\PCBuild -llibxslt -llibexslt -llibxml2 -liconv -lzlib -lWS2_32 -
lpython23 -o build\lib.win32-2.3\lxml\etree.pyd

build\temp.win32-2.3\Release\src\lxml\lxml.etree.o:lxml.etree.c:(.text+0x67e20):
 undefined reference to `xsltProcessOneNode'

build\temp.win32-2.3\Release\src\lxml\lxml.etree.o:lxml.etree.c:(.text+0x83946):
 undefined reference to `xsltLibxsltVersion'

build\temp.win32-2.3\Release\src\lxml\lxml.etree.o:lxml.etree.c:(.text+0x839e2):
 undefined reference to `xsltDocDefaultLoader'

collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1


</description>
    <dc:creator>Nguyễn Khánh Duy</dc:creator>
    <dc:date>2008-08-21T15:43:34</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3989">
    <title>Re: objectify.ObjectPath("wrongroot.a.b")(root, None)  should not raise an exception</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3989</link>
    <description>_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>jholg&lt; at &gt;gmx.de</dc:creator>
    <dc:date>2008-08-21T06:24:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3988">
    <title>Re: objectify.ObjectPath("wrongroot.a.b")(root, None) should not raise an exception</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3988</link>
    <description>Hi,

Holger Joukl wrote:


Please do.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-20T18:55:10</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3987">
    <title>Fwd: [xml] Security fix for libxml2</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3987</link>
    <description>FYI

-------- Original-Message --------
Subject: [xml] Security fix for libxml2
Date: Wed, 20 Aug 2008 19:00:51 +0200
From: Daniel Veillard &lt;veillard&lt; at &gt;redhat.com&gt;
To: xml&lt; at &gt;gnome.org

  Bad news, when checking against recursive entities expansion problem
back when it was made official (c.f. the billion laught attack circa
2004) I had checked for the normal recursion, but when happening in
an attribute value the resource consumption is way faster and the
recursion detection in place is not sufficient to catch the problem.

  Basically when this happen within an attribute just checking for
a recursion depth is not sufficient, and the only good method I could
find was to count the number of entities replacement taking place while
parsing a given document, and drop parsing after half a million
substitution. I think it's a fair default process and what the patches
below implements for various libxml2 versions, but i can understand that
in some case that may be problematic. So i intend in the next release
(2.7.0 hopefully available soon) to add a parser flag removing the
hardcoded limits (there is also a maximum document depth in place).

  Distributions have been made aware of the problem for a couple of
weeks and updates should be available soon from normal update channels
I'm updating SVN with the fix too,

Daniel
Index: include/libxml/parser.h
===================================================================
--- include/libxml/parser.h(revision 3771)
+++ include/libxml/parser.h(working copy)
&lt; at &gt;&lt; at &gt; -297,6 +297,7 &lt; at &gt;&lt; at &gt; struct _xmlParserCtxt {
      */
     xmlError          lastError;
     xmlParserMode     parseMode;    /* the parser mode */
+    unsigned long    nbentities;    /* number of entities references */
 };
 
 /**
Index: include/libxml/entities.h
===================================================================
--- include/libxml/entities.h(revision 3771)
+++ include/libxml/entities.h(working copy)
&lt; at &gt;&lt; at &gt; -57,6 +57,7 &lt; at &gt;&lt; at &gt; struct _xmlEntity {
     const xmlChar           *URI;/* the full URI as computed */
     int                    owner;/* does the entity own the childrens */
     int checked;/* was the entity content checked */
+    unsigned long     nbentities;/* the number of entities references */
 };
 
 /*
Index: entities.c
===================================================================
--- entities.c(revision 3771)
+++ entities.c(working copy)
&lt; at &gt;&lt; at &gt; -31,35 +31,35 &lt; at &gt;&lt; at &gt; static xmlEntity xmlEntityLt = {
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&lt;", BAD_CAST "&lt;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 1, 0
 };
 static xmlEntity xmlEntityGt = {
     NULL, XML_ENTITY_DECL, BAD_CAST "gt",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&gt;", BAD_CAST "&gt;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 1, 0
 };
 static xmlEntity xmlEntityAmp = {
     NULL, XML_ENTITY_DECL, BAD_CAST "amp",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&amp;", BAD_CAST "&amp;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 1, 0
 };
 static xmlEntity xmlEntityQuot = {
     NULL, XML_ENTITY_DECL, BAD_CAST "quot",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "\"", BAD_CAST "\"", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 1, 0
 };
 static xmlEntity xmlEntityApos = {
     NULL, XML_ENTITY_DECL, BAD_CAST "apos",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "'", BAD_CAST "'", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 1, 0
 };
 
 /**
Index: parserInternals.c
===================================================================
--- parserInternals.c(revision 3771)
+++ parserInternals.c(working copy)
&lt; at &gt;&lt; at &gt; -1670,6 +1670,7 &lt; at &gt;&lt; at &gt; xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
     ctxt-&gt;depth = 0;
     ctxt-&gt;charset = XML_CHAR_ENCODING_UTF8;
     ctxt-&gt;catalogs = NULL;
+    ctxt-&gt;nbentities = 0;
     xmlInitNodeInfoSeq(&amp;ctxt-&gt;node_seq);
     return(0);
 }
Index: parser.c
===================================================================
--- parser.c(revision 3771)
+++ parser.c(working copy)
&lt; at &gt;&lt; at &gt; -2379,7 +2379,7 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 return(NULL);
     last = str + len;
 
-    if (ctxt-&gt;depth &gt; 40) {
+    if ((ctxt-&gt;depth &gt; 40) || (ctxt-&gt;nbentities &gt;= 500000)) {
 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 return(NULL);
     }
&lt; at &gt;&lt; at &gt; -2417,6 +2417,11 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 "String decoding Entity Reference: %.30s\n",
 str);
     ent = xmlParseStringEntityRef(ctxt, &amp;str);
+    if (ctxt-&gt;lastError.code == XML_ERR_ENTITY_LOOP)
+        goto int_error;
+    ctxt-&gt;nbentities++;
+    if (ent != NULL)
+        ctxt-&gt;nbentities += ent-&gt;nbentities;
     if ((ent != NULL) &amp;&amp;
 (ent-&gt;etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
 if (ent-&gt;content != NULL) {
&lt; at &gt;&lt; at &gt; -2462,6 +2467,11 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 xmlGenericError(xmlGenericErrorContext,
 "String decoding PE Reference: %.30s\n", str);
     ent = xmlParseStringPEReference(ctxt, &amp;str);
+    if (ctxt-&gt;lastError.code == XML_ERR_ENTITY_LOOP)
+        goto int_error;
+    ctxt-&gt;nbentities++;
+    if (ent != NULL)
+        ctxt-&gt;nbentities += ent-&gt;nbentities;
     if (ent != NULL) {
                 if (ent-&gt;content == NULL) {
     if (xmlLoadEntityContent(ctxt, ent) &lt; 0) {
&lt; at &gt;&lt; at &gt; -2501,6 +2511,7 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 
 mem_error:
     xmlErrMemory(ctxt, NULL);
+int_error:
     if (rep != NULL)
         xmlFree(rep);
     if (buffer != NULL)
&lt; at &gt;&lt; at &gt; -3542,6 +3553,9 &lt; at &gt;&lt; at &gt; xmlParseAttValueComplex(xmlParserCtxtPtr
 }
     } else {
 ent = xmlParseEntityRef(ctxt);
+ctxt-&gt;nbentities++;
+if (ent != NULL)
+    ctxt-&gt;nbentities += ent-&gt;nbentities;
 if ((ent != NULL) &amp;&amp;
     (ent-&gt;etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
     if (len &gt; buf_size - 10) {
&lt; at &gt;&lt; at &gt; -4844,6 +4858,7 &lt; at &gt;&lt; at &gt; xmlParseEntityDecl(xmlParserCtxtPtr ctxt
     int isParameter = 0;
     xmlChar *orig = NULL;
     int skipped;
+    unsigned long oldnbent = ctxt-&gt;nbentities;
     
     /* GROW; done in the caller */
     if (CMP8(CUR_PTR, '&lt;', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) {
&lt; at &gt;&lt; at &gt; -5068,6 +5083,7 &lt; at &gt;&lt; at &gt; xmlParseEntityDecl(xmlParserCtxtPtr ctxt
 }
     }
             if (cur != NULL) {
+        cur-&gt;nbentities = ctxt-&gt;nbentities - oldnbent;
         if (cur-&gt;orig != NULL)
     xmlFree(orig);
 else
&lt; at &gt;&lt; at &gt; -6477,6 +6493,11 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 if (ent == NULL) return;
 if (!ctxt-&gt;wellFormed)
     return;
+ctxt-&gt;nbentities++;
+if (ctxt-&gt;nbentities &gt;= 500000) {
+    xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+    return;
+}
 was_checked = ent-&gt;checked;
 if ((ent-&gt;name != NULL) &amp;&amp; 
     (ent-&gt;etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
&lt; at &gt;&lt; at &gt; -6537,6 +6558,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 xmlFreeNodeList(list);
     }
 } else {
+    unsigned long oldnbent = ctxt-&gt;nbentities;
     /*
      * 4.3.2: An internal general parsed entity is well-formed
      * if its replacement text matches the production labeled
&lt; at &gt;&lt; at &gt; -6559,6 +6581,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 ret = xmlParseBalancedChunkMemoryInternal(ctxt,
    value, user_data, &amp;list);
 ctxt-&gt;depth--;
+
     } else if (ent-&gt;etype ==
        XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
 ctxt-&gt;depth++;
&lt; at &gt;&lt; at &gt; -6571,6 +6594,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
      "invalid entity type found\n", NULL);
     }
+    ent-&gt;nbentities = ctxt-&gt;nbentities - oldnbent;
     if (ret == XML_ERR_ENTITY_LOOP) {
 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 return;
&lt; at &gt;&lt; at &gt; -6629,6 +6653,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 }
 ent-&gt;checked = 1;
     }
+    ctxt-&gt;nbentities += ent-&gt;nbentities;
 
             if (ent-&gt;children == NULL) {
 /*
&lt; at &gt;&lt; at &gt; -11800,7 +11825,7 &lt; at &gt;&lt; at &gt; xmlParseCtxtExternalEntity(xmlParserCtxt
 
     if (ctx == NULL) return(-1);
 
-    if (ctx-&gt;depth &gt; 40) {
+    if ((ctx-&gt;depth &gt; 40) || (ctx-&gt;nbentities &gt;= 500000)) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -12010,7 +12035,8 &lt; at &gt;&lt; at &gt; xmlParseExternalEntityPrivate(xmlDocPtr 
     xmlChar start[4];
     xmlCharEncoding enc;
 
-    if (depth &gt; 40) {
+    if ((depth &gt; 40) ||
+        ((oldctxt != NULL) &amp;&amp; (oldctxt-&gt;nbentities &gt;= 500000))) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -12154,6 +12180,7 &lt; at &gt;&lt; at &gt; xmlParseExternalEntityPrivate(xmlDocPtr 
     oldctxt-&gt;node_seq.maximum = ctxt-&gt;node_seq.maximum;
     oldctxt-&gt;node_seq.length = ctxt-&gt;node_seq.length;
     oldctxt-&gt;node_seq.buffer = ctxt-&gt;node_seq.buffer;
+    oldctxt-&gt;nbentities += ctxt-&gt;nbentities;
     ctxt-&gt;node_seq.maximum = 0;
     ctxt-&gt;node_seq.length = 0;
     ctxt-&gt;node_seq.buffer = NULL;
&lt; at &gt;&lt; at &gt; -12254,7 +12281,7 &lt; at &gt;&lt; at &gt; xmlParseBalancedChunkMemoryInternal(xmlP
     int size;
     xmlParserErrors ret = XML_ERR_OK;
 
-    if (oldctxt-&gt;depth &gt; 40) {
+    if ((oldctxt-&gt;depth &gt; 40) || (oldctxt-&gt;nbentities &gt;= 500000)) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -12379,6 +12406,7 &lt; at &gt;&lt; at &gt; xmlParseBalancedChunkMemoryInternal(xmlP
         ctxt-&gt;myDoc-&gt;last = last;
     }
 
+    oldctxt-&gt;nbentities += ctxt-&gt;nbentities;
     ctxt-&gt;sax = oldsax;
     ctxt-&gt;dict = NULL;
     ctxt-&gt;attsDefault = NULL;
&lt; at &gt;&lt; at &gt; -13695,6 +13723,7 &lt; at &gt;&lt; at &gt; xmlCtxtReset(xmlParserCtxtPtr ctxt)
     ctxt-&gt;depth = 0;
     ctxt-&gt;charset = XML_CHAR_ENCODING_UTF8;
     ctxt-&gt;catalogs = NULL;
+    ctxt-&gt;nbentities = 0;
     xmlInitNodeInfoSeq(&amp;ctxt-&gt;node_seq);
 
     if (ctxt-&gt;attsDefault != NULL) {

--- include/libxml/parser.h(revision 3771)
+++ include/libxml/parser.h(working copy)
&lt; at &gt;&lt; at &gt; -297,6 +297,7 &lt; at &gt;&lt; at &gt; struct _xmlParserCtxt {
      */
     xmlError          lastError;
     xmlParserMode     parseMode;    /* the parser mode */
+    unsigned long    nbentities;    /* number of entities references */
 };
 
 /**
--- include/libxml/entities.h.orig2005-01-04 15:49:49.000000000 +0100
+++ include/libxml/entities.h2008-08-11 17:56:53.000000000 +0200
&lt; at &gt;&lt; at &gt; -56,6 +56,7 &lt; at &gt;&lt; at &gt; struct _xmlEntity {
     struct _xmlEntity     *nexte;/* unused */
     const xmlChar           *URI;/* the full URI as computed */
     int                    owner;/* does the entity own the childrens */
+    unsigned long     nbentities;/* the number of entities references */
 };
 
 /*
--- entities.c.orig2006-03-09 17:39:46.000000000 +0100
+++ entities.c2008-08-11 18:01:06.000000000 +0200
&lt; at &gt;&lt; at &gt; -31,35 +31,35 &lt; at &gt;&lt; at &gt; static xmlEntity xmlEntityLt = {
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&lt;", BAD_CAST "&lt;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityGt = {
     NULL, XML_ENTITY_DECL, BAD_CAST "gt",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&gt;", BAD_CAST "&gt;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityAmp = {
     NULL, XML_ENTITY_DECL, BAD_CAST "amp",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&amp;", BAD_CAST "&amp;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityQuot = {
     NULL, XML_ENTITY_DECL, BAD_CAST "quot",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "\"", BAD_CAST "\"", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityApos = {
     NULL, XML_ENTITY_DECL, BAD_CAST "apos",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "'", BAD_CAST "'", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 
 /**
--- parser.c.orig2006-04-23 11:39:15.000000000 +0200
+++ parser.c2008-08-11 18:36:56.000000000 +0200
&lt; at &gt;&lt; at &gt; -2174,7 +2176,7 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 return(NULL);
     last = str + len;
 
-    if (ctxt-&gt;depth &gt; 40) {
+    if ((ctxt-&gt;depth &gt; 40) || (ctxt-&gt;nbentities &gt;= 500000)) {
 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 return(NULL);
     }
&lt; at &gt;&lt; at &gt; -2212,6 +2214,11 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 "String decoding Entity Reference: %.30s\n",
 str);
     ent = xmlParseStringEntityRef(ctxt, &amp;str);
+    if (ctxt-&gt;lastError.code == XML_ERR_ENTITY_LOOP)
+        goto int_error;
+    ctxt-&gt;nbentities++;
+    if (ent != NULL)
+        ctxt-&gt;nbentities += ent-&gt;nbentities;
     if ((ent != NULL) &amp;&amp;
 (ent-&gt;etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
 if (ent-&gt;content != NULL) {
&lt; at &gt;&lt; at &gt; -2258,6 +2265,11 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 xmlGenericError(xmlGenericErrorContext,
 "String decoding PE Reference: %.30s\n", str);
     ent = xmlParseStringPEReference(ctxt, &amp;str);
+    if (ctxt-&gt;lastError.code == XML_ERR_ENTITY_LOOP)
+        goto int_error;
+    ctxt-&gt;nbentities++;
+    if (ent != NULL)
+        ctxt-&gt;nbentities += ent-&gt;nbentities;
     if (ent != NULL) {
 xmlChar *rep;
 
&lt; at &gt;&lt; at &gt; -2294,6 +2306,9 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 
 mem_error:
     xmlErrMemory(ctxt, NULL);
+int_error:
+    if (buffer != NULL)
+        xmlFree(buffer);
     return(NULL);
 }
 
&lt; at &gt;&lt; at &gt; -3100,6 +3115,9 &lt; at &gt;&lt; at &gt; xmlParseAttValueComplex(xmlParserCtxtPtr
 }
     } else {
 ent = xmlParseEntityRef(ctxt);
+ctxt-&gt;nbentities++;
+if (ent != NULL)
+    ctxt-&gt;nbentities += ent-&gt;nbentities;
 if ((ent != NULL) &amp;&amp;
     (ent-&gt;etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
     if (len &gt; buf_size - 10) {
&lt; at &gt;&lt; at &gt; -4342,6 +4360,7 &lt; at &gt;&lt; at &gt; xmlParseEntityDecl(xmlParserCtxtPtr ctxt
     int isParameter = 0;
     xmlChar *orig = NULL;
     int skipped;
+    unsigned long oldnbent = ctxt-&gt;nbentities;
     
     /* GROW; done in the caller */
     if (CMP8(CUR_PTR, '&lt;', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) {
&lt; at &gt;&lt; at &gt; -4551,6 +4570,7 &lt; at &gt;&lt; at &gt; xmlParseEntityDecl(xmlParserCtxtPtr ctxt
 }
     }
             if (cur != NULL) {
+        cur-&gt;nbentities = ctxt-&gt;nbentities - oldnbent;
         if (cur-&gt;orig != NULL)
     xmlFree(orig);
 else
&lt; at &gt;&lt; at &gt; -5927,6 +5947,11 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 if (ent == NULL) return;
 if (!ctxt-&gt;wellFormed)
     return;
+ctxt-&gt;nbentities++;
+if (ctxt-&gt;nbentities &gt;= 500000) {
+    xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+    return;
+}
 if ((ent-&gt;name != NULL) &amp;&amp; 
     (ent-&gt;etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
     xmlNodePtr list = NULL;
&lt; at &gt;&lt; at &gt; -5985,6 +6010,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 xmlFreeNodeList(list);
     }
 } else {
+    unsigned long oldnbent = ctxt-&gt;nbentities;
     /*
      * 4.3.2: An internal general parsed entity is well-formed
      * if its replacement text matches the production labeled
&lt; at &gt;&lt; at &gt; -6007,6 +6033,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 ret = xmlParseBalancedChunkMemoryInternal(ctxt,
    value, user_data, &amp;list);
 ctxt-&gt;depth--;
+
     } else if (ent-&gt;etype ==
        XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
 ctxt-&gt;depth++;
&lt; at &gt;&lt; at &gt; -6019,6 +6046,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
      "invalid entity type found\n", NULL);
     }
+    ent-&gt;nbentities = ctxt-&gt;nbentities - oldnbent;
     if (ret == XML_ERR_ENTITY_LOOP) {
 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 return;
&lt; at &gt;&lt; at &gt; -6075,6 +6103,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
     }
 }
     }
+    ctxt-&gt;nbentities += ent-&gt;nbentities;
     if ((ctxt-&gt;sax != NULL) &amp;&amp; (ctxt-&gt;sax-&gt;reference != NULL) &amp;&amp;
 (ctxt-&gt;replaceEntities == 0) &amp;&amp; (!ctxt-&gt;disableSAX)) {
 /*
&lt; at &gt;&lt; at &gt; -11035,7 +11064,7 &lt; at &gt;&lt; at &gt; xmlParseCtxtExternalEntity(xmlParserCtxt
 
     if (ctx == NULL) return(-1);
 
-    if (ctx-&gt;depth &gt; 40) {
+    if ((ctx-&gt;depth &gt; 40) || (ctx-&gt;nbentities &gt;= 500000)) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -11220,7 +11249,8 &lt; at &gt;&lt; at &gt; xmlParseExternalEntityPrivate(xmlDocPtr 
     xmlChar start[4];
     xmlCharEncoding enc;
 
-    if (depth &gt; 40) {
+    if ((depth &gt; 40) ||
+        ((oldctxt != NULL) &amp;&amp; (oldctxt-&gt;nbentities &gt;= 500000))) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -11363,6 +11393,7 &lt; at &gt;&lt; at &gt; xmlParseExternalEntityPrivate(xmlDocPtr 
     oldctxt-&gt;node_seq.maximum = ctxt-&gt;node_seq.maximum;
     oldctxt-&gt;node_seq.length = ctxt-&gt;node_seq.length;
     oldctxt-&gt;node_seq.buffer = ctxt-&gt;node_seq.buffer;
+    oldctxt-&gt;nbentities += ctxt-&gt;nbentities;
     ctxt-&gt;node_seq.maximum = 0;
     ctxt-&gt;node_seq.length = 0;
     ctxt-&gt;node_seq.buffer = NULL;
&lt; at &gt;&lt; at &gt; -11463,7 +11494,7 &lt; at &gt;&lt; at &gt; xmlParseBalancedChunkMemoryInternal(xmlP
     int size;
     xmlParserErrors ret = XML_ERR_OK;
 
-    if (oldctxt-&gt;depth &gt; 40) {
+    if ((oldctxt-&gt;depth &gt; 40) || (oldctxt-&gt;nbentities &gt;= 500000)) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -11587,6 +11618,7 &lt; at &gt;&lt; at &gt; xmlParseBalancedChunkMemoryInternal(xmlP
         ctxt-&gt;myDoc-&gt;last = last;
     }
 
+    oldctxt-&gt;nbentities += ctxt-&gt;nbentities;
     ctxt-&gt;sax = oldsax;
     ctxt-&gt;dict = NULL;
     ctxt-&gt;attsDefault = NULL;
&lt; at &gt;&lt; at &gt; -12883,6 +12915,7 &lt; at &gt;&lt; at &gt; xmlCtxtReset(xmlParserCtxtPtr ctxt)
     ctxt-&gt;depth = 0;
     ctxt-&gt;charset = XML_CHAR_ENCODING_UTF8;
     ctxt-&gt;catalogs = NULL;
+    ctxt-&gt;nbentities = 0;
     xmlInitNodeInfoSeq(&amp;ctxt-&gt;node_seq);
 
     if (ctxt-&gt;attsDefault != NULL) {

--- include/libxml/parser.h(revision 3771)
+++ include/libxml/parser.h(working copy)
&lt; at &gt;&lt; at &gt; -297,6 +297,7 &lt; at &gt;&lt; at &gt; struct _xmlParserCtxt {
      */
     xmlError          lastError;
     xmlParserMode     parseMode;    /* the parser mode */
+    unsigned long    nbentities;    /* number of entities references */
 };
 
 /**
--- include/libxml/entities.h.orig2005-01-04 15:49:49.000000000 +0100
+++ include/libxml/entities.h2008-08-11 17:56:53.000000000 +0200
&lt; at &gt;&lt; at &gt; -56,6 +56,7 &lt; at &gt;&lt; at &gt; struct _xmlEntity {
     struct _xmlEntity     *nexte;/* unused */
     const xmlChar           *URI;/* the full URI as computed */
     int                    owner;/* does the entity own the childrens */
+    unsigned long     nbentities;/* the number of entities references */
 };
 
 /*
--- entities.c.orig2006-03-09 17:39:46.000000000 +0100
+++ entities.c2008-08-11 18:01:06.000000000 +0200
&lt; at &gt;&lt; at &gt; -31,35 +31,35 &lt; at &gt;&lt; at &gt; static xmlEntity xmlEntityLt = {
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&lt;", BAD_CAST "&lt;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityGt = {
     NULL, XML_ENTITY_DECL, BAD_CAST "gt",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&gt;", BAD_CAST "&gt;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityAmp = {
     NULL, XML_ENTITY_DECL, BAD_CAST "amp",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&amp;", BAD_CAST "&amp;", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityQuot = {
     NULL, XML_ENTITY_DECL, BAD_CAST "quot",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "\"", BAD_CAST "\"", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 static xmlEntity xmlEntityApos = {
     NULL, XML_ENTITY_DECL, BAD_CAST "apos",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "'", BAD_CAST "'", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0
+    NULL, NULL, NULL, NULL, 0, 0
 };
 
 /**
--- parser.c.orig2006-04-23 11:39:15.000000000 +0200
+++ parser.c2008-08-11 18:36:56.000000000 +0200
&lt; at &gt;&lt; at &gt; -2174,7 +2176,7 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 return(NULL);
     last = str + len;
 
-    if (ctxt-&gt;depth &gt; 40) {
+    if ((ctxt-&gt;depth &gt; 40) || (ctxt-&gt;nbentities &gt;= 500000)) {
 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 return(NULL);
     }
&lt; at &gt;&lt; at &gt; -2212,6 +2214,11 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 "String decoding Entity Reference: %.30s\n",
 str);
     ent = xmlParseStringEntityRef(ctxt, &amp;str);
+    if (ctxt-&gt;lastError.code == XML_ERR_ENTITY_LOOP)
+        goto int_error;
+    ctxt-&gt;nbentities++;
+    if (ent != NULL)
+        ctxt-&gt;nbentities += ent-&gt;nbentities;
     if ((ent != NULL) &amp;&amp;
 (ent-&gt;etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
 if (ent-&gt;content != NULL) {
&lt; at &gt;&lt; at &gt; -2258,6 +2265,11 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 xmlGenericError(xmlGenericErrorContext,
 "String decoding PE Reference: %.30s\n", str);
     ent = xmlParseStringPEReference(ctxt, &amp;str);
+    if (ctxt-&gt;lastError.code == XML_ERR_ENTITY_LOOP)
+        goto int_error;
+    ctxt-&gt;nbentities++;
+    if (ent != NULL)
+        ctxt-&gt;nbentities += ent-&gt;nbentities;
     if (ent != NULL) {
 xmlChar *rep;
 
&lt; at &gt;&lt; at &gt; -2294,6 +2306,9 &lt; at &gt;&lt; at &gt; xmlStringLenDecodeEntities(xmlParserCtxt
 
 mem_error:
     xmlErrMemory(ctxt, NULL);
+int_error:
+    if (buffer != NULL)
+        xmlFree(buffer);
     return(NULL);
 }
 
&lt; at &gt;&lt; at &gt; -3100,6 +3115,9 &lt; at &gt;&lt; at &gt; xmlParseAttValueComplex(xmlParserCtxtPtr
 }
     } else {
 ent = xmlParseEntityRef(ctxt);
+ctxt-&gt;nbentities++;
+if (ent != NULL)
+    ctxt-&gt;nbentities += ent-&gt;nbentities;
 if ((ent != NULL) &amp;&amp;
     (ent-&gt;etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
     if (len &gt; buf_size - 10) {
&lt; at &gt;&lt; at &gt; -4342,6 +4360,7 &lt; at &gt;&lt; at &gt; xmlParseEntityDecl(xmlParserCtxtPtr ctxt
     int isParameter = 0;
     xmlChar *orig = NULL;
     int skipped;
+    unsigned long oldnbent = ctxt-&gt;nbentities;
     
     /* GROW; done in the caller */
     if (CMP8(CUR_PTR, '&lt;', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) {
&lt; at &gt;&lt; at &gt; -4551,6 +4570,7 &lt; at &gt;&lt; at &gt; xmlParseEntityDecl(xmlParserCtxtPtr ctxt
 }
     }
             if (cur != NULL) {
+        cur-&gt;nbentities = ctxt-&gt;nbentities - oldnbent;
         if (cur-&gt;orig != NULL)
     xmlFree(orig);
 else
&lt; at &gt;&lt; at &gt; -5927,6 +5947,11 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 if (ent == NULL) return;
 if (!ctxt-&gt;wellFormed)
     return;
+ctxt-&gt;nbentities++;
+if (ctxt-&gt;nbentities &gt;= 500000) {
+    xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+    return;
+}
 if ((ent-&gt;name != NULL) &amp;&amp; 
     (ent-&gt;etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
     xmlNodePtr list = NULL;
&lt; at &gt;&lt; at &gt; -5985,6 +6010,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 xmlFreeNodeList(list);
     }
 } else {
+    unsigned long oldnbent = ctxt-&gt;nbentities;
     /*
      * 4.3.2: An internal general parsed entity is well-formed
      * if its replacement text matches the production labeled
&lt; at &gt;&lt; at &gt; -6007,6 +6033,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 ret = xmlParseBalancedChunkMemoryInternal(ctxt,
    value, user_data, &amp;list);
 ctxt-&gt;depth--;
+
     } else if (ent-&gt;etype ==
        XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
 ctxt-&gt;depth++;
&lt; at &gt;&lt; at &gt; -6019,6 +6046,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
 xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
      "invalid entity type found\n", NULL);
     }
+    ent-&gt;nbentities = ctxt-&gt;nbentities - oldnbent;
     if (ret == XML_ERR_ENTITY_LOOP) {
 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 return;
&lt; at &gt;&lt; at &gt; -6075,6 +6103,7 &lt; at &gt;&lt; at &gt; xmlParseReference(xmlParserCtxtPtr ctxt)
     }
 }
     }
+    ctxt-&gt;nbentities += ent-&gt;nbentities;
     if ((ctxt-&gt;sax != NULL) &amp;&amp; (ctxt-&gt;sax-&gt;reference != NULL) &amp;&amp;
 (ctxt-&gt;replaceEntities == 0) &amp;&amp; (!ctxt-&gt;disableSAX)) {
 /*
&lt; at &gt;&lt; at &gt; -11035,7 +11064,7 &lt; at &gt;&lt; at &gt; xmlParseCtxtExternalEntity(xmlParserCtxt
 
     if (ctx == NULL) return(-1);
 
-    if (ctx-&gt;depth &gt; 40) {
+    if ((ctx-&gt;depth &gt; 40) || (ctx-&gt;nbentities &gt;= 500000)) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -11220,7 +11249,8 &lt; at &gt;&lt; at &gt; xmlParseExternalEntityPrivate(xmlDocPtr 
     xmlChar start[4];
     xmlCharEncoding enc;
 
-    if (depth &gt; 40) {
+    if ((depth &gt; 40) ||
+        ((oldctxt != NULL) &amp;&amp; (oldctxt-&gt;nbentities &gt;= 500000))) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -11363,6 +11393,7 &lt; at &gt;&lt; at &gt; xmlParseExternalEntityPrivate(xmlDocPtr 
     oldctxt-&gt;node_seq.maximum = ctxt-&gt;node_seq.maximum;
     oldctxt-&gt;node_seq.length = ctxt-&gt;node_seq.length;
     oldctxt-&gt;node_seq.buffer = ctxt-&gt;node_seq.buffer;
+    oldctxt-&gt;nbentities += ctxt-&gt;nbentities;
     ctxt-&gt;node_seq.maximum = 0;
     ctxt-&gt;node_seq.length = 0;
     ctxt-&gt;node_seq.buffer = NULL;
&lt; at &gt;&lt; at &gt; -11463,7 +11494,7 &lt; at &gt;&lt; at &gt; xmlParseBalancedChunkMemoryInternal(xmlP
     int size;
     xmlParserErrors ret = XML_ERR_OK;
 
-    if (oldctxt-&gt;depth &gt; 40) {
+    if ((oldctxt-&gt;depth &gt; 40) || (oldctxt-&gt;nbentities &gt;= 500000)) {
 return(XML_ERR_ENTITY_LOOP);
     }
 
&lt; at &gt;&lt; at &gt; -11587,6 +11618,7 &lt; at &gt;&lt; at &gt; xmlParseBalancedChunkMemoryInternal(xmlP
         ctxt-&gt;myDoc-&gt;last = last;
     }
 
+    oldctxt-&gt;nbentities += ctxt-&gt;nbentities;
     ctxt-&gt;sax = oldsax;
     ctxt-&gt;dict = NULL;
     ctxt-&gt;attsDefault = NULL;
&lt; at &gt;&lt; at &gt; -12883,6 +12915,7 &lt; at &gt;&lt; at &gt; xmlCtxtReset(xmlParserCtxtPtr ctxt)
     ctxt-&gt;depth = 0;
     ctxt-&gt;charset = XML_CHAR_ENCODING_UTF8;
     ctxt-&gt;catalogs = NULL;
+    ctxt-&gt;nbentities = 0;
     xmlInitNodeInfoSeq(&amp;ctxt-&gt;node_seq);
 
     if (ctxt-&gt;attsDefault != NULL) {

_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-20T18:50:26</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3986">
    <title>Re: namespace strangeness in lxml 1.1</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3986</link>
    <description>Hi,

coming back to this after a while...

Eric Jahn wrote:

I think you misunderstood my example (and apparently didn't try it on your
side). Isn't this what you wanted:

    &gt;&gt;&gt; import lxml.etree as et
    &gt;&gt;&gt; root = et.XML('&lt;root xmlns:a="http://my/ns"&gt;&lt;el/&gt;&lt;/root&gt;')
    &gt;&gt;&gt; root[0].set("type", et.QName("{http://my/ns}tname"))
    &gt;&gt;&gt; et.tostring(root)
    '&lt;root xmlns:a="http://my/ns"&gt;&lt;el type="a:tname"/&gt;&lt;/root&gt;'

This has been working for quite a while now.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-20T07:07:55</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3985">
    <title>objectify.ObjectPath("wrongroot.a.b")(root, None) should not raise an exception</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3985</link>
    <description>_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>Holger Joukl</dc:creator>
    <dc:date>2008-08-20T15:09:09</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3984">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3984</link>
    <description>Hi,

Sidnei da Silva wrote:

here's a patch that tries making filenames absolute when users pass a
file-like object. This only works for file objects (and maybe compatible
objects), but "file://..." URLs should be provided as absolute URLs anyway.

Is there anything that's missing? You mentioned problems with urlopen(), but
didn't elaborate on them any further.

Stefan
_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-19T19:45:36</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3983">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3983</link>
    <description>I wound up using tlslite the only issue was Windows for which there
wasn't an installer for Python 2.5 and it seemed I needed a version of
DevStudio (that I don't have) to build one.  I tried manually copying
the files and still no joy.  Anyway, back to lxml stuff.

John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221
(360) 299-4086
jlovell&lt; at &gt;nwesd.org
 
www.nwesd.org
Together We Can ...


-----Original Message-----
From: Stefan Behnel [mailto:stefan_ml&lt; at &gt;behnel.de] 
Sent: Tuesday, August 19, 2008 9:02 AM
To: Mike Meyer
Cc: John Lovell; ML-Lxml-dev
Subject: Re: [lxml-dev] Failure with custom resolvers and relative
xsl:import

Mike Meyer wrote:

Ah, sure, that's a portability issue then.



... for which there is tlslite, at least I know that one. From a quick
look at their web site, it's supposed to work with httplib also. I never
used it either, but a couple of blog entries seem to be happy with it.

Stefan
</description>
    <dc:creator>John Lovell</dc:creator>
    <dc:date>2008-08-19T16:16:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3982">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3982</link>
    <description>
Ah, sure, that's a portability issue then.



... for which there is tlslite, at least I know that one. From a quick
look at their web site, it's supposed to work with httplib also. I never
used it either, but a couple of blog entries seem to be happy with it.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-19T16:02:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3981">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3981</link>
    <description>I have used M2Crypto for clientTLS connections from MacOS, Ubuntu, and
Vista, all using the same codebase (including LXML) running under Plone.

Works brillantly.

ET

On 8/19/08 11:07 AM, "John Lovell" &lt;jlovell&lt; at &gt;esd189.org&gt; wrote:


</description>
    <dc:creator>Eric Tiffany</dc:creator>
    <dc:date>2008-08-19T15:49:03</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3980">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3980</link>
    <description>
I never needed to try (I'd start with urllib2 anyway...), but this sounds
like a question for comp.lang.python rather than this list.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-19T15:39:19</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3979">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3979</link>
    <description>Stefan:

So what is your "preferred Python HTTPS client library?"  I recently
tried very hard and ultimately failed at handling https cross platform
with Python.

Thanks for all you do,

John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221
(360) 299-4086
jlovell&lt; at &gt;nwesd.org
 
www.nwesd.org
Together We Can ...


-----Original Message-----
From: Stefan Behnel [mailto:stefan_ml&lt; at &gt;behnel.de] 
Sent: Tuesday, August 19, 2008 3:38 AM
To: John Lovell
Cc: ML-Lxml-dev
Subject: Re: [lxml-dev] Failure with custom resolvers and relative
xsl:import

John Lovell wrote:

Hmmm, isn't it enough to use a custom resolver to intercept only
"https://..." requests (return None for everything else) and to redirect
them to your preferred Python HTTPS client library?

I'm not sure implementing this directly in lxml makes sense, as it
wouldn't allow using certificates and these things. But it shouldn't be
too hard to do on your own.

Stefan
</description>
    <dc:creator>John Lovell</dc:creator>
    <dc:date>2008-08-19T15:07:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3978">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3978</link>
    <description>
Hmmm, isn't it enough to use a custom resolver to intercept only
"https://..." requests (return None for everything else) and to redirect
them to your preferred Python HTTPS client library?

I'm not sure implementing this directly in lxml makes sense, as it
wouldn't allow using certificates and these things. But it shouldn't be
too hard to do on your own.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-19T10:38:25</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3977">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3977</link>
    <description>
If you return a custom object, you can give it a "filename" attribute or a
"geturl()" method (as provided by urlopen() 'files'). lxml will recognise
at.

A StringIO object can't pass on its filename or source URL, so you have to
provide a meaningful base_url from your resolver in this case.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-19T10:26:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3976">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3976</link>
    <description>Stefan:

If you find a currently maintained pure Python way to add SSL, please
let us know.

John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221
(360) 299-4086
jlovell&lt; at &gt;nwesd.org
 
www.nwesd.org
Together We Can ...


-----Original Message-----
From: lxml-dev-bounces&lt; at &gt;codespeak.net
[mailto:lxml-dev-bounces&lt; at &gt;codespeak.net] On Behalf Of Stefan Behnel
Sent: Monday, August 18, 2008 1:17 PM
To: Sidnei da Silva
Cc: ML-Lxml-dev
Subject: Re: [lxml-dev] Failure with custom resolvers and relative
xsl:import

Hi,

Sidnei da Silva wrote:
wrote:
the file.
though.

I'm working on fixing this. However, do you really need something from
urlopen that lxml can't handle by itself? Any "HTTP GET" or "FTP get"
request should work when passed as an encoded URL. HTTP POSTs and
request options won't work, but they are pretty rarely used when
requesting pages. HTTPS also won't work, which I would consider more
important.

Stefan
_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>John Lovell</dc:creator>
    <dc:date>2008-08-18T20:50:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3975">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3975</link>
    <description>
Yes, HTTPS and I'm also using code that handles caching. So, I overly
simplified here. I actually use something that resembles urlopen but
that might return an open file handle (or something that resembles a
file, like a StringIO) if the requested url is cached locally.

</description>
    <dc:creator>Sidnei da Silva</dc:creator>
    <dc:date>2008-08-18T20:45:29</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3974">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3974</link>
    <description>Hi,

Sidnei da Silva wrote:

I'm working on fixing this. However, do you really need something from urlopen
that lxml can't handle by itself? Any "HTTP GET" or "FTP get" request should
work when passed as an encoded URL. HTTP POSTs and request options won't work,
but they are pretty rarely used when requesting pages. HTTPS also won't work,
which I would consider more important.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-18T20:16:53</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3973">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3973</link>
    <description>
Okay, I think that solves one of the problems, when the filename is
local. I suspect it won't solve the other problem I had, which was
when the file comes from urlopen(). Since the files are relatively
small though I can keep using resolve_string() for now.

</description>
    <dc:creator>Sidnei da Silva</dc:creator>
    <dc:date>2008-08-18T19:21:30</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3972">
    <title>Re: Failure with custom resolvers and relative xsl:import</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3972</link>
    <description>Hi,

Sidnei da Silva wrote:

The problem here is that lxml currently only takes the .name attribute of a
file object to determine the file name. The right thing to do would be to use
os.path.abspath(f.name) instead to retrieve the absolute path name of the file.

Using resolve_filename(filename) instead of resolve_file(open(filename))
provides a more efficient work around, though.

Stefan
</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-08-18T07:04:58</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.lxml.devel/3971">
    <title>Re: instance from schema</title>
    <link>http://permalink.gmane.org/gmane.comp.python.lxml.devel/3971</link>
    <description>_______________________________________________
lxml-dev mailing list
lxml-dev&lt; at &gt;codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
</description>
    <dc:creator>jholg&lt; at &gt;gmx.de</dc:creator>
    <dc:date>2008-08-15T10:56:51</dc:date>
  </item>
  <textinput about="http://search.gmane.org/?group=$group=gmane.comp.python.lxml.devel">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.python.lxml.devel</link>
  </textinput>
</rdf:RDF>
