Re: [libxml-devel] << operator

2008-08-24 Thread Sean Chittenden

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


It is easy when << returns self:

A << (B << C) \
 << (D << E)

This makes A with two children B and C each with a
If you want a path (tree without branches),
you can still do

A << (B << (C << D)))


Doh! Of course.

It has to return self.



I think the most common case is going to be something like this:


  



  
  


  



And the programatic construction of it will look like:

def n(a)
  XML::Node.new(a)
end

some_block = n('some_block') << (n('a') + n('b') + n('c'))
other_block = n('other_block') << (n('d') + n('e'))
root = n << some_block + other_block



... And I think the thing that needs to happen is this needs to be  
documented somewhere because XML construction is one of those things  
that people tend to like to want to do with XML libraries vs. nested  
function calls w/ string concatenation.  -sc



- --
Sean Chittenden
[EMAIL PROTECTED]



-BEGIN PGP SIGNATURE-

iEYEARECAAYFAkixio8ACgkQTrydwWwuXha9vQCeIYz+gNj6VyPNHEIkNFnhzbUW
hfQAn0DfHUfiCiDcbXrqOMz+ZJu6FdYz
=V3ic
-END PGP SIGNATURE-
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


[libxml-devel] [ libxml-Bugs-21658 ] failure to parse and obey encoding when creating document

2008-08-24 Thread noreply
Bugs item #21658, was opened at 2008-08-24 13:01
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21658&group_id=494

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: failure to parse and obey encoding when creating document

Initial Comment:
The following appeared on comp.ruby.lang:

= quoted material follows

I have an XML request,
using the following code as an example:

require "rubygems"
require "xml/libxml"

movie = "sin+city"
search_url = 'http://www.movie-xml.com/interfaces/getmovie.php?moviename='
url = search_url+movie
doc = XML::Document.file(url)

Here's the response I get:

Input is not proper UTF-8, indicate encoding !

The source XML has an encoding declared as such:



= end quoted material

Tested and confirmed, plus I tried the same operation with REXML and there was 
no problem. It looks like we are not examining the encoding attribute up front 
and obeying it when parsing the body of the doc.

--

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21658&group_id=494
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


[libxml-devel] [ libxml-Bugs-21658 ] failure to parse and obey encoding when creating document

2008-08-24 Thread noreply
Bugs item #21658, was opened at 2008-08-24 13:01
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21658&group_id=494

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: failure to parse and obey encoding when creating document

Initial Comment:
The following appeared on comp.ruby.lang:

= quoted material follows

I have an XML request,
using the following code as an example:

require "rubygems"
require "xml/libxml"

movie = "sin+city"
search_url = 'http://www.movie-xml.com/interfaces/getmovie.php?moviename='
url = search_url+movie
doc = XML::Document.file(url)

Here's the response I get:

Input is not proper UTF-8, indicate encoding !

The source XML has an encoding declared as such:



= end quoted material

Tested and confirmed, plus I tried the same operation with REXML and there was 
no problem. It looks like we are not examining the encoding attribute up front 
and obeying it when parsing the body of the doc.

--

Comment By: Eric Ivancich (ivancich)
Date: 2008-08-24 19:29

Message:
Twice in the XML data retrieved from the URL generated in the detailed 
description, the word "verg?enza" appears, where the "?" has hex code 0xFC that 
encodes a lower case "u" with umlaut in ISO-8859-1.  0xFC cannot appear in 
UTF-8 data due to RFC-3629.

So that adds further evidence that it's trying to parse the file as UTF-8 
rather than ISO-8859-1.

--

Comment By: Erik Hollensbe (erikh)
Date: 2008-08-24 16:24

Message:
>From this thread on ruby-talk: http://www.ruby-forum.com/topic/163524

--

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21658&group_id=494
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


[libxml-devel] [ libxml-Bugs-21658 ] failure to parse and obey encoding when creating document

2008-08-24 Thread noreply
Bugs item #21658, was opened at 2008-08-24 10:01
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21658&group_id=494

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: failure to parse and obey encoding when creating document

Initial Comment:
The following appeared on comp.ruby.lang:

= quoted material follows

I have an XML request,
using the following code as an example:

require "rubygems"
require "xml/libxml"

movie = "sin+city"
search_url = 'http://www.movie-xml.com/interfaces/getmovie.php?moviename='
url = search_url+movie
doc = XML::Document.file(url)

Here's the response I get:

Input is not proper UTF-8, indicate encoding !

The source XML has an encoding declared as such:



= end quoted material

Tested and confirmed, plus I tried the same operation with REXML and there was 
no problem. It looks like we are not examining the encoding attribute up front 
and obeying it when parsing the body of the doc.

--

Comment By: Erik Hollensbe (erikh)
Date: 2008-08-24 13:24

Message:
>From this thread on ruby-talk: http://www.ruby-forum.com/topic/163524

--

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21658&group_id=494
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel