Stefan Behnel | 4 Nov 19:43
Picon
Favicon
Gravatar

lxml trunk now requires Cython 0.9.6.8

Hi all,

the current trunk now requires Cython 0.9.6.8 to build, as will 2.0alpha5.
Many of the changes that lxml required in Pyrex (and that Cython provided)
have now gone back into the mainstream distribution - but different. It was
decided that Cython would follow these incompatible language changes, which
now required some minor changes in lxml.

This also means that external modules that use the C-API of lxml will need a
little adaption as the name of the public import function has changed from
"import_etree" to "import_lxml__etree". Everything else should work just as
before.

Note that lxml 1.3 will not be adapted. Future versions will continue to ship
with a patched Pyrex and will not build with Cython or future Pyrex versions.

Stefan
Ian Bicking | 5 Nov 03:12
Gravatar

Re: Failing lxml.html tests

Stefan Behnel wrote:
> Ian Bicking wrote:
>> I made a new checkout, did python setup.py develop, and retested, and
>> the errors seem even weirder now.  Many are for method, but there's a
>> bunch of others too (though still most pass).
>>
>> I attached the test output.
> 
> Hmm, there really must be something wrong with your setup. You have Cython
> 0.9.6.7 installed, I assume? I only get three errors, all in the HTML tests.
> The first one is because one of the entries in _tag_link_attrs is a list, not
> sure about the others.

I only get one, the _tag_link_attrs issue, which I just fixed.  It's 
possible one of these weird errors is preventing another error from 
occurring, though... I guess not, since all the errors I now get are in 
lxml.tests.test_elementtree.

> Anyway, you can run the HTML tests by calling "test.py -vv html", that should
> get you over the failing tests for now. I'll see how far I get with a clean
> checkout myself. Have you tried importing etree by hand and checked if the
> failing methods work there?

They do work there (at least the method argument that I tested).  So 
it's just in the test environment where it's acting weird.  Which is odd.

--

-- 
Ian Bicking : ianb <at> colorstudy.com : http://blog.ianbicking.org
Stefan Behnel | 5 Nov 09:00
Picon
Favicon
Gravatar

Re: Failing lxml.html tests


Ian Bicking wrote:
> Stefan Behnel wrote:
>> I only get three errors, all in the HTML tests.
>> The first one is because one of the entries in _tag_link_attrs is a
>> list, not sure about the others.
> 
> I only get one, the _tag_link_attrs issue, which I just fixed.

The others only occur with libxml2 2.6.29 and later. These versions handle the
"embed" tag as a special tag that does not need closing. However, a
parse-serialise-parse cycle for such HTML alters the document here: it omits
the closing tag and then reparses the following tags as children. So this is a
bug in libxml2. I'll report it there.

For the time being - maybe there's a way to work around that?

Stefan
John Lovell | 8 Nov 01:21

XSD Validation: No matching global declaration.

Hi All:
 
I don't know if my schema is invalid or if this represents a bug in lxml or libxml2.
 
Here is the situation...
 
I have a XML Schema that looks like this:
 
 
 
...
 
 <element name="Authentication">
  <complexType>
   <sequence>
    <element ref="sif:AuthenticationInfo" minOccurs="0" maxOccurs="unbounded"/>
    <element ref="sif:SIF_ExtendedElements" minOccurs="0" maxOccurs="1"/>
   </sequence>
   <attribute name="RefId" type="sif:RefIdType" use="required"/>
   <attribute name="SifRefId" type="sif:RefIdType" use="required"/>
   <attribute name="SifRefIdType" use="required">
    <simpleType>
     <restriction base="string">
      <enumeration value="StudentPersonal"/>
      <enumeration value="StaffPersonal"/>
      <enumeration value="StudentContact"/>
      <enumeration value="EmployeePersonal"/>
     </restriction>
    </simpleType>
   </attribute>
  </complexType>
 </element>
 
...
 
</schema>
 
I am trying to validate this data:
 
<?xml version="1.0"?>
<Authentication xmlns:ns3="http://www.w3.org/2001/XMLSchema" ns3:RefId="27D1CAEA85C2BAA647A01B551D21E1EB" ns3:SifRefId="211242238C60A55E25B2B86BB337C244" ns3:SifRefIdType="EmployeePersonal">
  <AuthenticationInfo>
    <System xmlns:ns0="http://www.w3.org/2001/XMLSchema" ns0:Type="Application">&amp;amp;1&amp;lt;tNk44}F2</System>
    <Username>;pl}ee&amp;apos;-</Username>
    <DistinguishedName>mlZm <at> JD</DistinguishedName>
    <Password xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns1:Algorithm="MD5" ns1:KeyName="(v4kSY.">l1uqg!</Password>
  </AuthenticationInfo>
  <SIF_ExtendedElements>
    <SIF_ExtendedElement xmlns:ns2="http://www.w3.org/2001/XMLSchema" ns2:Name="%~T=">ZE72n/l</SIF_ExtendedElement>
  </SIF_ExtendedElements>
</Authentication>
 
The error log shows the following error:
 
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml:2:ERROR:SCHEMASV:SCHEMAV_CVC_ELT_1: Element 'Authentication': No matching global declaration available for the validation root.
 
The same code given diffrent files works fine.  Does anyone have any ideas why I am getting this message?
 
Required version information:
 
lxml.etree:        (1, 3, 4, 0)
libxml used:       (2, 6, 30)
libxml compiled:   (2, 6, 30)
libxslt used:      (1, 1, 21)
libxslt compiled:  (1, 1, 22)
 
Thanks,
 
John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221
Together We Can ...
 
_______________________________________________
lxml-dev mailing list
lxml-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
Stefan Behnel | 8 Nov 07:55
Picon
Favicon
Gravatar

Re: XSD Validation: No matching global declaration.


John Lovell wrote:
> I don't know if my schema is invalid or if this represents a bug in lxml
> or libxml2.
> The error log shows the following error:
>  
> ../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml:2:ERROR:S
> CHEMASV:SCHEMAV_CVC_ELT_1: Element 'Authentication': No matching global
> declaration available for the validation root.

I'm not so firm with libxml2's XML Schema implementation, not sure what that
means exactly. Is it the only error you get in the log?

> The same code given diffrent files works fine.  Does anyone have any
> ideas why I am getting this message?

You can check if "xmllint" (which is the command line tool that comes with
libxml2) produces the same error. It is actually unlikely that this is an lxml
problem, so this would tell you if libxml2 really thinks that your file is
invalid. In that case, you can ask on the libxml2 mailing list instead.

Maybe you can also check with a different tool, that might give you more hints
on what is wrong here.

Stefan
jholg | 8 Nov 09:19
Picon
Picon

Re: XSD Validation: No matching global declaration.

Hi,

> I have a XML Schema that looks like this:
>  
> <schema 
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:sif="http://www.sifinfo.org/infrastructure/1.x"
> targetNamespace="http://www.sifinfo.org/infrastructure/1.x">
>  
>  <import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="http://www.w3.org/2001/xml.xsd"/> 
>  
> ...
>  
>  <element name="Authentication">
>   <complexType>

> ...
>  
> </schema>
>  
> I am trying to validate this data:
>  
> <?xml version="1.0"?>
> <Authentication xmlns:ns3="http://www.w3.org/2001/XMLSchema"
> ns3:RefId="27D1CAEA85C2BAA647A01B551D21E1EB"
> ns3:SifRefId="211242238C60A55E25B2B86BB337C244"
> ns3:SifRefIdType="EmployeePersonal">

Shouldn't <Authentication/> be from the namespace "http://www.sifinfo.org/infrastructure/1.x"
in the instance document?

How do other instance documents that validate fine differ?

Holger
--

-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
John Lovell | 8 Nov 18:22

Re: XSD Validation: No matching global declaration.

>John Lovell wrote:
>> I don't know if my schema is invalid or if this represents a bug in 
>> lxml or libxml2.
>> The error log shows the following error:
>>  
>>
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml:2:ERROR
>> :S
>> CHEMASV:SCHEMAV_CVC_ELT_1: Element 'Authentication': No matching 
>> global declaration available for the validation root.

>I'm not so firm with libxml2's XML Schema implementation, not sure what

>that means exactly. Is it the only error you get in the log?

I get just one similar error in the log for every file I try to validate
with this schema.  Only the elements name changes.

>> The same code given diffrent files works fine.  Does anyone have any 
>> ideas why I am getting this message?

>You can check if "xmllint" (which is the command line tool that comes
with
>libxml2) produces the same error. It is actually unlikely that this is
an 
>lxml problem, so this would tell you if libxml2 really thinks that your

>file is invalid. In that case, you can ask on the libxml2 mailing list 
>instead.

Okay here we go...

jlovell <at> esd189-10545:~/SIF Toolkit/Data Generator$ xmllint --schema
combined.txt
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml
<?xml version="1.0"?>
<Authentication xmlns:ns3="http://www.w3.org/2001/XMLSchema"
ns3:RefId="27D1CAEA85C2BAA647A01B551D21E1EB"
ns3:SifRefId="211242238C60A55E25B2B86BB337C244"
ns3:SifRefIdType="EmployeePersonal">
  <AuthenticationInfo>
    <System xmlns:ns0="http://www.w3.org/2001/XMLSchema"
ns0:Type="Application">&amp;amp;1&amp;lt;tNk44}F2</System>
    <Username>;pl}ee&amp;apos;-</Username>
    <DistinguishedName>mlZm <at> JD</DistinguishedName>
    <Password xmlns:ns1="http://www.w3.org/2001/XMLSchema"
ns1:Algorithm="MD5" ns1:KeyName="(v4kSY.">l1uqg!</Password>
  </AuthenticationInfo>
  <SIF_ExtendedElements>
    <SIF_ExtendedElement xmlns:ns2="http://www.w3.org/2001/XMLSchema"
ns2:Name="%~T=">ZE72n/l</SIF_ExtendedElement>
  </SIF_ExtendedElements>
</Authentication>
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml:2:
element Authentication: Schemas validity error : Element
'Authentication': No matching global declaration available for the
validation root.
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml fails to
validate

You are right it isn't an lxml problem!  Sorry, but I had to start
somewhere.

>Maybe you can also check with a different tool, that might give you
more
>hints on what is wrong here.

Good idea here is the output from: http://www.xmlme.com/Validator.aspx

Validation Results:
Schema Error: System.Xml.Schema.XmlSchemaException: The targetNamespace
parameter '' should be the same value as the targetNamespace
'http://www.sifinfo.org/infrastructure/1.x' of the schema. at
System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException
e, XmlSeverityType severity) at
System.Xml.Schema.SchemaCollectionPreprocessor.Preprocess(XmlSchema
schema, String targetNamespace, Compositor compositor) at
System.Xml.Schema.SchemaCollectionPreprocessor.Execute(XmlSchema schema,
String targetNamespace, Boolean loadExternals, XmlSchemaCollection xsc)
at System.Xml.Schema.XmlSchema.CompileSchema(XmlSchemaCollection xsc,
XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEventHandler validationEventHandler, XmlNameTable nameTable,
Boolean CompileContentModel) at
System.Xml.Schema.XmlSchemaCollection.Add(String ns, SchemaInfo
schemaInfo, XmlSchema schema, Boolean compile, XmlResolver resolver) at
System.Xml.Schema.XmlSchemaCollection.Add(String ns, XmlReader reader,
XmlResolver resolver) at
System.Xml.Schema.XmlSchemaCollection.Add(String ns, XmlReader reader)
at Validator.Button1_Click(Object sender, EventArgs e)

Okay, so it is me.  At this point, which mailing list should I be
bothering?  If you know how I can set the targetNamespace of my document
to match my schema, please email me but consider carefully if it is
appropriate to copy this list.

Thanks for all your help,

John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221

www.esd189.org
Together We Can ...
John Lovell | 8 Nov 18:29

Re: XSD Validation: No matching global declaration.

>Hi,

>> I have a XML Schema that looks like this:
>>  
>> <schema
>> xmlns="http://www.w3.org/2001/XMLSchema"
>> xmlns:sif="http://www.sifinfo.org/infrastructure/1.x"
>> targetNamespace="http://www.sifinfo.org/infrastructure/1.x">
>>  
>>  <import namespace="http://www.w3.org/XML/1998/namespace"
>> schemaLocation="http://www.w3.org/2001/xml.xsd"/>
>>  
>> ...
>>  
>>  <element name="Authentication">
>>   <complexType>

>> ...
>>  
>> </schema>
>>  
>> I am trying to validate this data:
>>  
>> <?xml version="1.0"?>
>> <Authentication xmlns:ns3="http://www.w3.org/2001/XMLSchema"
>> ns3:RefId="27D1CAEA85C2BAA647A01B551D21E1EB"
>> ns3:SifRefId="211242238C60A55E25B2B86BB337C244"
>> ns3:SifRefIdType="EmployeePersonal">

>Shouldn't <Authentication/> be from the namespace
"http://www.sifinfo.org/infrastructure/1.x"
>in the instance document?

You are probably right (see my last post).  However, I have been unable
to figure out how to do that.  I just received the O'Reilly XML Schema
book so that should change.  Although, if you would like to clue me in,
that would be great.

>How do other instance documents that validate fine differ?

Drastically, one is the very simple PO example while the schema I'm
working with is about a half a megabyte.

John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221

www.esd189.org
Together We Can ...
John Lovell | 8 Nov 19:23

Re: XSD Validation: No matching global declaration.

Thanks to Holger and Stefan:

Holger was right on, my problem was with my instance document not the
schema.

For anyone this might help, here are my new results:

jlovell <at> esd189-10545:~/SIF Toolkit/Data Generator$ xmllint --schema
combined.txt
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml
<?xml version="1.0"?>
<Authentication xmlns="http://www.sifinfo.org/infrastructure/1.x"
RefId="27D1CAEA85C2BAA647A01B551D21E1EB"
SifRefId="211242238C60A55E25B2B86BB337C244"
SifRefIdType="EmployeePersonal">
  <AuthenticationInfo>
    <System Type="Application">&amp;amp;1&amp;lt;tNk44}F2</System>
    <Username>;pl}ee&amp;apos;-</Username>
    <DistinguishedName>mlZm <at> JD</DistinguishedName>
    <Password Algorithm="MD5" KeyName="(v4kSY.">l1uqg!</Password>
  </AuthenticationInfo>
  <SIF_ExtendedElements>
    <SIF_ExtendedElement Name="%~T=">ZE72n/l</SIF_ExtendedElement>
  </SIF_ExtendedElements>
</Authentication>
../1.5r1/XSD/Infrastructure/Authentication__Authentication.xml validates

Thanks,

John W. Lovell
Web Applications Engineer
Northwest Educational Service District
1601 R Avenue
Anacortes, WA 98221

www.esd189.org
Together We Can ...
jholg | 13 Nov 14:28
Picon
Picon

2.0 release plan, any news?

Hi,

any plans on releasing another 2.0 alpha-cycle, or even going into Beta phase?
Just asking, as I'm about to package an lxml-based app by the end of week. I've no real issues with using an
alpha-snapshot as this runs smoothly, but of course would still prefer to ship an official release.

Cheers,
Holger
--

-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail

Gmane