Nokogiri::XML methods example

80 views
Skip to first unread message

Love U Ruby

unread,
Jun 4, 2013, 1:12:29 AM6/4/13
to rubyonra...@googlegroups.com
Hi,


I am not able to find out a simple example to find out the how the
method works:

> Nokogiri::XML::EntityReference::new
(http://nokogiri.org/Nokogiri/XML/EntityReference.html#method-c-new)

> Nokogiri::XML::Document#canonicalize
(http://nokogiri.org/Nokogiri/XML/Document.html#method-i-canonicalize)

Thanks

--
Posted via http://www.ruby-forum.com/.

Eduardo Figarola

unread,
Jun 4, 2013, 1:23:00 PM6/4/13
to rubyonra...@googlegroups.com
Hi, the examples will be atached to the answer, I hope you can get a
better idea of this methods.

Regards,
Eduardo Figarola.

Attachments:
http://www.ruby-forum.com/attachment/8472/test3.rb

Love U Ruby

unread,
Jun 5, 2013, 2:10:16 PM6/5/13
to rubyonra...@googlegroups.com
Eduardo Figarola wrote in post #1111343:
> Hi, the examples will be atached to the answer, I hope you can get a
> better idea of this methods.
>
> Regards,
> Eduardo Figarola.


can anyone tell me what the wrong I did here?

node = Nokogiri::XML::Node.new( <p>This text contains
<sup>superscript</sup> text.</p>, doc) # !> possibly useless use of a
variable in void context
node.description # =>
# ~> -:77: syntax error, unexpected '<', expecting ')'
# ~> ...de = Nokogiri::XML::Node.new( <p>This text contains <sup>sup...
# ~> ... ^
# ~> -:77: syntax error, unexpected tIDENTIFIER, expecting keyword_do or
'{' or '('
# ~> ...ri::XML::Node.new( <p>This text contains <sup>superscript</s...
# ~> ... ^
# ~> -:77: unknown regexp option - p
# ~> -:77: syntax error, unexpected ','
# ~> ...up>superscript</sup> text.</p>, doc)
# ~> ... ^

Colin Law

unread,
Jun 5, 2013, 3:49:03 PM6/5/13
to rubyonra...@googlegroups.com
On 5 June 2013 19:10, Love U Ruby <li...@ruby-forum.com> wrote:
> Eduardo Figarola wrote in post #1111343:
>> Hi, the examples will be atached to the answer, I hope you can get a
>> better idea of this methods.
>>
>> Regards,
>> Eduardo Figarola.
>
>
> can anyone tell me what the wrong I did here?
>
> node = Nokogiri::XML::Node.new( <p>This text contains

I expect you meant the first parameter passed to new to be a string,
so it needs quotes round it
.new("<p>......"

Colin

> <sup>superscript</sup> text.</p>, doc) # !> possibly useless use of a
> variable in void context
> node.description # =>
> # ~> -:77: syntax error, unexpected '<', expecting ')'
> # ~> ...de = Nokogiri::XML::Node.new( <p>This text contains <sup>sup...
> # ~> ... ^
> # ~> -:77: syntax error, unexpected tIDENTIFIER, expecting keyword_do or
> '{' or '('
> # ~> ...ri::XML::Node.new( <p>This text contains <sup>superscript</s...
> # ~> ... ^
> # ~> -:77: unknown regexp option - p
> # ~> -:77: syntax error, unexpected ','
> # ~> ...up>superscript</sup> text.</p>, doc)
> # ~> ... ^
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/df4836c77d48b5dae009cc8a04a17dac%40ruby-forum.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages