Skip to content

Commit

Permalink
parsing in the context of a document is OK
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jun 18, 2010
1 parent d4df96e commit 7db0429
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Bugfixes

* XML::NodeSet#{include?,delete,push} accept an XML::Namespace
* XML::Document#parse added for parsing in the context of a document

=== 1.4.2 / 2010/05/22

Expand Down
2 changes: 1 addition & 1 deletion lib/nokogiri/html/document_fragment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DocumentFragment < Nokogiri::XML::DocumentFragment
def self.parse tags
doc = HTML::Document.new
doc.encoding = 'UTF-8'
self.new(doc, tags)
new(doc, tags)
end

def initialize document, tags = nil, ctx = nil
Expand Down
3 changes: 1 addition & 2 deletions lib/nokogiri/xml/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module XML
#
# For searching a Document, see Nokogiri::XML::Node#css and
# Nokogiri::XML::Node#xpath
class Document < Node
class Document < Nokogiri::XML::Node
##
# Parse an XML file. +thing+ may be a String, or any object that
# responds to _read_ and _close_ such as an IO, or StringIO.
Expand Down Expand Up @@ -172,7 +172,6 @@ def fragment tags = nil
undef_method :swap, :parent, :namespace, :default_namespace=
undef_method :add_namespace_definition, :attributes
undef_method :namespace_definitions, :line, :add_namespace
undef_method :parse, :in_context

def add_child child
raise "Document already has a root node" if root
Expand Down
6 changes: 0 additions & 6 deletions test/xml/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ def test_root_set_to_nil
assert_equal nil, @xml.root
end

def test_parse_should_not_exist
assert_raises(NoMethodError) do
@xml.parse("foo")
end
end

def test_collect_namespaces
doc = Nokogiri::XML(<<-eoxml)
<xml>
Expand Down

0 comments on commit 7db0429

Please sign in to comment.