Robert Dailey | 1 Aug 23:02
Picon

Re: lxml 1.3.3 released

Thanks a ton Silva!

On 7/31/07, Sidnei da Silva <sidnei <at> enfoldsystems.com> wrote:
Hey there,

Sorry for the delay, I was taking a short vacation in LA, just arrived
in Houston now.

I've built 1.3.3 for Python 2.4 and 2.5 and uploaded them to the cheeseshop.

--
Sidnei da Silva
Enfold Systems                http://enfoldsystems.com
Fax +1 832 201 8856     Office +1 713 942 2377 Ext 214

_______________________________________________
lxml-dev mailing list
lxml-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
jholg | 2 Aug 11:33
Picon
Picon

schema typifier for objectify

Hi,
I'm interested in having a "schema typifier" for lxml.objectify that can
enrich an instance document with type information taken from an XML Schema (xsi:type and/or py:pytype).
Similar to the annotate()/pyannotate() stuff, but making use of the schema type definitions.

I'm wondering how one realized such thing best: Is there a possibility to make use of the lxml/libxml2
validation capabilities, i.e. to somehow hook this into the validation proceedings?

Any hints welcome,
Holger

--

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
Stefan Behnel | 2 Aug 13:52
Picon
Favicon
Gravatar

Re: [xml] Catching error messages in schematron

Hi Daniel,

Daniel Veillard wrote:
> On Thu, Jul 19, 2007 at 08:03:24PM +0200, Stefan Behnel wrote:
>> currently (as of libxml2 2.6.29), the schematron implementation writes
>> validation error messages to stderr with a plain fprintf in
>> xmlSchematronReportOutput (happily annotated with a "TODO").
>>
>> However, to make schematron usable in lxml, I need a way to propagate these
>> errors to the Python level. I would therefore like to see them passed into
>> __xmlRaiseError().
> 
>   The schematron code is really not complete, that sure could be fixed
> but a lot more may be needed. I asked for a definitive set of test for
> the ISO version and never got an answer, so I got discouraged and dropped
> working on it at the time. Of course now I have far less time for libxml2

Ah, that's too bad. Can you comment on how complete you consider the current
Schematron implementation?

Stefan
Daniel Veillard | 2 Aug 14:38
Picon
Favicon
Gravatar

Re: Catching error messages in schematron

On Thu, Aug 02, 2007 at 01:52:05PM +0200, Stefan Behnel wrote:
> Hi Daniel,
> 
> Daniel Veillard wrote:
> > On Thu, Jul 19, 2007 at 08:03:24PM +0200, Stefan Behnel wrote:
> >> currently (as of libxml2 2.6.29), the schematron implementation writes
> >> validation error messages to stderr with a plain fprintf in
> >> xmlSchematronReportOutput (happily annotated with a "TODO").
> >>
> >> However, to make schematron usable in lxml, I need a way to propagate these
> >> errors to the Python level. I would therefore like to see them passed into
> >> __xmlRaiseError().
> > 
> >   The schematron code is really not complete, that sure could be fixed
> > but a lot more may be needed. I asked for a definitive set of test for
> > the ISO version and never got an answer, so I got discouraged and dropped
> > working on it at the time. Of course now I have far less time for libxml2
> 
> Ah, that's too bad. Can you comment on how complete you consider the current
> Schematron implementation?

  I would like to be able to answer. But 1/ first I don't fully remember
2/ I added support only for XPath1 tests, and the last version I saw
had support for XSLT1/2, I don't know how much is required to be
conformant, and if XSLT is needed, then the schematron support can't be
implemented within libxml2 (since it would depend on libxslt).
Basically I implemented based on a public spec, then it went to ISO
and now I don't have a test suite and it seems the final version 
doesn't look 100% like what I used for the implementation 
   One think missing in the implementation is include support, that's
for sure.

Daniel

--

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard <at> redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
Mike Meyer | 3 Aug 16:55

easy_install of 1.3.3 not working

Hi,

I'm trying to install lxml-1.3.3 using easy-install, and it isn't so
easy. In particular (typescript edited for brevity):

Script started on Fri 03 Aug 2007 10:38:17 AM EDT
mwm$ sudo easy_install --verbose lxml==1.3.3
Searching for lxml==1.3.3
[...]
Best match: lxml 1.3.3
Downloading http://codespeak.net/lxml/lxml-1.3.3.tgz
Processing lxml-1.3.3.tgz
Unpacking lxml-1.3.3// to /tmp/easy_install-d0p9oh/lxml-1.3.3/
[...]
copying src/lxml/builder.py -> build/lib.linux-x86_64-2.5/lxml
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-x86_64-2.5
creating build/temp.linux-x86_64-2.5/src
creating build/temp.linux-x86_64-2.5/src/lxml
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC
-I/usr/include/libxml2 -I/usr/local/include/python2.5 -c src/lxml/etree.c -o
build/temp.linux-x86_64-2.5/src/lxml/etree.o -w
gcc -pthread -shared build/temp.linux-x86_64-2.5/src/lxml/etree.o -L/usr/lib64 -L/usr/local/lib
-lxslt -lexslt -lxml2 -lz -lm -lpython2.5 -o build/lib.linux-x86_64-2.5/lxml/etree.so
/usr/bin/ld: /usr/lib64/libxslt.a(xslt.o): relocation R_X86_64_32 against `a local symbol' can not
be used when making a shared object; recompile with -fPIC
/usr/lib64/libxslt.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1
mwm$ exit
Script done on Fri 03 Aug 2007 10:39:03 AM EDT

Checking the mail list archives turns up building python
--enable-shared, and I did that, and nothing changed. The problem
appears to be with libxslt, not python in any case.

Anyone got any clues as to what to help with this?

       thanks,
       <mike
--

-- 
Mike Meyer <mwm <at> mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
Stefan Behnel | 3 Aug 17:46
Picon
Favicon
Gravatar

Re: easy_install of 1.3.3 not working


Mike Meyer wrote:
> I'm trying to install lxml-1.3.3 using easy-install, and it isn't so
> easy. In particular (typescript edited for brevity):
> 
> /usr/bin/ld: /usr/lib64/libxslt.a(xslt.o): relocation R_X86_64_32 against `a local symbol' can not
be used when making a shared object; recompile with -fPIC

You need to provide (export) the CFLAGS that apply to your platform,
especially the -fPIC option is required on x86_64.

Stefan
Greg Willden | 8 Aug 21:30
Picon

Round Trip w/ Processing Instructions (Newbie)

Hello all,
I love the etree stuff and I'm excited about the API additions that this team is adding to make it better.  Thanks for all your work.  That said I'm really new to ElementTree.

I am using lxml.etree version 1.3.3 on both Python 2.4.3 and 2.5.1.

I have a question about processing instructions and round trip file processing.
Let's say I have a file 'test.xml' containing the following

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project SYSTEM "test.dtd">
<project><a><b/></a></project>

Then I run these commands

t1=etree.parse('test.xml')
t1.write('testout.xml ', xml_declaration=True)

testout.xml looks like this:
<?xml version='1.0' encoding='ASCII'?>
<project><a><b/></a></project>

I see that t1.docinfo.doctype contains:
<!DOCTYPE project SYSTEM "test.dtd">

So why isn't the PI written to the file?

I am parsing/modifying a file for consumption by another program that refuses to load the file without the PI.
Thanks
Greg

--
Linux.  Because rebooting is for adding hardware.

_______________________________________________
lxml-dev mailing list
lxml-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
Stefan Behnel | 9 Aug 09:37
Picon
Favicon
Gravatar

Re: Round Trip w/ Processing Instructions (Newbie)

Hi Greg,

Greg Willden wrote:
> I love the etree stuff and I'm excited about the API additions that this
> team is adding to make it better.  Thanks for all your work.

:)

> I have a question about processing instructions and round trip file
> processing.
> Let's say I have a file 'test.xml' containing the following
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE project SYSTEM "test.dtd">
> <project><a><b/></a></project>
> 
> Then I run these commands
> 
> t1=etree.parse('test.xml')
> t1.write('testout.xml ', xml_declaration=True)
> 
> testout.xml looks like this:
> <?xml version='1.0' encoding='ASCII'?>
> <project><a><b/></a></project>
> 
> I see that t1.docinfo.doctype contains:
> <!DOCTYPE project SYSTEM "test.dtd">
> 
> So why isn't the PI written to the file?
> 
> I am parsing/modifying a file for consumption by another program that
> refuses to load the file without the PI.

Hmm, the problem here is that libxml2 lacks a good backwards compatible way of
serialising documents including things like processing instructions, internal
subsets (DTDs) and doctype declarations (which you have here, it's not a PI).

I'll look into it (once again). IIRC, we serialise PIs by now, but not
internal subsets and doctypes. We should do that when serialising root nodes
(especially ElementTree objects).

Stefan
Greg Willden | 9 Aug 15:37
Picon

Fwd: Round Trip w/ Processing Instructions (Newbie)

It looks like this message didn't go to the list.

---------- Forwarded message ----------
Hi Stefan,

On 8/9/07, Stefan Behnel <stefan_ml <at> behnel.de> wrote:
> I see that t1.docinfo.doctype contains:
> <!DOCTYPE project SYSTEM "test.dtd">
>
> So why isn't the PI written to the file?

Hmm, the problem here is that libxml2 lacks a good backwards compatible way of
serialising documents including things like processing instructions, internal
subsets (DTDs) and doctype declarations (which you have here, it's not a PI).

I'll look into it (once again). IIRC, we serialise PIs by now, but not
internal subsets and doctypes. We should do that when serialising root nodes
(especially ElementTree objects).


Sorry I've got my terminology mixed up.  Obviously I'm not an XML expert.  Just enough to be dangerous ;-)

Thanks for looking into it.  I searched the mailing list to see if this stuff had come up before and I had seen a lot of similar questions so I'm sorry if it's a FAQ or something.


You mention serializing root nodes.  That brings up another question I had along these lines.

Given the same XML file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project SYSTEM "test.dtd">
<project><a><b/></a></project>

If I do an etree.parse('test.xml') I get an ElementTree object but If I were to have that same data as a string and call etree.XML() or etree.fromstring() then all I get is an Element.  That seems really odd to me.  If this question has been discussed (I'm guessing it has), I'd be happy with an answer like "take a look at this thread for the discussion".

I guess it's probably more of an ElementTree API question/confusion than a problem with lxml.etree though.

Thanks again for your work.
Greg
--
Linux.  Because rebooting is for adding hardware.
_______________________________________________
lxml-dev mailing list
lxml-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev
Stefan Behnel | 11 Aug 19:08
Picon
Favicon
Gravatar

Re: schema typifier for objectify


jholg <at> gmx.de wrote:
> I'm interested in having a "schema typifier" for lxml.objectify that can 
> enrich an instance document with type information taken from an XML Schema
> (xsi:type and/or py:pytype). Similar to the annotate()/pyannotate() stuff,
> but making use of the schema type definitions.
> 
> I'm wondering how one realized such thing best: Is there a possibility to
> make use of the lxml/libxml2 validation capabilities, i.e. to somehow hook
> this into the validation proceedings?

Hmm, there was a similar question on the libxml2 mailing list recently about
creating a valid document from a schema. You might take a look there.

http://mail.gnome.org/archives/xml/2007-July/msg00073.html
http://mail.gnome.org/archives/xml/2007-August/msg00056.html

Stefan

Gmane