From timuckun at gmail.com Mon Dec 1 16:17:44 2008
From: timuckun at gmail.com (tim)
Date: Mon, 1 Dec 2008 13:17:44 -0800 (PST)
Subject: [libxml-devel] Trying to parse a soap envelope.
Message-ID: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
I have the following soap envelope.
<ResultExDataset xmlns="http://
www.ezitracker.net/eziTrackerData/ResultExDataset.xsd">
<ResultSummary>
</ResultSummary>
</ResultExDataset><SchedulesDataset xmlns="http://
www.ezitracker.net/eziTrackerData/SchedulesDataset.xsd" />
GetLatestSchedulesExResult>
I can't for the life of me get to any of the nodes that I want in this
document. I tried to follow the documentation and wrote the following
doc=get_xml_from_file(filename)
root=doc.root
faults = root.find_first( "//soap:Fault")
if faults != nil
puts "SOAP FAULT: "
p root.find("/soap:Envelope/soap:Body/soap:Fault/
faultstring").first.first
#this works!
else
puts "SUCCESS!"#
end
# I am trying to get this node...
#
register_namespace = doc.find('//ns:GetLatestSchedulesExResponse',
'ns:http://www.ezitracker.com/eziTrackerData/')
node = doc.find_first('/soap:Envelope/soap:Body/
ns0:GetLatestSchedulesExResponse')
this gives the error
Error: Undefined namespace prefix at :0.
xmlXPathEval: evaluation failed
/usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml/document.rb:
55:in `find': Error: Undefined namespace prefix at :0.
(LibXML::XML::Error)
from /usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml/
document.rb:55:in `find'
from /usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml/
document.rb:62:in `find_first'
from /home/tim/junk/soap_test_xml.rb:165
I have tried all kinds of variations but I can't find anything that
works.
Where have I gone wrong?
From cfis at savagexi.com Mon Dec 1 17:05:50 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 01 Dec 2008 15:05:50 -0700
Subject: [libxml-devel] Trying to parse a soap envelope.
In-Reply-To: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
References: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
Message-ID: <49345FBE.9090305@savagexi.com>
Hi Tim,
The easiest way is like this:
data = <<-EOS
<>
EOS
doc = XML::Document.string(data)
nodes = doc.find('//ez:GetLatestSchedulesExResponse',
'ez' => 'http://www.ezitracker.com/eziTrackerData/')
puts nodes.length
nodes.each do |node|
puts node
end
Since GetLatestSchedulesExResponse' namespace doesn't have a numer
(since its the default namespace), you have tell libxml what to call it.
You can also register the namespace with libxml, but the above
approach is probably easiest.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From timuckun at gmail.com Mon Dec 1 17:59:44 2008
From: timuckun at gmail.com (tim)
Date: Mon, 1 Dec 2008 14:59:44 -0800 (PST)
Subject: [libxml-devel] Trying to parse a soap envelope.
In-Reply-To: <49345FBE.9090305@savagexi.com>
References: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
<49345FBE.9090305@savagexi.com>
Message-ID:
>
> Since GetLatestSchedulesExResponse' namespace doesn't have a numer
> (since its the default namespace), you have tell libxml what to call it.
> ? You can also register the namespace with libxml, but the above
> approach is probably easiest.
>
Hi Charlie. I tried it but it doesn't work. Here is an irb session
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'libxml'
=> true
irb(main):003:0> doc = LibXML::XML::Document.file
("latest_schedule.xml")
=>
<ResultExDataset xmlns="http://
www.ezitracker.net/eziTrackerData/ResultExDataset.xsd">
<ResultSummary>
<result>OK</result>
<lasterrtype>None</lasterrtype>
<lasterrtypevalue>0</lasterrtypevalue>
<errordesc />
<totalrows>0</totalrows>
<morerowsavailable>False</morerowsavailable>
</ResultSummary>
</ResultExDataset><SchedulesDataset xmlns="http://
www.ezitracker.net/eziTrackerData/SchedulesDataset.xsd" />
GetLatestSchedulesExResult>
irb(main):004:0> nodes = doc.find('//ez:GetLatestSchedulesExResponse',
'ez' => 'http://www.ezitracker.com/eziTrackerData/')
=> #
irb(main):005:0> nodes.debug
Object is a Node Set :
Set contains 1 nodes:
1 ELEMENT GetLatestSchedulesExResponse
default namespace href=http://www.ezitracker.com/eziTrackerData...
=> nil
As you can see it gives one node which is null.
I tried it in Hpricot like this at it worked.
doc = Hpricot::XML(xml)
p (doc/'GetLatestSchedulesExResponse').first.innerHTML
Obviously it's a namespace issue and hpricot doesn't care so much
about the namespace.
From cfis at savagexi.com Mon Dec 1 19:45:28 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 01 Dec 2008 17:45:28 -0700
Subject: [libxml-devel] Trying to parse a soap envelope.
In-Reply-To:
References: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com> <49345FBE.9090305@savagexi.com>
Message-ID: <49348528.6060603@savagexi.com>
Hi Tim,
> As you can see it gives one node which is null.
Hmm, it works as expected here. What if you do:
puts nodes.first (or nodes.first.to_s or nodes.first.name)
Instead of nodes.debug (I never use that method since it doesn't work on
Windows).
Does the node have content?
If not, then it looks like you've found a bug. So the usual questions.
What version of libxml-ruby, libxml, what OS, etc?
Charlie
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From noreply at rubyforge.org Wed Dec 3 12:54:26 2008
From: noreply at rubyforge.org (noreply at rubyforge.org)
Date: Wed, 3 Dec 2008 12:54:26 -0500 (EST)
Subject: [libxml-devel] [ libxml-Bugs-23094 ] Small typo in XML::Error docs
Message-ID: <20081203175426.7DA4316780DC@rubyforge.org>
Bugs item #23094, was opened at 2008-12-03 19:54
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=23094&group_id=494
Category: General
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Art?ras ?lajus (arturaz)
Assigned to: Nobody (None)
Summary: Small typo in XML::Error docs
Initial Comment:
http://libxml.rubyforge.org/rdoc/classes/LibXML/XML/Error.html
To disable this output you can install the quiet handler:
XML::Error.set_handler(&XML::Error::QUITE_HANDLER)
I believe it should be XML::Error::QUIET_HANDLER
:)
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=23094&group_id=494
From timuckun at gmail.com Thu Dec 4 00:20:35 2008
From: timuckun at gmail.com (Tim Uckun)
Date: Thu, 4 Dec 2008 18:20:35 +1300
Subject: [libxml-devel] Trying to parse a soap envelope.
In-Reply-To: <49348528.6060603@savagexi.com>
References: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
<49345FBE.9090305@savagexi.com>
<49348528.6060603@savagexi.com>
Message-ID: <855e4dcf0812032120m1076fc2cwee67dfa19df3aab2@mail.gmail.com>
>
> If not, then it looks like you've found a bug. So the usual questions.
> What version of libxml-ruby, libxml, what OS, etc?
>
I finally got it going. Here were the issues I had to deal with, I
hope this helps somebody.
find_first returns a node object and find returns a xpath object. They
are not the same (obviously)
xpath.count returns weird numbers. I still don't understand what it's counting.
when you get a node and iterate over it the first node is sometimes
blank. It's better to use each_element.
Also installing the gem gives strange errors when trying to build docs
and ri but the binary seems to be installed OK.
Thanks for your help. I got it going enough to parse my soap envelope.
From felipe.contreras at gmail.com Thu Dec 4 18:04:15 2008
From: felipe.contreras at gmail.com (Felipe Contreras)
Date: Fri, 5 Dec 2008 01:04:15 +0200
Subject: [libxml-devel] [PATCH] Support for Ruby 1.9
In-Reply-To: <94a0d4530811270313n28a4da5che849f7627dc7366f@mail.gmail.com>
References: <94a0d4530811220444v6986e2c2q33693228f24f6977@mail.gmail.com>
<492E5FC9.300@savagexi.com>
<94a0d4530811270313n28a4da5che849f7627dc7366f@mail.gmail.com>
Message-ID: <94a0d4530812041504v49d84706nb12428172db384bb@mail.gmail.com>
On Thu, Nov 27, 2008 at 1:13 PM, Felipe Contreras
wrote:
> On Thu, Nov 27, 2008 at 10:52 AM, Charlie Savage wrote:
>> Hi Felipe,
>>
>>> Basically $SUBJECT. I tested this with Ruby 1.9.1-preview1.
>>
>> Applied except this part:
>>
>> - st_foreach(RHASH(nslist)->tbl, iterate_ns_hash, self);
>> + st_foreach(RHASH_TBL(nslist), iterate_ns_hash, self);
>>
>> RHASH_TBL doesn't exist in Ruby 1.8.6 as far as I can see.
>
> Right, I wonder how I got it to compile... anyway:
>
> #ifdef RHASH_TBL
> st_foreach(RHASH_TBL(nslist), iterate_ns_hash, self);
> #else
> st_foreach(RHASH(nslist)->tbl, iterate_ns_hash, self);
> #endif
>
>> ps - next time better to use RubyForge to post the patch so it doesn't get
>> lost
>
> Right, I tried to do that first but I got the RubyForge account
> several days after I requested it.
Ok, I've put it in the trac.
Can you apply it now?
http://rubyforge.org/tracker/index.php?func=detail&aid=23111&group_id=494&atid=1973
--
Felipe Contreras
From cfis at savagexi.com Thu Dec 4 18:46:58 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Thu, 04 Dec 2008 16:46:58 -0700
Subject: [libxml-devel] [PATCH] Support for Ruby 1.9
In-Reply-To: <94a0d4530812041504v49d84706nb12428172db384bb@mail.gmail.com>
References: <94a0d4530811220444v6986e2c2q33693228f24f6977@mail.gmail.com>
<492E5FC9.300@savagexi.com>
<94a0d4530811270313n28a4da5che849f7627dc7366f@mail.gmail.com>
<94a0d4530812041504v49d84706nb12428172db384bb@mail.gmail.com>
Message-ID: <49386BF2.3020400@savagexi.com>
Hi Felipe,
> Ok, I've put it in the trac.
>
> Can you apply it now?
> http://rubyforge.org/tracker/index.php?func=detail&aid=23111&group_id=494&atid=1973
Will do. Sorry, I had forgotten about this...
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From felipe.contreras at gmail.com Thu Dec 4 18:48:23 2008
From: felipe.contreras at gmail.com (Felipe Contreras)
Date: Fri, 5 Dec 2008 01:48:23 +0200
Subject: [libxml-devel] [PATCH] Support for Ruby 1.9
In-Reply-To: <49386BF2.3020400@savagexi.com>
References: <94a0d4530811220444v6986e2c2q33693228f24f6977@mail.gmail.com>
<492E5FC9.300@savagexi.com>
<94a0d4530811270313n28a4da5che849f7627dc7366f@mail.gmail.com>
<94a0d4530812041504v49d84706nb12428172db384bb@mail.gmail.com>
<49386BF2.3020400@savagexi.com>
Message-ID: <94a0d4530812041548sd60b6f1wc1ef0cdf17976463@mail.gmail.com>
On Fri, Dec 5, 2008 at 1:46 AM, Charlie Savage wrote:
> Hi Felipe,
>
>> Ok, I've put it in the trac.
>>
>> Can you apply it now?
>>
>> http://rubyforge.org/tracker/index.php?func=detail&aid=23111&group_id=494&atid=1973
>
> Will do. Sorry, I had forgotten about this...
Great, thanks :)
--
Felipe Contreras
From cfis at savagexi.com Mon Dec 8 02:09:26 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 08 Dec 2008 00:09:26 -0700
Subject: [libxml-devel] Heading towards a 1.0 release - testing requested
Message-ID: <493CC826.5030209@savagexi.com>
Hi everyone,
Over the last month there I've put out a series of libxml 0.9.x releases
with the aim of reaching 1.0 by the end of the year.
These releases have made a number of improvements to libxml-ruby, including:
* Fix all known segmentation faults
* Much better documentation
* Much better support for encodings
* Cleaned up namespace support
* Closing off almost all bug reports, patches and features requests
* Ruby 1.9 support
* Heavily refactored code base
I think the bindings are now in great shape and worthy of a 1.0
designation. But before we get there, can everyone upgrade to the
latest 0.9.6 release and report back to the Ruby forge tracker
(http://rubyforge.org/tracker/?group_id=494) any issues they run into?
And thanks to everyone for reporting issues over the last month.
Charlie
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From jens.wille at uni-koeln.de Mon Dec 8 05:36:33 2008
From: jens.wille at uni-koeln.de (Jens Wille)
Date: Mon, 08 Dec 2008 11:36:33 +0100
Subject: [libxml-devel] Heading towards a 1.0 release - testing requested
In-Reply-To: <493CC826.5030209@savagexi.com>
References: <493CC826.5030209@savagexi.com>
Message-ID: <493CF8B1.50302@uni-koeln.de>
hey charlie!
Charlie Savage [2008-12-08 08:09]:
> Over the last month there I've put out a series of libxml 0.9.x
> releases with the aim of reaching 1.0 by the end of the year.
cool, i'm really looking forward to that. no problems here so far.
upgrade went smoothly, all tests passed. thanks!
cheers
jens
From paul at aps.org Mon Dec 8 11:55:35 2008
From: paul at aps.org (Paul Dlug)
Date: Mon, 8 Dec 2008 11:55:35 -0500
Subject: [libxml-devel] Heading towards a 1.0 release - testing requested
In-Reply-To: <493CC826.5030209@savagexi.com>
References: <493CC826.5030209@savagexi.com>
Message-ID: <083656D2-E075-4218-96E6-32BFBD0763D2@aps.org>
On Dec 8, 2008, at 2:09 AM, Charlie Savage wrote:
> Hi everyone,
>
> Over the last month there I've put out a series of libxml 0.9.x
> releases with the aim of reaching 1.0 by the end of the year.
>
> These releases have made a number of improvements to libxml-ruby,
> including:
>
> * Fix all known segmentation faults
> * Much better documentation
> * Much better support for encodings
> * Cleaned up namespace support
> * Closing off almost all bug reports, patches and features requests
> * Ruby 1.9 support
> * Heavily refactored code base
>
> I think the bindings are now in great shape and worthy of a 1.0
> designation. But before we get there, can everyone upgrade to the
> latest 0.9.6 release and report back to the Ruby forge tracker
> (http://rubyforge.org/tracker/?group_id=494) any issues they run into?
>
> And thanks to everyone for reporting issues over the last month.
Charlie,
Thanks for your hard work on this, it's great to see libxml
progressing so quickly. Before 1.0 I think there is one item that
needs a serious overhaul. Right now the default error handler is
VERBOSE_HANDLER which just writes out error messages to STDERR. This
makes it difficult to trap errors since I don't think it's always
clear from the return value of method what type of error was
encountered. I propose using either some type of exception hierarchy
with specific exceptions as appropriate (e.g. WellFormednessError,
DTDValidationError, etc.). If this is not feasible on a short time
scale I think at a minimum the current error handling should be
refactored to stash the current error message in the Error object on
Parser. Methods could then raise exceptions for error (or in the
interim, return nil) and the caller could get the message back.
I'd like to see what your thoughts are on this, I'm happy to provide
the first pass at a patch that implements this behavior. Error
handling right now is a major obstacle for me.
--Paul
From cfis at savagexi.com Mon Dec 8 12:43:51 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 08 Dec 2008 10:43:51 -0700
Subject: [libxml-devel] Trying to parse a soap envelope.
In-Reply-To: <855e4dcf0812032120m1076fc2cwee67dfa19df3aab2@mail.gmail.com>
References: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
<49345FBE.9090305@savagexi.com>
<49348528.6060603@savagexi.com>
<855e4dcf0812032120m1076fc2cwee67dfa19df3aab2@mail.gmail.com>
Message-ID: <493D5CD7.6000309@savagexi.com>
Hi Tim,
> I finally got it going. Here were the issues I had to deal with, I
> hope this helps somebody.
Thanks for posting your experiences.
>
> find_first returns a node object and find returns a xpath object. They
> are not the same (obviously).
Right. I updated the Rdocs to make that a bit more clear.
> xpath.count returns weird numbers. I still don't understand what it's counting.
Could you expand on this. Do you mean xpath.length (there isn't a count
method)? One thing that the docs don't make clear is that the fine
method can return a set of nodes, or it can returns immediate values
like numbers, boolean, string (that's just the way xpath works). Maybe
that is the issue?
> when you get a node and iterate over it the first node is sometimes
> blank. It's better to use each_element.
That sounds like a bug. Do you have a test case by chance?
> Also installing the gem gives strange errors when trying to build docs
> and ri but the binary seems to be installed OK.
Ignore those - its due to limitations in RDoc 1.x. Rdoc 2.x shows no
errors.
> Thanks for your help. I got it going enough to parse my soap envelope.
Sounds good.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Mon Dec 8 13:02:37 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 08 Dec 2008 11:02:37 -0700
Subject: [libxml-devel] Heading towards a 1.0 release - testing requested
In-Reply-To: <083656D2-E075-4218-96E6-32BFBD0763D2@aps.org>
References: <493CC826.5030209@savagexi.com>
<083656D2-E075-4218-96E6-32BFBD0763D2@aps.org>
Message-ID: <493D613D.8050906@savagexi.com>
Hi Paul,
> Before 1.0 I think there is one item that needs a serious
> overhaul. Right now the default error handler is VERBOSE_HANDLER which
> just writes out error messages to STDERR. This makes it difficult to
> trap errors since I don't think it's always clear from the return value
> of method what type of error was encountered.
Ah, thanks for reminding me of that. One of the things I forgot to
mention is that error handling has been refactored a lot. There are a
number of differences in the 0.9.x releases:
* The bindings now use libxml's "structured" error handler functionality
* This allows the use of XML::Error objects which inherit from Ruby's
StandardError.
* These error objects are now passed to error handlers (both the Verbose
and Quiet handlers).
* When something goes wrong, the bindings try to raise instances of
XML::Error.
* The XML::Error object specifies the type of error (Error#code) plus a
bunch of other information.
Having said all that, libxml error handling is still tricky because of
the way it works (this is the way the C library works, not the bindings):
1. Perform some operation, say document.find('some invalid xpath')
2. libxml notes the error, and calls any registered error handlers (for
example the verbose or quit error handlers)
3. It then sets xmlLastError
4. The original method call then returns with, or without, some
indication that an error happened (for example, -1 is passed back)
5. The bindings check for an error return code, and if there is one,
raise an exception:
rxml_raise(xmlLastError);
This sequence works a fair amount of time, but not always.
I propose using either
> some type of exception hierarchy with specific exceptions as appropriate
> (e.g. WellFormednessError, DTDValidationError, etc.).
I don't think its worth it - libxml defines almost 1,000 error codes.
To get at the information, check XML::Error#code and XML::Error#domain
If this is not
> feasible on a short time scale I think at a minimum the current error
> handling should be refactored to stash the current error message in the
> Error object on Parser.
libxml already maintains a global object called xmlLastError, which the
bindings make use.
Methods could then raise exceptions for error
> (or in the interim, return nil) and the caller could get the message back.
Yes, they do now (that was part of the big refactoring). However, I'm
sure there are places in the code I missed that still need to be updated.
> I'd like to see what your thoughts are on this, I'm happy to provide the
> first pass at a patch that implements this behavior. Error handling
> right now is a major obstacle for me.
Sure. I'd say find out what methods are causing you problems, then
update them to raise errors when something goes wrong. You can do that
like this:
rxml_raise(xmlLastError);
Note it won't always work, because xmlLastError is not always set by libxml.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From timuckun at gmail.com Mon Dec 8 15:11:40 2008
From: timuckun at gmail.com (Tim Uckun)
Date: Tue, 9 Dec 2008 09:11:40 +1300
Subject: [libxml-devel] Trying to parse a soap envelope.
In-Reply-To: <493D5CD7.6000309@savagexi.com>
References: <45a10290-d05d-4190-840b-5d24a62e8383@w1g2000prk.googlegroups.com>
<49345FBE.9090305@savagexi.com>
<49348528.6060603@savagexi.com>
<855e4dcf0812032120m1076fc2cwee67dfa19df3aab2@mail.gmail.com>
<493D5CD7.6000309@savagexi.com>
Message-ID: <855e4dcf0812081211tf7c20b0g369f916667480a23@mail.gmail.com>
>
>> xpath.count returns weird numbers. I still don't understand what it's
>> counting.
>
> Could you expand on this. Do you mean xpath.length (there isn't a count
> method)? One thing that the docs don't make clear is that the fine method
> can return a set of nodes, or it can returns immediate values like numbers,
> boolean, string (that's just the way xpath works). Maybe that is the issue?
>
I should not have used count. I meant size. xpath.size does not give
you the number of nodes as far as I can tell. Maybe it's meant to
work that way.
I have also learned that find_first can return a nil which is useful
for testing but find doesn't. Again this is probably all the way
it's supposed to work I was just confused.
>> when you get a node and iterate over it the first node is sometimes
>> blank. It's better to use each_element.
>
> That sounds like a bug. Do you have a test case by chance?
I don't know if I can get at the same XML document that was giving me
problems. If I run into it again I'll file a bug report for sure.
From marek at pld.ttu.ee Mon Dec 8 16:56:44 2008
From: marek at pld.ttu.ee (Marek Mandre)
Date: Mon, 08 Dec 2008 23:56:44 +0200
Subject: [libxml-devel] incorrect source code for Solaris native C
Message-ID: <493D981C.11C26FA4@pld.ttu.ee>
Hey,
libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
lines 139 through 157 need cleaning up for Solaris native C
preprocessor, the relaxed programming attitude with GNU C makes life
hell for cross-compiling and porting.
for preprocessor the macro should stay without '\' and linebreaks
once i modified the source like that it compiled and built nicely.
original compiler errors below:
"sax_parser_callbacks.inc", line 139: warning: invalid white space
character in directive
"sax_parser_callbacks.inc", line 140: syntax error before or at: do
"sax_parser_callbacks.inc", line 140: invalid source character: '\'
"sax_parser_callbacks.inc", line 141: invalid source character: '\'
"sax_parser_callbacks.inc", line 142: invalid source character: '\'
"sax_parser_callbacks.inc", line 143: invalid source character: '\'
"sax_parser_callbacks.inc", line 144: invalid source character: '\'
"sax_parser_callbacks.inc", line 145: invalid source character: '\'
"sax_parser_callbacks.inc", line 146: invalid source character: '\'
"sax_parser_callbacks.inc", line 147: invalid source character: '\'
"sax_parser_callbacks.inc", line 157: invalid source character: '\'
"sax_parser_callbacks.inc", line 159: cannot recover from previous
errors
cc: acomp failed for ruby_xml_sax_parser.c
Marek
--
"Imagination. Use it as a weapon."
-Juno Reactor
From cfis at savagexi.com Mon Dec 8 17:34:48 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 08 Dec 2008 15:34:48 -0700
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To: <493D981C.11C26FA4@pld.ttu.ee>
References: <493D981C.11C26FA4@pld.ttu.ee>
Message-ID: <493DA108.1050404@savagexi.com>
Hi Marek,
> libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
>
> lines 139 through 157 need cleaning up for Solaris native C
> preprocessor, the relaxed programming attitude with GNU C makes life
> hell for cross-compiling and porting.
>
> for preprocessor the macro should stay without '\' and linebreaks
> once i modified the source like that it compiled and built nicely.
Can you submit a patch? I'd be happy to apply it.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Mon Dec 8 19:49:12 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 08 Dec 2008 17:49:12 -0700
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To: <493DB80C.19BE0457@pld.ttu.ee>
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee>
Message-ID: <493DC088.8020001@savagexi.com>
Hi Marek,
> attached is 'diff -u old new' , its ugly hack but it made it work for
> me.
Great. So no \ and new lines. Amazing that's the only one. Will fix.
Charlie
>
> Charlie Savage wrote:
>> Hi Marek,
>>
>>> libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
>>>
>>> lines 139 through 157 need cleaning up for Solaris native C
>>> preprocessor, the relaxed programming attitude with GNU C makes life
>>> hell for cross-compiling and porting.
>>>
>>> for preprocessor the macro should stay without '\' and linebreaks
>>> once i modified the source like that it compiled and built nicely.
>> Can you submit a patch? I'd be happy to apply it.
>>
>> Charlie
>
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From matthias.marschall at gmail.com Thu Dec 11 06:05:18 2008
From: matthias.marschall at gmail.com (Matthias Marschall)
Date: Thu, 11 Dec 2008 03:05:18 -0800 (PST)
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To: <493DC088.8020001@savagexi.com>
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
Message-ID:
Hi Charlie,
I ran into the same problem. Do you have any ETA when the patch will
be released?
In the meantime: I'm struggling to patch it myself and install it.
I tried downloading and patching the tarball but "rake install" (as
described in the install instructions) is not a valid task. Using
"ruby setup.rb" compiles the stuff but "require 'libxml'" complains
that it cannot find the libxml_ruby.so file (but it _is_ there).
It would be great, if you could give me a hint how to proceed. Build
the gem locally? Any other ideas?
Thanks in advance,
Matthias
On 9 Dez., 01:49, Charlie Savage wrote:
> Hi Marek,
>
> ?> attached is 'diff -u old new' , its ugly hack but it made it work for
> ?> me.
>
> Great. ?So no \ and new lines. ?Amazing that's the only one. ?Will fix.
>
> Charlie
>
>
>
>
>
> > Charlie Savage wrote:
> >> Hi Marek,
>
> >>> libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
>
> >>> lines 139 through 157 need cleaning up for Solaris native C
> >>> preprocessor, the relaxed programming attitude with GNU C makes life
> >>> hell for cross-compiling and porting.
>
> >>> for preprocessor the macro should stay without '\' and linebreaks
> >>> once i modified the source like that it compiled and built nicely.
> >> Can you submit a patch? ?I'd be happy to apply it.
>
> >> Charlie
>
> --
> Charlie Savagehttp://cfis.savagexi.com
>
> ?smime.p7s
> 4KAnzeigenHerunterladen
>
> _______________________________________________
> libxml-devel mailing list
> libxml-de... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/libxml-devel
From matthias.marschall at gmail.com Thu Dec 11 07:35:52 2008
From: matthias.marschall at gmail.com (Matthias Marschall)
Date: Thu, 11 Dec 2008 04:35:52 -0800 (PST)
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To: <493DC088.8020001@savagexi.com>
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
Message-ID: <74e2981a-95a1-42c0-a807-2db2b4311b37@p2g2000prf.googlegroups.com>
ok, found a way to installed a patched version. Just for the records:
I had to manually install: SUNWgnu-libiconv (not installed by default
in a zone)
ln -s /usr/gnu/lib/libiconv.so.2 /usr/lib/libiconv.so.2 (needed as /
usr/gnu/lib is not in libary load path)
download and untar the tarball
patch libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
and then run:
# cd libxml-ruby-0.9.6
# pfexec rake
# cd admin/pkg
# pfexec gem install libxml-ruby --no-ri --no-rdoc
Any hints for doing better are appreciated ;-)
Matthias
On 9 Dez., 01:49, Charlie Savage wrote:
> Hi Marek,
>
> ?> attached is 'diff -u old new' , its ugly hack but it made it work for
> ?> me.
>
> Great. ?So no \ and new lines. ?Amazing that's the only one. ?Will fix.
>
> Charlie
>
>
>
>
>
> > Charlie Savage wrote:
> >> Hi Marek,
>
> >>> libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
>
> >>> lines 139 through 157 need cleaning up for Solaris native C
> >>> preprocessor, the relaxed programming attitude with GNU C makes life
> >>> hell for cross-compiling and porting.
>
> >>> for preprocessor the macro should stay without '\' and linebreaks
> >>> once i modified the source like that it compiled and built nicely.
> >> Can you submit a patch? ?I'd be happy to apply it.
>
> >> Charlie
>
> --
> Charlie Savagehttp://cfis.savagexi.com
>
> ?smime.p7s
> 4KAnzeigenHerunterladen
>
> _______________________________________________
> libxml-devel mailing list
> libxml-de... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/libxml-devel
From cfis at savagexi.com Thu Dec 11 14:29:09 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Thu, 11 Dec 2008 12:29:09 -0700
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To:
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
Message-ID: <49416A05.4080309@savagexi.com>
Matthias Marschall wrote:
> Hi Charlie,
>
> I ran into the same problem. Do you have any ETA when the patch will
> be released?
I was planning on doing this weekend - have a couple things need to
finish up for tomorrow work wise.
> In the meantime: I'm struggling to patch it myself and install it.
>
> I tried downloading and patching the tarball but "rake install" (as
> described in the install instructions) is not a valid task. Using
> "ruby setup.rb" compiles the stuff but "require 'libxml'" complains
> that it cannot find the libxml_ruby.so file (but it _is_ there).
Ah, that's interesting. Will have to take a look.
>
> It would be great, if you could give me a hint how to proceed. Build
> the gem locally? Any other ideas?
Yes, that would work.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Thu Dec 11 14:30:23 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Thu, 11 Dec 2008 12:30:23 -0700
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To: <74e2981a-95a1-42c0-a807-2db2b4311b37@p2g2000prf.googlegroups.com>
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
<74e2981a-95a1-42c0-a807-2db2b4311b37@p2g2000prf.googlegroups.com>
Message-ID: <49416A4F.8050602@savagexi.com>
Matthias Marschall wrote:
> ok, found a way to installed a patched version. Just for the records:
>
> I had to manually install: SUNWgnu-libiconv (not installed by default
> in a zone)
> ln -s /usr/gnu/lib/libiconv.so.2 /usr/lib/libiconv.so.2 (needed as /
> usr/gnu/lib is not in libary load path)
>
>
> download and untar the tarball
> patch libxml-ruby-0.9.6/ext/libxml/sax_parser_callbacks.inc
>
> and then run:
> # cd libxml-ruby-0.9.6
> # pfexec rake
> # cd admin/pkg
> # pfexec gem install libxml-ruby --no-ri --no-rdoc
That looks about right. In theory you're supposed to do gem install
--local, but it seems to work without that.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From dhelder at mudynamics.com Thu Dec 11 17:27:17 2008
From: dhelder at mudynamics.com (David Helder)
Date: Thu, 11 Dec 2008 14:27:17 -0800
Subject: [libxml-devel] xml2-config?
Message-ID: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
Would it be possible to use xml2-config in extconf.rb? I see there's
a --with-xml2-dir option, but xml2-config already provides LIBS and
CFLAGS values.
Thanks,
David
From noreply at rubyforge.org Thu Dec 11 16:51:45 2008
From: noreply at rubyforge.org (noreply at rubyforge.org)
Date: Thu, 11 Dec 2008 16:51:45 -0500 (EST)
Subject: [libxml-devel] [ libxml-Bugs-23192 ] Stray ext/libxml/libxml.c.rej
in 0.9.6
Message-ID: <20081211215145.5FB9718585A0@rubyforge.org>
Bugs item #23192, was opened at 2008-12-11 13:51
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=23192&group_id=494
Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: David Helder (dhelder)
Assigned to: Nobody (None)
Summary: Stray ext/libxml/libxml.c.rej in 0.9.6
Initial Comment:
This file probably shouldn't be in the tarball.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=23192&group_id=494
From cfis at savagexi.com Thu Dec 11 17:42:43 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Thu, 11 Dec 2008 15:42:43 -0700
Subject: [libxml-devel] xml2-config?
In-Reply-To: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
Message-ID: <49419763.1010506@savagexi.com>
Hi David,
> Would it be possible to use xml2-config in extconf.rb? I see there's a
> --with-xml2-dir option, but xml2-config already provides LIBS and CFLAGS
> values.
That's an interesting idea. Two issues come to mind:
* Finding xml2-config
* Parsing its output
Second should be easy, maybe the first also. And if we don't find it,
we could always fallback to what we do now.
Want to give it a try and put together a patch?
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From dhelder at mudynamics.com Fri Dec 12 13:07:59 2008
From: dhelder at mudynamics.com (David Helder)
Date: Fri, 12 Dec 2008 10:07:59 -0800
Subject: [libxml-devel] xml2-config?
In-Reply-To: <49419763.1010506@savagexi.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
Message-ID: <0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
It should just use the xml2-config that's in the path and the output
just requires a chop:
> xml2-config --cflags
-I/opt/local/include/libxml2
> xml2-config --libs
-L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm
I don't know mkmf that well, but I can take a look if I get some time.
David
On Dec 11, 2008, at 2:42 PM, Charlie Savage wrote:
>> Would it be possible to use xml2-config in extconf.rb? I see
>> there's a --with-xml2-dir option, but xml2-config already provides
>> LIBS and CFLAGS values.
>
> That's an interesting idea. Two issues come to mind:
>
> * Finding xml2-config
> * Parsing its output
>
> Second should be easy, maybe the first also. And if we don't find
> it, we could always fallback to what we do now.
>
> Want to give it a try and put together a patch?
From goodieBoy at gmail.com Fri Dec 12 16:49:38 2008
From: goodieBoy at gmail.com (matt mitchell)
Date: Fri, 12 Dec 2008 13:49:38 -0800 (PST)
Subject: [libxml-devel] get string position of element
Message-ID: <43627c54-41ee-48ef-bcac-77745f89e1d4@w1g2000prm.googlegroups.com>
Hi,
I'm using the ruby libxml and have looked at the api/docs but can't
find an answer to my question. Which is... is it possible to get the
current string position of an element while using the Reader/Parser?
Thanks!
Matt
From cfis at savagexi.com Fri Dec 12 18:51:59 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Fri, 12 Dec 2008 16:51:59 -0700
Subject: [libxml-devel] get string position of element
In-Reply-To: <43627c54-41ee-48ef-bcac-77745f89e1d4@w1g2000prm.googlegroups.com>
References: <43627c54-41ee-48ef-bcac-77745f89e1d4@w1g2000prm.googlegroups.com>
Message-ID: <4942F91F.1030107@savagexi.com>
Hi Matt,
> I'm using the ruby libxml and have looked at the api/docs but can't
> find an answer to my question. Which is... is it possible to get the
> current string position of an element while using the Reader/Parser?
Let's see - I'm not sure I understand the question. Do you mean if you
are parsing some string, say:
my_idmy entry
That you want to know at one character you are at? So say character 10,
thus at the end of id?
If that's it, I'm not sure, I'd have to check (are you familiar with
libxml itself, that's the other place to see).
What's the problem you are trying to solve that requires knowing the
string position - maybe there is a different approach?
Charlie
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Fri Dec 12 19:50:20 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Fri, 12 Dec 2008 17:50:20 -0700
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To:
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
Message-ID: <494306CC.3090809@savagexi.com>
Hi Matthias,
> I ran into the same problem. Do you have any ETA when the patch will
> be released?
Fix is checked in, will be in next release. Thanks for the report.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Fri Dec 12 20:06:20 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Fri, 12 Dec 2008 18:06:20 -0700
Subject: [libxml-devel] xml2-config?
In-Reply-To: <0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
Message-ID: <49430A8C.2060507@savagexi.com>
David Helder wrote:
> It should just use the xml2-config that's in the path and the output
> just requires a chop:
> > xml2-config --cflags
> -I/opt/local/include/libxml2
> > xml2-config --libs
> -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm
>
> I don't know mkmf that well,
That makes two of us.
but I can take a look if I get some time.
Cool - thanks.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Fri Dec 12 20:37:55 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Fri, 12 Dec 2008 18:37:55 -0700
Subject: [libxml-devel] libxml 0.9.7 released
Message-ID: <494311F3.3080103@savagexi.com>
Hi everyone,
I just pushed up a 0.9.7 release.
Biggest change is revamp on the SAX handling and error handling.
More specifically, include:
* Added SAX2 support. SAX handlers now define two new callbacks,
on_start_element_ns and on_end_element_ns methods. These
new callbacks support namespaces, making them superior to the older
callbacks on_start_element and on_end_element methods. The old
callbacks are still supported, but may be deprecated in the
future depending on community feedback.
* Added SAX support for libxml's structured error handling.
That menas sax handlers now define a new callback, on_error,
which takes one parameter, an instance of XML::Error. The older
on_parser_error, on_parser_warning and on_parser_fatal_error
callbacks are no longer suported so you must port your code.
Note that the older callbacks took one string parameter, instead of
an XML::Error object.
* Experimental work-around for libxml error handling bug - see
http://mail.gnome.org/archives/xml/2008-December/msg00014.html
for more information.
* Fix compilation bugs on Solaris.
* Fix Rdoc compilation bug.
Thanks,
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From todd.fisher at gmail.com Fri Dec 12 22:16:04 2008
From: todd.fisher at gmail.com (Todd Fisher)
Date: Fri, 12 Dec 2008 22:16:04 -0500
Subject: [libxml-devel] xml2-config?
In-Reply-To: <49430A8C.2060507@savagexi.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
Message-ID:
find_executable
2008/12/12 Charlie Savage
>
>
> David Helder wrote:
>
>> It should just use the xml2-config that's in the path and the output just
>> requires a chop:
>> > xml2-config --cflags
>> -I/opt/local/include/libxml2
>> > xml2-config --libs
>> -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm
>>
>> I don't know mkmf that well,
>>
>
> That makes two of us.
>
> but I can take a look if I get some time.
>
> Cool - thanks.
>
> Charlie
>
> _______________________________________________
> libxml-devel mailing list
> libxml-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From felipe.contreras at gmail.com Sat Dec 13 04:11:37 2008
From: felipe.contreras at gmail.com (Felipe Contreras)
Date: Sat, 13 Dec 2008 11:11:37 +0200
Subject: [libxml-devel] xml2-config?
In-Reply-To: <49430A8C.2060507@savagexi.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
Message-ID: <94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
2008/12/13 Charlie Savage :
>
>
> David Helder wrote:
>>
>> It should just use the xml2-config that's in the path and the output just
>> requires a chop:
>> > xml2-config --cflags
>> -I/opt/local/include/libxml2
>> > xml2-config --libs
>> -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm
>>
>> I don't know mkmf that well,
>
> That makes two of us.
>
> but I can take a look if I get some time.
>
> Cool - thanks.
It's much easier to use pkg-config.
in extconf.rb:
pkg_config('libxml-2.0')
--
Felipe Contreras
From todd.fisher at gmail.com Sat Dec 13 08:34:07 2008
From: todd.fisher at gmail.com (Todd Fisher)
Date: Sat, 13 Dec 2008 08:34:07 -0500
Subject: [libxml-devel] xml2-config?
In-Reply-To: <94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
<94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
Message-ID:
I think it's best to check for both... something like this would be ideal
if pkg_config('libxml-2.0')
elsif find_executable('xml2-config')
$CFLAGS << " #{`xml2-config --cflags`.strip}"
$LIBS << " #{`xml2-config --libs`.strip}"
elsif !have_library('xml2') or !have_header('libxml/parser.h')
fail "missing dependencies"
end
On Sat, Dec 13, 2008 at 4:11 AM, Felipe Contreras <
felipe.contreras at gmail.com> wrote:
> 2008/12/13 Charlie Savage :
> >
> >
> > David Helder wrote:
> >>
> >> It should just use the xml2-config that's in the path and the output
> just
> >> requires a chop:
> >> > xml2-config --cflags
> >> -I/opt/local/include/libxml2
> >> > xml2-config --libs
> >> -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm
> >>
> >> I don't know mkmf that well,
> >
> > That makes two of us.
> >
> > but I can take a look if I get some time.
> >
> > Cool - thanks.
>
> It's much easier to use pkg-config.
>
> in extconf.rb:
> pkg_config('libxml-2.0')
>
> --
> Felipe Contreras
> _______________________________________________
> libxml-devel mailing list
> libxml-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From felipe.contreras at gmail.com Sat Dec 13 08:46:34 2008
From: felipe.contreras at gmail.com (Felipe Contreras)
Date: Sat, 13 Dec 2008 15:46:34 +0200
Subject: [libxml-devel] xml2-config?
In-Reply-To:
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
<94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
Message-ID: <94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
2008/12/13 Todd Fisher :
> I think it's best to check for both... something like this would be ideal
> if pkg_config('libxml-2.0')
> elsif find_executable('xml2-config')
> $CFLAGS << " #{`xml2-config --cflags`.strip}"
> $LIBS << " #{`xml2-config --libs`.strip}"
> elsif !have_library('xml2') or !have_header('libxml/parser.h')
> fail "missing dependencies"
> end
I don't see why libraries still insist on legacy config scripts since
pretty much everyone uses pkg-config and it makes things so much
easier.
--
Felipe Contreras
From cfis at savagexi.com Sat Dec 13 16:33:34 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Sat, 13 Dec 2008 14:33:34 -0700
Subject: [libxml-devel] xml2-config?
In-Reply-To: <94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com> <49419763.1010506@savagexi.com> <0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com> <49430A8C.2060507@savagexi.com> <94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
<94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
Message-ID: <49442A2E.2010400@savagexi.com>
Felipe Contreras wrote:
> 2008/12/13 Todd Fisher :
>> I think it's best to check for both... something like this would be ideal
>> if pkg_config('libxml-2.0')
>> elsif find_executable('xml2-config')
>> $CFLAGS << " #{`xml2-config --cflags`.strip}"
>> $LIBS << " #{`xml2-config --libs`.strip}"
>> elsif !have_library('xml2') or !have_header('libxml/parser.h')
>> fail "missing dependencies"
>> end
>
> I don't see why libraries still insist on legacy config scripts since
> pretty much everyone uses pkg-config and it makes things so much
> easier.
So, does anyone want to put together a patch? If pkg-config is
universal across Linux/Solaris/BSD and OS X then great. If not, then do
we have to something like the code above?
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Sat Dec 13 17:57:41 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Sat, 13 Dec 2008 15:57:41 -0700
Subject: [libxml-devel] get string position of element
In-Reply-To:
References: <43627c54-41ee-48ef-bcac-77745f89e1d4@w1g2000prm.googlegroups.com>
<4942F91F.1030107@savagexi.com>
Message-ID: <49443DE5.3060803@savagexi.com>
> Hi Charlie,
>
> That's exactly what I mean. Is that possible?
>
> What I'd like to do is, parse an xml file and store each node in a flat
> search index. I want to store the string start/end position with the
> stored item so when the search returns the item, I can load only that
> fragment of xml. Some of the xml files I'm dealing with are like 13 MB.
>
> Does that make sense?
Yup. And you can sort of kind of do it. XML::Reader surfaces line_no
and column_number methods, but that pertain to where the parser is in
the file and not where the elements are - so that won't work. However,
libxml does define XML::Node#line_num. So you can figure out on what
line an element starts.
To do that:
def test_node
XML.default_line_numbers = true
reader = XML::Reader.file(XML_FILE)
while reader.read
puts reader.name
puts reader.node.line_num
end
end
The downsides:
* Reader#node is a new method just added, so you'll need to pull a build
from trunk
* You don't get the column number - I don't see an api for that
unfortunately (if you see one in libxml let me know)
* Node#line_num returns the starting line number when a node ends (not
the line where the node
So this will give you a rough idea of where things are, but not an exact
idea. Is that good enough?
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From cfis at savagexi.com Sat Dec 13 18:14:01 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Sat, 13 Dec 2008 16:14:01 -0700
Subject: [libxml-devel] get string position of element
In-Reply-To: <49443DE5.3060803@savagexi.com>
References: <43627c54-41ee-48ef-bcac-77745f89e1d4@w1g2000prm.googlegroups.com> <4942F91F.1030107@savagexi.com>
<49443DE5.3060803@savagexi.com>
Message-ID: <494441B9.5020009@savagexi.com>
Hey Matt,
Okay, there is a way to do this. libxml defines a global locator object:
/**
* xmlSAXLocator:
*
* A SAX Locator.
*/
struct _xmlSAXLocator {
const xmlChar *(*getPublicId)(void *ctx);
const xmlChar *(*getSystemId)(void *ctx);
int (*getLineNumber)(void *ctx);
int (*getColumnNumber)(void *ctx);
};
There is one per-thread.
So the one problem - the bindings don't currently expose this object.
How are your c skills, want to put together a patch?
Charlie
Charlie Savage wrote:
>> Hi Charlie,
>>
>> That's exactly what I mean. Is that possible?
>>
>> What I'd like to do is, parse an xml file and store each node in a
>> flat search index. I want to store the string start/end position with
>> the stored item so when the search returns the item, I can load only
>> that fragment of xml. Some of the xml files I'm dealing with are like
>> 13 MB.
>>
>> Does that make sense?
>
> Yup. And you can sort of kind of do it. XML::Reader surfaces line_no
> and column_number methods, but that pertain to where the parser is in
> the file and not where the elements are - so that won't work. However,
> libxml does define XML::Node#line_num. So you can figure out on what
> line an element starts.
>
> To do that:
>
> def test_node
> XML.default_line_numbers = true
> reader = XML::Reader.file(XML_FILE)
>
> while reader.read
> puts reader.name
> puts reader.node.line_num
> end
> end
>
> The downsides:
>
> * Reader#node is a new method just added, so you'll need to pull a build
> from trunk
>
> * You don't get the column number - I don't see an api for that
> unfortunately (if you see one in libxml let me know)
>
> * Node#line_num returns the starting line number when a node ends (not
> the line where the node
>
> So this will give you a rough idea of where things are, but not an exact
> idea. Is that good enough?
>
> Charlie
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> libxml-devel mailing list
> libxml-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From dhelder at mudynamics.com Mon Dec 15 14:07:27 2008
From: dhelder at mudynamics.com (David Helder)
Date: Mon, 15 Dec 2008 11:07:27 -0800
Subject: [libxml-devel] xml2-config?
In-Reply-To: <94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
<94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
<94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
Message-ID:
You're right - using pkg-config, not xml2-config, is the BCP. Any
Unix system with a libxml from the last few years should have this.
David
On Dec 13, 2008, at 5:46 AM, Felipe Contreras wrote:
> 2008/12/13 Todd Fisher :
>> I think it's best to check for both... something like this would
>> be ideal
>> if pkg_config('libxml-2.0')
>> elsif find_executable('xml2-config')
>> $CFLAGS << " #{`xml2-config --cflags`.strip}"
>> $LIBS << " #{`xml2-config --libs`.strip}"
>> elsif !have_library('xml2') or !have_header('libxml/parser.h')
>> fail "missing dependencies"
>> end
>
> I don't see why libraries still insist on legacy config scripts since
> pretty much everyone uses pkg-config and it makes things so much
> easier.
From sean at chittenden.org Mon Dec 15 23:45:27 2008
From: sean at chittenden.org (Sean Chittenden)
Date: Mon, 15 Dec 2008 20:45:27 -0800
Subject: [libxml-devel] xml2-config?
In-Reply-To:
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
<94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
<94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
Message-ID: <4844E9E0-2586-4928-BDD2-4DC72F00B022@chittenden.org>
> You're right - using pkg-config, not xml2-config, is the BCP. Any
> Unix system with a libxml from the last few years should have this.
I hate to be the stick in the mud, but pkg-config is a fantastic PITA
that's as joyous to work with as most of the autofuck utils. FreeBSD,
Solaris, and many other non-linux systems don't use pkg-config (not to
say it can't, but isn't). ruby-libxml should use xml2-config until a
sufficiently well adopted BSDL version of pkg-config is adopted and
used by most posix systems.
-sc
--
Sean Chittenden
sean at chittenden.org
From felipe.contreras at gmail.com Tue Dec 16 02:21:41 2008
From: felipe.contreras at gmail.com (Felipe Contreras)
Date: Tue, 16 Dec 2008 09:21:41 +0200
Subject: [libxml-devel] xml2-config?
In-Reply-To: <4844E9E0-2586-4928-BDD2-4DC72F00B022@chittenden.org>
References: <3DDB20DC-7935-4AE7-BD1C-3ED07615DCAA@mudynamics.com>
<49419763.1010506@savagexi.com>
<0FF546AB-3195-4528-B542-23C115046B09@mudynamics.com>
<49430A8C.2060507@savagexi.com>
<94a0d4530812130111v6419f167g8b72b318ed36e3a5@mail.gmail.com>
<94a0d4530812130546v4713e96agd8a57299dba70819@mail.gmail.com>
<4844E9E0-2586-4928-BDD2-4DC72F00B022@chittenden.org>
Message-ID: <94a0d4530812152321y7ac63b60y94d4886cd05fddf7@mail.gmail.com>
On Tue, Dec 16, 2008 at 6:45 AM, Sean Chittenden wrote:
>> You're right - using pkg-config, not xml2-config, is the BCP. Any Unix
>> system with a libxml from the last few years should have this.
>
> I hate to be the stick in the mud, but pkg-config is a fantastic PITA that's
> as joyous to work with as most of the autofuck utils. FreeBSD, Solaris, and
> many other non-linux systems don't use pkg-config (not to say it can't, but
> isn't). ruby-libxml should use xml2-config until a sufficiently well
> adopted BSDL version of pkg-config is adopted and used by most posix
> systems.
FreeBSD and Solaris have pkg-config, hell, I even have pkg-config on Windows.
It's backed by freedesktop, nothing to do with autotools, it's simple,
elegant and does the job that no other tool does. Simplifies the job
of library writers and applications trying to use them. Integrates
easily into autotools, but also simple Makefiles, and even mkmf.
Also, I wouldn't be surprised if libxml drops the xml2-config script.
--
Felipe Contreras
From matthias.marschall at gmail.com Tue Dec 16 09:01:54 2008
From: matthias.marschall at gmail.com (Matthias Marschall)
Date: Tue, 16 Dec 2008 06:01:54 -0800 (PST)
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To: <494306CC.3090809@savagexi.com>
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
<494306CC.3090809@savagexi.com>
Message-ID:
Hi Charlie,
thanks a lot for including the fix. It works like a charm.
You saved me from having to maintain that ugly workaround :-)
Matthias
On 13 Dez., 01:50, Charlie Savage wrote:
> Hi Matthias,
>
> > I ran into the same problem. Do you have any ETA when the patch will
> > be released?
>
> Fix is checked in, will be in next release. Thanks for the report.
>
> Charlie
>
> ?smime.p7s
> 4KAnzeigenHerunterladen
>
> _______________________________________________
> libxml-devel mailing list
> libxml-de... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/libxml-devel
From cfis at savagexi.com Tue Dec 16 12:51:55 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Tue, 16 Dec 2008 10:51:55 -0700
Subject: [libxml-devel] incorrect source code for Solaris native C
In-Reply-To:
References: <493D981C.11C26FA4@pld.ttu.ee> <493DA108.1050404@savagexi.com>
<493DB80C.19BE0457@pld.ttu.ee> <493DC088.8020001@savagexi.com>
<494306CC.3090809@savagexi.com>
Message-ID: <4947EABB.7030206@savagexi.com>
Hi Matthias,
> thanks a lot for including the fix. It works like a charm.
>
> You saved me from having to maintain that ugly workaround :-)
No problem. Thanks for pointing out the issue.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From xiaoquqi at gmail.com Wed Dec 17 03:05:16 2008
From: xiaoquqi at gmail.com (RaySun)
Date: Wed, 17 Dec 2008 16:05:16 +0800
Subject: [libxml-devel] libxml installation problem
Message-ID: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
Hello,I met some problems during installation. I cannot find 'xmlErrorPtr'
defined in the C headers. So I got the error:ruby_xml_error.h:11: error:
expected ')' before 'xerror'. Does anybody know why this is happened? Or my
settings goes wrong? Thanks a lot. By the way, I also use gcc version 4.3.2
(GCC) and got the same error message.
My enviroment:
gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54)
ruby setup.rb
---> lib
---> lib/libxml
<--- lib/libxml
---> lib/xml
<--- lib/xml
<--- lib
---> ext
---> ext/libxml
/dataCentral/ruby/bin/ruby
/data0/dataCentral/tmp/libxml-ruby-0.9.7/ext/libxml/extconf.rb
setup.rb:655: warning: Insecure world writable dir
/data0/dataCentral/tmp/libxml-ruby-0.9.7/ext/libxml/./ in PATH, mode 040777
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for #include
... yes
checking for xmlDocFormatDump()... yes
checking for docbCreateFileParserCtxt()... yes
creating extconf.h
creating Makefile
<--- ext/libxml
---> ext/mingw
<--- ext/mingw
---> ext/vc
<--- ext/vc
<--- ext
---> lib
---> lib/libxml
<--- lib/libxml
---> lib/xml
<--- lib/xml
<--- lib
---> ext
---> ext/libxml
make
gcc -I. -I. -I/dataCentral/ruby/lib/ruby/1.8/i686-linux
-I/data0/dataCentral/tmp/libxml-ruby-0.9.7/ext/libxml -I/usr/include/libxml2
-I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -g -O2 -I.
-I/dataCentral/ruby/lib/ruby/1.8/i686-linux
-I/data0/dataCentral/tmp/libxml-ruby-0.9.7/ext/libxml -I/usr/include/libxml2
-I/usr/local/include -c cbg.c
In file included from ruby_libxml.h:63,
from cbg.c:1:
ruby_xml_error.h:11: error: expected ')' before 'xerror'
ruby_xml_error.h:12: error: expected ')' before 'xerror'
make: *** [cbg.o] Error 1
setup.rb:655:in `command': system("make") failed (RuntimeError)
from setup.rb:664:in `make'
from setup.rb:1258:in `setup_dir_ext'
from setup.rb:1532:in `__send__'
from setup.rb:1532:in `traverse'
from setup.rb:1549:in `dive_into'
from setup.rb:1530:in `traverse'
from setup.rb:1534:in `traverse'
from setup.rb:1533:in `each'
... 7 levels...
from setup.rb:996:in `exec_setup'
from setup.rb:813:in `invoke'
from setup.rb:773:in `invoke'
from setup.rb:1578
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From linnerud at gmail.com Fri Dec 19 10:01:37 2008
From: linnerud at gmail.com (tel)
Date: Fri, 19 Dec 2008 07:01:37 -0800 (PST)
Subject: [libxml-devel] XmlNode Doc is not bound! (ruby_xml_node.c:58) on
0.9.7
Message-ID: <215b31bd-a4e7-490d-98c1-56eeb83b83dd@s9g2000prm.googlegroups.com>
I am hitting the error in subject when trying to parse a document on
OS X Leopard.
[BUG] XmlNode Doc is not bound! (ruby_xml_node.c:58)
ruby 1.8.6 (2008-03-03) [universal-darwin9.0]
Abort trap
tel at mac-pro alpha $ ruby --version
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
The error also appears to be present for 0.9.5.
regards,
Tor Erik
From kirill at shutemov.name Fri Dec 19 15:36:41 2008
From: kirill at shutemov.name (Kirill A. Shutemov)
Date: Fri, 19 Dec 2008 22:36:41 +0200
Subject: [libxml-devel] [PATCH] Fix warnings
Message-ID: <1229719002-31993-2-git-send-email-kirill@shutemov.name>
Signed-off-by: Kirill A. Shutemov
---
ext/libxml/libxml.c | 2 +-
ext/libxml/ruby_xml_document.c | 2 +-
ext/libxml/ruby_xml_reader.c | 2 +-
ext/libxml/ruby_xml_sax2_handler.c | 34 +++++++++++++++++-----------------
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index b6cc679..c722642 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -564,7 +564,7 @@ static VALUE rxml_default_tree_indent_string_get(VALUE class)
static VALUE rxml_default_tree_indent_string_set(VALUE class, VALUE string)
{
Check_Type(string, T_STRING);
- xmlTreeIndentString = xmlStrdup((xmlChar *)StringValuePtr(string));
+ xmlTreeIndentString = strdup(StringValuePtr(string));
return (string);
}
diff --git a/ext/libxml/ruby_xml_document.c b/ext/libxml/ruby_xml_document.c
index cab739d..032c2ab 100644
--- a/ext/libxml/ruby_xml_document.c
+++ b/ext/libxml/ruby_xml_document.c
@@ -541,7 +541,7 @@ static VALUE rxml_document_save(int argc, VALUE *argv, VALUE self)
xfilename = StringValuePtr(filename);
Data_Get_Struct(self, xmlDoc, xdoc);
- encoding = xdoc->encoding;
+ encoding = (char *)xdoc->encoding;
if (!NIL_P(options))
{
diff --git a/ext/libxml/ruby_xml_reader.c b/ext/libxml/ruby_xml_reader.c
index f3cdd14..818ebdc 100644
--- a/ext/libxml/ruby_xml_reader.c
+++ b/ext/libxml/ruby_xml_reader.c
@@ -324,7 +324,7 @@ static VALUE rxml_reader_read(VALUE self)
int result = xmlTextReaderRead(rxml_text_reader_get(self));
switch(result)
{
- case -1:
+ default:
rxml_raise(&xmlLastError);
return Qnil;
break;
diff --git a/ext/libxml/ruby_xml_sax2_handler.c b/ext/libxml/ruby_xml_sax2_handler.c
index 739d10c..c9284c9 100644
--- a/ext/libxml/ruby_xml_sax2_handler.c
+++ b/ext/libxml/ruby_xml_sax2_handler.c
@@ -83,21 +83,21 @@ static void end_element_ns_callback(void *ctx,
VALUE name;
if (xprefix)
{
- name = rb_str_new2(xprefix);
+ name = rb_str_new2((char *)xprefix);
rb_str_cat2(name, ":");
- rb_str_cat2(name, xlocalname);
+ rb_str_cat2(name, (char *)xlocalname);
}
else
{
- name = rb_str_new2(xlocalname);
+ name = rb_str_new2((char *)xlocalname);
}
rb_funcall(handler, cbidOnEndElement, 1, name);
}
rb_funcall(handler, cbidOnEndElementNs, 3,
- rb_str_new2(xlocalname),
- xprefix ? rb_str_new2(xprefix) : Qnil,
- xURI ? rb_str_new2(xURI) : Qnil);
+ rb_str_new2((char *)xlocalname),
+ xprefix ? rb_str_new2((char *)xprefix) : Qnil,
+ xURI ? rb_str_new2((char *)xURI) : Qnil);
}
static void external_subset_callback(void *ctx, const char *name, const char *extid, const char *sysid)
@@ -206,8 +206,8 @@ static void start_element_ns_callback(void *ctx,
int i;
for (i = 0;i < nb_attributes * 5; i+=5)
{
- VALUE attrName = rb_str_new2(xattributes[i+0]);
- VALUE attrValue = rb_str_new(xattributes[i+3], xattributes[i+4] - xattributes[i+3]);
+ VALUE attrName = rb_str_new2((char *)xattributes[i+0]);
+ VALUE attrValue = rb_str_new((char *)xattributes[i+3], xattributes[i+4] - xattributes[i+3]);
/* VALUE attrPrefix = xattributes[i+1] ? rb_str_new2(xattributes[i+1]) : Qnil;
VALUE attrURI = xattributes[i+2] ? rb_str_new2(xattributes[i+2]) : Qnil; */
@@ -220,8 +220,8 @@ static void start_element_ns_callback(void *ctx,
int i;
for (i = 0;i < nb_namespaces * 2; i+=2)
{
- VALUE nsPrefix = xnamespaces[i+0] ? rb_str_new2(xnamespaces[i+0]) : Qnil;
- VALUE nsURI = xnamespaces[i+1] ? rb_str_new2(xnamespaces[i+1]) : Qnil;
+ VALUE nsPrefix = xnamespaces[i+0] ? rb_str_new2((char *)xnamespaces[i+0]) : Qnil;
+ VALUE nsURI = xnamespaces[i+1] ? rb_str_new2((char *)xnamespaces[i+1]) : Qnil;
rb_hash_aset(attributes, nsPrefix, nsURI);
}
}
@@ -232,23 +232,23 @@ static void start_element_ns_callback(void *ctx,
VALUE name;
if (xprefix)
{
- name = rb_str_new2(xprefix);
+ name = rb_str_new2((char *)xprefix);
rb_str_cat2(name, ":");
- rb_str_cat2(name, xlocalname);
+ rb_str_cat2(name, (char *)xlocalname);
}
else
{
- name = rb_str_new2(xlocalname);
+ name = rb_str_new2((char *)xlocalname);
}
rb_funcall(handler, cbidOnStartElement, 2, name, attributes);
}
rb_funcall(handler, cbidOnStartElementNs, 5,
- rb_str_new2(xlocalname),
+ rb_str_new2((char *)xlocalname),
attributes,
- xprefix ? rb_str_new2(xprefix) : Qnil,
- xURI ? rb_str_new2(xURI) : Qnil,
- namespaces);
+ xprefix ? rb_str_new2((char *)xprefix) : Qnil,
+ xURI ? rb_str_new2((char *)xURI) : Qnil,
+ (char *)namespaces);
}
static void structured_error_callback(void *ctx, xmlErrorPtr xerror)
--
1.6.0.2.GIT
From kirill at shutemov.name Fri Dec 19 15:36:40 2008
From: kirill at shutemov.name (Kirill A. Shutemov)
Date: Fri, 19 Dec 2008 22:36:40 +0200
Subject: [libxml-devel] [PATCH] Fix building
Message-ID: <1229719002-31993-1-git-send-email-kirill@shutemov.name>
Signed-off-by: Kirill A. Shutemov
---
ext/libxml/ruby_xml_node.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ext/libxml/ruby_xml_node.c b/ext/libxml/ruby_xml_node.c
index 5535887..ec59f9e 100644
--- a/ext/libxml/ruby_xml_node.c
+++ b/ext/libxml/ruby_xml_node.c
@@ -132,7 +132,7 @@ static VALUE rxml_node_new_cdata(int argc, VALUE *argv, VALUE klass)
if (xnode == NULL)
rxml_raise(&xmlLastError);
- return rxml_node_wrap(klass, xnode);
+ return rxml_node_wrap(xnode);
}
/*
@@ -163,7 +163,7 @@ static VALUE rxml_node_new_comment(int argc, VALUE *argv, VALUE klass)
if (xnode == NULL)
rxml_raise(&xmlLastError);
- return rxml_node_wrap(klass, xnode);
+ return rxml_node_wrap(xnode);
}
/*
@@ -184,7 +184,7 @@ static VALUE rxml_node_new_text(VALUE klass, VALUE content)
if (xnode == NULL)
rxml_raise(&xmlLastError);
- return rxml_node_wrap(klass, xnode);
+ return rxml_node_wrap(xnode);
}
/*
--
1.6.0.2.GIT
From kirill at shutemov.name Fri Dec 19 15:36:42 2008
From: kirill at shutemov.name (Kirill A. Shutemov)
Date: Fri, 19 Dec 2008 22:36:42 +0200
Subject: [libxml-devel] [PATCH] Add new PushParser based on xmlParseChunk
Message-ID: <1229719002-31993-3-git-send-email-kirill@shutemov.name>
Signed-off-by: Kirill A. Shutemov
---
ext/libxml/libxml.c | 1 +
ext/libxml/ruby_libxml.h | 1 +
ext/libxml/ruby_xml_push_parser.c | 77 +++++++++++
ext/libxml/ruby_xml_push_parser.h | 8 ++
test/tc_push_parser.rb | 253 +++++++++++++++++++++++++++++++++++++
test/test_suite.rb | 3 +-
6 files changed, 342 insertions(+), 1 deletions(-)
create mode 100644 ext/libxml/ruby_xml_push_parser.c
create mode 100644 ext/libxml/ruby_xml_push_parser.h
create mode 100644 test/tc_push_parser.rb
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index c722642..b861f93 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -859,6 +859,7 @@ void Init_libxml_ruby(void)
ruby_init_xml_namespace();
ruby_init_xml_sax_parser();
ruby_init_xml_sax2_handler();
+ ruby_init_xml_push_parser();
ruby_init_xml_xinclude();
ruby_init_xml_xpath();
ruby_init_xml_xpath_context();
diff --git a/ext/libxml/ruby_libxml.h b/ext/libxml/ruby_libxml.h
index fbc3108..2843398 100644
--- a/ext/libxml/ruby_libxml.h
+++ b/ext/libxml/ruby_libxml.h
@@ -73,6 +73,7 @@
#include "ruby_xml_parser_context.h"
#include "ruby_xml_sax2_handler.h"
#include "ruby_xml_sax_parser.h"
+#include "ruby_xml_push_parser.h"
#include "ruby_xml_xinclude.h"
#include "ruby_xml_xpath.h"
#include "ruby_xml_xpath_expression.h"
diff --git a/ext/libxml/ruby_xml_push_parser.c b/ext/libxml/ruby_xml_push_parser.c
new file mode 100644
index 0000000..deab671
--- /dev/null
+++ b/ext/libxml/ruby_xml_push_parser.c
@@ -0,0 +1,77 @@
+#include "ruby_libxml.h"
+#include "ruby_xml_push_parser.h"
+
+VALUE cXMLPushParser;
+
+static ID CALLBACKS_ATTR;
+
+static void free_parser(xmlParserCtxtPtr ctxt)
+{
+ xmlFreeParserCtxt(ctxt);
+}
+
+static VALUE rxml_push_parser_initialize(VALUE self)
+{
+ xmlParserCtxtPtr ctxt;
+ VALUE parser;
+
+ ctxt = xmlCreatePushParserCtxt(&rxml_sax_handler,
+ NULL, NULL, 0, NULL);
+
+ if (!ctxt) {
+ rxml_raise(&xmlLastError);
+ return Qnil;
+ }
+
+ parser = Data_Wrap_Struct(rb_cData, NULL, free_parser, ctxt);
+ rb_iv_set(self, "@parser", parser);
+ return self;
+}
+
+static VALUE rxml_push_parser_parse_chunk(VALUE self, VALUE string)
+{
+ xmlParserCtxtPtr ctxt;
+ VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
+
+ Data_Get_Struct(rb_iv_get(self, "@parser"), xmlParserCtxt, ctxt);
+
+ ctxt->userData = (void *)handler;
+
+ if (xmlParseChunk(ctxt, StringValuePtr(string),
+ RSTRING_LEN(string), 0)) {
+ rxml_raise(&xmlLastError);
+ return Qfalse;
+ } else
+ return Qtrue;
+}
+
+static VALUE rxml_push_parser_close(VALUE self)
+{
+ xmlParserCtxtPtr ctxt;
+ VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
+
+ Data_Get_Struct(rb_iv_get(self, "@parser"), xmlParserCtxt, ctxt);
+
+ ctxt->userData = (void *)handler;
+
+ if (xmlParseChunk(ctxt, "", 0, 1)) {
+ rxml_raise(&xmlLastError);
+ return Qfalse;
+ } else
+ return Qtrue;
+}
+
+void ruby_init_xml_push_parser(void)
+{
+ /* PushParser */
+ cXMLPushParser = rb_define_class_under(mXML, "PushParser", rb_cObject);
+
+ /* Attributes */
+ CALLBACKS_ATTR = rb_intern("@callbacks");
+ rb_define_attr(cXMLPushParser, "callbacks", 1, 1);
+
+ /* Instance Methods */
+ rb_define_method(cXMLPushParser, "initialize", rxml_push_parser_initialize, 0);
+ rb_define_method(cXMLPushParser, "parse_chunk", rxml_push_parser_parse_chunk, 1);
+ rb_define_method(cXMLPushParser, "close", rxml_push_parser_close, 0);
+}
diff --git a/ext/libxml/ruby_xml_push_parser.h b/ext/libxml/ruby_xml_push_parser.h
new file mode 100644
index 0000000..e0f7ce3
--- /dev/null
+++ b/ext/libxml/ruby_xml_push_parser.h
@@ -0,0 +1,8 @@
+#ifndef __rxml_PUSH_PARSER__
+#define __rxml_PUSH_PARSER__
+
+extern VALUE cXMLSaxParser;
+
+void ruby_init_xml_push_parser(void);
+
+#endif
diff --git a/test/tc_push_parser.rb b/test/tc_push_parser.rb
new file mode 100644
index 0000000..e6dc492
--- /dev/null
+++ b/test/tc_push_parser.rb
@@ -0,0 +1,253 @@
+require 'xml'
+require 'test/unit'
+
+class DocTypeCallback
+ include XML::SaxParser::Callbacks
+ def on_start_element(element, attributes)
+ end
+end
+
+class TestCaseCallbacks
+ include XML::SaxParser::Callbacks
+
+ attr_accessor :result
+
+ def initialize
+ @result = Array.new
+ end
+
+ def on_cdata_block(cdata)
+ @result << "cdata: #{cdata}"
+ end
+
+ def on_characters(chars)
+ @result << "characters: #{chars}"
+ end
+
+ def on_comment(text)
+ @result << "comment: #{text}"
+ end
+
+ def on_end_document
+ @result << "end_document"
+ end
+
+ def on_end_element(name)
+ @result << "end_element: #{name}"
+ end
+
+ def on_end_element_ns(name, prefix, uri)
+ @result << "end_element_ns #{name}, prefix: #{prefix}, uri: #{uri}"
+ end
+
+ # Called for parser errors.
+ def on_error(error)
+ @result << "error: #{error}"
+ end
+
+ def on_processing_instruction(target, data)
+ @result << "pi: #{target} #{data}"
+ end
+
+ def on_start_document
+ @result << "startdoc"
+ end
+
+ def on_start_element(name, attributes)
+ attributes ||= Hash.new
+ @result << "start_element: #{name}, attr: #{attributes.inspect}"
+ end
+
+ def on_start_element_ns(name, attributes, prefix, uri, namespaces)
+ attributes ||= Hash.new
+ namespaces ||= Hash.new
+ @result << "start_element_ns: #{name}, attr: #{attributes.inspect}, prefix: #{prefix}, uri: #{uri}, ns: #{namespaces.inspect}"
+ end
+end
+
+class TestPushParser < Test::Unit::TestCase
+ def setup
+ XML.default_keep_blanks = true
+ @xp = XML::PushParser.new
+ end
+
+ def teardown
+ @xp = nil
+ XML.default_keep_blanks = true
+ end
+
+ def saxtest_file
+ File.join(File.dirname(__FILE__), 'model/atom.xml')
+ end
+
+ def verify
+ result = @xp.callbacks.result
+
+ i = -1
+ assert_equal("startdoc", result[i+=1])
+ assert_equal("pi: xml-stylesheet type=\"text/xsl\" href=\"my_stylesheet.xsl\"", result[i+=1])
+ assert_equal("start_element: feed, attr: {nil=>\"http://www.w3.org/2005/Atom\"}", result[i+=1])
+ assert_equal("start_element_ns: feed, attr: {nil=>\"http://www.w3.org/2005/Atom\"}, prefix: , uri: http://www.w3.org/2005/Atom, ns: {}", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("comment: Not a valid atom entry ", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("start_element: entry, attr: {}", result[i+=1])
+ assert_equal("start_element_ns: entry, attr: {}, prefix: , uri: http://www.w3.org/2005/Atom, ns: {}", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("start_element: title, attr: {\"type\"=>\"html\"}", result[i+=1])
+ assert_equal("start_element_ns: title, attr: {\"type\"=>\"html\"}, prefix: , uri: http://www.w3.org/2005/Atom, ns: {}", result[i+=1])
+ assert_equal("cdata: <>", result[i+=1])
+ assert_equal("end_element: title", result[i+=1])
+ assert_equal("end_element_ns title, prefix: , uri: http://www.w3.org/2005/Atom", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("start_element: content, attr: {\"type\"=>\"xhtml\"}", result[i+=1])
+ assert_equal("start_element_ns: content, attr: {\"type\"=>\"xhtml\"}, prefix: , uri: http://www.w3.org/2005/Atom, ns: {}", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("start_element: xhtml:div, attr: {\"xhtml\"=>\"http://www.w3.org/1999/xhtml\"}", result[i+=1])
+ assert_equal("start_element_ns: div, attr: {\"xhtml\"=>\"http://www.w3.org/1999/xhtml\"}, prefix: xhtml, uri: http://www.w3.org/1999/xhtml, ns: {}", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("start_element: xhtml:p, attr: {}", result[i+=1])
+ assert_equal("start_element_ns: p, attr: {}, prefix: xhtml, uri: http://www.w3.org/1999/xhtml, ns: {}", result[i+=1])
+ assert_equal("characters: hi there", result[i+=1])
+ assert_equal("end_element: xhtml:p", result[i+=1])
+ assert_equal("end_element_ns p, prefix: xhtml, uri: http://www.w3.org/1999/xhtml", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("end_element: xhtml:div", result[i+=1])
+ assert_equal("end_element_ns div, prefix: xhtml, uri: http://www.w3.org/1999/xhtml", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("end_element: content", result[i+=1])
+ assert_equal("end_element_ns content, prefix: , uri: http://www.w3.org/2005/Atom", result[i+=1])
+ assert_equal("characters: \n ", result[i+=1])
+ assert_equal("end_element: entry", result[i+=1])
+ assert_equal("end_element_ns entry, prefix: , uri: http://www.w3.org/2005/Atom", result[i+=1])
+ assert_equal("characters: \n", result[i+=1])
+ assert_equal("end_element: feed", result[i+=1])
+ assert_equal("end_element_ns feed, prefix: , uri: http://www.w3.org/2005/Atom", result[i+=1])
+ assert_equal("end_document", result[i+=1])
+ end
+
+ def test_no_callbacks
+ File.read(saxtest_file).each_char{ |char|
+ assert_equal true, @xp.parse_chunk(char)
+ }
+ assert_equal true, @xp.close
+ end
+
+ def test_parsing
+ @xp.callbacks = TestCaseCallbacks.new
+ File.read(saxtest_file).each_char{ |char|
+ @xp.parse_chunk(char)
+ }
+ @xp.close
+ verify
+ end
+
+ def test_doctype
+ @xp.callbacks = DocTypeCallback.new
+ string = <<-EOS
+
+
+
+ a1
+
+EOS
+ string.each_char{ |char|
+ assert_equal true, @xp.parse_chunk(char)
+ }
+ assert_equal true, @xp.close
+ end
+
+ def test_parse_warning
+ @xp.callbacks = TestCaseCallbacks.new
+ # Two xml PIs is a warning
+ string = <<-EOS
+
+
+
+EOS
+
+ string.each_char{ |char|
+ @xp.parse_chunk(char)
+ }
+ @xp.close
+
+ # Check callbacks
+ result = @xp.callbacks.result
+ i = -1
+ assert_equal("startdoc", result[i+=1])
+ assert_equal("error: Warning: xmlParsePITarget: invalid name prefix 'xml' at :2.", result[i+=1])
+ assert_equal("pi: xml-invalid ", result[i+=1])
+ assert_equal("start_element: Test, attr: {}", result[i+=1])
+ assert_equal("start_element_ns: Test, attr: {}, prefix: , uri: , ns: {}", result[i+=1])
+ assert_equal("end_element: Test", result[i+=1])
+ assert_equal("end_element_ns Test, prefix: , uri: ", result[i+=1])
+ assert_equal("end_document", result[i+=1])
+ end
+
+ def test_parse_error
+ @xp.callbacks = TestCaseCallbacks.new
+ string = <<-EOS
+
+ EOS
+
+ error = assert_raise(XML::Error) do
+ string.each_char{ |char|
+ @xp.parse_chunk(char)
+ }
+ @xp.close
+ end
+
+ # Check callbacks
+ result = @xp.callbacks.result
+
+ i = -1
+
+ assert_equal("startdoc", result[i+=1])
+ assert_equal("start_element: Results, attr: {}", result[i+=1])
+ assert_equal("start_element_ns: Results, attr: {}, prefix: , uri: , ns: {}", result[i+=1])
+ assert_equal("error: Fatal error: Extra content at the end of the document at :1.", result[i+=1])
+ assert_equal("end_document", result[i+=1])
+
+ assert_not_nil(error)
+ assert_kind_of(XML::Error, error)
+ assert_equal("Fatal error: Extra content at the end of the document at :1.", error.message)
+ assert_equal(XML::Error::PARSER, error.domain)
+ assert_equal(XML::Error::DOCUMENT_END, error.code)
+ assert_equal(XML::Error::FATAL, error.level)
+ assert_nil(error.file)
+ assert_equal(1, error.line)
+ assert_nil(error.str1)
+ assert_nil(error.str2)
+ assert_nil(error.str3)
+ assert_equal(0, error.int1)
+ assert_equal(10, error.int2)
+ assert_nil(error.node)
+ end
+
+ def test_push
+ @xp.callbacks = TestCaseCallbacks.new
+
+ assert_nil(@xp.callbacks.result.shift)
+ @xp.parse_chunk("")
+ assert_equal("start_element: test, attr: {}", @xp.callbacks.result.shift)
+ assert_equal("start_element_ns: test, attr: {}, prefix: , uri: , ns: {}", @xp.callbacks.result.shift)
+ assert_nil(@xp.callbacks.result.shift)
+ @xp.parse_chunk("text")
+ assert_nil(@xp.callbacks.result.shift)
+ @xp.parse_chunk("<")
+ assert_equal("characters: text", @xp.callbacks.result.shift)
+ assert_nil(@xp.callbacks.result.shift)
+ @xp.parse_chunk("/test")
+ assert_nil(@xp.callbacks.result.shift)
+ @xp.parse_chunk(">")
+ assert_equal("end_element: test", @xp.callbacks.result.shift)
+ assert_equal("end_element_ns test, prefix: , uri: ", @xp.callbacks.result.shift)
+ assert_nil(@xp.callbacks.result.shift)
+ @xp.close
+ assert_equal("end_document", @xp.callbacks.result.shift)
+ assert_nil(@xp.callbacks.result.shift)
+ end
+end
diff --git a/test/test_suite.rb b/test/test_suite.rb
index 1389842..d88912d 100644
--- a/test/test_suite.rb
+++ b/test/test_suite.rb
@@ -18,6 +18,7 @@ require 'tc_node_write'
require 'tc_node_xlink'
require 'tc_parser'
require 'tc_parser_context'
+require 'tc_push_parser'
require 'tc_reader'
require 'tc_relaxng'
require 'tc_sax_parser'
@@ -31,4 +32,4 @@ require 'tc_xpointer'
# Compatibility
require 'tc_properties'
-require 'tc_deprecated_require'
\ No newline at end of file
+require 'tc_deprecated_require'
--
1.6.0.2.GIT
From cfis at savagexi.com Sat Dec 20 16:23:01 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Sat, 20 Dec 2008 13:23:01 -0800
Subject: [libxml-devel] libxml installation problem
In-Reply-To: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
References: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
Message-ID: <494D6235.4030907@savagexi.com>
Hi RaySun,
> I met some problems during installation. I cannot find 'xmlErrorPtr'
> defined in the C headers. So I got the error:ruby_xml_error.h:11: error:
> expected ')' before 'xerror'. Does anybody know why this is happened? Or
> my settings goes wrong? Thanks a lot.
What version of libxml2 do you have installed? Is it very old?
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From xiaoquqi at gmail.com Sun Dec 21 19:08:12 2008
From: xiaoquqi at gmail.com (RaySun)
Date: Mon, 22 Dec 2008 08:08:12 +0800
Subject: [libxml-devel] libxml installation problem
In-Reply-To: <494D6235.4030907@savagexi.com>
References: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
<494D6235.4030907@savagexi.com>
Message-ID: <8dac26cc0812211608y3e3d96a4r182ece07497baa7a@mail.gmail.com>
Hi Charlie,I have two versions of libxml, one is the default libxml, the
other one is the latest one which install to my local path. I changed
the --with-xml2-include, --with-xml2-dir, --with-xml2-lib to the latest one
when I generate makefile, the error is same. I guess there's something wrong
with my path settings, but I am not sure where it is. Please help. Thanks.
Here's my system default libxml under /usr/lib:
-rwxr-xr-x 1 root root 723 Apr 17 2003 libxmltok.la
-rwxr-xr-x 1 root root 737 Apr 17 2003 libxmlparse.la
-rw-r--r-- 1 root root 106512 Apr 17 2003 libxmltok.a
-rw-r--r-- 1 root root 34260 Apr 17 2003 libxmlparse.a
-rwxr-xr-x 1 root root 77304 Apr 17 2003 libxmltok.so.0.1.0
-rwxr-xr-x 1 root root 32648 Apr 17 2003 libxmlparse.so.0.1.0
-rwxr-xr-x 1 root root 720 Oct 27 2004 libxml2.la
-rwxr-xr-x 1 root root 988452 Oct 27 2004 libxml2.so.2.5.10
-rw-r--r-- 1 root root 1185462 Oct 27 2004 libxml2.a
-rwxr-xr-x 1 root root 470052 Nov 17 2004 libxml.so.1.8.17
-rwxr-xr-x 1 root root 695 Nov 17 2004 libxml.la
-rw-r--r-- 1 root root 532172 Nov 17 2004 libxml.a
lrwxrwxrwx 1 root root 17 Jan 31 2007 libxml2.so.2 ->
libxml2.so.2.5.10
lrwxrwxrwx 1 root root 16 Jan 31 2007 libxml.so.1 ->
libxml.so.1.8.17
lrwxrwxrwx 1 root root 18 Jan 31 2007 libxmltok.so.0 ->
libxmltok.so.0.1.0
lrwxrwxrwx 1 root root 20 Jan 31 2007 libxmlparse.so.0 ->
libxmlparse.so.0.1.0
lrwxrwxrwx 1 root root 17 Jan 31 2007 libxml2.so ->
libxml2.so.2.5.10
lrwxrwxrwx 1 root root 18 Jan 31 2007 libxmltok.so ->
libxmltok.so.0.1.0
lrwxrwxrwx 1 root root 16 Jan 31 2007 libxml.so ->
libxml.so.1.8.17
lrwxrwxrwx 1 root root 20 Jan 31 2007 libxmlparse.so ->
libxmlparse.so.0.1.0
And I install the latest to my local path:
-rwxr-xr-x 1 user devsrc 3550751 Dec 17 16:25 libxml2.so.2.7.2
lrwxrwxrwx 1 user devsrc 16 Dec 17 16:25 libxml2.so.2 ->
libxml2.so.2.7.2
lrwxrwxrwx 1 user devsrc 16 Dec 17 16:25 libxml2.so ->
libxml2.so.2.7.2
-rwxr-xr-x 1 user devsrc 811 Dec 17 16:25 libxml2.la
-rw-r--r-- 1 user devsrc 4897992 Dec 17 16:25 libxml2.a
2008/12/21 Charlie Savage
> Hi RaySun,
>
> I met some problems during installation. I cannot find 'xmlErrorPtr'
>> defined in the C headers. So I got the error:ruby_xml_error.h:11: error:
>> expected ')' before 'xerror'. Does anybody know why this is happened? Or my
>> settings goes wrong? Thanks a lot.
>>
>
> What version of libxml2 do you have installed? Is it very old?
>
> Charlie
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From cfis at savagexi.com Mon Dec 22 12:53:30 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Mon, 22 Dec 2008 09:53:30 -0800
Subject: [libxml-devel] libxml installation problem
In-Reply-To: <8dac26cc0812211608y3e3d96a4r182ece07497baa7a@mail.gmail.com>
References: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
<494D6235.4030907@savagexi.com>
<8dac26cc0812211608y3e3d96a4r182ece07497baa7a@mail.gmail.com>
Message-ID: <494FD41A.1070800@savagexi.com>
Hi Ray,
> I have two versions of libxml, one is the default libxml, the other one
> is the latest one which install to my local path. I changed
> the --with-xml2-include, --with-xml2-dir, --with-xml2-lib to the latest
> one when I generate makefile, the error is same. I guess there's
> something wrong with my path settings, but I am not sure where it is.
Well, it seems you have libxml2.so.2.5.10. So, maybe that version
doesn't define xmlErrorPtr.
>
> I met some problems during installation. I cannot find
> 'xmlErrorPtr' defined in the C headers. So I got the
> error:ruby_xml_error.h:11: error: expected ')' before 'xerror'.
> Does anybody know why this is happened? Or my settings goes
> wrong? Thanks a lot.
>
>
> What version of libxml2 do you have installed? Is it very old?
Can you use a newer version of libxml?
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From mingde.hong at gmail.com Mon Dec 22 13:55:03 2008
From: mingde.hong at gmail.com (Victor)
Date: Mon, 22 Dec 2008 10:55:03 -0800 (PST)
Subject: [libxml-devel] Looking for ruby code to convert libxml:xml to json
Message-ID: <9dc6a294-59c7-4d0d-b9bf-5e506a223430@a12g2000yqm.googlegroups.com>
Hi
Does anyone know if someone had put out code to convert xml to json in
ruby?
Thanks in advance,
Victor
From xiaoquqi at gmail.com Tue Dec 23 03:41:54 2008
From: xiaoquqi at gmail.com (RaySun)
Date: Tue, 23 Dec 2008 16:41:54 +0800
Subject: [libxml-devel] libxml installation problem
In-Reply-To: <494FD41A.1070800@savagexi.com>
References: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
<494D6235.4030907@savagexi.com>
<8dac26cc0812211608y3e3d96a4r182ece07497baa7a@mail.gmail.com>
<494FD41A.1070800@savagexi.com>
Message-ID: <8dac26cc0812230041x40d5db3bwcca7d955534bcd79@mail.gmail.com>
Hi Charlie,After reset libxml path in extconf.rb, I can install libxml
successfully. Thanks very much. I wish you Merry Christmas!
--with-xml2-dir=
--with-xml2-lib=
--with-xml2-include=
2008/12/23 Charlie Savage
> Hi Ray,
>
> I have two versions of libxml, one is the default libxml, the other one is
>> the latest one which install to my local path. I changed the
>> --with-xml2-include, --with-xml2-dir, --with-xml2-lib to the latest one when
>> I generate makefile, the error is same. I guess there's something wrong with
>> my path settings, but I am not sure where it is.
>>
>
> Well, it seems you have libxml2.so.2.5.10. So, maybe that version doesn't
> define xmlErrorPtr.
>
>
>> I met some problems during installation. I cannot find
>> 'xmlErrorPtr' defined in the C headers. So I got the
>> error:ruby_xml_error.h:11: error: expected ')' before 'xerror'.
>> Does anybody know why this is happened? Or my settings goes
>> wrong? Thanks a lot.
>>
>>
>> What version of libxml2 do you have installed? Is it very old?
>>
>
> Can you use a newer version of libxml?
>
> Charlie
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From cfis at savagexi.com Tue Dec 23 13:11:32 2008
From: cfis at savagexi.com (Charlie Savage)
Date: Tue, 23 Dec 2008 11:11:32 -0700
Subject: [libxml-devel] libxml installation problem
In-Reply-To: <8dac26cc0812230041x40d5db3bwcca7d955534bcd79@mail.gmail.com>
References: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
<494D6235.4030907@savagexi.com>
<8dac26cc0812211608y3e3d96a4r182ece07497baa7a@mail.gmail.com>
<494FD41A.1070800@savagexi.com>
<8dac26cc0812230041x40d5db3bwcca7d955534bcd79@mail.gmail.com>
Message-ID: <495129D4.6080407@savagexi.com>
Hi RaySun,
> After reset libxml path in extconf.rb, I can install libxml
> successfully. Thanks very much. I wish you Merry Christmas!
> --with-xml2-dir=
> --with-xml2-lib=
> --with-xml2-include=
Good news. Can you post how you reset the libxml path in case others
run into the same problem?
And Merry Christmas to you also!
Charlie
--
Charlie Savage
http://cfis.savagexi.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL:
From xiaoquqi at gmail.com Tue Dec 23 22:16:30 2008
From: xiaoquqi at gmail.com (RaySun)
Date: Wed, 24 Dec 2008 11:16:30 +0800
Subject: [libxml-devel] libxml installation problem
In-Reply-To: <495129D4.6080407@savagexi.com>
References: <8dac26cc0812170005u3468b70gf0530bca3d1ed4b7@mail.gmail.com>
<494D6235.4030907@savagexi.com>
<8dac26cc0812211608y3e3d96a4r182ece07497baa7a@mail.gmail.com>
<494FD41A.1070800@savagexi.com>
<8dac26cc0812230041x40d5db3bwcca7d955534bcd79@mail.gmail.com>
<495129D4.6080407@savagexi.com>
Message-ID: <8dac26cc0812231916p3e57ab61o336b1c0d18424434@mail.gmail.com>
Hi Charlie,I directly added my lib and include path in
./ext/libxml/extconf.rb LINE 79 and LINE 82, I am not sure is there any way
to pass the parameters when I run ruby setup.rb. Thanks for your help.
77 unless (have_library('xml2', 'xmlParseDoc') or
78 have_library('libxml2', 'xmlParseDoc') or
79 find_library('xml2', 'xmlParseDoc', '/dataCentral/lib/lib',
'/opt/lib', '/usr/local/lib', '/usr/lib')) and
80 (have_header('libxml/xmlversion.h') or
81 find_header('libxml/xmlversion.h',
82 '/dataCentral/lib/include/libxml2',
83 "#{CONFIG['prefix']}/include",
84 "#{CONFIG['prefix']}/include/libxml2",
85 '/opt/include/libxml2',
86 '/usr/local/include/libxml2',
87 '/usr/include/libxml2'))
2008/12/24 Charlie Savage
> Hi RaySun,
>
> After reset libxml path in extconf.rb, I can install libxml successfully.
>> Thanks very much. I wish you Merry Christmas!
>> --with-xml2-dir=
>> --with-xml2-lib=
>> --with-xml2-include=
>>
>
> Good news. Can you post how you reset the libxml path in case others run
> into the same problem?
>
> And Merry Christmas to you also!
>
> Charlie
>
> --
> Charlie Savage
> http://cfis.savagexi.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From mark at thomaszone.com Tue Dec 30 12:34:01 2008
From: mark at thomaszone.com (Mark Thomas)
Date: Tue, 30 Dec 2008 09:34:01 -0800 (PST)
Subject: [libxml-devel] Looking for ruby code to convert libxml:xml to
json
In-Reply-To: <9dc6a294-59c7-4d0d-b9bf-5e506a223430@a12g2000yqm.googlegroups.com>
References: <9dc6a294-59c7-4d0d-b9bf-5e506a223430@a12g2000yqm.googlegroups.com>
Message-ID: <4e5eeea0-142d-4fc3-9643-d03e4f573977@v39g2000pro.googlegroups.com>
If it's not too complicated, you can probably do
XML --> hash --> JSON
Using XmlSimple and json-ruby or ActiveSupport::JSON
-- Mark.