Re: [libxml-devel] problem with UTF-16 encoding

2007-11-27 Thread Tim Perrett
Interesting stuff. Just changed back to utf-16, and using doc.dump I  
see the byte order mark and the rest of the xml - result :)

Cheers guys

Tim

On 27 Nov 2007, at 04:39, Dan Janowski wrote:

> I have modified Document#to_s to permit the inclusion of a second
> encoding argument (didn't know there was a first one, eh?). It will
> not change the document encoding, but will case libxml to produce a
> representation of the document in the requested encoding (transcoding
> it if necessary). The default for it is nil, and results in the
> document's encoding.
>
> A few other notes about UTF-16 specifically; UTF-16 will result in a
> two byte lead in, UTF-16BE will not, nor will UTF-16LE. These latter
> encodings are not familiar, but may or may not be of interest.
>
> You were getting two 8bit chars and nothing else because of the
> UTF-16 lead in, but it was also getting truncated because the wrong
> ruby string constructor was being called (which did not use the
> length returned by the libxml dump, so an ^@ was stopping the string).
>
> In other words, it was always broken (I had not previously modified
> this code), now it is less broken.
>
> Dan

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Specifying namespace on XPath?

2007-11-27 Thread keisuke fukuda
So, this should be the patch.

Index: ext/xml/ruby_xml_xpath.c
===
--- ext/xml/ruby_xml_xpath.c(revision 218)
+++ ext/xml/ruby_xml_xpath.c(working copy)
@@ -76,9 +76,9 @@
 }
 else {
   // tuples of prefix/uri
-  if (RARRAY(RARRAY(nslist)->ptr[i])->len == 2) {
-   rprefix = RARRAY(RARRAY(nslist)->ptr[i])->ptr[0];
-   ruri = RARRAY(RARRAY(nslist)->ptr[i])->ptr[1];
+  if (RARRAY(nslist)->len == 2) {
+   rprefix = RARRAY(nslist)->ptr[0];
+   ruri = RARRAY(nslist)->ptr[1];
ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
   } else {
rb_raise(rb_eArgError, "nested array must be an array of
strings, prefix and href/uri");
Index: ext/xml/ruby_xml_xpath.c
===
--- ext/xml/ruby_xml_xpath.c(revision 218)
+++ ext/xml/ruby_xml_xpath.c(working copy)
@@ -76,9 +76,9 @@
 }
 else {
   // tuples of prefix/uri
-  if (RARRAY(RARRAY(nslist)->ptr[i])->len == 2) {
-   rprefix = RARRAY(RARRAY(nslist)->ptr[i])->ptr[0];
-   ruri = RARRAY(RARRAY(nslist)->ptr[i])->ptr[1];
+  if (RARRAY(nslist)->len == 2) {
+   rprefix = RARRAY(nslist)->ptr[0];
+   ruri = RARRAY(nslist)->ptr[1];
ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
   } else {
rb_raise(rb_eArgError, "nested array must be an array of strings, 
prefix and href/uri");
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Re: [libxml-devel] problem with UTF-16 encoding

2007-11-27 Thread Dan Janowski
Last night I could not see what could BE and LE stand for?! Well, of  
course, Big Endian and Little Endian. When there is no lead in to  
indicate, the encoding can specify.

Dan


On Nov 27, 2007, at 05:08, Tim Perrett wrote:

>> A few other notes about UTF-16 specifically; UTF-16 will result in a
>> two byte lead in, UTF-16BE will not, nor will UTF-16LE. These latter
>> encodings are not familiar, but may or may not be of interest.

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] problem with UTF-16 encoding

2007-11-27 Thread Erik Hollensbe

On Nov 27, 2007, at 6:42 AM, Dan Janowski wrote:

> Last night I could not see what could BE and LE stand for?! Well, of
> course, Big Endian and Little Endian. When there is no lead in to
> indicate, the encoding can specify.

That's what the byte order mark is for. When we were battling unicode  
issues at work, I found the wikipedia articles on the subject very  
helpful:

http://en.wikipedia.org/wiki/Unicode

is a good starter.

HTH,

-Erik
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Load external DTD true/false not working?

2007-11-27 Thread Paul Dlug

On Nov 26, 2007, at 9:34 PM, Dan Janowski wrote:

> Hi,
>
> You are at least half correct. xmlSubstituteEntitiesDefaultValue has
> nothing to do with DTD. However, while the _get method you have
> illustrated here makes reference to the wrong variable, the _set
> method does not suffer the same problem. So, while the script return
> value  interrogating the variable is not correct, the functionality
> should be. Does the DTD entity loading work when you set it?
>
> The correction is committed in svn #216

Two problems here

1) As I said in the original message, even changing that variable in  
the _get doesn't seem to cause it's value to change at (try the test I  
posted below).

2) Even set to false the DTD is still loaded when the document is  
parsed which does not appear to be correct behavior.

The real problem I'm trying to get around is a possible bug with XPath  
on documents that have DTD's specifying namespaces. This may be the  
same as another thread I just saw so I'll post my reply to that one.


Thanks,
Paul


> On Nov 26, 2007, at 16:18, Paul Dlug wrote:
>
>> It doesn't appear to me that the flag on XML::Parser
>> 'default_load_external_dtd" works.
>>
>> Looking at the source:
>>
>> VALUE
>> ruby_xml_parser_default_load_external_dtd_get(VALUE class) {
>>   if (xmlSubstituteEntitiesDefaultValue)
>> return(Qtrue);
>>   else
>> return(Qfalse);
>> }
>>
>> I think the variable to set here should be xmlLoadExtDtdDefaultValue,
>> not xmlSubstituteEntitiesDefaultValue.
>>
>> This can be verified with a small test:
>>
>> require 'xml/libxml'
>>
>> puts "Load DTD: #{XML::Parser.default_load_external_dtd}"
>> XML::Parser.default_load_external_dtd = true
>> puts "Load DTD: #{XML::Parser.default_load_external_dtd}"
>>
>> Which outputs (incorrectly I believe):
>>
>> Load DTD: false
>> Load DTD: false
>>
>> However, changing this variable still does not make the above test
>> case work and the DTD is still loaded when I parse the document.
>>
>> Any suggestions?
>>
>>
>> --Paul
>> ___
>> libxml-devel mailing list
>> libxml-devel@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/libxml-devel
>
> ___
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
>

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Specifying namespace on XPath?

2007-11-27 Thread Paul Dlug
I think I have a related bug that your patch doesn't fix. If I have a  
document with a DTD declaration specifying a namespace and an  
identical document without it the XPath expression finds the node in  
the document w/o DTD but not with the DTD. The attached test case  
illustrates the problem, to replicate:


1) Run dtdtest.rb, you will see that the test will fail being unable  
to find a node via XML::Node.find()


2) Comment out the ATTLIST spec in a.dtd and re-run, test will pass  
this time (or remove the DTD declaration from the file dtd.xml).



--Paul

On Nov 27, 2007, at 8:39 AM, keisuke fukuda wrote:


So, this should be the patch.

Index: ext/xml/ruby_xml_xpath.c
===
--- ext/xml/ruby_xml_xpath.c(revision 218)
+++ ext/xml/ruby_xml_xpath.c(working copy)
@@ -76,9 +76,9 @@
}
else {
  // tuples of prefix/uri
-  if (RARRAY(RARRAY(nslist)->ptr[i])->len == 2) {
-   rprefix = RARRAY(RARRAY(nslist)->ptr[i])->ptr[0];
-   ruri = RARRAY(RARRAY(nslist)->ptr[i])->ptr[1];
+  if (RARRAY(nslist)->len == 2) {
+   rprefix = RARRAY(nslist)->ptr[0];
+   ruri = RARRAY(nslist)->ptr[1];
   ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
  } else {
   rb_raise(rb_eArgError, "nested array must be an array of
strings, prefix and href/uri");
< 
xpath_ns_fix.patch.txt>___

libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel




a.dtd
Description: Binary data


Testing...
require 'xml/libxml'

doc1 = XML::Document.file('dtd.xml')
doc2 = XML::Document.file('nodtd.xml')

node1 = doc1.root.find_first('b')
puts "Node from doc w/ DTD declaration not found" unless node1

node2 = doc2.root.find_first('b')
puts "Node from doc w/o DTD declaration not found" unless node2

unless node1.eql?(node2)
  puts "Nodes do not match"
else
  puts "Nodes match"
end

puts "NODE1: #{node1}\nNODE2: #{node2}"

Testing...


___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Re: [libxml-devel] Specifying namespace on XPath?

2007-11-27 Thread Dan Janowski
Patch applied, svn #219. Note that 'p' of the .find result will not  
result in the xml segment that it used to in 0.3.8. The .find now  
returns an XPath::Object type and it has no to_s method defined. You  
can get the same effect by using .to_a on XPath::Object.

I had not looked closely enough at this code segment when I  
encapsulated the the namespace recursion. Thanks for the patch. You  
have credit in the svn log.

Dan

On Nov 27, 2007, at 08:39, keisuke fukuda wrote:

> So, this should be the patch.
>
> Index: ext/xml/ruby_xml_xpath.c
> ===
> --- ext/xml/ruby_xml_xpath.c(revision 218)
> +++ ext/xml/ruby_xml_xpath.c(working copy)
> @@ -76,9 +76,9 @@
>  }
>  else {
>// tuples of prefix/uri
> -  if (RARRAY(RARRAY(nslist)->ptr[i])->len == 2) {
> -   rprefix = RARRAY(RARRAY(nslist)->ptr[i])->ptr[0];
> -   ruri = RARRAY(RARRAY(nslist)->ptr[i])->ptr[1];
> +  if (RARRAY(nslist)->len == 2) {
> +   rprefix = RARRAY(nslist)->ptr[0];
> +   ruri = RARRAY(nslist)->ptr[1];
> ruby_xml_xpath_context_register_namespace(xxpc, rprefix,  
> ruri);
>} else {
> rb_raise(rb_eArgError, "nested array must be an array of
> strings, prefix and href/ 
> uri"); 
> ___
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Load external DTD true/false not working?

2007-11-27 Thread Dan Janowski
The method mapping was transposed and is fixed in svn #220

See if that works now.

Dan

On Nov 27, 2007, at 10:17, Paul Dlug wrote:

>
> On Nov 26, 2007, at 9:34 PM, Dan Janowski wrote:
>
>> Hi,
>>
>> You are at least half correct. xmlSubstituteEntitiesDefaultValue has
>> nothing to do with DTD. However, while the _get method you have
>> illustrated here makes reference to the wrong variable, the _set
>> method does not suffer the same problem. So, while the script return
>> value  interrogating the variable is not correct, the functionality
>> should be. Does the DTD entity loading work when you set it?
>>
>> The correction is committed in svn #216
>
> Two problems here
>
> 1) As I said in the original message, even changing that variable in
> the _get doesn't seem to cause it's value to change at (try the test I
> posted below).
>
> 2) Even set to false the DTD is still loaded when the document is
> parsed which does not appear to be correct behavior.
>
> The real problem I'm trying to get around is a possible bug with XPath
> on documents that have DTD's specifying namespaces. This may be the
> same as another thread I just saw so I'll post my reply to that one.
>
>
> Thanks,
> Paul
>
>
>> On Nov 26, 2007, at 16:18, Paul Dlug wrote:
>>
>>> It doesn't appear to me that the flag on XML::Parser
>>> 'default_load_external_dtd" works.
>>>
>>> Looking at the source:
>>>
>>> VALUE
>>> ruby_xml_parser_default_load_external_dtd_get(VALUE class) {
>>>   if (xmlSubstituteEntitiesDefaultValue)
>>> return(Qtrue);
>>>   else
>>> return(Qfalse);
>>> }
>>>
>>> I think the variable to set here should be  
>>> xmlLoadExtDtdDefaultValue,
>>> not xmlSubstituteEntitiesDefaultValue.
>>>
>>> This can be verified with a small test:
>>>
>>> require 'xml/libxml'
>>>
>>> puts "Load DTD: #{XML::Parser.default_load_external_dtd}"
>>> XML::Parser.default_load_external_dtd = true
>>> puts "Load DTD: #{XML::Parser.default_load_external_dtd}"
>>>
>>> Which outputs (incorrectly I believe):
>>>
>>> Load DTD: false
>>> Load DTD: false
>>>
>>> However, changing this variable still does not make the above test
>>> case work and the DTD is still loaded when I parse the document.
>>>
>>> Any suggestions?
>>>
>>>
>>> --Paul
>>> ___
>>> libxml-devel mailing list
>>> libxml-devel@rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/libxml-devel
>>
>> ___
>> libxml-devel mailing list
>> libxml-devel@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/libxml-devel
>>
>
> ___
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Load external DTD true/false not working?

2007-11-27 Thread Paul Dlug

On Nov 27, 2007, at 11:05 AM, Dan Janowski wrote:

> The method mapping was transposed and is fixed in svn #220
>
> See if that works now.

It's working great now. Thanks!


--Paul

> On Nov 27, 2007, at 10:17, Paul Dlug wrote:
>
>>
>> On Nov 26, 2007, at 9:34 PM, Dan Janowski wrote:
>>
>>> Hi,
>>>
>>> You are at least half correct. xmlSubstituteEntitiesDefaultValue has
>>> nothing to do with DTD. However, while the _get method you have
>>> illustrated here makes reference to the wrong variable, the _set
>>> method does not suffer the same problem. So, while the script return
>>> value  interrogating the variable is not correct, the functionality
>>> should be. Does the DTD entity loading work when you set it?
>>>
>>> The correction is committed in svn #216
>>
>> Two problems here
>>
>> 1) As I said in the original message, even changing that variable in
>> the _get doesn't seem to cause it's value to change at (try the  
>> test I
>> posted below).
>>
>> 2) Even set to false the DTD is still loaded when the document is
>> parsed which does not appear to be correct behavior.
>>
>> The real problem I'm trying to get around is a possible bug with  
>> XPath
>> on documents that have DTD's specifying namespaces. This may be the
>> same as another thread I just saw so I'll post my reply to that one.
>>
>>
>> Thanks,
>> Paul
>>
>>
>>> On Nov 26, 2007, at 16:18, Paul Dlug wrote:
>>>
 It doesn't appear to me that the flag on XML::Parser
 'default_load_external_dtd" works.

 Looking at the source:

 VALUE
 ruby_xml_parser_default_load_external_dtd_get(VALUE class) {
  if (xmlSubstituteEntitiesDefaultValue)
return(Qtrue);
  else
return(Qfalse);
 }

 I think the variable to set here should be
 xmlLoadExtDtdDefaultValue,
 not xmlSubstituteEntitiesDefaultValue.

 This can be verified with a small test:

 require 'xml/libxml'

 puts "Load DTD: #{XML::Parser.default_load_external_dtd}"
 XML::Parser.default_load_external_dtd = true
 puts "Load DTD: #{XML::Parser.default_load_external_dtd}"

 Which outputs (incorrectly I believe):

 Load DTD: false
 Load DTD: false

 However, changing this variable still does not make the above test
 case work and the DTD is still loaded when I parse the document.

 Any suggestions?


 --Paul
 ___
 libxml-devel mailing list
 libxml-devel@rubyforge.org
 http://rubyforge.org/mailman/listinfo/libxml-devel
>>>
>>> ___
>>> libxml-devel mailing list
>>> libxml-devel@rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/libxml-devel
>>>
>>
>> ___
>> libxml-devel mailing list
>> libxml-devel@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/libxml-devel
>
> ___
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
>

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


[libxml-devel] Disabling substitution of UTF-8 chars with entities

2007-11-27 Thread Paul Dlug
There is a serious inconsistency when "round tripping" XML containing  
UTF-8 characters. If you output the document to a string after parsing  
you get the UTF-8 back out, if you just grab a node and convert to a  
string you get UTF-8 characters substituted with entities:

utf8test.rb:

require 'xml/libxml'

xml = <
This is a UTF-8 pi: π
XML

parser = XML::Parser.new
parser.string = xml

doc = parser.parse

puts doc.to_s
puts doc.root.to_s


This outputs:


This is a UTF-8 pi: π
This is a UTF-8 pi: π


I would think that the behavior of to_s by default would be to write  
the XML out as a string just as it was parsed. Another variant should  
be provided if character conversion is desirable.


--Paul
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

[libxml-devel] Segmentation fault when add the cloned/copied node

2007-11-27 Thread optyk
hello,

I get segmentation fault when add the cloned/copied node to other
node,
script to problem reproduction below,

segv appears when use clone and copy methods,
what's interesting, with clone segv is thrown in div1.child_add(c)
line (see script)
but when use copy I get it in printf root statement, moreover copy
seems to work wrong only for text nodes, when use 't3' div everything
works fine

I get this error on 0.5.2.0, 0.5.2.1 and 0.5.2.2 (latest svn) version

it looks like fix is required in ruby-libxml code,

BTW. it looks also like ruby_xml_node_copy() in ruby_xml_node.c calls
xmlCopyNode() with wrong attributes, it should be 2 for shallow copy
and 1 for deep copy

regards,
Piotrek

 SCRIPT -
require 'xml/libxml'

str = <<-STR


werwerwerwerwer 

Quisque et diam dapibus nisi bibendum blandit.


a



STR


XML::Parser.default_keep_blanks = false
xp = XML::Parser.new
xp.string = str
doc = xp.parse

xpath = "//[EMAIL PROTECTED]'t1']"
div1 = doc.find(xpath).to_a[0]
printf "xxx div1: #{div1}\n"

xpath = "//[EMAIL PROTECTED]'t2']"
div2 = doc.find(xpath).to_a[0]
printf "xxx div2: #{div2}\n"


div2.each do |child|
#c = child.clone
c = child.copy(false)
div1.child_add(c)
end

printf "xxx root: #{doc.root}\n"


___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


[libxml-devel] Status of Patch #7758?

2007-11-27 Thread Paul Dlug
I see patch #7758 hasn't been worked on or updated since submission  
(long ago):
http://rubyforge.org/tracker/index.php?func=detail&aid=7758&group_id=494&atid=1973

This seems like a great idea and the new parse method solves  
eliminates the need for part of the patch I submitted   (#15807). Is  
there any interest in getting this into the current library? I would  
be happy to modify the patch to bring it up to date with the current  
trunk version. This would certainly create a much more user friendly  
API than what currently exists.


Thanks,
Paul
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Disabling substitution of UTF-8 chars with entities

2007-11-27 Thread Dan Janowski
The handling of encoding is not coherent in the extension, as my last  
patch on the topic illustrates. While I have no doubt that there are  
issues to resolve, in this particular instance I do not get the  
result you do.


Anyone wanting to look at the way encoding is handled is welcome to  
make a recommendation.


Dan

On Nov 27, 2007, at 11:41, Paul Dlug wrote:


There is a serious inconsistency when "round tripping" XML containing
UTF-8 characters. If you output the document to a string after parsing
you get the UTF-8 back out, if you just grab a node and convert to a
string you get UTF-8 characters substituted with entities:

utf8test.rb:

require 'xml/libxml'

xml = <
This is a UTF-8 pi: π
XML

parser = XML::Parser.new
parser.string = xml

doc = parser.parse

puts doc.to_s
puts doc.root.to_s


This outputs:


This is a UTF-8 pi: π
This is a UTF-8 pi: π


I would think that the behavior of to_s by default would be to write
the XML out as a string just as it was parsed. Another variant should
be provided if character conversion is desirable.


--Paul
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Re: [libxml-devel] Disabling substitution of UTF-8 chars with entities

2007-11-27 Thread Paul Dlug

On Nov 27, 2007, at 3:08 PM, Dan Janowski wrote:

> The handling of encoding is not coherent in the extension, as my  
> last patch on the topic illustrates. While I have no doubt that  
> there are issues to resolve, in this particular instance I do not  
> get the result you do.
>
> Anyone wanting to look at the way encoding is handled is welcome to  
> make a recommendation.

I just did a few more experiments, it seems I only get this on Mac OS  
X, it works just fine on FreeBSD and Linux (gentoo). I'll do some more  
digging to see if I can identify the cause.


--Paul

> On Nov 27, 2007, at 11:41, Paul Dlug wrote:
>
>> There is a serious inconsistency when "round tripping" XML containing
>> UTF-8 characters. If you output the document to a string after  
>> parsing
>> you get the UTF-8 back out, if you just grab a node and convert to a
>> string you get UTF-8 characters substituted with entities:
>>
>> utf8test.rb:
>>
>> require 'xml/libxml'
>>
>> xml = <> 
>> This is a UTF-8 pi: π
>> XML
>>
>> parser = XML::Parser.new
>> parser.string = xml
>>
>> doc = parser.parse
>>
>> puts doc.to_s
>> puts doc.root.to_s
>>
>>
>> This outputs:
>>
>> 
>> This is a UTF-8 pi: π
>> This is a UTF-8 pi: π
>>
>>
>> I would think that the behavior of to_s by default would be to write
>> the XML out as a string just as it was parsed. Another variant should
>> be provided if character conversion is desirable.
>>
>>
>> --Paul
>> ___
>> libxml-devel mailing list
>> libxml-devel@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/libxml-devel
>
> ___
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Re: [libxml-devel] Status of Patch #7758?

2007-11-27 Thread Dan Janowski
I see the merit in this kind of approach but it cannot conflict with  
the libxml work flow. I.e.:

instead of XML::Document.parse(xml) => Document
XML::Parser.parse(xml) => Document

If you want to update the patch for the current code base, I am  
willing to apply and eval it.

Dan


On Nov 27, 2007, at 13:48, Paul Dlug wrote:

> I see patch #7758 hasn't been worked on or updated since submission
> (long ago):
> http://rubyforge.org/tracker/index.php? 
> func=detail&aid=7758&group_id=494&atid=1973
>
> This seems like a great idea and the new parse method solves
> eliminates the need for part of the patch I submitted   (#15807). Is
> there any interest in getting this into the current library? I would
> be happy to modify the patch to bring it up to date with the current
> trunk version. This would certainly create a much more user friendly
> API than what currently exists.
>
>
> Thanks,
> Paul
> ___
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel

___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


Re: [libxml-devel] Status of Patch #7758?

2007-11-27 Thread Paul Dlug


On Nov 27, 2007, at 3:26 PM, Dan Janowski wrote:


I see the merit in this kind of approach but it cannot conflict with
the libxml work flow. I.e.:

instead of XML::Document.parse(xml) => Document
XML::Parser.parse(xml) => Document

If you want to update the patch for the current code base, I am
willing to apply and eval it.


I updated the original patch from Tobias to work with the current  
subversion trunk (220). I made the suggested modification above so  
it's XML::Parser.parse(xml) rather than XML::Document.parse -- though  
I do think XML::Document.parse is a little bit of a cleaner API.


I also found a bug with namespace assignments, if you assign a  
namespace to a node not associated with a document it segfaults:


doc = XML::Document.new
node = XML::Node.new('root')
node.namespace = "t:test"

I'm not sure what the best way to fix this is since I'm not the  
familiar with the namespace code at this point.



Thanks,
Paul



libxml-patched.tar.gz
Description: GNU Zip compressed data






On Nov 27, 2007, at 13:48, Paul Dlug wrote:


I see patch #7758 hasn't been worked on or updated since submission
(long ago):
http://rubyforge.org/tracker/index.php?
func=detail&aid=7758&group_id=494&atid=1973

This seems like a great idea and the new parse method solves
eliminates the need for part of the patch I submitted   (#15807). Is
there any interest in getting this into the current library? I would
be happy to modify the patch to bring it up to date with the current
trunk version. This would certainly create a much more user friendly
API than what currently exists.


Thanks,
Paul
___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel


___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel



___
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel