diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a84cc9c7..be61ef31 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,6 +7,7 @@ on: - 'docs/**' - 'lib/**' - 'ext/**' + - 'CHANGELOG.md' - 'zensical.toml' - '.github/workflows/docs.yml' workflow_dispatch: @@ -47,7 +48,7 @@ jobs: run: zensical build --clean - name: Build API reference - run: rdoc --format aliki --output site/reference --title 'LibXML Ruby API' --line-numbers --charset=utf-8 --exclude lib/xml.rb --exclude lib/xml/libxml.rb --main README.md ext/**/libxml.c ext/**/ruby_xml.c ext/**/*.c lib/**/*.rb README.md + run: rdoc --format aliki --output site/reference --title 'LibXML Ruby API' --line-numbers --charset=utf-8 --main README.md ext/**/libxml.c ext/**/ruby_xml.c ext/**/*.c lib/**/*.rb README.md - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dc3ea42..b9b70994 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,17 @@ This release is a major refresh of libxml-ruby. The most important changes inclu * Brand-new documentation site available at https://xml4r.github.io/libxml-ruby/ with guides on parsing, XPath, validation, the Writer API, and the internal architecture * Updated reference documentation to Ruby's new Aliki theme * Expanded tests + * Finally removed require 'xml' which has been deprecated for a very long time -The release also include a number of smaller improvements, including: +Breaking changes: + +* Remove deprecated Document methods: dump, format_dump, debug_dump, debug_dump_head, debug_format_dump, reader +* Remove deprecated Parser.register_error_handler (use Error.set_handler) +* Remove deprecated HTMLParser#file=, #io=, #string= (use class methods HTMLParser.file, .io, .string) +* Remove deprecated require paths: require 'libxml', require 'xml/libxml', and require 'xml' (use require 'libxml-ruby') +* Fix misspelled Schema::Type#annonymus_subtypes -> anonymous_subtypes + +The release also includes a number of smaller improvements, including: * Support Ruby 4.0 (no changes were required) * Fix RelaxNG factories to raise on parse failure instead of wrapping NULL @@ -24,6 +33,10 @@ The release also include a number of smaller improvements, including: * Remove dead Float::INFINITY definition for Ruby 1.8.7 * Add mswin CI job using vcpkg for libxml2 * Minimum Ruby version is now 3.2 +* Revert require_relative back to require for loading the C extension (fixes #226) +* Allow nil for external and system IDs when creating a DTD (fixes #215) +* Fix C14N document subset canonicalization with namespace nodes +* Enable W3C C14N spec tests 3.5 (entity references) and 3.7 (document subsets) * Rename HISTORY to CHANGELOG.md, README.rdoc to README.md == 5.0.6 / 2026-04-03 @@ -159,11 +172,10 @@ The release also include a number of smaller improvements, including: (Charlie Savage) * Change XML::Reader.expand API. Previously it would automatically instantiate a reader document so - the an xpath expression could be used to search the returned node. Now you should first call + an xpath expression could be used to search the returned node. Now you should first call reader.doc (Charlie Savage) * Update Visual Studio project for Visual Studio 15 - requires ruby 2.4+ (Charlie Savage) - * Remove APIs that have been deprecated for several years (Charlie Savage) == 2.9.0 / 2016-06-13 Charlie Savage @@ -171,10 +183,10 @@ The release also include a number of smaller improvements, including: * Revamp libxml-ruby's memory management to not cause crashes when used with Nokogiri (James Laird-Wah) * Fix garbage collection issue that sometimes caused the library to hang (Charlie Savage) * Improved multi-threading support (Charlie Savage) -* Fix crash sometimes caused by a xml node being being freed twice (Charlie Savage) +* Fix crash sometimes caused by an xml node being freed twice (Charlie Savage) * Fix memory leak when setting the text content of a node (Charlie Savage) * Set a default task in the Rakefile - use "test" (Robert Haines) -* Add "hanna_gudao" gem and add "rake-compiler" to develpoment dependencies (Robert Haines) +* Add "hanna_gudao" gem and add "rake-compiler" to development dependencies (Robert Haines) * Use Process.getrlimit instead of `ulimit` in the tests (Robert Haines) * Build on smartos (Steven Williamson) * Fix compiler warnings (Charlie Savage) @@ -225,12 +237,10 @@ The release also include a number of smaller improvements, including: == 2.4.0 / 2012-12-14 Charlie Savage * Support libxml 2.9.0 (Daniel Veillard) - -* Extensive new interfaces for xml schema functionality including suppor for - schemal elements, types, facets and attributes (Anton Sozontov) +* Extensive new interfaces for xml schema functionality including support for + schema elements, types, facets and attributes (Anton Sozontov) * Fix Encoding#from_s bug and update docs (Nikita Afanasenko) - * Node#content= encoding (Nikita Afanasenko) == 2.3.3 / 2012-07-01 Charlie Savage @@ -250,7 +260,6 @@ The release also include a number of smaller improvements, including: == 2.3.0 / 2012-03-18 Charlie Savage * Add ability to insert new PI-nodes into the xmltree (Axel Struebing). - * Added full pass-through access to libxml2 xmlC14NDocDumpMemory method via LibXML::XML::Document#canonicalize method with optional arguments. @@ -277,7 +286,7 @@ Fixes GitHub issue #30. allow the underlying io stream (file, string, etc) to be closed. Once a parser is done parsing its data, it now calls one of these methods. This means that if you parse thousands of files at the same time, - without running Ruby's garbage colllector, you won't get a too + without running Ruby's garbage collector, you won't get a too many files open error. Fixes GitHub issue #29. * Fixed bug where Node#inner_xml caused an error when it had no child nodes. @@ -310,17 +319,13 @@ Fixes GitHub issue #30. == 2.1.0 / 2011-07-31 Charlie Savage -* Ruby 1.9.3 compatability (Charlie Savage). - +* Ruby 1.9.3 compatibility (Charlie Savage). * Added XPath expression <-> Ruby value conversion methods (Jens Wille). - * Extracted rxml_xpath_to_value from rxml_xpath_context_find (Jens Wille). - * Adapted rxml_xpath_from_value from Gregoire Lejeune's ruby-xslt library, see https://github.com/glejeune/ruby-xslt (Jens Wille). * Allow calling #find on nodes returned from Reader (Charlie Savage). - * Change document handling in XPath::Context to address segmentation fault on Ruby Enterprise Edition (Charlie Savage). @@ -328,7 +333,6 @@ Fixes GitHub issue #30. repository to be used as gem (Charlie Savage). * Support gem buld (Charlie Savage). - * Simplify memory management of attributes namespaces to fix segmentation faults that occurred when using Ruby 1.9.3 (Charlie Savage). @@ -336,7 +340,6 @@ Fixes GitHub issue #30. == 2.0.8 / 2011-06-23 Charlie Savage * Add in 2 new HTML Parser constants - NODEFDTD and NOIMPLIED. - * Fix compile issue on Ruby 1.9.3 == 2.0.6 / 2011-05-23 Charlie Savage @@ -376,26 +379,17 @@ Fixes GitHub issue #30. segmentation faults caused by freeing a node twice (Charlie Savage). * Add support for Document#canonicalization (Victor Lin). - * Fix memory leak in Reader#lookup_namespace (Charlie Savage). - * Fix memory leak in Reader#[] (Nathan Kriege). - * Fix usage of @io instance variable (Jeffrey Taylor) - * Removed old sax error handling code that has been fixed in newer versions of libxml (Charlie Savage). * Code cleanup - remove unused variables and commented out code (Charlie Savage) - * Minor text changes and documentation fixes (Charlie Savage). - * Fix documentation error (fixes RubyForge #26888). - * Update documentation for Document#validation* methods (fixes RubyForge #24833). - * Update documentation and test (fixes Ruby Forge Issue #28770). - * Updated documentation in README (Anurag Priyam): 1. rake doc does not work; use rake rdoc. 2. gem mislav-hanna does not exist; use hanna. @@ -404,13 +398,11 @@ Fixes GitHub issue #30. 5. Point to the github (gh-pages) site for docs * Add tc_error to test suite (Charlie Savage). - * Add sax test (Stanislav O.Pogrebnyak). == 2.0.2 / 2011-04-17 Charlie Savage * Added binaries for windows (Charlie Savage). - * Update Ruby 1.9 encoding handling to support libxml versions older than version 2.6.26 which was released on June 6, 2006 (Charlie Savage). @@ -418,16 +410,12 @@ Fixes GitHub issue #30. website and docs (Anurag Priyam). * Correctly copy the documentation directory (Anurag Priyam) - * Use relative link for rdoc so the links are correct on both rubyforge and github (Anurag Priyam). * Update Rakefile to use Hanna RDco template (Charlie Savage). - * Update dates on license file (Charlie Savage). - * Add api to allow setting of attribute namespaces. Fixes issue #10 (Charlie Savage). - * Remove old hack to call the on_error method. This hack isn't needed anymore since a better workaround was put in place in the parser context. Fixes This fixes issue #12 (Charlie Savage). @@ -437,7 +425,6 @@ Fixes GitHub issue #30. issue #6 (Charlie Savage). * Fix up comment in Document and Node. See issue #8 (Charlie Savage). - * Update website text (Charlie Savage). == 2.0.0 / 2011-04-16 Charlie Savage @@ -446,23 +433,16 @@ Fixes GitHub issue #30. Strings returned by the libxml bindings are now set to the encoding of the underlying xml document (Charlie Savage). -* Rubinius compatability. Removed unnecessary use of RHASH_TBL (Aman Gupta) - +* Rubinius compatibility. Removed unnecessary use of RHASH_TBL (Aman Gupta) * Added .gemspec file (Dudley Flanders). - * Updated Windows checks to take into account mingw32 (Yaohan Chen). - * Fix memory leak in Reader#Expand (Szymon Nowak). - * Fix memory leaks in Reader#read_string, Reader#read_inner_xml and Reader#read_outer_xml (Sean Geoghegan). * Node#space_preserve= was backwards (Dudley Flanders) - * Fixed typo in readme, added rdoc extension (Loren Sands-Ramshaw). - * Switched to Rake Compiler (Charlie Savage). - * Use xmlMalloc() memory for ctxt->sax structure. Sometimes the ctxt->sax pointer may not be zeroed in rxml_sax_parser_parse(), for example when exception is raised in one of callbacks. This lets xmlFreeParserCtxt() clean this up (Alexey I. Froloff). @@ -479,16 +459,12 @@ Fixes GitHub issue #30. feature that allows parsers to reuse previously parsed strings. * Fix XML::Node#remove! to work correctly with libxml's dictionary feature. - * Correctly set up parser context options. - * Simplify DOM modification code (Node#next=, Node#prev=, Node#sibling=) and update documentation. * Deprecated Node#add_child and Node#child=, use Node#<< instead - * Fix documentation for Node#<< - * Added Document#import to enable moving nodes from one document to another document. @@ -496,7 +472,6 @@ Fixes GitHub issue #30. == 1.1.2 / 2009-03-12 Charlie Savage * Added XML::Node#inner_xml helper method. - * Fix segmentation that could occur when calling the mark function on a previously freed node. @@ -520,9 +495,9 @@ Fixes GitHub issue #30. == 0.9.9 / 2009-03-05 Charlie Savage -* Ruby 1.9.1 support (Charlie Savage). libxml-ruby now compiles and runs on either +* Ruby 1.9.1 support (Charlie Savage). libxml-ruby now compiles and runs on 1.8.6 and 1.9.1. With 1.8.6 all tests should pass while on 1.9.1 all but - for encoding tests pass. The port to Ruby 1.9.1 revealed two memory + encoding tests pass. The port to Ruby 1.9.1 revealed two memory allocation bugs (one with dtds, one with nodes) which are now fixed. * Better OS X support (Joe Khoobyar). The default version of libxml2 @@ -540,11 +515,8 @@ Fixes GitHub issue #30. See http://rubyforge.org/pipermail/libxml-devel/2009-February/001375.html. * Add Document#xhtml? and document#node_type methods (Joe Khoobyar) - * Add XPath::Object#last (Joe Khoobyar) - * Provide finer control over CDATA nodes on a parser by parser basis (Joe Khoobyar). - * Bug fix - Namespaces were incorrectly merged with attributes in the new sax2 handler (Charlie Savage). @@ -552,11 +524,8 @@ Fixes GitHub issue #30. that call remove! (Charlie Savage) * Bug fix - If reader.node is NULL, return nil instead of crashing (Charlie Savage) - * Bug fix - Dtd's owned by documents were freed twice in some circumstances (Joe Khoobyar). - * Bug fix - Fix output escaping on attributes nodes (Joe Khoobyar). - * Bug fix - Make sure IO objects are not garbage collected when used as parser sources (Charlie Savage). @@ -598,13 +567,9 @@ Fixes GitHub issue #30. segmentation faults when the error is reraised. * Added XML::Reader#node method. - * Fixed compile errors on OS X which uses an older version of libxml. - * Fixed memory leak when performing XPath searches. - * Fixed rdocs. - * Don't override libxml's default settings for entity substitution and loading external DTDs. This may break some code - you may need to add in a call to XML.default_substitute_entities = true or @@ -633,7 +598,6 @@ Fixes GitHub issue #30. for more information. * Fix compilation bugs on Solaris. - * Fix Rdoc compilation bug. @@ -657,18 +621,15 @@ Fixes GitHub issue #30. its unlikely anyone is using it. * Rationalized XML::Document#debug, XML::Node#debug, XML::XPath::XPathObject#Debug. - * Deprecated a number of duplicate dump* and debug_* methods in XML::Document and XML::Node. -* Additional Ruby 1.9.1 compatability fixes. - +* Additional Ruby 1.9.1 compatibility fixes. * Cleaned up header file guards. == 0.9.5 / 2008-11-29 Charlie Savage -* Ruby 1.9.1 preview release compatability (Felipe Contreras) - +* Ruby 1.9.1 preview release compatibility (Felipe Contreras) * Update Node#remove! to return the removed node and to set its document to nil. This allows the node to be either moved to another document, another part of the same document @@ -679,11 +640,8 @@ Fixes GitHub issue #30. RegExp#compile. * Update Node to use standard ruby allocators and initializers. - * Update HTML parser to be more forgiving of invalid documents. - * Update include paths for Darwin Ports on OS X. - * Updated C code base to use BSD/Allman style @@ -693,7 +651,6 @@ Fixes GitHub issue #30. streams. * Update HTML parser to support user specified encodings. - * Additional C code cleanup. == 0.9.3 / 2008-11-22 Charlie Savage @@ -702,9 +659,7 @@ Fixes GitHub issue #30. before xpath results that referenced the document (take 2). * Allowed sax parser to use io stream - * Combined encoding and input classes - * Cleaned up C code - removed remaining legacy structures, added static to most methods, changed C namespace from ruby_xml to rxml @@ -712,13 +667,11 @@ Fixes GitHub issue #30. == 0.9.2 / 2008-11-19 Charlie Savage * Add support for compiled XPath expressions (donated by Pavel Valodzka) - * Fixes for compiling on OS X 10.5.4 and 10.5.5 == 0.9.1 / 2008-11-18 Charlie Savage * Expose LibXML's encoding support via a new Encoding object. - * Revamp error handling to be much easier to use. Errors are now wrapped by the new XML::Error class and are thrown as exceptions when it is appropriate. @@ -727,9 +680,7 @@ Fixes GitHub issue #30. before xpath results that referenced the document. * Add Node#register_default_namespace to simplify default namespace handling. - * Significantly improve documentation - * A number of bug fixes and patches. == 0.9.0 / 2008-11-18 Charlie Savage @@ -750,83 +701,54 @@ Fixes GitHub issue #30. from 0.8.0 and 0.8.1 and may require updating your code. * Support RelaxNG validation (thanks to Morus Walter) - * Support passing IO objects to XmlReaders (thanks to Tom Hughes) - * Fix segmentation fault caused by adding an attribute to a CDATA node - * Moved node checking functions from C to Ruby - * Improved Windows support - libxml-ruby should now work out of the box. - * Improved Windows support - turned on libxml's zlib and iconv support. == 0.8.1 / 2008-07-09 Charlie Savage -* Reimplmented Node#each_attr for backwards compatability - +* Reimplemented Node#each_attr for backwards compatibility * Moved node type test to Ruby. == 0.8.0 / 2008-07-09 Charlie Savage * Fixed bug in returning attributes from XPath results - * Fixed DOM traversal methods - * Changed Node#children to return an array of nodes - * Fixed bug in returning attributes from XPath results - * Refactored XPath support, providing more user hooks in the XPath::Context class - * Added Node#properties for backwards compatibility - * Updated setup.rb - * Added more tests - * Updated rdocs and README file - * Moved libxml into LibXML namespace == 0.7.0 / 2008-07-09 Charlie Savage * Added new attributes class to provide a more natural way of working with attributes - * Fixed XML::Attr to better support namespaces - * Added documentation on how to use namespaces with XPath - * Removed allocation of extraneous structures used to wrap nodes, namespaces and attributes - * Cleaned up tests and added new test suite - * Updated rdocs and README file - * Cleaned out most of the bug list == 0.6.0 / 2008-07-01 Charlie Savage * Fixed memory allocation errors in Windows. On Windows, it is essential that the same library that allocates memory must free it. Thus ALLOC calls must be matched to ruby_xfree calls, which they were not. In addition, in one case Ruby was allocating memory to be freed by libxml. On Windows, that's a segmentation fault. On Linux it might fly, but still seems like a bad idea. - * Fixed segmentation fault in xml reader expand (same xml tree freed twice) - * Applied a number of patches from Tom Bagby, including fixes for xpath segmentation faults and fixes for various memory leaks - * Cleaned up a number of compiler warnings - * Renamed libxml_so.so to libxml_ruby.so (same for xslt). That wasn't actually my original intention, but um, it kind of sort of happened. It should not be noticeable from an end-user perspective. - * Added rake files for building with MingW - * Added rake files for packing gems. Note that I did this outside the existing rake tasks because I didn't see how they were actually building the gems. - * Cleaned up the tests and added a few more based on bug reports from the Tracker and mailing list. - * Cleaned out the patch queue and went through about 1/2 the bug list @@ -939,7 +861,7 @@ Fixes GitHub issue #30. === 2003-12-30 "Martin Povolny" * ruby_xml_dtd.c, ruby_xml_dtd.h, ruby_xml_schema.c, ruby_xml_schema.h: - prelimitary support for dtd and schema validation + preliminary support for dtd and schema validation === 2003-09-15 "Martin Povolny" @@ -950,7 +872,4 @@ Fixes GitHub issue #30. === 2003-08-01 "Martin Povolny" * ruby_xml_document.c: corrected argument handling in ruby_xml_document_find -* ruby_xml_node.c: corrected argument handling in ruby_xml_node_find - - - +* ruby_xml_node.c: corrected argument handling in ruby_xml_node_find \ No newline at end of file diff --git a/README.md b/README.md index ac076b62..e9116587 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,14 @@ see the additional configuration options.) This may be done with RubyGems: ``` -gem install libxml-ruby -- --with-xml2-dir=/path/to/xml2-config +gem install libxml-ruby -- --with-xml2-config=/path/to/xml2-config ``` Or bundler: ``` bundle config build.libxml-ruby --with-xml2-config=/path/to/xml2-config -bundle install libxml-ruby +bundle install ``` Full documentation is available at [xml4r.github.io/libxml-ruby](https://xml4r.github.io/libxml-ruby/) including a [getting started](https://xml4r.github.io/libxml-ruby/getting_started/) guide. diff --git a/Rakefile b/Rakefile index a8954a9c..2dcdc0e6 100644 --- a/Rakefile +++ b/Rakefile @@ -68,7 +68,6 @@ RDoc::Task.new("rdoc") do |rdoc| 'README.md', 'CHANGELOG.md', 'LICENSE') - rdoc.rdoc_files.exclude('lib/xml.rb', 'lib/xml/libxml.rb') end # Test Task diff --git a/docs/getting_started.md b/docs/getting_started.md index 9fbe11b0..36b07447 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -2,22 +2,14 @@ ## Requiring the Library -There are several ways to load libxml-ruby: - ```ruby -# Recommended - keeps everything under the LibXML namespace require 'libxml-ruby' document = LibXML::XML::Document.new ``` -```ruby -# Convenience - mixes LibXML into the global namespace -require 'xml' -document = XML::Document.new -``` +If you prefer shorter names, include the LibXML module in your own namespace: ```ruby -# In your own namespace require 'libxml-ruby' module MyApp diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 51f59c7e..fb69549a 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -9,18 +9,6 @@ VALUE mLibXML; -static void rxml_init_memory(void) -{ - /* Disable for now - broke attributes. - xmlGcMemSetup( - (xmlFreeFunc)ruby_xfree, - (xmlMallocFunc)ruby_xmalloc, - (xmlMallocFunc)ruby_xmalloc, - (xmlReallocFunc)ruby_xrealloc, - (xmlStrdupFunc)ruby_strdup - );*/ -} - void Init_libxml_ruby(void) { /* The libxml gem provides Ruby language bindings for GNOME's Libxml2 @@ -40,12 +28,11 @@ void Init_libxml_ruby(void) * copyright and distribution information. */ - // Seutp for threading. http://xmlsoft.org/threads.html + // Setup for threading. http://xmlsoft.org/threads.html xmlInitParser(); mLibXML = rb_define_module("LibXML"); - rxml_init_memory(); rxml_init_registry(); rxml_init_xml(); rxml_init_io(); diff --git a/ext/libxml/ruby_libxml.h b/ext/libxml/ruby_libxml.h index ca0c3bb4..95c0bd25 100644 --- a/ext/libxml/ruby_libxml.h +++ b/ext/libxml/ruby_libxml.h @@ -24,7 +24,6 @@ #include "ruby_xml_html_parser_options.h" #include "ruby_xml_html_parser_context.h" #include "ruby_xml_reader.h" -#include "ruby_xml_writer.h" #include "ruby_xml_sax2_handler.h" #include "ruby_xml_sax_parser.h" #include "ruby_xml_writer.h" diff --git a/ext/libxml/ruby_xml_cbg.c b/ext/libxml/ruby_xml_cbg.c deleted file mode 100644 index ea9fcca8..00000000 --- a/ext/libxml/ruby_xml_cbg.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "ruby_libxml.h" -#include -#include - -/* - int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, - xmlInputOpenCallback openFunc, - xmlInputReadCallback readFunc, - xmlInputCloseCallback closeFunc); - - - int (*xmlInputMatchCallback) (char const *filename); - void* (*xmlInputOpenCallback) (char const *filename); - int (*xmlInputReadCallback) (void *context, - char *buffer, - int len); - int (*xmlInputCloseCallback) (void *context); - */ - -typedef struct deb_doc_context -{ - char *buffer; - char *bpos; - int remaining; -} deb_doc_context; - -int deb_Match(char const *filename) -{ - fprintf(stderr, "deb_Match: %s\n", filename); - if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6)) - { - return (1); - } - return (0); -} - -void* deb_Open(char const *filename) -{ - deb_doc_context *deb_doc; - VALUE res; - - deb_doc = (deb_doc_context*) malloc(sizeof(deb_doc_context)); - - res = rb_funcall(rb_funcall(rb_mKernel, rb_intern("const_get"), 1, - rb_str_new2("DEBSystem")), rb_intern("document_query"), 1, rb_str_new2(filename)); - deb_doc->buffer = strdup(StringValuePtr(res)); - //deb_doc->buffer = strdup("serepes"); - - deb_doc->bpos = deb_doc->buffer; - deb_doc->remaining = (int)strlen(deb_doc->buffer); - return deb_doc; -} - -int deb_Read(void *context, char *buffer, int len) -{ - deb_doc_context *deb_doc; - int ret_len; - deb_doc = (deb_doc_context*) context; - - if (len >= deb_doc->remaining) - { - ret_len = deb_doc->remaining; - } - else - { - ret_len = len; - } - deb_doc->remaining -= ret_len; - strncpy(buffer, deb_doc->bpos, ret_len); - deb_doc->bpos += ret_len; - - return ret_len; -} - -int deb_Close(void *context) -{ - free(((deb_doc_context*) context)->buffer); - free(context); - return 1; -} - -void deb_register_cbg(void) -{ - xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close); -} diff --git a/ext/libxml/ruby_xml_document.c b/ext/libxml/ruby_xml_document.c index 2d33a1ee..d51511b2 100644 --- a/ext/libxml/ruby_xml_document.c +++ b/ext/libxml/ruby_xml_document.c @@ -275,42 +275,50 @@ rxml_document_canonicalize(int argc, VALUE *argv, VALUE self) //o_ns_prefixes will free at end of block o_nodes = rb_hash_aref(option_hash, ID2SYM(rb_intern("nodes"))); - if (!NIL_P(o_nodes)) + if (!NIL_P(o_nodes)) { - int i; - int p = 0; // index of pointer array - VALUE * list_in = NULL; - long node_list_size = 0; - if (CLASS_OF(o_nodes) == cXMLXPathObject) { - o_nodes = rb_funcall(o_nodes, rb_intern("to_a"), 0); + /* Use the raw xmlNodeSet directly to preserve namespace nodes + which cannot survive a roundtrip through Ruby objects */ + rxml_xpath_object *rxpop; + TypedData_Get_Struct(o_nodes, rxml_xpath_object, &rxml_xpath_object_data_type, rxpop); + if (rxpop->xpop->nodesetval) + { + nodeset.nodeNr = rxpop->xpop->nodesetval->nodeNr; + nodeset.nodeMax = rxpop->xpop->nodesetval->nodeMax; + nodeset.nodeTab = rxpop->xpop->nodesetval->nodeTab; + } } else { - Check_Type(o_nodes, T_ARRAY); - } - list_in = RARRAY_PTR(o_nodes); - node_list_size = RARRAY_LEN(o_nodes); + int i; + int p = 0; + VALUE *list_in = NULL; + long node_list_size = 0; - for (i=0; i < node_list_size; ++i) - { - if (p >= C14N_NODESET_LIMIT) { break; } + Check_Type(o_nodes, T_ARRAY); + list_in = RARRAY_PTR(o_nodes); + node_list_size = RARRAY_LEN(o_nodes); - if (RTEST(list_in[i])) + for (i=0; i < node_list_size; ++i) { - xmlNodePtr node_ptr; - TypedData_Get_Struct(list_in[i], xmlNode, &rxml_node_data_type, node_ptr); - node_ptr_array[p] = node_ptr; - p++; + if (p >= C14N_NODESET_LIMIT) { break; } + + if (RTEST(list_in[i])) + { + xmlNodePtr node_ptr; + TypedData_Get_Struct(list_in[i], xmlNode, &rxml_node_data_type, node_ptr); + node_ptr_array[p] = node_ptr; + p++; + } } - } - // Need to set values in nodeset struct - nodeset.nodeNr = (node_list_size > C14N_NODESET_LIMIT ? - C14N_NODESET_LIMIT : - (int)node_list_size); - nodeset.nodeTab = node_ptr_array; + nodeset.nodeNr = (node_list_size > C14N_NODESET_LIMIT ? + C14N_NODESET_LIMIT : + (int)node_list_size); + nodeset.nodeTab = node_ptr_array; + } } }//option_hash diff --git a/ext/libxml/ruby_xml_dtd.c b/ext/libxml/ruby_xml_dtd.c index 2918fb02..0710b221 100644 --- a/ext/libxml/ruby_xml_dtd.c +++ b/ext/libxml/ruby_xml_dtd.c @@ -183,11 +183,17 @@ static VALUE rxml_dtd_initialize(int argc, VALUE *argv, VALUE self) VALUE name, doc, internal; rb_scan_args(argc, argv, "23", &external, &system, &name, &doc, &internal); - Check_Type(external, T_STRING); - xpublic = (const xmlChar*) StringValuePtr(external); + if (external != Qnil) + { + Check_Type(external, T_STRING); + xpublic = (const xmlChar*) StringValuePtr(external); + } - Check_Type(system, T_STRING); - xsystem = (const xmlChar*) StringValuePtr(system); + if (system != Qnil) + { + Check_Type(system, T_STRING); + xsystem = (const xmlChar*) StringValuePtr(system); + } if (name != Qnil) { diff --git a/ext/libxml/ruby_xml_input_cbg.c b/ext/libxml/ruby_xml_input_cbg.c index 1863f52d..69fdac4b 100644 --- a/ext/libxml/ruby_xml_input_cbg.c +++ b/ext/libxml/ruby_xml_input_cbg.c @@ -8,8 +8,38 @@ * Support for adding custom scheme handlers. */ static ic_scheme *first_scheme = 0; +static int input_callbacks_registered = 0; -int ic_match(char const *filename) +static int ic_match(char const *filename); +static void* ic_open(char const *filename); +static int ic_read(void *context, char *buffer, int len); +static int ic_close(void *context); + +static void input_callbacks_register_once(void) +{ + if (input_callbacks_registered) + return; + + xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close); + input_callbacks_registered = 1; +} + +static char *ic_strdup(const char *string) +{ + size_t length = strlen(string) + 1; + char *copy = ruby_xmalloc(length); + memcpy(copy, string, length); + return copy; +} + +static void ic_scheme_free(ic_scheme *scheme) +{ + rb_gc_unregister_address(&scheme->class); + ruby_xfree(scheme->scheme_name); + ruby_xfree(scheme); +} + +static int ic_match(char const *filename) { ic_scheme *scheme; @@ -27,7 +57,7 @@ int ic_match(char const *filename) return 0; } -void* ic_open(char const *filename) +static void* ic_open(char const *filename) { ic_doc_context *ic_doc; ic_scheme *scheme; @@ -38,12 +68,11 @@ void* ic_open(char const *filename) { if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len)) { - ic_doc = (ic_doc_context*) malloc(sizeof(ic_doc_context)); - res = rb_funcall(scheme->class, rb_intern("document_query"), 1, rb_str_new2(filename)); - ic_doc->buffer = strdup(StringValuePtr(res)); + ic_doc = ALLOC(ic_doc_context); + ic_doc->buffer = ic_strdup(StringValueCStr(res)); ic_doc->bpos = ic_doc->buffer; ic_doc->remaining = (int)strlen(ic_doc->buffer); @@ -54,7 +83,7 @@ void* ic_open(char const *filename) return 0; } -int ic_read(void *context, char *buffer, int len) +static int ic_read(void *context, char *buffer, int len) { ic_doc_context *ic_doc; int ret_len; @@ -75,7 +104,7 @@ int ic_read(void *context, char *buffer, int len) return ret_len; } -int ic_close(void *context) +static int ic_close(void *context) { ruby_xfree(((ic_doc_context*) context)->buffer); ruby_xfree(context); @@ -90,7 +119,7 @@ int ic_close(void *context) */ static VALUE input_callbacks_register_input_callbacks(VALUE self) { - xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close); + input_callbacks_register_once(); return (Qtrue); } @@ -107,11 +136,14 @@ static VALUE input_callbacks_add_scheme(VALUE self, VALUE scheme_name, Check_Type(scheme_name, T_STRING); - scheme = (ic_scheme*) malloc(sizeof(ic_scheme)); + input_callbacks_register_once(); + + scheme = ALLOC(ic_scheme); scheme->next_scheme = 0; - scheme->scheme_name = strdup(StringValuePtr(scheme_name)); /* TODO alloc, dealloc */ + scheme->scheme_name = ic_strdup(StringValueCStr(scheme_name)); scheme->name_len = (int)strlen(scheme->scheme_name); - scheme->class = class; /* TODO alloc, dealloc */ + scheme->class = class; + rb_gc_register_address(&scheme->class); //fprintf( stderr, "registered: %s, %d, %s\n", scheme->scheme_name, scheme->name_len, scheme->class ); @@ -150,9 +182,7 @@ static VALUE input_callbacks_remove_scheme(VALUE self, VALUE scheme_name) { save_scheme = first_scheme->next_scheme; - ruby_xfree(first_scheme->scheme_name); - ruby_xfree(first_scheme); - + ic_scheme_free(first_scheme); first_scheme = save_scheme; return Qtrue; } @@ -165,9 +195,7 @@ static VALUE input_callbacks_remove_scheme(VALUE self, VALUE scheme_name) { save_scheme = scheme->next_scheme->next_scheme; - ruby_xfree(scheme->next_scheme->scheme_name); - ruby_xfree(scheme->next_scheme); - + ic_scheme_free(scheme->next_scheme); scheme->next_scheme = save_scheme; return Qtrue; } diff --git a/ext/libxml/ruby_xml_namespace.c b/ext/libxml/ruby_xml_namespace.c index 0f24220c..9f1636b7 100644 --- a/ext/libxml/ruby_xml_namespace.c +++ b/ext/libxml/ruby_xml_namespace.c @@ -137,10 +137,14 @@ static VALUE rxml_namespace_next(VALUE self) { xmlNsPtr xns; TypedData_Get_Struct(self, xmlNs, &rxml_namespace_type, xns); - if (xns == NULL || xns->next == NULL) + /* Guard against libxml2's XPath hack where xns->next stores a parent + element pointer instead of the next namespace (see xmlXPathNodeSetAddNs + in xpath.c). xmlNs.type and xmlNode.type share the same struct offset, + so checking the type is safe even when next points to an xmlNode. */ + if (xns == NULL || xns->next == NULL || xns->next->type != XML_LOCAL_NAMESPACE) return (Qnil); - else - return rxml_namespace_wrap(xns->next); + + return rxml_namespace_wrap(xns->next); } void rxml_init_namespace(void) diff --git a/ext/libxml/ruby_xml_version.h b/ext/libxml/ruby_xml_version.h index df20a9f6..010142a5 100644 --- a/ext/libxml/ruby_xml_version.h +++ b/ext/libxml/ruby_xml_version.h @@ -1,9 +1,9 @@ /* Don't nuke this block! It is used for automatically updating the * versions below. VERSION = string formatting, VERNUM = numbered * version for inline testing: increment both or none at all.*/ -#define RUBY_LIBXML_VERSION "5.0.6" -#define RUBY_LIBXML_VERNUM 505 -#define RUBY_LIBXML_VER_MAJ 5 +#define RUBY_LIBXML_VERSION "6.0.0" +#define RUBY_LIBXML_VERNUM 600 +#define RUBY_LIBXML_VER_MAJ 6 #define RUBY_LIBXML_VER_MIN 0 -#define RUBY_LIBXML_VER_MIC 6 +#define RUBY_LIBXML_VER_MIC 0 #define RUBY_LIBXML_VER_PATCH 0 diff --git a/ext/libxml/ruby_xml_xpath_object.c b/ext/libxml/ruby_xml_xpath_object.c index 3bca8e18..b03a09f9 100644 --- a/ext/libxml/ruby_xml_xpath_object.c +++ b/ext/libxml/ruby_xml_xpath_object.c @@ -64,7 +64,7 @@ static void rxml_xpath_object_mark(void *data) rb_gc_mark(rxpop->nsnodes); } -static const rb_data_type_t rxml_xpath_object_data_type = { +const rb_data_type_t rxml_xpath_object_data_type = { .wrap_struct_name = "LibXML::XML::XPath::Object", .function = { .dmark = rxml_xpath_object_mark, .dfree = rxml_xpath_object_free }, .flags = RUBY_TYPED_FREE_IMMEDIATELY, @@ -82,7 +82,11 @@ VALUE rxml_xpath_object_wrap(VALUE document, xmlDocPtr xdoc, xmlXPathObjectPtr x rxpopp->xdoc = xdoc; rxpopp->xpop = xpop; - /* Find all the extra namespace nodes and wrap them. */ + /* Find all the extra namespace nodes and wrap them. In XPath results, + libxml2 stores the parent element pointer in xns->next (a hack -- see + xmlXPathNodeSetAddNs in xpath.c). We leave that pointer intact so + that xmlC14NIsNodeInNodeset can match namespace nodes for C14N. + Namespace#next is guarded to detect this hack and return nil. */ if (xpop->nodesetval && xpop->nodesetval->nodeNr) { for (i = 0; i < xpop->nodesetval->nodeNr; i++) @@ -91,12 +95,6 @@ VALUE rxml_xpath_object_wrap(VALUE document, xmlDocPtr xdoc, xmlXPathObjectPtr x if (xnode != NULL && xnode->type == XML_NAMESPACE_DECL) { VALUE ns = Qnil; - xmlNsPtr xns = (xmlNsPtr)xnode; - - /* Get rid of libxml's -> next hack. The issue here is - the rxml_namespace code assumes that ns->next refers - to another namespace. */ - xns->next = NULL; /* Specify a custom free function here since by default namespace nodes will not be freed */ diff --git a/ext/libxml/ruby_xml_xpath_object.h b/ext/libxml/ruby_xml_xpath_object.h index 303e9211..20afa1a5 100644 --- a/ext/libxml/ruby_xml_xpath_object.h +++ b/ext/libxml/ruby_xml_xpath_object.h @@ -2,6 +2,7 @@ #define __RXML_XPATH_OBJECT__ extern VALUE cXMLXPathObject; +extern const rb_data_type_t rxml_xpath_object_data_type; typedef struct rxml_xpath_object { diff --git a/ext/vc/libxml_ruby/libxml_ruby.vcxproj b/ext/vc/libxml_ruby/libxml_ruby.vcxproj index 3c0a3f27..30754a61 100644 --- a/ext/vc/libxml_ruby/libxml_ruby.vcxproj +++ b/ext/vc/libxml_ruby/libxml_ruby.vcxproj @@ -194,7 +194,6 @@ - @@ -211,6 +210,7 @@ + @@ -248,6 +248,7 @@ + diff --git a/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj b/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj index cf504d15..26d9f565 100644 --- a/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj +++ b/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj @@ -50,7 +50,6 @@ C7F2B5CD2B4B636C004E0A86 /* ruby_xml_attr_decl.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B54A2B4B5AED004E0A86 /* ruby_xml_attr_decl.c */; }; C7F2B5CE2B4B636C004E0A86 /* ruby_xml_attr.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B5212B4B5AEC004E0A86 /* ruby_xml_attr.c */; }; C7F2B5CF2B4B636C004E0A86 /* ruby_xml_attributes.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B5482B4B5AED004E0A86 /* ruby_xml_attributes.c */; }; - C7F2B5D02B4B636C004E0A86 /* ruby_xml_cbg.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B5382B4B5AED004E0A86 /* ruby_xml_cbg.c */; }; C7F2B5D12B4B636C004E0A86 /* ruby_xml_document.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B5522B4B5AED004E0A86 /* ruby_xml_document.c */; }; C7F2B5D22B4B636C004E0A86 /* ruby_xml_dtd.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B5622B4B5AEE004E0A86 /* ruby_xml_dtd.c */; }; C7F2B5D32B4B636C004E0A86 /* ruby_xml_encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = C7F2B5362B4B5AED004E0A86 /* ruby_xml_encoding.c */; }; @@ -124,7 +123,6 @@ C7F2B5352B4B5AED004E0A86 /* ruby_xml_encoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ruby_xml_encoding.h; path = ../libxml/ruby_xml_encoding.h; sourceTree = ""; }; C7F2B5362B4B5AED004E0A86 /* ruby_xml_encoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ruby_xml_encoding.c; path = ../libxml/ruby_xml_encoding.c; sourceTree = ""; }; C7F2B5372B4B5AED004E0A86 /* ruby_xml_writer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ruby_xml_writer.c; path = ../libxml/ruby_xml_writer.c; sourceTree = ""; }; - C7F2B5382B4B5AED004E0A86 /* ruby_xml_cbg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ruby_xml_cbg.c; path = ../libxml/ruby_xml_cbg.c; sourceTree = ""; }; C7F2B5392B4B5AED004E0A86 /* ruby_xml_schema_attribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ruby_xml_schema_attribute.h; path = ../libxml/ruby_xml_schema_attribute.h; sourceTree = ""; }; C7F2B53A2B4B5AED004E0A86 /* ruby_xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ruby_xml.c; path = ../libxml/ruby_xml.c; sourceTree = ""; }; C7F2B53B2B4B5AED004E0A86 /* ruby_xml_namespace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ruby_xml_namespace.c; path = ../libxml/ruby_xml_namespace.c; sourceTree = ""; }; @@ -203,7 +201,6 @@ C7F2B54F2B4B5AED004E0A86 /* ruby_xml_attr.h */, C7F2B5482B4B5AED004E0A86 /* ruby_xml_attributes.c */, C7F2B52E2B4B5AED004E0A86 /* ruby_xml_attributes.h */, - C7F2B5382B4B5AED004E0A86 /* ruby_xml_cbg.c */, C7F2B5522B4B5AED004E0A86 /* ruby_xml_document.c */, C7F2B5602B4B5AEE004E0A86 /* ruby_xml_document.h */, C7F2B5622B4B5AEE004E0A86 /* ruby_xml_dtd.c */, @@ -409,7 +406,6 @@ C7F2B5CD2B4B636C004E0A86 /* ruby_xml_attr_decl.c in Sources */, C7F2B5CE2B4B636C004E0A86 /* ruby_xml_attr.c in Sources */, C7F2B5CF2B4B636C004E0A86 /* ruby_xml_attributes.c in Sources */, - C7F2B5D02B4B636C004E0A86 /* ruby_xml_cbg.c in Sources */, C7F2B5D12B4B636C004E0A86 /* ruby_xml_document.c in Sources */, C7F2B5D22B4B636C004E0A86 /* ruby_xml_dtd.c in Sources */, C7F2B5D32B4B636C004E0A86 /* ruby_xml_encoding.c in Sources */, diff --git a/lib/libxml-ruby.rb b/lib/libxml-ruby.rb index c1dfb078..f9086c0a 100644 --- a/lib/libxml-ruby.rb +++ b/lib/libxml-ruby.rb @@ -3,9 +3,9 @@ # Load the C-based binding. begin RUBY_VERSION =~ /(\d+.\d+)/ - require_relative "#{$1}/libxml_ruby" + require "#{$1}/libxml_ruby" rescue LoadError - require_relative "libxml_ruby" + require "libxml_ruby" end # Load Ruby supporting code. diff --git a/lib/libxml.rb b/lib/libxml.rb deleted file mode 100644 index 552a5755..00000000 --- a/lib/libxml.rb +++ /dev/null @@ -1,5 +0,0 @@ -# encoding: UTF-8 -# -# This include is deprecated, use libxml-ruby instead! - -require 'libxml-ruby' \ No newline at end of file diff --git a/lib/libxml/document.rb b/lib/libxml/document.rb index f012f2e9..8e5bbda6 100644 --- a/lib/libxml/document.rb +++ b/lib/libxml/document.rb @@ -160,35 +160,6 @@ def html_doc? node_type == XML::Node::HTML_DOCUMENT_NODE end - def dump - warn('Document#dump is deprecated. Use Document#to_s instead.') - self.to_s - end - - def format_dump - warn('Document#format_dump is deprecated. Use Document#to_s instead.') - self.to_s - end - - def debug_dump - warn('Document#debug_dump is deprecated. Use Document#debug instead.') - self.debug - end - - def debug_dump_head - warn('Document#debug_dump_head is deprecated. Use Document#debug instead.') - self.debug - end - - def debug_format_dump - warn('Document#debug_format_dump is deprecated. Use Document#to_s instead.') - self.to_s - end - - def reader - warn('Document#reader is deprecated. Use XML::Reader.document(self) instead.') - XML::Reader.document(self) - end end end end diff --git a/lib/libxml/error.rb b/lib/libxml/error.rb index 648af14f..2d4b00b7 100644 --- a/lib/libxml/error.rb +++ b/lib/libxml/error.rb @@ -23,7 +23,7 @@ class Error map[const_get(code)] = code end end - + # Verbose error handler VERBOSE_HANDLER = lambda do |error| STDERR << error.to_s << "\n" @@ -33,11 +33,20 @@ class Error # Quiet error handler QUIET_HANDLER = lambda do |error| end - + + # call-seq: + # error == other -> true or false + # + # Returns whether two errors have the same attributes. def ==(other) eql?(other) end - + + # call-seq: + # error.eql?(other) -> true or false + # + # Returns whether two errors have identical code, domain, message, + # level, file, line, and all other attributes. def eql?(other) self.code == other.code and self.domain == other.domain and @@ -56,6 +65,11 @@ def eql?(other) false end + # call-seq: + # error.level_to_s -> String + # + # Returns a human-readable string for the error level: + # "Warning:", "Error:", "Fatal error:", or "". def level_to_s case self.level when NONE @@ -69,14 +83,27 @@ def level_to_s end end + # call-seq: + # error.domain_to_s -> String + # + # Returns the name of the error domain (e.g. "PARSER", "XPATH"). def domain_to_s DOMAIN_CODE_MAP[self.domain].to_s end + # call-seq: + # error.code_to_s -> String + # + # Returns the name of the error code constant. def code_to_s ERROR_CODE_MAP[self.code].to_s end + # call-seq: + # error.to_s -> String + # + # Returns a formatted error string including the level, message, + # and file/line when available. def to_s msg = super msg = msg ? msg.strip: '' diff --git a/lib/libxml/hpricot.rb b/lib/libxml/hpricot.rb deleted file mode 100644 index 955917b5..00000000 --- a/lib/libxml/hpricot.rb +++ /dev/null @@ -1,78 +0,0 @@ -# encoding: UTF-8 - -## Provide hpricot API for libxml. Provided by Michael Guterl, -## inspired by http://thebogles.com/blog/an-hpricot-style-interface-to-libxml -# -#class String -# def to_libxml_doc -# xp = XML::Parser.new -# xp.string = self -# xp.parse -# end -#end -# -#module LibXML -# module XML -# class Document -# alias :search :find -# end -# -# class Node -# # find the child node with the given xpath -# def at(xpath) -# self.find_first(xpath) -# end -# -# # find the array of child nodes matching the given xpath -# def search(xpath) -# results = self.find(xpath).to_a -# if block_given? -# results.each do |result| -# yield result -# end -# end -# return results -# end -# -# def /(xpath) -# search(xpath) -# end -# -# # return the inner contents of this node as a string -# def inner_xml -# child.to_s -# end -# -# # alias for inner_xml -# def inner_html -# inner_xml -# end -# -# # return this node and its contents as an xml string -# def to_xml -# self.to_s -# end -# -# # alias for path -# def xpath -# self.path -# end -# -# def find_with_default_ns(xpath_expr, namespace=nil) -# find_base(xpath_expr, namespace || default_namespaces) -# end -# -# def find_first_with_default_ns(xpath_expr, namespace=nil) -# find_first_base(xpath_expr, namespace || default_namespaces) -# end -# -## alias_method :find_base, :find unless method_defined?(:find_base) -## alias_method :find, :find_with_default_ns -## alias_method :find_first_base, :find_first unless method_defined?(:find_first_base) -## alias_method :find_first, :find_first_with_default_ns -## alias :child? :first? -## alias :children? :first? -## alias :child :first -# end -# end -#end \ No newline at end of file diff --git a/lib/libxml/html_parser.rb b/lib/libxml/html_parser.rb index 2242281a..1d367449 100644 --- a/lib/libxml/html_parser.rb +++ b/lib/libxml/html_parser.rb @@ -75,22 +75,6 @@ def self.string(string, base_uri: nil, encoding: nil, options: nil) self.new(context) end - # :enddoc: - - def file=(value) - warn("XML::HTMLParser#file is deprecated. Use XML::HTMLParser.file instead") - @context = XML::HTMLParser::Context.file(value) - end - - def io=(value) - warn("XML::HTMLParser#io is deprecated. Use XML::HTMLParser.io instead") - @context = XML::HTMLParser::Context.io(value) - end - - def string=(value) - warn("XML::HTMLParser#string is deprecated. Use XML::HTMLParser.string instead") - @context = XML::HTMLParser::Context.string(value) - end end end end diff --git a/lib/libxml/node.rb b/lib/libxml/node.rb index 638c5a78..92f2ba21 100644 --- a/lib/libxml/node.rb +++ b/lib/libxml/node.rb @@ -313,9 +313,7 @@ def xinclude_start? def create_string_io(xml) result = StringIO.new("") - if defined?(::Encoding) - result.set_encoding(xml.encoding) - end + result.set_encoding(xml.encoding) result end end diff --git a/lib/libxml/parser.rb b/lib/libxml/parser.rb index a78e96cf..5a3e0123 100644 --- a/lib/libxml/parser.rb +++ b/lib/libxml/parser.rb @@ -90,14 +90,6 @@ def self.string(string, base_uri: nil, encoding: nil, options: nil) self.new(context) end - def self.register_error_handler(proc) - warn('Parser.register_error_handler is deprecated. Use Error.set_handler instead') - if proc.nil? - Error.reset_handler - else - Error.set_handler(&proc) - end - end end end end \ No newline at end of file diff --git a/lib/libxml/schema/attribute.rb b/lib/libxml/schema/attribute.rb index 9c06fef1..78b6161f 100644 --- a/lib/libxml/schema/attribute.rb +++ b/lib/libxml/schema/attribute.rb @@ -6,10 +6,18 @@ class Schema::Attribute REQUIRED = 1 OPTIONAL = 2 + # call-seq: + # attribute.default -> String or nil + # + # Returns the default value for this attribute, or nil if none. def default node['default'] end + # call-seq: + # attribute.required? -> true or false + # + # Returns whether this attribute is required. def required? occurs == REQUIRED end diff --git a/lib/libxml/schema/element.rb b/lib/libxml/schema/element.rb index 8ecb5d28..318b24a0 100644 --- a/lib/libxml/schema/element.rb +++ b/lib/libxml/schema/element.rb @@ -3,22 +3,42 @@ module LibXML module XML class Schema::Element + # call-seq: + # element.min_occurs -> Integer + # + # Returns the minimum number of times this element must appear. def min_occurs @min end + # call-seq: + # element.max_occurs -> Integer + # + # Returns the maximum number of times this element may appear. def max_occurs @max end + # call-seq: + # element.required? -> true or false + # + # Returns whether this element is required (min_occurs > 0). def required? !min_occurs.zero? end + # call-seq: + # element.array? -> true or false + # + # Returns whether this element can appear more than once (max_occurs > 1). def array? max_occurs > 1 end + # call-seq: + # element.elements -> Hash + # + # Returns the child elements of this element's type. def elements type.elements end diff --git a/lib/libxml/schema/type.rb b/lib/libxml/schema/type.rb index 96f5590a..d5276a28 100644 --- a/lib/libxml/schema/type.rb +++ b/lib/libxml/schema/type.rb @@ -1,18 +1,41 @@ module LibXML module XML class Schema::Type + # call-seq: + # type.kind_name -> String + # + # Returns the name of the constant that matches this type's +kind+ value. + # + # schema.types['shiporderType'].kind_name + # # => :XML_SCHEMA_TYPE_COMPLEX def kind_name Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind } end - def annonymus_subtypes + # call-seq: + # type.anonymous_subtypes -> Hash + # + # Returns a Hash of child elements whose types are anonymous + # (inline complex types with no global name). + # + # type.anonymous_subtypes + # # => {"shipto" => #, "item" => #} + def anonymous_subtypes elements.select { |_, e| e.type.name.nil? } end - def annonymus_subtypes_recursively(parent=nil) - annonymus_subtypes.map do |element_name, e| + # call-seq: + # type.anonymous_subtypes_recursively -> Array + # + # Returns a flattened Array of Hashes mapping qualified names to + # anonymous Schema::Type instances, descending into nested types. + # + # type.anonymous_subtypes_recursively + # # => [{"shipto" => #}, {"item" => #}] + def anonymous_subtypes_recursively(parent=nil) + anonymous_subtypes.map do |element_name, e| [{[parent, element_name].compact.join('::') => e.type}, - e.type.annonymus_subtypes_recursively(element_name)] + e.type.anonymous_subtypes_recursively(element_name)] end.flatten end diff --git a/lib/xml.rb b/lib/xml.rb deleted file mode 100644 index f388b164..00000000 --- a/lib/xml.rb +++ /dev/null @@ -1,14 +0,0 @@ -# encoding: UTF-8 - -# This file loads libxml and adds the LibXML namespace -# to the toplevel for conveneience. The end result -# is to have XML:: universally exposed. -# -# It is recommend that you only load this file for libs -# that do not have their own namespace, eg. administrative -# scripts, personal programs, etc. For other applications -# require 'libxml' instead and include LibXML into your -# app/libs namespace. - -require 'libxml' -include LibXML \ No newline at end of file diff --git a/lib/xml/libxml.rb b/lib/xml/libxml.rb deleted file mode 100644 index 2c496ed3..00000000 --- a/lib/xml/libxml.rb +++ /dev/null @@ -1,10 +0,0 @@ -# encoding: UTF-8 - -# This is here for backward compatibility. -# -# TODO: DEPRECATE! - -require 'libxml.rb' - -include LibXML - diff --git a/libxml-ruby.gemspec b/libxml-ruby.gemspec index 0a46f248..7502646c 100644 --- a/libxml-ruby.gemspec +++ b/libxml-ruby.gemspec @@ -1,5 +1,4 @@ # encoding: utf-8 -require 'date' # Determine the current version of the software version = File.read('ext/libxml/ruby_xml_version.h').match(/\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/)[1] @@ -10,11 +9,9 @@ Gem::Specification.new do |spec| spec.homepage = 'https://xml4r.github.io/libxml-ruby/' spec.summary = 'Ruby Bindings for LibXML2' spec.description = <<-EOS - The Libxml-Ruby project provides Ruby language bindings for the GNOME - Libxml2 XML toolkit. It is free software, released under the MIT License. - Libxml-ruby's primary advantage over REXML is performance - if speed - is your need, these are good libraries to consider, as demonstrated - by the informal benchmark below. + libxml-Ruby provides Ruby language bindings for libxml2 It is free software, + released under the MIT License. libxml-ruby provides DOM, SAX, Reader, and + Writer APIs along with XPath support and validation via DTD, RelaxNG, and XML Schema. EOS spec.authors = ['Ross Bamform', 'Wai-Sun Chia', 'Sean Chittenden', 'Dan Janwoski', 'Anurag Priyam', 'Charlie Savage', @@ -26,23 +23,21 @@ Gem::Specification.new do |spec| spec.files = Dir.glob(['CHANGELOG.md', 'LICENSE', 'libxml-ruby.gemspec', - 'MANIFEST', 'Rakefile', 'README.md', - 'setup.rb', 'ext/libxml/*.def', 'ext/libxml/*.h', 'ext/libxml/*.c', 'ext/libxml/*.rb', - 'ext/vc/*.sln', - 'ext/vc/*.vcprojx', + 'ext/vc/**/*.sln', + 'ext/vc/**/*.vcxproj', + 'ext/xcode/**/*', 'lib/**/*.rb', - 'script/**/*', - 'test/**/*']) + 'test/**/*']) - + Dir.glob(['ext/libxml/extconf.h']) spec.test_files = Dir.glob('test/test_*.rb') spec.required_ruby_version = '>= 3.2' - spec.date = DateTime.now spec.add_development_dependency('logger') spec.add_development_dependency('rake-compiler') spec.add_development_dependency('minitest') diff --git a/log/Changelog-0.txt b/log/Changelog-0.txt deleted file mode 100644 index 518cfcc7..00000000 --- a/log/Changelog-0.txt +++ /dev/null @@ -1,426 +0,0 @@ -2007-09-05 15:43 danj - - * ChangeLog: svn cannot checkout the file, unknown why. - -2007-09-05 15:27 danj - - * ChangeLog: VERSION 0.5.1 - -2007-09-05 15:23 danj - - * ext/xml/libxml.h: VERSION 0.5.1 - -2007-09-05 15:22 danj - - * CHANGELOG, ChangeLog: Convert from manual CHANGELOG to - autogenerated ChangeLog by http://ch.tudelft.nl/~arthur/svn2cl/ - -2007-09-05 12:51 danj - - * tests/tc_xml_html_parser.rb: maybe the html parser is changed, - but the html doc now gets a wrapping

, so the first child - content is not the hello. So a child.child is necessary - -2007-09-05 12:47 danj - - * ext/xml/ruby_xml_node.c: _child_set now performs implicit copy - when adding a non-root node to another node, the return value is - the new node. The return value is now the new node or the - original if not copied. rb_warning when implicit copy done. added - child_add to api so return value can be used after implicit copy. - -2007-09-04 20:47 danj - - * ext/xml/ruby_xml_node.c: zero sum change, notes that child= - cannot really return anything as ruby will only return the rhs of - the assignment - -2007-09-04 13:02 danj - - * ext/xml/ruby_xml_node.c, rwtest/copy_bug.rb, rwtest/copy_bug2.rb, - rwtest/runner.rb, tests/copy_bug.rb, tests/copy_bug2.rb: fix node - << operator, move tests for it (copy_bug.rb, copy_bug2.rb) to - rwtests - -2007-08-31 15:37 danj - - * ext/xml/libxml.h, ext/xml/ruby_xml_node.c: add create callback to - clear _private, hopefully resolving copy problems, elevate to - patch level 0.5.0.1 - -2007-08-31 15:36 danj - - * Rakefile, rwtest/doc_file.rb, rwtest/doc_to_s.rb, - rwtest/node_gc.rb, rwtest/runner.rb: add memtests - -2007-08-30 12:50 danj - - * ext/xml/libxml.h: change version line to 0.5.0 - -2007-08-30 12:49 danj - - * rwtest/doc_file.rb, rwtest/test.xml: files for bug 8337 - -2007-08-29 18:56 danj - - * tests/tc_xml_node4.rb: since object_id will not be the same for - the same node, employs to parser/docuemnt sets for comparison - test - -2007-08-29 18:37 danj - - * rwtest/doc_to_s.rb: test against bug 7945, doc.to_s leak - -2007-08-29 18:28 danj - - * ext/xml/ruby_xml_document.c: fix leak doing doc.to_s, freeing the - result from xmlDocDump... - -2007-08-29 18:00 danj - - * ext/xml/libxml.c, ext/xml/libxml.h, ext/xml/ruby_xml_attr.c, - ext/xml/ruby_xml_attr.h, ext/xml/ruby_xml_attribute.c, - ext/xml/ruby_xml_attribute.h, ext/xml/ruby_xml_document.c, - ext/xml/ruby_xml_document.h, ext/xml/ruby_xml_html_parser.c, - ext/xml/ruby_xml_node.c, ext/xml/ruby_xml_node.h, - ext/xml/ruby_xml_node_set.c, ext/xml/ruby_xml_parser.c, - ext/xml/ruby_xml_parser_context.c, ext/xml/ruby_xml_reader.c, - ext/xml/ruby_xml_xpath.c, ext/xml/ruby_xml_xpath_context.c, - ext/xml/ruby_xml_xpointer.c, rwtest, rwtest/gpx.rb, - rwtest/tsr.rb: initial commit of new memory management. Only 3 - components have - been rewritten: node, document, attr. attribute has been removed. - Other modules have been modified to work with new rewritten - parts. - -2007-08-29 17:46 danj - - * .: create branch for new memory model. - -2007-01-14 21:47 lrz - - * : ===== 14.1.2007 Laurent Sansonetti - * Added some preliminary RDoc comments for XML::Reader. - -2006-12-23 18:14 roscopeco - - * : Replaced RSTRING(str)->len with RSTRING_LEN(str) for future - compatibility - -2006-12-05 12:03 roscopeco - - * : Improved compatibility with MS Visual C: - * Replace void* increment and decrement with char* arithmetic. - * Predeclare all locals - * Removed -Wall (Win32 platform sdk emits *lots* of warnings) - * Fixed extconf for win32 libxml2 and dependencies from - http://www.zlatkovic.com/pub/libxml/ - -2006-12-05 11:56 roscopeco - - * : removed object file committed by mistake - -2006-12-04 23:40 lrz - - * : ===== 5.12.2006 Laurent Sansonetti - * Added XML::Reader, a set of bindings to the xmlTextReader API. - -2006-12-02 11:06 roscopeco - - * : Merged release task fix from 0.3.8.4 - -2006-11-30 17:29 roscopeco - - * : Restore default config after tests to prevent wierd failures in - other tests - -2006-11-27 10:41 roscopeco - - * : Merged from 0.3.8.3: - * Fixed a segfault on node.properties with empty props list - (patch from Michael Koziarski) - * Fixed version macros and release version handling - -2006-11-26 12:57 roscopeco - - * : Merged contributed patches #6604, #6839, #6871 - Slight fix to sax error formatting patch - -2006-11-22 14:20 roscopeco - - * : Fixed non-inclusion of Enumerable on Node::Set - -2006-11-22 12:41 roscopeco - - * : Fixed parsing with errors bug - -2006-11-20 01:39 roscopeco - - * : Merged non-backward-compatible DEV_0_4 changes: - - * Implemented new HTMLParser interface - * Implemented new (faster) SAX callback strategy - -2006-11-20 01:22 roscopeco - - * : Merged backward-compatible fixes down from DEV_0_4: - - * Tested fix of bug #4635 - * Reimplemented attribute memory handling - * Fixed attribute list traversal (bug #4719) - * Integrated Luc Van Deuren's cdata/comment node patch - * Fixed test-naming bugs - * Fixed doc build bug - * Reimplemented XML::Node memory management - * Reimplemented node copy handling - * Fixed parser error handler proc early GC bug - * include stdarg.h on ruby_xml_document - -2006-11-04 10:04 roscopeco - - * : Merged stdarg fix - -2006-10-29 19:42 roscopeco - - * : Remove nodoc from libxml.rb - -2006-10-20 12:31 roscopeco - - * : Fixed up new packaging to play nice with 'rake install' - -2006-10-20 10:41 roscopeco - - * : Applied gem-build patch from Masashi Shimbo. See: - http://rubyforge.org/pipermail/libxml-devel/2006-August/000205.html - -2006-10-20 10:39 roscopeco - - * : Another failing test :( - -2006-10-20 10:39 roscopeco - - * : Removed debugging printouts - -2006-08-15 13:53 roscopeco - - * : Fixed nodelist handling - - Patches from Stephen Veit: - Fixed for windows/visual C compliance - Fixed extconf build for Windows - - (bug 5022, - http://rubyforge.org/tracker/index.php?func=detail&aid=5022&group_id=494&atid=1971) - -2006-08-15 13:49 roscopeco - - * : Fixed typo in reading example - See: - http://rubyforge.org/pipermail/libxml-devel/2006-June/000181.html - -2006-05-31 18:22 roscopeco - - * : Bugfix: gc_mark both filename and str - -2006-05-31 17:26 roscopeco - - * : Fixed a typo bug - -2006-05-28 14:06 roscopeco - - * : Allow Node#[] and Node#[]= to handle symbol keys (See - http://rubyforge.org/pipermail/libxml-devel/2006-May/000135.html) - -2006-05-28 13:29 roscopeco - - * : Applied previous node fix (See bug #4497) - -2006-05-10 18:03 roscopeco - - * : Implemented Node#next= and Node#prev= - -2006-05-10 18:02 roscopeco - - * : Fixed incorrect class name - -2006-05-01 16:42 roscopeco - - * : Removed a duplicate definition (and corresponding warning) - -2006-05-01 16:39 roscopeco - - * : dev 0.3.9 - -2006-04-24 19:40 roscopeco - - * : release 0.3.8 - -2006-04-24 19:39 roscopeco - - * : Fixed a bug in release version update - -2006-04-24 19:29 roscopeco - - * : changelog/readme update for release - -2006-04-24 19:17 roscopeco - - * : Fixed tarball installation to site_ruby (added libxml.rb to - install) - -2006-04-24 18:29 roscopeco - - * : Check compiler supports -Wall before using it - -2006-04-24 18:26 roscopeco - - * : Fixed rake testrunner bug - -2006-04-17 13:30 roscopeco - - * : Switched .so to libxml_so and introduced libxml.rb to allow - easier API prototype / update - Fixed testcases for new require setup (use $LOADPATH rather than - filename require) - -2006-04-17 12:02 roscopeco - - * : Fixed rdoc build in gems - -2006-04-14 23:46 roscopeco - - * : Fixed a struct initialization bug I introduced - -2006-04-14 14:50 roscopeco - - * : Fixed a build bug I introduced - -2006-04-14 14:45 roscopeco - - * : First cut of SAX callback API - -2006-04-14 14:45 roscopeco - - * : Include Enumerable - -2006-04-12 12:08 roscopeco - - * : From Mark Van Holstyn (mvette13 AT gmail DOT com): - * Added XML::Node::Set#first - * Added XML::Node::Set#empty? - * Fixes to XML::Node::Set#to_a - * Added XML::Node#find_first - * Added XML::Node#remove! - - Also: - * Tested the above - * Defined node (hash) equality in terms of XML representation - * Added comparable nodes to TODOs and updated changelog - -2006-04-12 10:02 roscopeco - - * : XML::Node#content fix Tim Yamin - -2006-04-12 10:00 roscopeco - - * : Added rubygems require to example code - -2006-03-27 20:49 roscopeco - - * : Implemented & tested XML::Parser.register_error_handler - Doc fixup (XML::DTD -> XML::Dtd) - -2006-03-27 20:46 roscopeco - - * : development version roll - -2006-03-21 22:41 roscopeco - - * : Updated instructions - -2006-03-09 23:12 roscopeco - - * : Added RUBY_LIBXML_VER_xxx defines for libxslt checking - Updated release versioning in Rakefile - Todo update - -2006-03-09 20:04 roscopeco - - * : Fixed copy/paste errors in documentation - -2006-02-28 09:57 roscopeco - - * : * Ignored vi .swp files - * Updated Changelog - * Updated copyright years - * Removed done todos - -2006-02-27 12:55 roscopeco - - * : * Fixed issues with -fno-common GCC flag - * Removed OSX -fno-common workaround - * Fixed a couple of typos - -2006-02-23 18:30 roscopeco - - * : Release 0.3.6 - -2006-02-21 20:40 roscopeco - - * : Rearranged source layout to suit RubyGems packaging - Removed obsolete (Rubynet) utility scripts - -2006-02-21 10:35 roscopeco - - * : Band-aid for OSX build probs - -2006-02-20 11:16 roscopeco - - * : * Fixed attribute memory handling - (http://rubyforge.org/pipermail/libxml-devel/2005-December/000030.html) - * Removed a small leak in ruby_xml_node. - * Fixed parser memory_debug_enabled doc - * Updated shebang in test runner - -2006-01-02 23:19 roscopeco - - * : Cleaned up casts for GCC 4.0 - Migrated from (obsolete) STR2CSTR to StringValuePtr - -2006-01-02 23:18 roscopeco - - * : Fixed Make invocation - -2006-01-02 21:31 roscopeco - - * : Cleaned up casts for GCC 4.0 - Migrated from (obsolete) STR2CSTR to StringValuePtr - -2005-12-29 19:10 bshow - - * : Added "doc" to cleanfiles; added new task "pubdoc" - -2005-12-29 19:10 bshow - - * : Added "doc" - -2005-12-29 19:00 bshow - - * : Prevent RDoc from wrapping copyright notices - -2005-12-19 20:51 roscopeco - - * : Removed (forgotten) temporary notice for documentation set - -2005-12-19 20:48 roscopeco - - * : MIT license - -2005-12-19 19:57 roscopeco - - * : better ignorance - -2005-12-19 19:53 roscopeco - - * : Initial import - diff --git a/log/Changelog.txt b/log/Changelog.txt deleted file mode 100644 index 7375035a..00000000 --- a/log/Changelog.txt +++ /dev/null @@ -1,435 +0,0 @@ -= ChangeLog - -== 2008-02-01 transami - -* Update test scripts to reflect move to test/. (r261) -* Moves tests/ to test/ which is more conventional. (r260) -* Update config file. (r259) -* Moved changelog.xml and changelog.xsl to doc/log/. (r258) -* Added doc/log for xml-based changelog and notes. (r257) - -== 2008-01-31 transami - -* Minor update to a task description in Rakefile. (r256) - -== 2008-01-30 transami - -* Added memory test task. (r255) -* Added work dir for "scrap" material. Modified Rakefile. (r254) -* Fixed adding lib/ to $LOAD_PATH. (r253) - -== 2008-01-22 transami - -* Small fixes to task/make and task/test. (r252) -* Changed all requires for 'libxml_test.rb' to 'libxml'. (r251) -* Removed runner code from tests/. It is now in task/test. (r250) -* Renamed compile to make. (r249) -* Convert task/compile to pure ruby. (r248) -* Moved svn task to admin. (r247) -* Moved admin tasks to admin directory. (r246) -* Added admin/ directory. (r245) -* Remove task/tests. (r244) -* Converted test task to pure ruby. (r243) - -== 2007-12-22 transami - -* Added distclean task. (r242) -* Added svn tasks and metadata. (r241) - -== 2007-12-15 transami - -* Added svn/log task and backward compatability require (xml/libxml.rb). (r240) -* Added doc/changelog.xsl. (r239) -* Moved TODO up a directory level and updated meta/project.yaml. (r238) -* Moved task/config.yaml to meta/config.yaml as required by Ratch 0.4.0. (r237) -* Added packaging tasks. (r236) - -== 2007-12-11 danj - -* fix XML_TEXT_NODE add handling when libxml merges nodes (r235) - -== 2007-12-10 transami - -* Added lib/xml/libxml.rb for backward compatibility. (r234) -* Moved ext/libxml/libxml.rb to lib/. (r233) -* Removed compile prerequisite from test task for now. (r232) -* Fixed extensions attribute inf project.yaml. (r231) -* Added setup task. (r230) -* Fixed tasks to "main". (r229) - -== 2007-12-07 transami - -* Added test and compile tasks. (r228) -* Added version.h. (r227) -* Moved header verison. (r226) - -== 2007-12-06 transami - -* Moved ext/xml to ext/libxml. (r225) - -== 2007-12-04 transami - -* Added meta dir and project.yaml file. (r224) -* Added doc/.rsync-filter and .htaccess (r223) -* Added some tasks. (r222) - -== 2007-12-03 danj - -* raise if parser string set to empty (r221) - -== 2007-11-27 danj - -* fix transposed ruby method mapping (r220) -* apply patch to fix multiple namespaces for .find (submitted by keisukefukuda at gmail.com) (r219) - -== 2007-11-26 danj - -* add docs for to_s and encoding (r218) -* take a step in the right direction with document encoding (r217) -* fix variable reference in ruby_xml_parser_default_load_external_dtd_get (r216) - -== 2007-11-20 transami - -* Added project name. (r215) -* Added log/history (for hand entries) and moved TODO to log/ too. (r214) -* Added a log directory. (r213) - -== 2007-11-20 danj - -* deal with different .find return types, rev to 0.5.2.2 (r212) - -== 2007-11-14 danj - -* add Node#new_text (r211) -* fix expand bug (r210) -* move rwtest to test/ets... (r209) -* add [] to XPath::Object and tests for it (r208) -* full merge from MEM2 r.194 v0.5.2.1 (r207) - -== 2007-10-25 transami - -* Added task/ dir. (r205) -* Further improvements on website. (r204) -* Removed doc/web. (r203) -* Moved doc/web files up one level. (r202) - -== 2007-10-20 transami - -* moved raze to web (r201) -* added image (r200) -* converted site to xml/xslt (r199) -* updated stylesheet (r198) -* removed pages (r197) -* removed pages (r196) -* these are about to be deleted (r195) - -== 2007-08-30 transami - -* remove .cvsignore (r162) -* moved www/ to doc/ (r161) -* removed www/Rakefile (not using Rote any longer) (r160) -* moved www/doc to www/raze (r159) -* removed rote logo (r158) -* added raze logo (r157) -* updated icon (r156) -* added icon (r155) -* website work (r154) -* moved stylesheets to styles (r153) - -== 2007-08-29 transami - -* remove CVSROOT from trunk (r150) -* continued work on website (r149) -* removed res dir (r148) -* continued work on converting website (r147) -* converting website from rote to new system (r146) -* removed libxslt (now in libxsl project) (r145) -* removed libxml subdir (r144) -* moved trunk/libxml/* to trunk/* (r143) - -== 2007-01-14 lrz - -* ===== 14.1.2007 Laurent Sansonetti -* Added some preliminary RDoc comments for XML::Reader. (r133) - -== 2006-12-23 roscopeco - -* Replaced RSTRING(str)->len with RSTRING_LEN(str) for future compatibility (r132) - -== 2006-12-05 roscopeco - -* Improved compatibility with MS Visual C: - * Replace void* increment and decrement with char* arithmetic. - * Predeclare all locals - * Removed -Wall (Win32 platform sdk emits *lots* of warnings) - * Fixed extconf for win32 libxml2 and dependencies from http://www.zlatkovic.com/pub/libxml/ (r131) -* removed object file committed by mistake (r130) - -== 2006-12-04 lrz - -* ===== 5.12.2006 Laurent Sansonetti -* Added XML::Reader, a set of bindings to the xmlTextReader API. (r129) - -== 2006-12-02 roscopeco - -* Merged release task fix from 0.3.8.4 (r128) - -== 2006-11-30 roscopeco - -* Restore default config after tests to prevent wierd failures in other tests (r124) - -== 2006-11-27 roscopeco - -* Merged from 0.3.8.3: -* Fixed a segfault on node.properties with empty props list (patch from Michael Koziarski) -* Fixed version macros and release version handling (r123) - -== 2006-11-26 roscopeco - -* Merged contributed patches #6604, #6839, #6871 -Slight fix to sax error formatting patch (r120) - -== 2006-11-22 roscopeco - -* Fixed non-inclusion of Enumerable on Node::Set (r116) -* Fixed parsing with errors bug (r113) - -== 2006-11-19 roscopeco - -* Merged non-backward-compatible DEV_0_4 changes: - -* Implemented new HTMLParser interface -* Implemented new (faster) SAX callback strategy (r111) -* Merged backward-compatible fixes down from DEV_0_4: - -* Tested fix of bug #4635 -* Reimplemented attribute memory handling -* Fixed attribute list traversal (bug #4719) -* Integrated Luc Van Deuren's cdata/comment node patch -* Fixed test-naming bugs -* Fixed doc build bug -* Reimplemented XML::Node memory management -* Reimplemented node copy handling -* Fixed parser error handler proc early GC bug -* include stdarg.h on ruby_xml_document (r107) - -== 2006-11-04 roscopeco - -* Merged stdarg fix (r106) - -== 2006-10-29 roscopeco - -* Remove nodoc from libxml.rb (r96) -* Added benchmarks -Updated project status (r93) - -== 2006-10-20 roscopeco - -* Fixed up new packaging to play nice with 'rake install' (r88) -* Applied gem-build patch from Masashi Shimbo. See: -http://rubyforge.org/pipermail/libxml-devel/2006-August/000205.html (r87) -* Another failing test :( (r86) -* Removed debugging printouts (r85) - -== 2006-08-15 roscopeco - -* Fixed nodelist handling - -Patches from Stephen Veit: -Fixed for windows/visual C compliance -Fixed extconf build for Windows - -(bug 5022, http://rubyforge.org/tracker/index.php?func=detail&aid=5022&group_id=494&atid=1971) (r84) -* Fixed typo in reading example -See: http://rubyforge.org/pipermail/libxml-devel/2006-June/000181.html (r83) - -== 2006-05-31 roscopeco - -* Bugfix: gc_mark both filename and str (r82) -* Fixed a typo bug (r81) - -== 2006-05-28 roscopeco - -* Allow Node#[] and Node#[]= to handle symbol keys (See http://rubyforge.org/pipermail/libxml-devel/2006-May/000135.html) (r80) -* Applied previous node fix (See bug #4497) (r79) - -== 2006-05-10 roscopeco - -* Implemented Node#next= and Node#prev= (r78) -* Fixed incorrect class name (r77) - -== 2006-05-01 roscopeco - -* Removed a duplicate definition (and corresponding warning) (r76) -* dev 0.3.9 (r75) - -== 2006-04-24 roscopeco - -* release 0.3.8 (r73) -* Fixed a bug in release version update (r72) -* changelog/readme update for release (r71) -* Fixed tarball installation to site_ruby (added libxml.rb to install) (r70) -* Check compiler supports -Wall before using it (r69) -* Fixed rake testrunner bug (r68) - -== 2006-04-17 roscopeco - -* Switched .so to libxml_so and introduced libxml.rb to allow easier API prototype / update -Fixed testcases for new require setup (use $LOADPATH rather than filename require) (r67) -* Fixed rdoc build in gems (r66) - -== 2006-04-14 roscopeco - -* Fixed a struct initialization bug I introduced (r65) -* Fixed a build bug I introduced (r64) -* First cut of SAX callback API (r63) -* Include Enumerable (r62) - -== 2006-04-12 roscopeco - -* Typos (r61) -* Extended documentation -Restyled things a little bit -Removed standard Rote readme (r60) -* From Mark Van Holstyn (mvette13 AT gmail DOT com): -* Added XML::Node::Set#first -* Added XML::Node::Set#empty? -* Fixes to XML::Node::Set#to_a -* Added XML::Node#find_first -* Added XML::Node#remove! - -Also: -* Tested the above -* Defined node (hash) equality in terms of XML representation -* Added comparable nodes to TODOs and updated changelog (r59) -* XML::Node#content fix Tim Yamin (r58) -* Added rubygems require to example code (r57) - -== 2006-03-27 roscopeco - -* Implemented & tested XML::Parser.register_error_handler -Doc fixup (XML::DTD -> XML::Dtd) (r56) -* development version roll (r55) - -== 2006-03-21 roscopeco - -* Added RDoc -Updated gem build -Updated instructions (r53) -* Updated instructions (r52) - -== 2006-03-09 roscopeco - -* Implemented better version check (Added RUBY_LIBXSLT_VER_xxx defines) -Updated release versioning in Rakefile (r51) -* Added RUBY_LIBXML_VER_xxx defines for libxslt checking -Updated release versioning in Rakefile -Todo update (r50) -* Fixed copy/paste errors in documentation (r49) - -== 2006-03-08 roscopeco - -* Rakefile bugfix, Readme update, cvs ignorance update (r48) -* Initial revision (r43) - -== 2006-02-28 roscopeco - -* * Ignored vi .swp files -* Updated Changelog -* Updated copyright years -* Removed done todos (r42) - -== 2006-02-27 roscopeco - -* * Fixed issues with -fno-common GCC flag -* Removed OSX -fno-common workaround -* Fixed a couple of typos (r41) - -== 2006-02-23 roscopeco - -* Release 0.3.6 (r40) - -== 2006-02-21 roscopeco - -* Rearranged source layout to suit RubyGems packaging -Removed obsolete (Rubynet) utility scripts (r39) -* Band-aid for OSX build probs (r38) - -== 2006-02-20 roscopeco - -* * Fixed attribute memory handling (http://rubyforge.org/pipermail/libxml-devel/2005-December/000030.html) -* Removed a small leak in ruby_xml_node. -* Fixed parser memory_debug_enabled doc -* Updated shebang in test runner (r37) - -== 2006-01-02 roscopeco - -* Cleaned up casts for GCC 4.0 -Migrated from (obsolete) STR2CSTR to StringValuePtr (r36) -* Fixed Make invocation (r35) -* Cleaned up casts for GCC 4.0 -Migrated from (obsolete) STR2CSTR to StringValuePtr (r34) - -== 2005-12-29 bshow - -* Initial checkin (r33) -* Added "doc" to cleanfiles; added new task "pubdoc" (r32) -* Added "doc" (r31) -* Prevent RDoc from wrapping copyright notices (r30) - -== 2005-12-19 roscopeco - -* Removed (forgotten) temporary notice for documentation set (r29) -* MIT license (r28) -* better ignorance (r27) -* Initial import (r26) - -== 2004-12-28 tom - -* initial checkin (r25) - -== 2003-09-04 gforge - -* initial checkin (r22) - -== 2003-09-04 tom - -* Test (r24) -* Test (r23) - -== 2003-04-25 tcarrico - -* Updating binary default types (r21) - -== 2003-04-24 tom - -* initial checkin (r20) -* tweak (r19) -* initial checkin (r18) - -== 2003-03-05 tom - -* *** empty log message *** (r17) -* *** empty log message *** (r16) - -== 2003-02-28 (no author) - -* New repository initialized by cvs2svn. (r1) - -== 2003-02-28 tom - -* *** empty log message *** (r15) -* *** empty log message *** (r14) -* *** empty log message *** (r13) -* *** empty log message *** (r12) -* *** empty log message *** (r11) -* *** empty log message *** (r10) -* *** empty log message *** (r9) -* *** empty log message *** (r8) -* *** empty log message *** (r7) -* *** empty log message *** (r6) -* *** empty log message *** (r5) -* *** empty log message *** (r4) -* added newline (r3) -* *** empty log message *** (r2) - diff --git a/log/changelog.xml b/log/changelog.xml deleted file mode 100644 index 0ad18849..00000000 --- a/log/changelog.xml +++ /dev/null @@ -1,1324 +0,0 @@ - - - - -transami -2008-02-01T21:14:24.501344Z -Update test scripts to reflect move to test/. - - - -transami -2008-02-01T20:56:58.894977Z -Moves tests/ to test/ which is more conventional. - - - -transami -2008-02-01T20:55:23.367569Z -Update config file. - - - -transami -2008-02-01T20:51:57.250130Z -Moved changelog.xml and changelog.xsl to doc/log/. - - - -transami -2008-02-01T20:51:14.786912Z -Added doc/log for xml-based changelog and notes. - - - -transami -2008-01-31T13:09:55.716965Z -Minor update to a task description in Rakefile. - - - -transami -2008-01-31T04:22:13.717493Z -Added memory test task. - - - -transami -2008-01-31T04:07:23.904143Z -Added work dir for "scrap" material. Modified Rakefile. - - - -transami -2008-01-30T22:43:18.490381Z -Fixed adding lib/ to $LOAD_PATH. - - - -transami -2008-01-22T18:16:15.788965Z -Small fixes to task/make and task/test. - - - -transami -2008-01-22T18:12:00.856153Z -Changed all requires for 'libxml_test.rb' to 'libxml'. - - - -transami -2008-01-22T18:01:12.918663Z -Removed runner code from tests/. It is now in task/test. - - - -transami -2008-01-22T17:41:03.219364Z -Renamed compile to make. - - - -transami -2008-01-22T17:40:40.704832Z -Convert task/compile to pure ruby. - - - -transami -2008-01-22T17:35:02.641804Z -Moved svn task to admin. - - - -transami -2008-01-22T17:33:53.833641Z -Moved admin tasks to admin directory. - - - -transami -2008-01-22T17:32:26.793056Z -Added admin/ directory. - - - -transami -2008-01-22T17:30:42.415296Z -Remove task/tests. - - - -transami -2008-01-22T17:30:05.478561Z -Converted test task to pure ruby. - - - -transami -2007-12-23T04:11:28.706386Z -Added distclean task. - - - -transami -2007-12-23T04:10:48.910408Z -Added svn tasks and metadata. - - - -transami -2007-12-15T11:37:40.069746Z -Added svn/log task and backward compatability require (xml/libxml.rb). - - - -transami -2007-12-15T11:34:25.377811Z -Added doc/changelog.xsl. - - - -transami -2007-12-15T11:31:59.660804Z -Moved TODO up a directory level and updated meta/project.yaml. - - - -transami -2007-12-15T11:15:48.589695Z -Moved task/config.yaml to meta/config.yaml as required by Ratch 0.4.0. - - - -transami -2007-12-15T11:14:35.082137Z -Added packaging tasks. - - - -danj -2007-12-11T20:28:30.392939Z -fix XML_TEXT_NODE add handling when libxml merges nodes - - -transami -2007-12-10T20:31:40.790542Z -Added lib/xml/libxml.rb for backward compatibility. - - - -transami -2007-12-10T20:19:17.829180Z -Moved ext/libxml/libxml.rb to lib/. - - - -transami -2007-12-10T20:15:26.614974Z -Removed compile prerequisite from test task for now. - - - -transami -2007-12-10T20:14:10.257135Z -Fixed extensions attribute inf project.yaml. - - - -transami -2007-12-10T20:08:21.546856Z -Added setup task. - - - -transami -2007-12-10T20:05:40.313014Z -Fixed tasks to "main". - - - -transami -2007-12-07T22:29:00.839378Z -Added test and compile tasks. - - - -transami -2007-12-07T22:27:17.374712Z -Added version.h. - - - -transami -2007-12-07T22:26:42.837169Z -Moved header verison. - - - -transami -2007-12-07T04:58:09.846535Z -Moved ext/xml to ext/libxml. - - - -transami -2007-12-05T01:32:20.805608Z -Added meta dir and project.yaml file. - - - -transami -2007-12-05T01:10:38.404486Z -Added doc/.rsync-filter and .htaccess - - - -transami -2007-12-05T01:06:26.781159Z -Added some tasks. - - - -danj -2007-12-03T18:14:52.560018Z -raise if parser string set to empty - - -danj -2007-11-27T16:04:11.409274Z -fix transposed ruby method mapping - - -danj -2007-11-27T15:47:30.944390Z -apply patch to fix multiple namespaces for .find (submitted by keisukefukuda at gmail.com) - - -danj -2007-11-27T04:31:13.455806Z -add docs for to_s and encoding - - -danj -2007-11-27T04:23:09.933493Z -take a step in the right direction with document encoding - - -danj -2007-11-27T02:34:16.567976Z -fix variable reference in ruby_xml_parser_default_load_external_dtd_get - - -transami -2007-11-21T04:03:36.853240Z -Added project name. - - - -transami -2007-11-21T04:00:34.021355Z -Added log/history (for hand entries) and moved TODO to log/ too. - - - -transami -2007-11-21T03:03:33.424350Z -Added a log directory. - - - -danj -2007-11-21T02:20:11.556121Z -deal with different .find return types, rev to 0.5.2.2 - - -danj -2007-11-14T09:52:57.758975Z -add Node#new_text - - -danj -2007-11-14T09:11:20.369033Z -fix expand bug - - -danj -2007-11-14T09:10:34.539051Z -move rwtest to test/ets... - - -danj -2007-11-14T08:36:41.603096Z -add [] to XPath::Object and tests for it - - -danj -2007-11-14T07:51:46.588669Z -full merge from MEM2 r.194 v0.5.2.1 - - -transami -2007-10-25T18:11:13.076903Z -Added task/ dir. - - - -transami -2007-10-25T18:10:30.544460Z -Further improvements on website. - - - -transami -2007-10-25T17:50:39.143575Z -Removed doc/web. - - - -transami -2007-10-25T17:49:48.112911Z -Moved doc/web files up one level. - - - -transami -2007-10-20T08:46:34.739064Z -moved raze to web - - - -transami -2007-10-20T08:43:40.090838Z -added image - - - -transami -2007-10-20T08:42:07.187472Z -converted site to xml/xslt - - - -transami -2007-10-20T08:40:56.059561Z -updated stylesheet - - - -transami -2007-10-20T07:39:37.079389Z -removed pages - - - -transami -2007-10-20T07:38:25.605974Z -removed pages - - - -transami -2007-10-20T07:37:37.406559Z -these are about to be deleted - - - -transami -2007-08-30T22:08:59.593789Z -remove .cvsignore - - - -transami -2007-08-30T21:50:47.414263Z -moved www/ to doc/ - - - -transami -2007-08-30T21:49:30.258911Z -removed www/Rakefile (not using Rote any longer) - - - -transami -2007-08-30T21:43:39.704322Z -moved www/doc to www/raze - - - -transami -2007-08-30T21:42:03.640867Z -removed rote logo - - - -transami -2007-08-30T21:41:40.377083Z -added raze logo - - - -transami -2007-08-30T21:22:34.123232Z -updated icon - - - -transami -2007-08-30T21:07:47.744095Z -added icon - - - -transami -2007-08-30T21:00:40.243033Z -website work - - - -transami -2007-08-30T18:58:59.480483Z -moved stylesheets to styles - - - -transami -2007-08-30T03:55:44.910869Z -remove CVSROOT from trunk - - - -transami -2007-08-30T03:55:15.348059Z -continued work on website - - - -transami -2007-08-29T22:35:28.999160Z -removed res dir - - - -transami -2007-08-29T22:34:39.881610Z -continued work on converting website - - - -transami -2007-08-29T22:29:17.391979Z -converting website from rote to new system - - - -transami -2007-08-29T21:52:31.434540Z -removed libxslt (now in libxsl project) - - - -transami -2007-08-29T21:48:46.402082Z -removed libxml subdir - - - -transami -2007-08-29T21:45:48.353029Z -moved trunk/libxml/* to trunk/* - - - -lrz -2007-01-14T21:47:59.000000Z -===== 14.1.2007 Laurent Sansonetti <lrz at chopine.be> -* Added some preliminary RDoc comments for XML::Reader. - - - -roscopeco -2006-12-23T18:14:55.000000Z -Replaced RSTRING(str)->len with RSTRING_LEN(str) for future compatibility - - - -roscopeco -2006-12-05T12:03:12.000000Z -Improved compatibility with MS Visual C: - * Replace void* increment and decrement with char* arithmetic. - * Predeclare all locals - * Removed -Wall (Win32 platform sdk emits *lots* of warnings) - * Fixed extconf for win32 libxml2 and dependencies from http://www.zlatkovic.com/pub/libxml/ - - - -roscopeco -2006-12-05T11:56:30.000000Z -removed object file committed by mistake - - - -lrz -2006-12-04T23:40:08.000000Z -===== 5.12.2006 Laurent Sansonetti <lrz at chopine.be> -* Added XML::Reader, a set of bindings to the xmlTextReader API. - - - -roscopeco -2006-12-02T11:06:28.000000Z -Merged release task fix from 0.3.8.4 - - - -roscopeco -2006-11-30T17:29:04.000000Z -Restore default config after tests to prevent wierd failures in other tests - - - -roscopeco -2006-11-27T10:41:14.000000Z -Merged from 0.3.8.3: -* Fixed a segfault on node.properties with empty props list (patch from Michael Koziarski) -* Fixed version macros and release version handling - - - -roscopeco -2006-11-26T12:57:56.000000Z -Merged contributed patches #6604, #6839, #6871 -Slight fix to sax error formatting patch - - - -roscopeco -2006-11-22T14:20:33.000000Z -Fixed non-inclusion of Enumerable on Node::Set - - - -roscopeco -2006-11-22T12:41:56.000000Z -Fixed parsing with errors bug - - - -roscopeco -2006-11-20T01:39:14.000000Z -Merged non-backward-compatible DEV_0_4 changes: - -* Implemented new HTMLParser interface -* Implemented new (faster) SAX callback strategy - - - -roscopeco -2006-11-20T01:22:08.000000Z -Merged backward-compatible fixes down from DEV_0_4: - -* Tested fix of bug #4635 -* Reimplemented attribute memory handling -* Fixed attribute list traversal (bug #4719) -* Integrated Luc Van Deuren's cdata/comment node patch -* Fixed test-naming bugs -* Fixed doc build bug -* Reimplemented XML::Node memory management -* Reimplemented node copy handling -* Fixed parser error handler proc early GC bug -* include stdarg.h on ruby_xml_document - - - -roscopeco -2006-11-04T10:04:27.000000Z -Merged stdarg fix - - - -roscopeco -2006-10-29T19:42:45.000000Z -Remove nodoc from libxml.rb - - - -roscopeco -2006-10-29T13:39:14.000000Z -Added benchmarks -Updated project status - - - -roscopeco -2006-10-20T12:31:19.000000Z -Fixed up new packaging to play nice with 'rake install' - - - -roscopeco -2006-10-20T10:41:45.000000Z -Applied gem-build patch from Masashi Shimbo. See: -http://rubyforge.org/pipermail/libxml-devel/2006-August/000205.html - - - -roscopeco -2006-10-20T10:39:42.000000Z -Another failing test :( - - - -roscopeco -2006-10-20T10:39:21.000000Z -Removed debugging printouts - - - -roscopeco -2006-08-15T13:53:45.000000Z -Fixed nodelist handling - -Patches from Stephen Veit: -Fixed for windows/visual C compliance -Fixed extconf build for Windows - -(bug 5022, http://rubyforge.org/tracker/index.php?func=detail&aid=5022&group_id=494&atid=1971) - - - -roscopeco -2006-08-15T13:49:53.000000Z -Fixed typo in reading example -See: http://rubyforge.org/pipermail/libxml-devel/2006-June/000181.html - - - -roscopeco -2006-05-31T18:22:39.000000Z -Bugfix: gc_mark both filename and str - - - -roscopeco -2006-05-31T17:26:43.000000Z -Fixed a typo bug - - - -roscopeco -2006-05-28T14:06:14.000000Z -Allow Node#[] and Node#[]= to handle symbol keys (See http://rubyforge.org/pipermail/libxml-devel/2006-May/000135.html) - - - -roscopeco -2006-05-28T13:29:42.000000Z -Applied previous node fix (See bug #4497) - - - -roscopeco -2006-05-10T18:03:57.000000Z -Implemented Node#next= and Node#prev= - - - -roscopeco -2006-05-10T18:02:51.000000Z -Fixed incorrect class name - - - -roscopeco -2006-05-01T16:42:29.000000Z -Removed a duplicate definition (and corresponding warning) - - - -roscopeco -2006-05-01T16:39:52.000000Z -dev 0.3.9 - - - -roscopeco -2006-04-24T19:40:42.000000Z -release 0.3.8 - - - -roscopeco -2006-04-24T19:39:36.000000Z -Fixed a bug in release version update - - - -roscopeco -2006-04-24T19:29:49.000000Z -changelog/readme update for release - - - -roscopeco -2006-04-24T19:17:56.000000Z -Fixed tarball installation to site_ruby (added libxml.rb to install) - - - -roscopeco -2006-04-24T18:29:19.000000Z -Check compiler supports -Wall before using it - - - -roscopeco -2006-04-24T18:26:54.000000Z -Fixed rake testrunner bug - - - -roscopeco -2006-04-17T13:30:22.000000Z -Switched .so to libxml_so and introduced libxml.rb to allow easier API prototype / update -Fixed testcases for new require setup (use $LOADPATH rather than filename require) - - - -roscopeco -2006-04-17T12:02:09.000000Z -Fixed rdoc build in gems - - - -roscopeco -2006-04-14T23:46:06.000000Z -Fixed a struct initialization bug I introduced - - - -roscopeco -2006-04-14T14:50:58.000000Z -Fixed a build bug I introduced - - - -roscopeco -2006-04-14T14:45:52.000000Z -First cut of SAX callback API - - - -roscopeco -2006-04-14T14:45:25.000000Z -Include Enumerable - - - -roscopeco -2006-04-12T16:04:09.000000Z -Typos - - - -roscopeco -2006-04-12T16:01:11.000000Z -Extended documentation -Restyled things a little bit -Removed standard Rote readme - - - -roscopeco -2006-04-12T12:08:39.000000Z -From Mark Van Holstyn (mvette13 AT gmail DOT com): -* Added XML::Node::Set#first -* Added XML::Node::Set#empty? -* Fixes to XML::Node::Set#to_a -* Added XML::Node#find_first -* Added XML::Node#remove! - -Also: -* Tested the above -* Defined node (hash) equality in terms of XML representation -* Added comparable nodes to TODOs and updated changelog - - - -roscopeco -2006-04-12T10:02:46.000000Z -XML::Node#content fix Tim Yamin <plasmaroo AT gentoo DOT org> - - - -roscopeco -2006-04-12T10:00:39.000000Z -Added rubygems require to example code - - - -roscopeco -2006-03-27T20:49:19.000000Z -Implemented & tested XML::Parser.register_error_handler -Doc fixup (XML::DTD -> XML::Dtd) - - - -roscopeco -2006-03-27T20:46:48.000000Z -development version roll - - - -roscopeco -2006-03-21T22:42:21.000000Z -Added RDoc -Updated gem build -Updated instructions - - - -roscopeco -2006-03-21T22:41:30.000000Z -Updated instructions - - - -roscopeco -2006-03-09T23:13:28.000000Z -Implemented better version check (Added RUBY_LIBXSLT_VER_xxx defines) -Updated release versioning in Rakefile - - - -roscopeco -2006-03-09T23:12:12.000000Z -Added RUBY_LIBXML_VER_xxx defines for libxslt checking -Updated release versioning in Rakefile -Todo update - - - -roscopeco -2006-03-09T20:04:23.000000Z -Fixed copy/paste errors in documentation - - - -roscopeco -2006-03-09T01:45:03.000000Z -Rakefile bugfix, Readme update, cvs ignorance update - - - -roscopeco -2006-03-09T01:36:19.000000Z -Initial revision - - - -roscopeco -2006-02-28T09:57:52.000000Z -* Ignored vi .swp files -* Updated Changelog -* Updated copyright years -* Removed done todos - - - -roscopeco -2006-02-27T12:55:32.000000Z -* Fixed issues with -fno-common GCC flag -* Removed OSX -fno-common workaround -* Fixed a couple of typos - - - -roscopeco -2006-02-23T18:30:01.000000Z -Release 0.3.6 - - - -roscopeco -2006-02-21T20:40:16.000000Z -Rearranged source layout to suit RubyGems packaging -Removed obsolete (Rubynet) utility scripts - - - -roscopeco -2006-02-21T10:35:25.000000Z -Band-aid for OSX build probs - - - -roscopeco -2006-02-20T11:16:15.000000Z -* Fixed attribute memory handling (http://rubyforge.org/pipermail/libxml-devel/2005-December/000030.html) -* Removed a small leak in ruby_xml_node. -* Fixed parser memory_debug_enabled doc -* Updated shebang in test runner - - - -roscopeco -2006-01-02T23:19:21.000000Z -Cleaned up casts for GCC 4.0 -Migrated from (obsolete) STR2CSTR to StringValuePtr - - - -roscopeco -2006-01-02T23:18:46.000000Z -Fixed Make invocation - - - -roscopeco -2006-01-02T21:31:47.000000Z -Cleaned up casts for GCC 4.0 -Migrated from (obsolete) STR2CSTR to StringValuePtr - - - -bshow -2005-12-29T19:12:38.000000Z -Initial checkin - - - -bshow -2005-12-29T19:10:52.000000Z -Added "doc" to cleanfiles; added new task "pubdoc" - - - -bshow -2005-12-29T19:10:20.000000Z -Added "doc" - - - -bshow -2005-12-29T19:00:01.000000Z -Prevent RDoc from wrapping copyright notices - - - -roscopeco -2005-12-19T20:51:39.000000Z -Removed (forgotten) temporary notice for documentation set - - - -roscopeco -2005-12-19T20:48:52.000000Z -MIT license - - - -roscopeco -2005-12-19T19:57:20.000000Z -better ignorance - - - -roscopeco -2005-12-19T19:53:07.000000Z -Initial import - - - -tom -2004-12-29T01:03:49.000000Z -initial checkin - - -tom -2003-09-04T20:58:03.000000Z -Test - - - -tom -2003-09-04T20:56:15.000000Z -Test - - - -gforge -2003-09-04T18:31:27.000000Z -initial checkin - - - -tcarrico -2003-04-25T14:22:04.000000Z -Updating binary default types - - - -tom -2003-04-24T20:14:32.000000Z -initial checkin - - - -tom -2003-04-24T19:46:12.000000Z -tweak - - - -tom -2003-04-24T19:43:45.000000Z -initial checkin - - - -tom -2003-03-05T16:47:11.000000Z -*** empty log message *** - - - -tom -2003-03-05T16:42:18.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:37:09.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:26:07.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:10:35.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:10:18.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:10:11.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:09:57.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:06:41.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:00:46.000000Z -*** empty log message *** - - - -tom -2003-02-28T19:00:06.000000Z -*** empty log message *** - - - -tom -2003-02-28T18:59:06.000000Z -*** empty log message *** - - - -tom -2003-02-28T18:24:49.000000Z -*** empty log message *** - - - -tom -2003-02-28T18:23:12.000000Z -*** empty log message *** - - - -tom -2003-02-28T18:17:45.000000Z -added newline - - - -tom -2003-02-28T18:13:00.000000Z -*** empty log message *** - - - -2003-02-28T18:13:00.000000Z -New repository initialized by cvs2svn. - - diff --git a/log/changelog.xsl b/log/changelog.xsl deleted file mode 100644 index 232ed310..00000000 --- a/log/changelog.xsl +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - Facets Changelog - - - - -

-

LibXML ChangeLog

- - -
-

- -
- - - - - - - -
- - - -
- - - diff --git a/script/benchmark/depixelate b/script/benchmark/depixelate deleted file mode 100755 index 4efbf510..00000000 --- a/script/benchmark/depixelate +++ /dev/null @@ -1,634 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'benchmark' -require 'hpricot' -require 'rexml/document' -require 'xml' - - -# Taken from http://depixelate.com/2008/4/23/ruby-xml-parsing-benchmarks - -XML_STRING = DATA.read - -class Parse - def self.libxml - doc = XML::Parser.string(XML_STRING).parse - ary = [] - doc.find('/*/*/*').each do |node| - case node.name - when 'ItemQueryRs' - node.each_element do |child| - ary << child.find_first('./ListID') - end - end - end - ary - end - - def self.rexml - doc = REXML::Document.new(XML_STRING) - ary = [] - REXML::XPath.each(doc, '/*/*/*') do |node| - case node.name - when 'ItemQueryRs' - node.elements.each do |element| - ary << rexml_fetch(element, 'ListID') - end - end - end - ary - end - - def self.hpricot - doc = Hpricot.XML(XML_STRING) - ary = [] - response_element = doc.search('/*/*/*').each do |node| - next unless node.elem? - case node.name - when 'ItemQueryRs' - node.containers.each do |element| - ary << hpricot_fetch(element/'ListID') - end - end - end - ary - end - - # rexml helper - def self.rexml_fetch(node, name) - e = REXML::XPath.first(node, name) - e ? e.text : nil - end - - # hpricot helper - def self.hpricot_fetch(path) - return nil if path.nil? || path.empty? - path = path.first if path.is_a?(Array) - path.innerHTML - end -end - -TIMES = 10 -Benchmark.bmbm do |x| - x.report('libxml') { TIMES.times { Parse.libxml } } - x.report('Hpricot') { TIMES.times { Parse.hpricot } } - x.report('REXML') { TIMES.times { Parse.rexml } } -end - -__END__ - - - - - - 240000-1071531214 - 2003-12-15T15:33:34-08:00 - 2003-12-15T15:34:51-08:00 - 1071531291 - Delivery - Delivery - true - 0 - - 20000-999021789 - Non - - - Delivery Service Fee (free for orders over $100) - 15.00 - - 610001-1071531179 - Service - - - - - 10000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Design - Design - true - 0 - - 20000-999021789 - Non - - - Custom Landscape Design - 55.00 - - 150000-934380913 - Landscaping Services:Design Services - - - - - 20000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T08:59:12-08:00 - 934387152 - Gardening - Gardening - true - 0 - - 20000-999021789 - Non - - - Weekly gardening services - 0.00 - - 1F0000-934380913 - Landscaping Services:Labor:Installation - - - - - 30000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Installation - Installation - true - 0 - - 20000-999021789 - Non - - - Installation of landscape design - 35.00 - - 1F0000-934380913 - Landscaping Services:Labor:Installation - - - - - 40000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Pest Control - Pest Control - true - 0 - - 20000-999021789 - Non - - - Pest control services - 0.00 - - 200000-934380913 - Landscaping Services:Labor:Maintenance & Repairs - - - - - 2E0000-1071514896 - 2003-12-15T11:01:36-08:00 - 2003-12-15T14:42:51-08:00 - 1071528171 - Tree Removal - Tree Removal - true - 0 - - 20000-999021789 - Non - - - Tree Removal Service - 0.00 - - 610001-1071531179 - Service - - - - - 50000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Trimming - Trimming - true - 0 - - 20000-999021789 - Non - - - Tree and shrub trimming - 35.00 - - 200000-934380913 - Landscaping Services:Labor:Maintenance & Repairs - - - - - B0000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Concrete - Concrete - true - 0 - - 10000-999021789 - Tax - - - Concrete for fountain installation - 0.00 - - 1B0000-934380913 - Landscaping Services:Job Materials:Fountains & Garden Lighting - - - - - C0000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Deck Lumber - Deck Lumber - true - 0 - - 10000-999021789 - Tax - - - Deck Lumber - 0.00 - - 1A0000-934380913 - Landscaping Services:Job Materials:Decks & Patios - - - - - 210000-1071530240 - 2003-12-15T15:17:20-08:00 - 2003-12-15T15:17:20-08:00 - 1071530240 - Fertilizer - Fertilizer - true - 0 - - 10000-999021789 - Tax - - - Parent Item - Do Not Use - 0.00 - - 600001-1071530232 - Retail Sales - - - - - 250000-1071523682 - 2003-12-15T13:28:02-08:00 - 2003-12-15T13:44:20-08:00 - 1071524660 - Irrigation Hose - Irrigation Hose - true - 0 - - 10000-999021789 - Tax - - Parent Item Vinyl Irrigation Line- Do Not Purchase or Sell - 0.00 - - 690001-1071523679 - Landscaping Services:Job Materials:Misc Materials - - Vinyl Irrigation LineParent Item - Do Not Purchase or Sell - 0.00 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - -1 - 0 - 0.00 - 0 - 0 - - - 270000-1071524193 - 2003-12-15T13:36:33-08:00 - 2003-12-15T13:38:13-08:00 - 1071524293 - 1/2" Line - Irrigation Hose:1/2" Line - true - - 250000-1071523682 - Irrigation Hose - - 1 - - 10000-999021789 - Tax - - 1/2" Vinyl Irrigation Line - 0.15 - - 690001-1071523679 - Landscaping Services:Job Materials:Misc Materials - - 1/2" Vinyl Irrigation Line - 0.12 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 1500 - 1783 - 0.12 - 0 - 0 - - - 260000-1071523858 - 2003-12-15T13:30:58-08:00 - 2003-12-15T13:37:52-08:00 - 1071524272 - 1/4" Line - Irrigation Hose:1/4" Line - true - - 250000-1071523682 - Irrigation Hose - - 1 - - 10000-999021789 - Tax - - 1/4" Vinyl Irrigation Line - 0.10 - - 690001-1071523679 - Landscaping Services:Job Materials:Misc Materials - - 1/4" Vinyl Irrigation Line - 0.07 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 500 - 1235 - 0.07 - 0 - 0 - - - 280000-1071524260 - 2003-12-15T13:37:40-08:00 - 2003-12-15T13:37:40-08:00 - 1071524260 - 3/4" Line - Irrigation Hose:3/4" Line - true - - 250000-1071523682 - Irrigation Hose - - 1 - - 10000-999021789 - Tax - - 3/4" Vinyl Irrigation Line - 0.27 - - 690001-1071523679 - Landscaping Services:Job Materials:Misc Materials - - 3/4" Vinyl Irrigation Line - 0.18 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 1500 - 2670 - 0.18 - 0 - 0 - - - 60000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Lighting - Lighting - true - 0 - - 10000-999021789 - Tax - - Garden Lighting - 0.00 - - 1B0000-934380913 - Landscaping Services:Job Materials:Fountains & Garden Lighting - - Garden Lighting - 0.00 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 94 - 14.80 - 28 - 0 - - - 70000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Pump - Pump - true - 0 - - 10000-999021789 - Tax - - Fountain pump - 75.00 - - 1B0000-934380913 - Landscaping Services:Job Materials:Fountains & Garden Lighting - - Fountain pump #198-30 - 56.00 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 48 - 53.93 - 0 - 0 - - - 80000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Soil - Soil - true - 0 - - 10000-999021789 - Tax - - Soil, 2 cubic ft bag - 6.75 - - 1C0000-934380913 - Landscaping Services:Job Materials:Plants and Sod - - Soil, 2 cubic ft bag - 5.30 - - 240000-934380913 - Cost of Goods Sold - - - 10000-934380927 - Middlefield Nursery - - - 60000-934380912 - Inventory Asset - - 25 - 0 - 5.30 - 6 - 10 - - - 90000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Sprinkler Hds - Sprinkler Hds - true - 0 - - 10000-999021789 - Tax - - Sprinkler heads - 0.00 - - 1D0000-934380913 - Landscaping Services:Job Materials:Sprinklers & Drip systems - - Sprinkler head #BLS9081-09 - 0.00 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 69 - 6.38 - 36 - 0 - - - A0000-934380927 - 1999-08-11T07:15:27-08:00 - 1999-08-11T07:15:27-08:00 - 934380927 - Sprkl pipes - Sprkl pipes - true - 0 - - 10000-999021789 - Tax - - Plastic sprinkler piping - 2.75 - - 1D0000-934380913 - Landscaping Services:Job Materials:Sprinklers & Drip systems - - Plastic sprinkler piping #1098-20 - 2.10 - - 240000-934380913 - Cost of Goods Sold - - - 60000-934380912 - Inventory Asset - - 250 - 826 - 2.10 - 115 - 0 - - - - diff --git a/script/benchmark/hamlet.xml b/script/benchmark/hamlet.xml deleted file mode 100644 index abff4399..00000000 --- a/script/benchmark/hamlet.xml +++ /dev/null @@ -1,9055 +0,0 @@ - - -The Tragedy of Hamlet, Prince of Denmark - - -

ASCII text placed in the public domain by Moby Lexical Tools, 1992.

-

SGML markup by Jon Bosak, 1992-1994.

-

XML version by Jon Bosak, 1996-1999.

-

The XML markup in this version is Copyright © 1999 Jon Bosak. -This work may freely be distributed on condition that it not be -modified or altered in any way.

-
- - -Dramatis Personae - -CLAUDIUS, king of Denmark. -HAMLET, son to the late, and nephew to the present king. -POLONIUS, lord chamberlain. -HORATIO, friend to Hamlet. -LAERTES, son to Polonius. -LUCIANUS, nephew to the king. - - -VOLTIMAND -CORNELIUS -ROSENCRANTZ -GUILDENSTERN -OSRIC -courtiers. - - -A Gentleman -A Priest. - - -MARCELLUS -BERNARDO -officers. - - -FRANCISCO, a soldier. -REYNALDO, servant to Polonius. -Players. -Two Clowns, grave-diggers. -FORTINBRAS, prince of Norway. -A Captain. -English Ambassadors. -GERTRUDE, queen of Denmark, and mother to Hamlet. -OPHELIA, daughter to Polonius. -Lords, Ladies, Officers, Soldiers, Sailors, Messengers, and other Attendants. -Ghost of Hamlet's Father. - - -SCENE Denmark. - -HAMLET - -ACT I - -SCENE I. Elsinore. A platform before the castle. -FRANCISCO at his post. Enter to him BERNARDO - - -BERNARDO -Who's there? - - - -FRANCISCO -Nay, answer me: stand, and unfold yourself. - - - -BERNARDO -Long live the king! - - - -FRANCISCO -Bernardo? - - - -BERNARDO -He. - - - -FRANCISCO -You come most carefully upon your hour. - - - -BERNARDO -'Tis now struck twelve; get thee to bed, Francisco. - - - -FRANCISCO -For this relief much thanks: 'tis bitter cold, -And I am sick at heart. - - - -BERNARDO -Have you had quiet guard? - - - -FRANCISCO -Not a mouse stirring. - - - -BERNARDO -Well, good night. -If you do meet Horatio and Marcellus, -The rivals of my watch, bid them make haste. - - - -FRANCISCO -I think I hear them. Stand, ho! Who's there? - - -Enter HORATIO and MARCELLUS - - -HORATIO -Friends to this ground. - - - -MARCELLUS -And liegemen to the Dane. - - - -FRANCISCO -Give you good night. - - - -MARCELLUS -O, farewell, honest soldier: -Who hath relieved you? - - - -FRANCISCO -Bernardo has my place. -Give you good night. - - -Exit - - -MARCELLUS -Holla! Bernardo! - - - -BERNARDO -Say, -What, is Horatio there? - - - -HORATIO -A piece of him. - - - -BERNARDO -Welcome, Horatio: welcome, good Marcellus. - - - -MARCELLUS -What, has this thing appear'd again to-night? - - - -BERNARDO -I have seen nothing. - - - -MARCELLUS -Horatio says 'tis but our fantasy, -And will not let belief take hold of him -Touching this dreaded sight, twice seen of us: -Therefore I have entreated him along -With us to watch the minutes of this night; -That if again this apparition come, -He may approve our eyes and speak to it. - - - -HORATIO -Tush, tush, 'twill not appear. - - - -BERNARDO -Sit down awhile; -And let us once again assail your ears, -That are so fortified against our story -What we have two nights seen. - - - -HORATIO -Well, sit we down, -And let us hear Bernardo speak of this. - - - -BERNARDO -Last night of all, -When yond same star that's westward from the pole -Had made his course to illume that part of heaven -Where now it burns, Marcellus and myself, -The bell then beating one,-- - - -Enter Ghost - - -MARCELLUS -Peace, break thee off; look, where it comes again! - - - -BERNARDO -In the same figure, like the king that's dead. - - - -MARCELLUS -Thou art a scholar; speak to it, Horatio. - - - -BERNARDO -Looks it not like the king? mark it, Horatio. - - - -HORATIO -Most like: it harrows me with fear and wonder. - - - -BERNARDO -It would be spoke to. - - - -MARCELLUS -Question it, Horatio. - - - -HORATIO -What art thou that usurp'st this time of night, -Together with that fair and warlike form -In which the majesty of buried Denmark -Did sometimes march? by heaven I charge thee, speak! - - - -MARCELLUS -It is offended. - - - -BERNARDO -See, it stalks away! - - - -HORATIO -Stay! speak, speak! I charge thee, speak! - - -Exit Ghost - - -MARCELLUS -'Tis gone, and will not answer. - - - -BERNARDO -How now, Horatio! you tremble and look pale: -Is not this something more than fantasy? -What think you on't? - - - -HORATIO -Before my God, I might not this believe -Without the sensible and true avouch -Of mine own eyes. - - - -MARCELLUS -Is it not like the king? - - - -HORATIO -As thou art to thyself: -Such was the very armour he had on -When he the ambitious Norway combated; -So frown'd he once, when, in an angry parle, -He smote the sledded Polacks on the ice. -'Tis strange. - - - -MARCELLUS -Thus twice before, and jump at this dead hour, -With martial stalk hath he gone by our watch. - - - -HORATIO -In what particular thought to work I know not; -But in the gross and scope of my opinion, -This bodes some strange eruption to our state. - - - -MARCELLUS -Good now, sit down, and tell me, he that knows, -Why this same strict and most observant watch -So nightly toils the subject of the land, -And why such daily cast of brazen cannon, -And foreign mart for implements of war; -Why such impress of shipwrights, whose sore task -Does not divide the Sunday from the week; -What might be toward, that this sweaty haste -Doth make the night joint-labourer with the day: -Who is't that can inform me? - - - -HORATIO -That can I; -At least, the whisper goes so. Our last king, -Whose image even but now appear'd to us, -Was, as you know, by Fortinbras of Norway, -Thereto prick'd on by a most emulate pride, -Dared to the combat; in which our valiant Hamlet-- -For so this side of our known world esteem'd him-- -Did slay this Fortinbras; who by a seal'd compact, -Well ratified by law and heraldry, -Did forfeit, with his life, all those his lands -Which he stood seized of, to the conqueror: -Against the which, a moiety competent -Was gaged by our king; which had return'd -To the inheritance of Fortinbras, -Had he been vanquisher; as, by the same covenant, -And carriage of the article design'd, -His fell to Hamlet. Now, sir, young Fortinbras, -Of unimproved mettle hot and full, -Hath in the skirts of Norway here and there -Shark'd up a list of lawless resolutes, -For food and diet, to some enterprise -That hath a stomach in't; which is no other-- -As it doth well appear unto our state-- -But to recover of us, by strong hand -And terms compulsatory, those foresaid lands -So by his father lost: and this, I take it, -Is the main motive of our preparations, -The source of this our watch and the chief head -Of this post-haste and romage in the land. - - - -BERNARDO -I think it be no other but e'en so: -Well may it sort that this portentous figure -Comes armed through our watch; so like the king -That was and is the question of these wars. - - - -HORATIO -A mote it is to trouble the mind's eye. -In the most high and palmy state of Rome, -A little ere the mightiest Julius fell, -The graves stood tenantless and the sheeted dead -Did squeak and gibber in the Roman streets: -As stars with trains of fire and dews of blood, -Disasters in the sun; and the moist star -Upon whose influence Neptune's empire stands -Was sick almost to doomsday with eclipse: -And even the like precurse of fierce events, -As harbingers preceding still the fates -And prologue to the omen coming on, -Have heaven and earth together demonstrated -Unto our climatures and countrymen.-- -But soft, behold! lo, where it comes again! -Re-enter Ghost -I'll cross it, though it blast me. Stay, illusion! -If thou hast any sound, or use of voice, -Speak to me: -If there be any good thing to be done, -That may to thee do ease and grace to me, -Speak to me: -Cock crows -If thou art privy to thy country's fate, -Which, happily, foreknowing may avoid, O, speak! -Or if thou hast uphoarded in thy life -Extorted treasure in the womb of earth, -For which, they say, you spirits oft walk in death, -Speak of it: stay, and speak! Stop it, Marcellus. - - - -MARCELLUS -Shall I strike at it with my partisan? - - - -HORATIO -Do, if it will not stand. - - - -BERNARDO -'Tis here! - - - -HORATIO -'Tis here! - - - -MARCELLUS -'Tis gone! -Exit Ghost -We do it wrong, being so majestical, -To offer it the show of violence; -For it is, as the air, invulnerable, -And our vain blows malicious mockery. - - - -BERNARDO -It was about to speak, when the cock crew. - - - -HORATIO -And then it started like a guilty thing -Upon a fearful summons. I have heard, -The cock, that is the trumpet to the morn, -Doth with his lofty and shrill-sounding throat -Awake the god of day; and, at his warning, -Whether in sea or fire, in earth or air, -The extravagant and erring spirit hies -To his confine: and of the truth herein -This present object made probation. - - - -MARCELLUS -It faded on the crowing of the cock. -Some say that ever 'gainst that season comes -Wherein our Saviour's birth is celebrated, -The bird of dawning singeth all night long: -And then, they say, no spirit dares stir abroad; -The nights are wholesome; then no planets strike, -No fairy takes, nor witch hath power to charm, -So hallow'd and so gracious is the time. - - - -HORATIO -So have I heard and do in part believe it. -But, look, the morn, in russet mantle clad, -Walks o'er the dew of yon high eastward hill: -Break we our watch up; and by my advice, -Let us impart what we have seen to-night -Unto young Hamlet; for, upon my life, -This spirit, dumb to us, will speak to him. -Do you consent we shall acquaint him with it, -As needful in our loves, fitting our duty? - - - -MARCELLUS -Let's do't, I pray; and I this morning know -Where we shall find him most conveniently. - - -Exeunt - - -SCENE II. A room of state in the castle. -Enter KING CLAUDIUS, QUEEN GERTRUDE, HAMLET, -POLONIUS, LAERTES, VOLTIMAND, CORNELIUS, Lords, -and Attendants - - -KING CLAUDIUS -Though yet of Hamlet our dear brother's death -The memory be green, and that it us befitted -To bear our hearts in grief and our whole kingdom -To be contracted in one brow of woe, -Yet so far hath discretion fought with nature -That we with wisest sorrow think on him, -Together with remembrance of ourselves. -Therefore our sometime sister, now our queen, -The imperial jointress to this warlike state, -Have we, as 'twere with a defeated joy,-- -With an auspicious and a dropping eye, -With mirth in funeral and with dirge in marriage, -In equal scale weighing delight and dole,-- -Taken to wife: nor have we herein barr'd -Your better wisdoms, which have freely gone -With this affair along. For all, our thanks. -Now follows, that you know, young Fortinbras, -Holding a weak supposal of our worth, -Or thinking by our late dear brother's death -Our state to be disjoint and out of frame, -Colleagued with the dream of his advantage, -He hath not fail'd to pester us with message, -Importing the surrender of those lands -Lost by his father, with all bonds of law, -To our most valiant brother. So much for him. -Now for ourself and for this time of meeting: -Thus much the business is: we have here writ -To Norway, uncle of young Fortinbras,-- -Who, impotent and bed-rid, scarcely hears -Of this his nephew's purpose,--to suppress -His further gait herein; in that the levies, -The lists and full proportions, are all made -Out of his subject: and we here dispatch -You, good Cornelius, and you, Voltimand, -For bearers of this greeting to old Norway; -Giving to you no further personal power -To business with the king, more than the scope -Of these delated articles allow. -Farewell, and let your haste commend your duty. - - - -CORNELIUS -VOLTIMAND -In that and all things will we show our duty. - - - -KING CLAUDIUS -We doubt it nothing: heartily farewell. -Exeunt VOLTIMAND and CORNELIUS -And now, Laertes, what's the news with you? -You told us of some suit; what is't, Laertes? -You cannot speak of reason to the Dane, -And loose your voice: what wouldst thou beg, Laertes, -That shall not be my offer, not thy asking? -The head is not more native to the heart, -The hand more instrumental to the mouth, -Than is the throne of Denmark to thy father. -What wouldst thou have, Laertes? - - - -LAERTES -My dread lord, -Your leave and favour to return to France; -From whence though willingly I came to Denmark, -To show my duty in your coronation, -Yet now, I must confess, that duty done, -My thoughts and wishes bend again toward France -And bow them to your gracious leave and pardon. - - - -KING CLAUDIUS -Have you your father's leave? What says Polonius? - - - -LORD POLONIUS -He hath, my lord, wrung from me my slow leave -By laboursome petition, and at last -Upon his will I seal'd my hard consent: -I do beseech you, give him leave to go. - - - -KING CLAUDIUS -Take thy fair hour, Laertes; time be thine, -And thy best graces spend it at thy will! -But now, my cousin Hamlet, and my son,-- - - - -HAMLET -Aside A little more than kin, and less than kind. - - - -KING CLAUDIUS -How is it that the clouds still hang on you? - - - -HAMLET -Not so, my lord; I am too much i' the sun. - - - -QUEEN GERTRUDE -Good Hamlet, cast thy nighted colour off, -And let thine eye look like a friend on Denmark. -Do not for ever with thy vailed lids -Seek for thy noble father in the dust: -Thou know'st 'tis common; all that lives must die, -Passing through nature to eternity. - - - -HAMLET -Ay, madam, it is common. - - - -QUEEN GERTRUDE -If it be, -Why seems it so particular with thee? - - - -HAMLET -Seems, madam! nay it is; I know not 'seems.' -'Tis not alone my inky cloak, good mother, -Nor customary suits of solemn black, -Nor windy suspiration of forced breath, -No, nor the fruitful river in the eye, -Nor the dejected 'havior of the visage, -Together with all forms, moods, shapes of grief, -That can denote me truly: these indeed seem, -For they are actions that a man might play: -But I have that within which passeth show; -These but the trappings and the suits of woe. - - - -KING CLAUDIUS -'Tis sweet and commendable in your nature, Hamlet, -To give these mourning duties to your father: -But, you must know, your father lost a father; -That father lost, lost his, and the survivor bound -In filial obligation for some term -To do obsequious sorrow: but to persever -In obstinate condolement is a course -Of impious stubbornness; 'tis unmanly grief; -It shows a will most incorrect to heaven, -A heart unfortified, a mind impatient, -An understanding simple and unschool'd: -For what we know must be and is as common -As any the most vulgar thing to sense, -Why should we in our peevish opposition -Take it to heart? Fie! 'tis a fault to heaven, -A fault against the dead, a fault to nature, -To reason most absurd: whose common theme -Is death of fathers, and who still hath cried, -From the first corse till he that died to-day, -'This must be so.' We pray you, throw to earth -This unprevailing woe, and think of us -As of a father: for let the world take note, -You are the most immediate to our throne; -And with no less nobility of love -Than that which dearest father bears his son, -Do I impart toward you. For your intent -In going back to school in Wittenberg, -It is most retrograde to our desire: -And we beseech you, bend you to remain -Here, in the cheer and comfort of our eye, -Our chiefest courtier, cousin, and our son. - - - -QUEEN GERTRUDE -Let not thy mother lose her prayers, Hamlet: -I pray thee, stay with us; go not to Wittenberg. - - - -HAMLET -I shall in all my best obey you, madam. - - - -KING CLAUDIUS -Why, 'tis a loving and a fair reply: -Be as ourself in Denmark. Madam, come; -This gentle and unforced accord of Hamlet -Sits smiling to my heart: in grace whereof, -No jocund health that Denmark drinks to-day, -But the great cannon to the clouds shall tell, -And the king's rouse the heavens all bruit again, -Re-speaking earthly thunder. Come away. - - -Exeunt all but HAMLET - - -HAMLET -O, that this too too solid flesh would melt -Thaw and resolve itself into a dew! -Or that the Everlasting had not fix'd -His canon 'gainst self-slaughter! O God! God! -How weary, stale, flat and unprofitable, -Seem to me all the uses of this world! -Fie on't! ah fie! 'tis an unweeded garden, -That grows to seed; things rank and gross in nature -Possess it merely. That it should come to this! -But two months dead: nay, not so much, not two: -So excellent a king; that was, to this, -Hyperion to a satyr; so loving to my mother -That he might not beteem the winds of heaven -Visit her face too roughly. Heaven and earth! -Must I remember? why, she would hang on him, -As if increase of appetite had grown -By what it fed on: and yet, within a month-- -Let me not think on't--Frailty, thy name is woman!-- -A little month, or ere those shoes were old -With which she follow'd my poor father's body, -Like Niobe, all tears:--why she, even she-- -O, God! a beast, that wants discourse of reason, -Would have mourn'd longer--married with my uncle, -My father's brother, but no more like my father -Than I to Hercules: within a month: -Ere yet the salt of most unrighteous tears -Had left the flushing in her galled eyes, -She married. O, most wicked speed, to post -With such dexterity to incestuous sheets! -It is not nor it cannot come to good: -But break, my heart; for I must hold my tongue. - - -Enter HORATIO, MARCELLUS, and BERNARDO - - -HORATIO -Hail to your lordship! - - - -HAMLET -I am glad to see you well: -Horatio,--or I do forget myself. - - - -HORATIO -The same, my lord, and your poor servant ever. - - - -HAMLET -Sir, my good friend; I'll change that name with you: -And what make you from Wittenberg, Horatio? Marcellus? - - - -MARCELLUS -My good lord-- - - - -HAMLET -I am very glad to see you. Good even, sir. -But what, in faith, make you from Wittenberg? - - - -HORATIO -A truant disposition, good my lord. - - - -HAMLET -I would not hear your enemy say so, -Nor shall you do mine ear that violence, -To make it truster of your own report -Against yourself: I know you are no truant. -But what is your affair in Elsinore? -We'll teach you to drink deep ere you depart. - - - -HORATIO -My lord, I came to see your father's funeral. - - - -HAMLET -I pray thee, do not mock me, fellow-student; -I think it was to see my mother's wedding. - - - -HORATIO -Indeed, my lord, it follow'd hard upon. - - - -HAMLET -Thrift, thrift, Horatio! the funeral baked meats -Did coldly furnish forth the marriage tables. -Would I had met my dearest foe in heaven -Or ever I had seen that day, Horatio! -My father!--methinks I see my father. - - - -HORATIO -Where, my lord? - - - -HAMLET -In my mind's eye, Horatio. - - - -HORATIO -I saw him once; he was a goodly king. - - - -HAMLET -He was a man, take him for all in all, -I shall not look upon his like again. - - - -HORATIO -My lord, I think I saw him yesternight. - - - -HAMLET -Saw? who? - - - -HORATIO -My lord, the king your father. - - - -HAMLET -The king my father! - - - -HORATIO -Season your admiration for awhile -With an attent ear, till I may deliver, -Upon the witness of these gentlemen, -This marvel to you. - - - -HAMLET -For God's love, let me hear. - - - -HORATIO -Two nights together had these gentlemen, -Marcellus and Bernardo, on their watch, -In the dead vast and middle of the night, -Been thus encounter'd. A figure like your father, -Armed at point exactly, cap-a-pe, -Appears before them, and with solemn march -Goes slow and stately by them: thrice he walk'd -By their oppress'd and fear-surprised eyes, -Within his truncheon's length; whilst they, distilled -Almost to jelly with the act of fear, -Stand dumb and speak not to him. This to me -In dreadful secrecy impart they did; -And I with them the third night kept the watch; -Where, as they had deliver'd, both in time, -Form of the thing, each word made true and good, -The apparition comes: I knew your father; -These hands are not more like. - - - -HAMLET -But where was this? - - - -MARCELLUS -My lord, upon the platform where we watch'd. - - - -HAMLET -Did you not speak to it? - - - -HORATIO -My lord, I did; -But answer made it none: yet once methought -It lifted up its head and did address -Itself to motion, like as it would speak; -But even then the morning cock crew loud, -And at the sound it shrunk in haste away, -And vanish'd from our sight. - - - -HAMLET -'Tis very strange. - - - -HORATIO -As I do live, my honour'd lord, 'tis true; -And we did think it writ down in our duty -To let you know of it. - - - -HAMLET -Indeed, indeed, sirs, but this troubles me. -Hold you the watch to-night? - - - -MARCELLUS -BERNARDO -We do, my lord. - - - -HAMLET -Arm'd, say you? - - - -MARCELLUS -BERNARDO -Arm'd, my lord. - - - -HAMLET -From top to toe? - - - -MARCELLUS -BERNARDO -My lord, from head to foot. - - - -HAMLET -Then saw you not his face? - - - -HORATIO -O, yes, my lord; he wore his beaver up. - - - -HAMLET -What, look'd he frowningly? - - - -HORATIO -A countenance more in sorrow than in anger. - - - -HAMLET -Pale or red? - - - -HORATIO -Nay, very pale. - - - -HAMLET -And fix'd his eyes upon you? - - - -HORATIO -Most constantly. - - - -HAMLET -I would I had been there. - - - -HORATIO -It would have much amazed you. - - - -HAMLET -Very like, very like. Stay'd it long? - - - -HORATIO -While one with moderate haste might tell a hundred. - - - -MARCELLUS -BERNARDO -Longer, longer. - - - -HORATIO -Not when I saw't. - - - -HAMLET -His beard was grizzled--no? - - - -HORATIO -It was, as I have seen it in his life, -A sable silver'd. - - - -HAMLET -I will watch to-night; -Perchance 'twill walk again. - - - -HORATIO -I warrant it will. - - - -HAMLET -If it assume my noble father's person, -I'll speak to it, though hell itself should gape -And bid me hold my peace. I pray you all, -If you have hitherto conceal'd this sight, -Let it be tenable in your silence still; -And whatsoever else shall hap to-night, -Give it an understanding, but no tongue: -I will requite your loves. So, fare you well: -Upon the platform, 'twixt eleven and twelve, -I'll visit you. - - - -All -Our duty to your honour. - - - -HAMLET -Your loves, as mine to you: farewell. -Exeunt all but HAMLET -My father's spirit in arms! all is not well; -I doubt some foul play: would the night were come! -Till then sit still, my soul: foul deeds will rise, -Though all the earth o'erwhelm them, to men's eyes. - - -Exit - - -SCENE III. A room in Polonius' house. -Enter LAERTES and OPHELIA - - -LAERTES -My necessaries are embark'd: farewell: -And, sister, as the winds give benefit -And convoy is assistant, do not sleep, -But let me hear from you. - - - -OPHELIA -Do you doubt that? - - - -LAERTES -For Hamlet and the trifling of his favour, -Hold it a fashion and a toy in blood, -A violet in the youth of primy nature, -Forward, not permanent, sweet, not lasting, -The perfume and suppliance of a minute; No more. - - - -OPHELIA -No more but so? - - - -LAERTES -Think it no more; -For nature, crescent, does not grow alone -In thews and bulk, but, as this temple waxes, -The inward service of the mind and soul -Grows wide withal. Perhaps he loves you now, -And now no soil nor cautel doth besmirch -The virtue of his will: but you must fear, -His greatness weigh'd, his will is not his own; -For he himself is subject to his birth: -He may not, as unvalued persons do, -Carve for himself; for on his choice depends -The safety and health of this whole state; -And therefore must his choice be circumscribed -Unto the voice and yielding of that body -Whereof he is the head. Then if he says he loves you, -It fits your wisdom so far to believe it -As he in his particular act and place -May give his saying deed; which is no further -Than the main voice of Denmark goes withal. -Then weigh what loss your honour may sustain, -If with too credent ear you list his songs, -Or lose your heart, or your chaste treasure open -To his unmaster'd importunity. -Fear it, Ophelia, fear it, my dear sister, -And keep you in the rear of your affection, -Out of the shot and danger of desire. -The chariest maid is prodigal enough, -If she unmask her beauty to the moon: -Virtue itself 'scapes not calumnious strokes: -The canker galls the infants of the spring, -Too oft before their buttons be disclosed, -And in the morn and liquid dew of youth -Contagious blastments are most imminent. -Be wary then; best safety lies in fear: -Youth to itself rebels, though none else near. - - - -OPHELIA -I shall the effect of this good lesson keep, -As watchman to my heart. But, good my brother, -Do not, as some ungracious pastors do, -Show me the steep and thorny way to heaven; -Whiles, like a puff'd and reckless libertine, -Himself the primrose path of dalliance treads, -And recks not his own rede. - - - -LAERTES -O, fear me not. -I stay too long: but here my father comes. -Enter POLONIUS -A double blessing is a double grace, -Occasion smiles upon a second leave. - - - -LORD POLONIUS -Yet here, Laertes! aboard, aboard, for shame! -The wind sits in the shoulder of your sail, -And you are stay'd for. There; my blessing with thee! -And these few precepts in thy memory -See thou character. Give thy thoughts no tongue, -Nor any unproportioned thought his act. -Be thou familiar, but by no means vulgar. -Those friends thou hast, and their adoption tried, -Grapple them to thy soul with hoops of steel; -But do not dull thy palm with entertainment -Of each new-hatch'd, unfledged comrade. Beware -Of entrance to a quarrel, but being in, -Bear't that the opposed may beware of thee. -Give every man thy ear, but few thy voice; -Take each man's censure, but reserve thy judgment. -Costly thy habit as thy purse can buy, -But not express'd in fancy; rich, not gaudy; -For the apparel oft proclaims the man, -And they in France of the best rank and station -Are of a most select and generous chief in that. -Neither a borrower nor a lender be; -For loan oft loses both itself and friend, -And borrowing dulls the edge of husbandry. -This above all: to thine ownself be true, -And it must follow, as the night the day, -Thou canst not then be false to any man. -Farewell: my blessing season this in thee! - - - -LAERTES -Most humbly do I take my leave, my lord. - - - -LORD POLONIUS -The time invites you; go; your servants tend. - - - -LAERTES -Farewell, Ophelia; and remember well -What I have said to you. - - - -OPHELIA -'Tis in my memory lock'd, -And you yourself shall keep the key of it. - - - -LAERTES -Farewell. - - -Exit - - -LORD POLONIUS -What is't, Ophelia, be hath said to you? - - - -OPHELIA -So please you, something touching the Lord Hamlet. - - - -LORD POLONIUS -Marry, well bethought: -'Tis told me, he hath very oft of late -Given private time to you; and you yourself -Have of your audience been most free and bounteous: -If it be so, as so 'tis put on me, -And that in way of caution, I must tell you, -You do not understand yourself so clearly -As it behoves my daughter and your honour. -What is between you? give me up the truth. - - - -OPHELIA -He hath, my lord, of late made many tenders -Of his affection to me. - - - -LORD POLONIUS -Affection! pooh! you speak like a green girl, -Unsifted in such perilous circumstance. -Do you believe his tenders, as you call them? - - - -OPHELIA -I do not know, my lord, what I should think. - - - -LORD POLONIUS -Marry, I'll teach you: think yourself a baby; -That you have ta'en these tenders for true pay, -Which are not sterling. Tender yourself more dearly; -Or--not to crack the wind of the poor phrase, -Running it thus--you'll tender me a fool. - - - -OPHELIA -My lord, he hath importuned me with love -In honourable fashion. - - - -LORD POLONIUS -Ay, fashion you may call it; go to, go to. - - - -OPHELIA -And hath given countenance to his speech, my lord, -With almost all the holy vows of heaven. - - - -LORD POLONIUS -Ay, springes to catch woodcocks. I do know, -When the blood burns, how prodigal the soul -Lends the tongue vows: these blazes, daughter, -Giving more light than heat, extinct in both, -Even in their promise, as it is a-making, -You must not take for fire. From this time -Be somewhat scanter of your maiden presence; -Set your entreatments at a higher rate -Than a command to parley. For Lord Hamlet, -Believe so much in him, that he is young -And with a larger tether may he walk -Than may be given you: in few, Ophelia, -Do not believe his vows; for they are brokers, -Not of that dye which their investments show, -But mere implorators of unholy suits, -Breathing like sanctified and pious bawds, -The better to beguile. This is for all: -I would not, in plain terms, from this time forth, -Have you so slander any moment leisure, -As to give words or talk with the Lord Hamlet. -Look to't, I charge you: come your ways. - - - -OPHELIA -I shall obey, my lord. - - -Exeunt - - -SCENE IV. The platform. -Enter HAMLET, HORATIO, and MARCELLUS - - -HAMLET -The air bites shrewdly; it is very cold. - - - -HORATIO -It is a nipping and an eager air. - - - -HAMLET -What hour now? - - - -HORATIO -I think it lacks of twelve. - - - -HAMLET -No, it is struck. - - - -HORATIO -Indeed? I heard it not: then it draws near the season -Wherein the spirit held his wont to walk. -A flourish of trumpets, and ordnance shot off, within -What does this mean, my lord? - - - -HAMLET -The king doth wake to-night and takes his rouse, -Keeps wassail, and the swaggering up-spring reels; -And, as he drains his draughts of Rhenish down, -The kettle-drum and trumpet thus bray out -The triumph of his pledge. - - - -HORATIO -Is it a custom? - - - -HAMLET -Ay, marry, is't: -But to my mind, though I am native here -And to the manner born, it is a custom -More honour'd in the breach than the observance. -This heavy-headed revel east and west -Makes us traduced and tax'd of other nations: -They clepe us drunkards, and with swinish phrase -Soil our addition; and indeed it takes -From our achievements, though perform'd at height, -The pith and marrow of our attribute. -So, oft it chances in particular men, -That for some vicious mole of nature in them, -As, in their birth--wherein they are not guilty, -Since nature cannot choose his origin-- -By the o'ergrowth of some complexion, -Oft breaking down the pales and forts of reason, -Or by some habit that too much o'er-leavens -The form of plausive manners, that these men, -Carrying, I say, the stamp of one defect, -Being nature's livery, or fortune's star,-- -Their virtues else--be they as pure as grace, -As infinite as man may undergo-- -Shall in the general censure take corruption -From that particular fault: the dram of eale -Doth all the noble substance of a doubt -To his own scandal. - - - -HORATIO -Look, my lord, it comes! - - -Enter Ghost - - -HAMLET -Angels and ministers of grace defend us! -Be thou a spirit of health or goblin damn'd, -Bring with thee airs from heaven or blasts from hell, -Be thy intents wicked or charitable, -Thou comest in such a questionable shape -That I will speak to thee: I'll call thee Hamlet, -King, father, royal Dane: O, answer me! -Let me not burst in ignorance; but tell -Why thy canonized bones, hearsed in death, -Have burst their cerements; why the sepulchre, -Wherein we saw thee quietly inurn'd, -Hath oped his ponderous and marble jaws, -To cast thee up again. What may this mean, -That thou, dead corse, again in complete steel -Revisit'st thus the glimpses of the moon, -Making night hideous; and we fools of nature -So horridly to shake our disposition -With thoughts beyond the reaches of our souls? -Say, why is this? wherefore? what should we do? - - -Ghost beckons HAMLET - - -HORATIO -It beckons you to go away with it, -As if it some impartment did desire -To you alone. - - - -MARCELLUS -Look, with what courteous action -It waves you to a more removed ground: -But do not go with it. - - - -HORATIO -No, by no means. - - - -HAMLET -It will not speak; then I will follow it. - - - -HORATIO -Do not, my lord. - - - -HAMLET -Why, what should be the fear? -I do not set my life in a pin's fee; -And for my soul, what can it do to that, -Being a thing immortal as itself? -It waves me forth again: I'll follow it. - - - -HORATIO -What if it tempt you toward the flood, my lord, -Or to the dreadful summit of the cliff -That beetles o'er his base into the sea, -And there assume some other horrible form, -Which might deprive your sovereignty of reason -And draw you into madness? think of it: -The very place puts toys of desperation, -Without more motive, into every brain -That looks so many fathoms to the sea -And hears it roar beneath. - - - -HAMLET -It waves me still. -Go on; I'll follow thee. - - - -MARCELLUS -You shall not go, my lord. - - - -HAMLET -Hold off your hands. - - - -HORATIO -Be ruled; you shall not go. - - - -HAMLET -My fate cries out, -And makes each petty artery in this body -As hardy as the Nemean lion's nerve. -Still am I call'd. Unhand me, gentlemen. -By heaven, I'll make a ghost of him that lets me! -I say, away! Go on; I'll follow thee. - - -Exeunt Ghost and HAMLET - - -HORATIO -He waxes desperate with imagination. - - - -MARCELLUS -Let's follow; 'tis not fit thus to obey him. - - - -HORATIO -Have after. To what issue will this come? - - - -MARCELLUS -Something is rotten in the state of Denmark. - - - -HORATIO -Heaven will direct it. - - - -MARCELLUS -Nay, let's follow him. - - -Exeunt - - -SCENE V. Another part of the platform. -Enter GHOST and HAMLET - - -HAMLET -Where wilt thou lead me? speak; I'll go no further. - - - -Ghost -Mark me. - - - -HAMLET -I will. - - - -Ghost -My hour is almost come, -When I to sulphurous and tormenting flames -Must render up myself. - - - -HAMLET -Alas, poor ghost! - - - -Ghost -Pity me not, but lend thy serious hearing -To what I shall unfold. - - - -HAMLET -Speak; I am bound to hear. - - - -Ghost -So art thou to revenge, when thou shalt hear. - - - -HAMLET -What? - - - -Ghost -I am thy father's spirit, -Doom'd for a certain term to walk the night, -And for the day confined to fast in fires, -Till the foul crimes done in my days of nature -Are burnt and purged away. But that I am forbid -To tell the secrets of my prison-house, -I could a tale unfold whose lightest word -Would harrow up thy soul, freeze thy young blood, -Make thy two eyes, like stars, start from their spheres, -Thy knotted and combined locks to part -And each particular hair to stand on end, -Like quills upon the fretful porpentine: -But this eternal blazon must not be -To ears of flesh and blood. List, list, O, list! -If thou didst ever thy dear father love-- - - - -HAMLET -O God! - - - -Ghost -Revenge his foul and most unnatural murder. - - - -HAMLET -Murder! - - - -Ghost -Murder most foul, as in the best it is; -But this most foul, strange and unnatural. - - - -HAMLET -Haste me to know't, that I, with wings as swift -As meditation or the thoughts of love, -May sweep to my revenge. - - - -Ghost -I find thee apt; -And duller shouldst thou be than the fat weed -That roots itself in ease on Lethe wharf, -Wouldst thou not stir in this. Now, Hamlet, hear: -'Tis given out that, sleeping in my orchard, -A serpent stung me; so the whole ear of Denmark -Is by a forged process of my death -Rankly abused: but know, thou noble youth, -The serpent that did sting thy father's life -Now wears his crown. - - - -HAMLET -O my prophetic soul! My uncle! - - - -Ghost -Ay, that incestuous, that adulterate beast, -With witchcraft of his wit, with traitorous gifts,-- -O wicked wit and gifts, that have the power -So to seduce!--won to his shameful lust -The will of my most seeming-virtuous queen: -O Hamlet, what a falling-off was there! -From me, whose love was of that dignity -That it went hand in hand even with the vow -I made to her in marriage, and to decline -Upon a wretch whose natural gifts were poor -To those of mine! -But virtue, as it never will be moved, -Though lewdness court it in a shape of heaven, -So lust, though to a radiant angel link'd, -Will sate itself in a celestial bed, -And prey on garbage. -But, soft! methinks I scent the morning air; -Brief let me be. Sleeping within my orchard, -My custom always of the afternoon, -Upon my secure hour thy uncle stole, -With juice of cursed hebenon in a vial, -And in the porches of my ears did pour -The leperous distilment; whose effect -Holds such an enmity with blood of man -That swift as quicksilver it courses through -The natural gates and alleys of the body, -And with a sudden vigour doth posset -And curd, like eager droppings into milk, -The thin and wholesome blood: so did it mine; -And a most instant tetter bark'd about, -Most lazar-like, with vile and loathsome crust, -All my smooth body. -Thus was I, sleeping, by a brother's hand -Of life, of crown, of queen, at once dispatch'd: -Cut off even in the blossoms of my sin, -Unhousel'd, disappointed, unanel'd, -No reckoning made, but sent to my account -With all my imperfections on my head: -O, horrible! O, horrible! most horrible! -If thou hast nature in thee, bear it not; -Let not the royal bed of Denmark be -A couch for luxury and damned incest. -But, howsoever thou pursuest this act, -Taint not thy mind, nor let thy soul contrive -Against thy mother aught: leave her to heaven -And to those thorns that in her bosom lodge, -To prick and sting her. Fare thee well at once! -The glow-worm shows the matin to be near, -And 'gins to pale his uneffectual fire: -Adieu, adieu! Hamlet, remember me. - - -Exit - - -HAMLET -O all you host of heaven! O earth! what else? -And shall I couple hell? O, fie! Hold, hold, my heart; -And you, my sinews, grow not instant old, -But bear me stiffly up. Remember thee! -Ay, thou poor ghost, while memory holds a seat -In this distracted globe. Remember thee! -Yea, from the table of my memory -I'll wipe away all trivial fond records, -All saws of books, all forms, all pressures past, -That youth and observation copied there; -And thy commandment all alone shall live -Within the book and volume of my brain, -Unmix'd with baser matter: yes, by heaven! -O most pernicious woman! -O villain, villain, smiling, damned villain! -My tables,--meet it is I set it down, -That one may smile, and smile, and be a villain; -At least I'm sure it may be so in Denmark: -Writing -So, uncle, there you are. Now to my word; -It is 'Adieu, adieu! remember me.' -I have sworn 't. - - - -MARCELLUS -HORATIO -Within My lord, my lord,-- - - - -MARCELLUS -Within Lord Hamlet,-- - - - -HORATIO -Within Heaven secure him! - - - -HAMLET -So be it! - - - -HORATIO -Within Hillo, ho, ho, my lord! - - - -HAMLET -Hillo, ho, ho, boy! come, bird, come. - - -Enter HORATIO and MARCELLUS - - -MARCELLUS -How is't, my noble lord? - - - -HORATIO -What news, my lord? - - - -HAMLET -O, wonderful! - - - -HORATIO -Good my lord, tell it. - - - -HAMLET -No; you'll reveal it. - - - -HORATIO -Not I, my lord, by heaven. - - - -MARCELLUS -Nor I, my lord. - - - -HAMLET -How say you, then; would heart of man once think it? -But you'll be secret? - - - -HORATIO -MARCELLUS -Ay, by heaven, my lord. - - - -HAMLET -There's ne'er a villain dwelling in all Denmark -But he's an arrant knave. - - - -HORATIO -There needs no ghost, my lord, come from the grave -To tell us this. - - - -HAMLET -Why, right; you are i' the right; -And so, without more circumstance at all, -I hold it fit that we shake hands and part: -You, as your business and desire shall point you; -For every man has business and desire, -Such as it is; and for mine own poor part, -Look you, I'll go pray. - - - -HORATIO -These are but wild and whirling words, my lord. - - - -HAMLET -I'm sorry they offend you, heartily; -Yes, 'faith heartily. - - - -HORATIO -There's no offence, my lord. - - - -HAMLET -Yes, by Saint Patrick, but there is, Horatio, -And much offence too. Touching this vision here, -It is an honest ghost, that let me tell you: -For your desire to know what is between us, -O'ermaster 't as you may. And now, good friends, -As you are friends, scholars and soldiers, -Give me one poor request. - - - -HORATIO -What is't, my lord? we will. - - - -HAMLET -Never make known what you have seen to-night. - - - -HORATIO -MARCELLUS -My lord, we will not. - - - -HAMLET -Nay, but swear't. - - - -HORATIO -In faith, -My lord, not I. - - - -MARCELLUS -Nor I, my lord, in faith. - - - -HAMLET -Upon my sword. - - - -MARCELLUS -We have sworn, my lord, already. - - - -HAMLET -Indeed, upon my sword, indeed. - - - -Ghost -Beneath Swear. - - - -HAMLET -Ah, ha, boy! say'st thou so? art thou there, -truepenny? -Come on--you hear this fellow in the cellarage-- -Consent to swear. - - - -HORATIO -Propose the oath, my lord. - - - -HAMLET -Never to speak of this that you have seen, -Swear by my sword. - - - -Ghost -Beneath Swear. - - - -HAMLET -Hic et ubique? then we'll shift our ground. -Come hither, gentlemen, -And lay your hands again upon my sword: -Never to speak of this that you have heard, -Swear by my sword. - - - -Ghost -Beneath Swear. - - - -HAMLET -Well said, old mole! canst work i' the earth so fast? -A worthy pioner! Once more remove, good friends. - - - -HORATIO -O day and night, but this is wondrous strange! - - - -HAMLET -And therefore as a stranger give it welcome. -There are more things in heaven and earth, Horatio, -Than are dreamt of in your philosophy. But come; -Here, as before, never, so help you mercy, -How strange or odd soe'er I bear myself, -As I perchance hereafter shall think meet -To put an antic disposition on, -That you, at such times seeing me, never shall, -With arms encumber'd thus, or this headshake, -Or by pronouncing of some doubtful phrase, -As 'Well, well, we know,' or 'We could, an if we would,' -Or 'If we list to speak,' or 'There be, an if they might,' -Or such ambiguous giving out, to note -That you know aught of me: this not to do, -So grace and mercy at your most need help you, Swear. - - - -Ghost -Beneath Swear. - - - -HAMLET -Rest, rest, perturbed spirit! -They swear -So, gentlemen, -With all my love I do commend me to you: -And what so poor a man as Hamlet is -May do, to express his love and friending to you, -God willing, shall not lack. Let us go in together; -And still your fingers on your lips, I pray. -The time is out of joint: O cursed spite, -That ever I was born to set it right! -Nay, come, let's go together. - - -Exeunt - - - - -ACT II - -SCENE I. A room in POLONIUS' house. -Enter POLONIUS and REYNALDO - - -LORD POLONIUS -Give him this money and these notes, Reynaldo. - - - -REYNALDO -I will, my lord. - - - -LORD POLONIUS -You shall do marvellous wisely, good Reynaldo, -Before you visit him, to make inquire -Of his behavior. - - - -REYNALDO -My lord, I did intend it. - - - -LORD POLONIUS -Marry, well said; very well said. Look you, sir, -Inquire me first what Danskers are in Paris; -And how, and who, what means, and where they keep, -What company, at what expense; and finding -By this encompassment and drift of question -That they do know my son, come you more nearer -Than your particular demands will touch it: -Take you, as 'twere, some distant knowledge of him; -As thus, 'I know his father and his friends, -And in part him: ' do you mark this, Reynaldo? - - - -REYNALDO -Ay, very well, my lord. - - - -LORD POLONIUS -'And in part him; but' you may say 'not well: -But, if't be he I mean, he's very wild; -Addicted so and so:' and there put on him -What forgeries you please; marry, none so rank -As may dishonour him; take heed of that; -But, sir, such wanton, wild and usual slips -As are companions noted and most known -To youth and liberty. - - - -REYNALDO -As gaming, my lord. - - - -LORD POLONIUS -Ay, or drinking, fencing, swearing, quarrelling, -Drabbing: you may go so far. - - - -REYNALDO -My lord, that would dishonour him. - - - -LORD POLONIUS -'Faith, no; as you may season it in the charge -You must not put another scandal on him, -That he is open to incontinency; -That's not my meaning: but breathe his faults so quaintly -That they may seem the taints of liberty, -The flash and outbreak of a fiery mind, -A savageness in unreclaimed blood, -Of general assault. - - - -REYNALDO -But, my good lord,-- - - - -LORD POLONIUS -Wherefore should you do this? - - - -REYNALDO -Ay, my lord, -I would know that. - - - -LORD POLONIUS -Marry, sir, here's my drift; -And I believe, it is a fetch of wit: -You laying these slight sullies on my son, -As 'twere a thing a little soil'd i' the working, Mark you, -Your party in converse, him you would sound, -Having ever seen in the prenominate crimes -The youth you breathe of guilty, be assured -He closes with you in this consequence; -'Good sir,' or so, or 'friend,' or 'gentleman,' -According to the phrase or the addition -Of man and country. - - - -REYNALDO -Very good, my lord. - - - -LORD POLONIUS -And then, sir, does he this--he does--what was I -about to say? By the mass, I was about to say -something: where did I leave? - - - -REYNALDO -At 'closes in the consequence,' at 'friend or so,' -and 'gentleman.' - - - -LORD POLONIUS -At 'closes in the consequence,' ay, marry; -He closes thus: 'I know the gentleman; -I saw him yesterday, or t' other day, -Or then, or then; with such, or such; and, as you say, -There was a' gaming; there o'ertook in's rouse; -There falling out at tennis:' or perchance, -'I saw him enter such a house of sale,' -Videlicet, a brothel, or so forth. -See you now; -Your bait of falsehood takes this carp of truth: -And thus do we of wisdom and of reach, -With windlasses and with assays of bias, -By indirections find directions out: -So by my former lecture and advice, -Shall you my son. You have me, have you not? - - - -REYNALDO -My lord, I have. - - - -LORD POLONIUS -God be wi' you; fare you well. - - - -REYNALDO -Good my lord! - - - -LORD POLONIUS -Observe his inclination in yourself. - - - -REYNALDO -I shall, my lord. - - - -LORD POLONIUS -And let him ply his music. - - - -REYNALDO -Well, my lord. - - - -LORD POLONIUS -Farewell! -Exit REYNALDO -Enter OPHELIA -How now, Ophelia! what's the matter? - - - -OPHELIA -O, my lord, my lord, I have been so affrighted! - - - -LORD POLONIUS -With what, i' the name of God? - - - -OPHELIA -My lord, as I was sewing in my closet, -Lord Hamlet, with his doublet all unbraced; -No hat upon his head; his stockings foul'd, -Ungarter'd, and down-gyved to his ancle; -Pale as his shirt; his knees knocking each other; -And with a look so piteous in purport -As if he had been loosed out of hell -To speak of horrors,--he comes before me. - - - -LORD POLONIUS -Mad for thy love? - - - -OPHELIA -My lord, I do not know; -But truly, I do fear it. - - - -LORD POLONIUS -What said he? - - - -OPHELIA -He took me by the wrist and held me hard; -Then goes he to the length of all his arm; -And, with his other hand thus o'er his brow, -He falls to such perusal of my face -As he would draw it. Long stay'd he so; -At last, a little shaking of mine arm -And thrice his head thus waving up and down, -He raised a sigh so piteous and profound -As it did seem to shatter all his bulk -And end his being: that done, he lets me go: -And, with his head over his shoulder turn'd, -He seem'd to find his way without his eyes; -For out o' doors he went without their helps, -And, to the last, bended their light on me. - - - -LORD POLONIUS -Come, go with me: I will go seek the king. -This is the very ecstasy of love, -Whose violent property fordoes itself -And leads the will to desperate undertakings -As oft as any passion under heaven -That does afflict our natures. I am sorry. -What, have you given him any hard words of late? - - - -OPHELIA -No, my good lord, but, as you did command, -I did repel his fetters and denied -His access to me. - - - -LORD POLONIUS -That hath made him mad. -I am sorry that with better heed and judgment -I had not quoted him: I fear'd he did but trifle, -And meant to wreck thee; but, beshrew my jealousy! -By heaven, it is as proper to our age -To cast beyond ourselves in our opinions -As it is common for the younger sort -To lack discretion. Come, go we to the king: -This must be known; which, being kept close, might -move -More grief to hide than hate to utter love. - - -Exeunt - - -SCENE II. A room in the castle. -Enter KING CLAUDIUS, QUEEN GERTRUDE, ROSENCRANTZ, -GUILDENSTERN, and Attendants - - -KING CLAUDIUS -Welcome, dear Rosencrantz and Guildenstern! -Moreover that we much did long to see you, -The need we have to use you did provoke -Our hasty sending. Something have you heard -Of Hamlet's transformation; so call it, -Sith nor the exterior nor the inward man -Resembles that it was. What it should be, -More than his father's death, that thus hath put him -So much from the understanding of himself, -I cannot dream of: I entreat you both, -That, being of so young days brought up with him, -And sith so neighbour'd to his youth and havior, -That you vouchsafe your rest here in our court -Some little time: so by your companies -To draw him on to pleasures, and to gather, -So much as from occasion you may glean, -Whether aught, to us unknown, afflicts him thus, -That, open'd, lies within our remedy. - - - -QUEEN GERTRUDE -Good gentlemen, he hath much talk'd of you; -And sure I am two men there are not living -To whom he more adheres. If it will please you -To show us so much gentry and good will -As to expend your time with us awhile, -For the supply and profit of our hope, -Your visitation shall receive such thanks -As fits a king's remembrance. - - - -ROSENCRANTZ -Both your majesties -Might, by the sovereign power you have of us, -Put your dread pleasures more into command -Than to entreaty. - - - -GUILDENSTERN -But we both obey, -And here give up ourselves, in the full bent -To lay our service freely at your feet, -To be commanded. - - - -KING CLAUDIUS -Thanks, Rosencrantz and gentle Guildenstern. - - - -QUEEN GERTRUDE -Thanks, Guildenstern and gentle Rosencrantz: -And I beseech you instantly to visit -My too much changed son. Go, some of you, -And bring these gentlemen where Hamlet is. - - - -GUILDENSTERN -Heavens make our presence and our practises -Pleasant and helpful to him! - - - -QUEEN GERTRUDE -Ay, amen! - - -Exeunt ROSENCRANTZ, GUILDENSTERN, and some -Attendants -Enter POLONIUS - - -LORD POLONIUS -The ambassadors from Norway, my good lord, -Are joyfully return'd. - - - -KING CLAUDIUS -Thou still hast been the father of good news. - - - -LORD POLONIUS -Have I, my lord? I assure my good liege, -I hold my duty, as I hold my soul, -Both to my God and to my gracious king: -And I do think, or else this brain of mine -Hunts not the trail of policy so sure -As it hath used to do, that I have found -The very cause of Hamlet's lunacy. - - - -KING CLAUDIUS -O, speak of that; that do I long to hear. - - - -LORD POLONIUS -Give first admittance to the ambassadors; -My news shall be the fruit to that great feast. - - - -KING CLAUDIUS -Thyself do grace to them, and bring them in. -Exit POLONIUS -He tells me, my dear Gertrude, he hath found -The head and source of all your son's distemper. - - - -QUEEN GERTRUDE -I doubt it is no other but the main; -His father's death, and our o'erhasty marriage. - - - -KING CLAUDIUS -Well, we shall sift him. -Re-enter POLONIUS, with VOLTIMAND and CORNELIUS -Welcome, my good friends! -Say, Voltimand, what from our brother Norway? - - - -VOLTIMAND -Most fair return of greetings and desires. -Upon our first, he sent out to suppress -His nephew's levies; which to him appear'd -To be a preparation 'gainst the Polack; -But, better look'd into, he truly found -It was against your highness: whereat grieved, -That so his sickness, age and impotence -Was falsely borne in hand, sends out arrests -On Fortinbras; which he, in brief, obeys; -Receives rebuke from Norway, and in fine -Makes vow before his uncle never more -To give the assay of arms against your majesty. -Whereon old Norway, overcome with joy, -Gives him three thousand crowns in annual fee, -And his commission to employ those soldiers, -So levied as before, against the Polack: -With an entreaty, herein further shown, -Giving a paper -That it might please you to give quiet pass -Through your dominions for this enterprise, -On such regards of safety and allowance -As therein are set down. - - - -KING CLAUDIUS -It likes us well; -And at our more consider'd time well read, -Answer, and think upon this business. -Meantime we thank you for your well-took labour: -Go to your rest; at night we'll feast together: -Most welcome home! - - -Exeunt VOLTIMAND and CORNELIUS - - -LORD POLONIUS -This business is well ended. -My liege, and madam, to expostulate -What majesty should be, what duty is, -Why day is day, night night, and time is time, -Were nothing but to waste night, day and time. -Therefore, since brevity is the soul of wit, -And tediousness the limbs and outward flourishes, -I will be brief: your noble son is mad: -Mad call I it; for, to define true madness, -What is't but to be nothing else but mad? -But let that go. - - - -QUEEN GERTRUDE -More matter, with less art. - - - -LORD POLONIUS -Madam, I swear I use no art at all. -That he is mad, 'tis true: 'tis true 'tis pity; -And pity 'tis 'tis true: a foolish figure; -But farewell it, for I will use no art. -Mad let us grant him, then: and now remains -That we find out the cause of this effect, -Or rather say, the cause of this defect, -For this effect defective comes by cause: -Thus it remains, and the remainder thus. Perpend. -I have a daughter--have while she is mine-- -Who, in her duty and obedience, mark, -Hath given me this: now gather, and surmise. -Reads -'To the celestial and my soul's idol, the most -beautified Ophelia,'-- -That's an ill phrase, a vile phrase; 'beautified' is -a vile phrase: but you shall hear. Thus: -Reads -'In her excellent white bosom, these, &c.' - - - -QUEEN GERTRUDE -Came this from Hamlet to her? - - - -LORD POLONIUS -Good madam, stay awhile; I will be faithful. -Reads -'Doubt thou the stars are fire; -Doubt that the sun doth move; -Doubt truth to be a liar; -But never doubt I love. -'O dear Ophelia, I am ill at these numbers; -I have not art to reckon my groans: but that -I love thee best, O most best, believe it. Adieu. -'Thine evermore most dear lady, whilst -this machine is to him, HAMLET.' -This, in obedience, hath my daughter shown me, -And more above, hath his solicitings, -As they fell out by time, by means and place, -All given to mine ear. - - - -KING CLAUDIUS -But how hath she -Received his love? - - - -LORD POLONIUS -What do you think of me? - - - -KING CLAUDIUS -As of a man faithful and honourable. - - - -LORD POLONIUS -I would fain prove so. But what might you think, -When I had seen this hot love on the wing-- -As I perceived it, I must tell you that, -Before my daughter told me--what might you, -Or my dear majesty your queen here, think, -If I had play'd the desk or table-book, -Or given my heart a winking, mute and dumb, -Or look'd upon this love with idle sight; -What might you think? No, I went round to work, -And my young mistress thus I did bespeak: -'Lord Hamlet is a prince, out of thy star; -This must not be:' and then I precepts gave her, -That she should lock herself from his resort, -Admit no messengers, receive no tokens. -Which done, she took the fruits of my advice; -And he, repulsed--a short tale to make-- -Fell into a sadness, then into a fast, -Thence to a watch, thence into a weakness, -Thence to a lightness, and, by this declension, -Into the madness wherein now he raves, -And all we mourn for. - - - -KING CLAUDIUS -Do you think 'tis this? - - - -QUEEN GERTRUDE -It may be, very likely. - - - -LORD POLONIUS -Hath there been such a time--I'd fain know that-- -That I have positively said 'Tis so,' -When it proved otherwise? - - - -KING CLAUDIUS -Not that I know. - - - -LORD POLONIUS -Pointing to his head and shoulder -Take this from this, if this be otherwise: -If circumstances lead me, I will find -Where truth is hid, though it were hid indeed -Within the centre. - - - -KING CLAUDIUS -How may we try it further? - - - -LORD POLONIUS -You know, sometimes he walks four hours together -Here in the lobby. - - - -QUEEN GERTRUDE -So he does indeed. - - - -LORD POLONIUS -At such a time I'll loose my daughter to him: -Be you and I behind an arras then; -Mark the encounter: if he love her not -And be not from his reason fall'n thereon, -Let me be no assistant for a state, -But keep a farm and carters. - - - -KING CLAUDIUS -We will try it. - - - -QUEEN GERTRUDE -But, look, where sadly the poor wretch comes reading. - - - -LORD POLONIUS -Away, I do beseech you, both away: -I'll board him presently. -Exeunt KING CLAUDIUS, QUEEN GERTRUDE, and -Attendants -Enter HAMLET, reading -O, give me leave: -How does my good Lord Hamlet? - - - -HAMLET -Well, God-a-mercy. - - - -LORD POLONIUS -Do you know me, my lord? - - - -HAMLET -Excellent well; you are a fishmonger. - - - -LORD POLONIUS -Not I, my lord. - - - -HAMLET -Then I would you were so honest a man. - - - -LORD POLONIUS -Honest, my lord! - - - -HAMLET -Ay, sir; to be honest, as this world goes, is to be -one man picked out of ten thousand. - - - -LORD POLONIUS -That's very true, my lord. - - - -HAMLET -For if the sun breed maggots in a dead dog, being a -god kissing carrion,--Have you a daughter? - - - -LORD POLONIUS -I have, my lord. - - - -HAMLET -Let her not walk i' the sun: conception is a -blessing: but not as your daughter may conceive. -Friend, look to 't. - - - -LORD POLONIUS -Aside How say you by that? Still harping on my -daughter: yet he knew me not at first; he said I -was a fishmonger: he is far gone, far gone: and -truly in my youth I suffered much extremity for -love; very near this. I'll speak to him again. -What do you read, my lord? - - - -HAMLET -Words, words, words. - - - -LORD POLONIUS -What is the matter, my lord? - - - -HAMLET -Between who? - - - -LORD POLONIUS -I mean, the matter that you read, my lord. - - - -HAMLET -Slanders, sir: for the satirical rogue says here -that old men have grey beards, that their faces are -wrinkled, their eyes purging thick amber and -plum-tree gum and that they have a plentiful lack of -wit, together with most weak hams: all which, sir, -though I most powerfully and potently believe, yet -I hold it not honesty to have it thus set down, for -yourself, sir, should be old as I am, if like a crab -you could go backward. - - - -LORD POLONIUS -Aside Though this be madness, yet there is method -in 't. Will you walk out of the air, my lord? - - - -HAMLET -Into my grave. - - - -LORD POLONIUS -Indeed, that is out o' the air. -Aside -How pregnant sometimes his replies are! a happiness -that often madness hits on, which reason and sanity -could not so prosperously be delivered of. I will -leave him, and suddenly contrive the means of -meeting between him and my daughter.--My honourable -lord, I will most humbly take my leave of you. - - - -HAMLET -You cannot, sir, take from me any thing that I will -more willingly part withal: except my life, except -my life, except my life. - - - -LORD POLONIUS -Fare you well, my lord. - - - -HAMLET -These tedious old fools! - - -Enter ROSENCRANTZ and GUILDENSTERN - - -LORD POLONIUS -You go to seek the Lord Hamlet; there he is. - - - -ROSENCRANTZ -To POLONIUS God save you, sir! - - -Exit POLONIUS - - -GUILDENSTERN -My honoured lord! - - - -ROSENCRANTZ -My most dear lord! - - - -HAMLET -My excellent good friends! How dost thou, -Guildenstern? Ah, Rosencrantz! Good lads, how do ye both? - - - -ROSENCRANTZ -As the indifferent children of the earth. - - - -GUILDENSTERN -Happy, in that we are not over-happy; -On fortune's cap we are not the very button. - - - -HAMLET -Nor the soles of her shoe? - - - -ROSENCRANTZ -Neither, my lord. - - - -HAMLET -Then you live about her waist, or in the middle of -her favours? - - - -GUILDENSTERN -'Faith, her privates we. - - - -HAMLET -In the secret parts of fortune? O, most true; she -is a strumpet. What's the news? - - - -ROSENCRANTZ -None, my lord, but that the world's grown honest. - - - -HAMLET -Then is doomsday near: but your news is not true. -Let me question more in particular: what have you, -my good friends, deserved at the hands of fortune, -that she sends you to prison hither? - - - -GUILDENSTERN -Prison, my lord! - - - -HAMLET -Denmark's a prison. - - - -ROSENCRANTZ -Then is the world one. - - - -HAMLET -A goodly one; in which there are many confines, -wards and dungeons, Denmark being one o' the worst. - - - -ROSENCRANTZ -We think not so, my lord. - - - -HAMLET -Why, then, 'tis none to you; for there is nothing -either good or bad, but thinking makes it so: to me -it is a prison. - - - -ROSENCRANTZ -Why then, your ambition makes it one; 'tis too -narrow for your mind. - - - -HAMLET -O God, I could be bounded in a nut shell and count -myself a king of infinite space, were it not that I -have bad dreams. - - - -GUILDENSTERN -Which dreams indeed are ambition, for the very -substance of the ambitious is merely the shadow of a dream. - - - -HAMLET -A dream itself is but a shadow. - - - -ROSENCRANTZ -Truly, and I hold ambition of so airy and light a -quality that it is but a shadow's shadow. - - - -HAMLET -Then are our beggars bodies, and our monarchs and -outstretched heroes the beggars' shadows. Shall we -to the court? for, by my fay, I cannot reason. - - - -ROSENCRANTZ -GUILDENSTERN -We'll wait upon you. - - - -HAMLET -No such matter: I will not sort you with the rest -of my servants, for, to speak to you like an honest -man, I am most dreadfully attended. But, in the -beaten way of friendship, what make you at Elsinore? - - - -ROSENCRANTZ -To visit you, my lord; no other occasion. - - - -HAMLET -Beggar that I am, I am even poor in thanks; but I -thank you: and sure, dear friends, my thanks are -too dear a halfpenny. Were you not sent for? Is it -your own inclining? Is it a free visitation? Come, -deal justly with me: come, come; nay, speak. - - - -GUILDENSTERN -What should we say, my lord? - - - -HAMLET -Why, any thing, but to the purpose. You were sent -for; and there is a kind of confession in your looks -which your modesties have not craft enough to colour: -I know the good king and queen have sent for you. - - - -ROSENCRANTZ -To what end, my lord? - - - -HAMLET -That you must teach me. But let me conjure you, by -the rights of our fellowship, by the consonancy of -our youth, by the obligation of our ever-preserved -love, and by what more dear a better proposer could -charge you withal, be even and direct with me, -whether you were sent for, or no? - - - -ROSENCRANTZ -Aside to GUILDENSTERN What say you? - - - -HAMLET -Aside Nay, then, I have an eye of you.--If you -love me, hold not off. - - - -GUILDENSTERN -My lord, we were sent for. - - - -HAMLET -I will tell you why; so shall my anticipation -prevent your discovery, and your secrecy to the king -and queen moult no feather. I have of late--but -wherefore I know not--lost all my mirth, forgone all -custom of exercises; and indeed it goes so heavily -with my disposition that this goodly frame, the -earth, seems to me a sterile promontory, this most -excellent canopy, the air, look you, this brave -o'erhanging firmament, this majestical roof fretted -with golden fire, why, it appears no other thing to -me than a foul and pestilent congregation of vapours. -What a piece of work is a man! how noble in reason! -how infinite in faculty! in form and moving how -express and admirable! in action how like an angel! -in apprehension how like a god! the beauty of the -world! the paragon of animals! And yet, to me, -what is this quintessence of dust? man delights not -me: no, nor woman neither, though by your smiling -you seem to say so. - - - -ROSENCRANTZ -My lord, there was no such stuff in my thoughts. - - - -HAMLET -Why did you laugh then, when I said 'man delights not me'? - - - -ROSENCRANTZ -To think, my lord, if you delight not in man, what -lenten entertainment the players shall receive from -you: we coted them on the way; and hither are they -coming, to offer you service. - - - -HAMLET -He that plays the king shall be welcome; his majesty -shall have tribute of me; the adventurous knight -shall use his foil and target; the lover shall not -sigh gratis; the humourous man shall end his part -in peace; the clown shall make those laugh whose -lungs are tickled o' the sere; and the lady shall -say her mind freely, or the blank verse shall halt -for't. What players are they? - - - -ROSENCRANTZ -Even those you were wont to take delight in, the -tragedians of the city. - - - -HAMLET -How chances it they travel? their residence, both -in reputation and profit, was better both ways. - - - -ROSENCRANTZ -I think their inhibition comes by the means of the -late innovation. - - - -HAMLET -Do they hold the same estimation they did when I was -in the city? are they so followed? - - - -ROSENCRANTZ -No, indeed, are they not. - - - -HAMLET -How comes it? do they grow rusty? - - - -ROSENCRANTZ -Nay, their endeavour keeps in the wonted pace: but -there is, sir, an aery of children, little eyases, -that cry out on the top of question, and are most -tyrannically clapped for't: these are now the -fashion, and so berattle the common stages--so they -call them--that many wearing rapiers are afraid of -goose-quills and dare scarce come thither. - - - -HAMLET -What, are they children? who maintains 'em? how are -they escoted? Will they pursue the quality no -longer than they can sing? will they not say -afterwards, if they should grow themselves to common -players--as it is most like, if their means are no -better--their writers do them wrong, to make them -exclaim against their own succession? - - - -ROSENCRANTZ -'Faith, there has been much to do on both sides; and -the nation holds it no sin to tarre them to -controversy: there was, for a while, no money bid -for argument, unless the poet and the player went to -cuffs in the question. - - - -HAMLET -Is't possible? - - - -GUILDENSTERN -O, there has been much throwing about of brains. - - - -HAMLET -Do the boys carry it away? - - - -ROSENCRANTZ -Ay, that they do, my lord; Hercules and his load too. - - - -HAMLET -It is not very strange; for mine uncle is king of -Denmark, and those that would make mows at him while -my father lived, give twenty, forty, fifty, an -hundred ducats a-piece for his picture in little. -'Sblood, there is something in this more than -natural, if philosophy could find it out. - - -Flourish of trumpets within - - -GUILDENSTERN -There are the players. - - - -HAMLET -Gentlemen, you are welcome to Elsinore. Your hands, -come then: the appurtenance of welcome is fashion -and ceremony: let me comply with you in this garb, -lest my extent to the players, which, I tell you, -must show fairly outward, should more appear like -entertainment than yours. You are welcome: but my -uncle-father and aunt-mother are deceived. - - - -GUILDENSTERN -In what, my dear lord? - - - -HAMLET -I am but mad north-north-west: when the wind is -southerly I know a hawk from a handsaw. - - -Enter POLONIUS - - -LORD POLONIUS -Well be with you, gentlemen! - - - -HAMLET -Hark you, Guildenstern; and you too: at each ear a -hearer: that great baby you see there is not yet -out of his swaddling-clouts. - - - -ROSENCRANTZ -Happily he's the second time come to them; for they -say an old man is twice a child. - - - -HAMLET -I will prophesy he comes to tell me of the players; -mark it. You say right, sir: o' Monday morning; -'twas so indeed. - - - -LORD POLONIUS -My lord, I have news to tell you. - - - -HAMLET -My lord, I have news to tell you. -When Roscius was an actor in Rome,-- - - - -LORD POLONIUS -The actors are come hither, my lord. - - - -HAMLET -Buz, buz! - - - -LORD POLONIUS -Upon mine honour,-- - - - -HAMLET -Then came each actor on his ass,-- - - - -LORD POLONIUS -The best actors in the world, either for tragedy, -comedy, history, pastoral, pastoral-comical, -historical-pastoral, tragical-historical, tragical- -comical-historical-pastoral, scene individable, or -poem unlimited: Seneca cannot be too heavy, nor -Plautus too light. For the law of writ and the -liberty, these are the only men. - - - -HAMLET -O Jephthah, judge of Israel, what a treasure hadst thou! - - - -LORD POLONIUS -What a treasure had he, my lord? - - - -HAMLET -Why, -'One fair daughter and no more, -The which he loved passing well.' - - - -LORD POLONIUS -Aside Still on my daughter. - - - -HAMLET -Am I not i' the right, old Jephthah? - - - -LORD POLONIUS -If you call me Jephthah, my lord, I have a daughter -that I love passing well. - - - -HAMLET -Nay, that follows not. - - - -LORD POLONIUS -What follows, then, my lord? - - - -HAMLET -Why, -'As by lot, God wot,' -and then, you know, -'It came to pass, as most like it was,'-- -the first row of the pious chanson will show you -more; for look, where my abridgement comes. -Enter four or five Players -You are welcome, masters; welcome, all. I am glad -to see thee well. Welcome, good friends. O, my old -friend! thy face is valenced since I saw thee last: -comest thou to beard me in Denmark? What, my young -lady and mistress! By'r lady, your ladyship is -nearer to heaven than when I saw you last, by the -altitude of a chopine. Pray God, your voice, like -apiece of uncurrent gold, be not cracked within the -ring. Masters, you are all welcome. We'll e'en -to't like French falconers, fly at any thing we see: -we'll have a speech straight: come, give us a taste -of your quality; come, a passionate speech. - - - -First Player -What speech, my lord? - - - -HAMLET -I heard thee speak me a speech once, but it was -never acted; or, if it was, not above once; for the -play, I remember, pleased not the million; 'twas -caviare to the general: but it was--as I received -it, and others, whose judgments in such matters -cried in the top of mine--an excellent play, well -digested in the scenes, set down with as much -modesty as cunning. I remember, one said there -were no sallets in the lines to make the matter -savoury, nor no matter in the phrase that might -indict the author of affectation; but called it an -honest method, as wholesome as sweet, and by very -much more handsome than fine. One speech in it I -chiefly loved: 'twas Aeneas' tale to Dido; and -thereabout of it especially, where he speaks of -Priam's slaughter: if it live in your memory, begin -at this line: let me see, let me see-- -'The rugged Pyrrhus, like the Hyrcanian beast,'-- -it is not so:--it begins with Pyrrhus:-- -'The rugged Pyrrhus, he whose sable arms, -Black as his purpose, did the night resemble -When he lay couched in the ominous horse, -Hath now this dread and black complexion smear'd -With heraldry more dismal; head to foot -Now is he total gules; horridly trick'd -With blood of fathers, mothers, daughters, sons, -Baked and impasted with the parching streets, -That lend a tyrannous and damned light -To their lord's murder: roasted in wrath and fire, -And thus o'er-sized with coagulate gore, -With eyes like carbuncles, the hellish Pyrrhus -Old grandsire Priam seeks.' -So, proceed you. - - - -LORD POLONIUS -'Fore God, my lord, well spoken, with good accent and -good discretion. - - - -First Player -'Anon he finds him -Striking too short at Greeks; his antique sword, -Rebellious to his arm, lies where it falls, -Repugnant to command: unequal match'd, -Pyrrhus at Priam drives; in rage strikes wide; -But with the whiff and wind of his fell sword -The unnerved father falls. Then senseless Ilium, -Seeming to feel this blow, with flaming top -Stoops to his base, and with a hideous crash -Takes prisoner Pyrrhus' ear: for, lo! his sword, -Which was declining on the milky head -Of reverend Priam, seem'd i' the air to stick: -So, as a painted tyrant, Pyrrhus stood, -And like a neutral to his will and matter, -Did nothing. -But, as we often see, against some storm, -A silence in the heavens, the rack stand still, -The bold winds speechless and the orb below -As hush as death, anon the dreadful thunder -Doth rend the region, so, after Pyrrhus' pause, -Aroused vengeance sets him new a-work; -And never did the Cyclops' hammers fall -On Mars's armour forged for proof eterne -With less remorse than Pyrrhus' bleeding sword -Now falls on Priam. -Out, out, thou strumpet, Fortune! All you gods, -In general synod 'take away her power; -Break all the spokes and fellies from her wheel, -And bowl the round nave down the hill of heaven, -As low as to the fiends!' - - - -LORD POLONIUS -This is too long. - - - -HAMLET -It shall to the barber's, with your beard. Prithee, -say on: he's for a jig or a tale of bawdry, or he -sleeps: say on: come to Hecuba. - - - -First Player -'But who, O, who had seen the mobled queen--' - - - -HAMLET -'The mobled queen?' - - - -LORD POLONIUS -That's good; 'mobled queen' is good. - - - -First Player -'Run barefoot up and down, threatening the flames -With bisson rheum; a clout upon that head -Where late the diadem stood, and for a robe, -About her lank and all o'er-teemed loins, -A blanket, in the alarm of fear caught up; -Who this had seen, with tongue in venom steep'd, -'Gainst Fortune's state would treason have -pronounced: -But if the gods themselves did see her then -When she saw Pyrrhus make malicious sport -In mincing with his sword her husband's limbs, -The instant burst of clamour that she made, -Unless things mortal move them not at all, -Would have made milch the burning eyes of heaven, -And passion in the gods.' - - - -LORD POLONIUS -Look, whether he has not turned his colour and has -tears in's eyes. Pray you, no more. - - - -HAMLET -'Tis well: I'll have thee speak out the rest soon. -Good my lord, will you see the players well -bestowed? Do you hear, let them be well used; for -they are the abstract and brief chronicles of the -time: after your death you were better have a bad -epitaph than their ill report while you live. - - - -LORD POLONIUS -My lord, I will use them according to their desert. - - - -HAMLET -God's bodykins, man, much better: use every man -after his desert, and who should 'scape whipping? -Use them after your own honour and dignity: the less -they deserve, the more merit is in your bounty. -Take them in. - - - -LORD POLONIUS -Come, sirs. - - - -HAMLET -Follow him, friends: we'll hear a play to-morrow. -Exit POLONIUS with all the Players but the First -Dost thou hear me, old friend; can you play the -Murder of Gonzago? - - - -First Player -Ay, my lord. - - - -HAMLET -We'll ha't to-morrow night. You could, for a need, -study a speech of some dozen or sixteen lines, which -I would set down and insert in't, could you not? - - - -First Player -Ay, my lord. - - - -HAMLET -Very well. Follow that lord; and look you mock him -not. -Exit First Player -My good friends, I'll leave you till night: you are -welcome to Elsinore. - - - -ROSENCRANTZ -Good my lord! - - - -HAMLET -Ay, so, God be wi' ye; -Exeunt ROSENCRANTZ and GUILDENSTERN -Now I am alone. -O, what a rogue and peasant slave am I! -Is it not monstrous that this player here, -But in a fiction, in a dream of passion, -Could force his soul so to his own conceit -That from her working all his visage wann'd, -Tears in his eyes, distraction in's aspect, -A broken voice, and his whole function suiting -With forms to his conceit? and all for nothing! -For Hecuba! -What's Hecuba to him, or he to Hecuba, -That he should weep for her? What would he do, -Had he the motive and the cue for passion -That I have? He would drown the stage with tears -And cleave the general ear with horrid speech, -Make mad the guilty and appal the free, -Confound the ignorant, and amaze indeed -The very faculties of eyes and ears. Yet I, -A dull and muddy-mettled rascal, peak, -Like John-a-dreams, unpregnant of my cause, -And can say nothing; no, not for a king, -Upon whose property and most dear life -A damn'd defeat was made. Am I a coward? -Who calls me villain? breaks my pate across? -Plucks off my beard, and blows it in my face? -Tweaks me by the nose? gives me the lie i' the throat, -As deep as to the lungs? who does me this? -Ha! -'Swounds, I should take it: for it cannot be -But I am pigeon-liver'd and lack gall -To make oppression bitter, or ere this -I should have fatted all the region kites -With this slave's offal: bloody, bawdy villain! -Remorseless, treacherous, lecherous, kindless villain! -O, vengeance! -Why, what an ass am I! This is most brave, -That I, the son of a dear father murder'd, -Prompted to my revenge by heaven and hell, -Must, like a whore, unpack my heart with words, -And fall a-cursing, like a very drab, -A scullion! -Fie upon't! foh! About, my brain! I have heard -That guilty creatures sitting at a play -Have by the very cunning of the scene -Been struck so to the soul that presently -They have proclaim'd their malefactions; -For murder, though it have no tongue, will speak -With most miraculous organ. I'll have these players -Play something like the murder of my father -Before mine uncle: I'll observe his looks; -I'll tent him to the quick: if he but blench, -I know my course. The spirit that I have seen -May be the devil: and the devil hath power -To assume a pleasing shape; yea, and perhaps -Out of my weakness and my melancholy, -As he is very potent with such spirits, -Abuses me to damn me: I'll have grounds -More relative than this: the play 's the thing -Wherein I'll catch the conscience of the king. - - -Exit - - - - -ACT III - -SCENE I. A room in the castle. -Enter KING CLAUDIUS, QUEEN GERTRUDE, POLONIUS, -OPHELIA, ROSENCRANTZ, and GUILDENSTERN - - -KING CLAUDIUS -And can you, by no drift of circumstance, -Get from him why he puts on this confusion, -Grating so harshly all his days of quiet -With turbulent and dangerous lunacy? - - - -ROSENCRANTZ -He does confess he feels himself distracted; -But from what cause he will by no means speak. - - - -GUILDENSTERN -Nor do we find him forward to be sounded, -But, with a crafty madness, keeps aloof, -When we would bring him on to some confession -Of his true state. - - - -QUEEN GERTRUDE -Did he receive you well? - - - -ROSENCRANTZ -Most like a gentleman. - - - -GUILDENSTERN -But with much forcing of his disposition. - - - -ROSENCRANTZ -Niggard of question; but, of our demands, -Most free in his reply. - - - -QUEEN GERTRUDE -Did you assay him? -To any pastime? - - - -ROSENCRANTZ -Madam, it so fell out, that certain players -We o'er-raught on the way: of these we told him; -And there did seem in him a kind of joy -To hear of it: they are about the court, -And, as I think, they have already order -This night to play before him. - - - -LORD POLONIUS -'Tis most true: -And he beseech'd me to entreat your majesties -To hear and see the matter. - - - -KING CLAUDIUS -With all my heart; and it doth much content me -To hear him so inclined. -Good gentlemen, give him a further edge, -And drive his purpose on to these delights. - - - -ROSENCRANTZ -We shall, my lord. - - -Exeunt ROSENCRANTZ and GUILDENSTERN - - -KING CLAUDIUS -Sweet Gertrude, leave us too; -For we have closely sent for Hamlet hither, -That he, as 'twere by accident, may here -Affront Ophelia: -Her father and myself, lawful espials, -Will so bestow ourselves that, seeing, unseen, -We may of their encounter frankly judge, -And gather by him, as he is behaved, -If 't be the affliction of his love or no -That thus he suffers for. - - - -QUEEN GERTRUDE -I shall obey you. -And for your part, Ophelia, I do wish -That your good beauties be the happy cause -Of Hamlet's wildness: so shall I hope your virtues -Will bring him to his wonted way again, -To both your honours. - - - -OPHELIA -Madam, I wish it may. - - -Exit QUEEN GERTRUDE - - -LORD POLONIUS -Ophelia, walk you here. Gracious, so please you, -We will bestow ourselves. -To OPHELIA -Read on this book; -That show of such an exercise may colour -Your loneliness. We are oft to blame in this,-- -'Tis too much proved--that with devotion's visage -And pious action we do sugar o'er -The devil himself. - - - -KING CLAUDIUS -Aside O, 'tis too true! -How smart a lash that speech doth give my conscience! -The harlot's cheek, beautied with plastering art, -Is not more ugly to the thing that helps it -Than is my deed to my most painted word: -O heavy burthen! - - - -LORD POLONIUS -I hear him coming: let's withdraw, my lord. - - -Exeunt KING CLAUDIUS and POLONIUS -Enter HAMLET - - -HAMLET -To be, or not to be: that is the question: -Whether 'tis nobler in the mind to suffer -The slings and arrows of outrageous fortune, -Or to take arms against a sea of troubles, -And by opposing end them? To die: to sleep; -No more; and by a sleep to say we end -The heart-ache and the thousand natural shocks -That flesh is heir to, 'tis a consummation -Devoutly to be wish'd. To die, to sleep; -To sleep: perchance to dream: ay, there's the rub; -For in that sleep of death what dreams may come -When we have shuffled off this mortal coil, -Must give us pause: there's the respect -That makes calamity of so long life; -For who would bear the whips and scorns of time, -The oppressor's wrong, the proud man's contumely, -The pangs of despised love, the law's delay, -The insolence of office and the spurns -That patient merit of the unworthy takes, -When he himself might his quietus make -With a bare bodkin? who would fardels bear, -To grunt and sweat under a weary life, -But that the dread of something after death, -The undiscover'd country from whose bourn -No traveller returns, puzzles the will -And makes us rather bear those ills we have -Than fly to others that we know not of? -Thus conscience does make cowards of us all; -And thus the native hue of resolution -Is sicklied o'er with the pale cast of thought, -And enterprises of great pith and moment -With this regard their currents turn awry, -And lose the name of action.--Soft you now! -The fair Ophelia! Nymph, in thy orisons -Be all my sins remember'd. - - - -OPHELIA -Good my lord, -How does your honour for this many a day? - - - -HAMLET -I humbly thank you; well, well, well. - - - -OPHELIA -My lord, I have remembrances of yours, -That I have longed long to re-deliver; -I pray you, now receive them. - - - -HAMLET -No, not I; -I never gave you aught. - - - -OPHELIA -My honour'd lord, you know right well you did; -And, with them, words of so sweet breath composed -As made the things more rich: their perfume lost, -Take these again; for to the noble mind -Rich gifts wax poor when givers prove unkind. -There, my lord. - - - -HAMLET -Ha, ha! are you honest? - - - -OPHELIA -My lord? - - - -HAMLET -Are you fair? - - - -OPHELIA -What means your lordship? - - - -HAMLET -That if you be honest and fair, your honesty should -admit no discourse to your beauty. - - - -OPHELIA -Could beauty, my lord, have better commerce than -with honesty? - - - -HAMLET -Ay, truly; for the power of beauty will sooner -transform honesty from what it is to a bawd than the -force of honesty can translate beauty into his -likeness: this was sometime a paradox, but now the -time gives it proof. I did love you once. - - - -OPHELIA -Indeed, my lord, you made me believe so. - - - -HAMLET -You should not have believed me; for virtue cannot -so inoculate our old stock but we shall relish of -it: I loved you not. - - - -OPHELIA -I was the more deceived. - - - -HAMLET -Get thee to a nunnery: why wouldst thou be a -breeder of sinners? I am myself indifferent honest; -but yet I could accuse me of such things that it -were better my mother had not borne me: I am very -proud, revengeful, ambitious, with more offences at -my beck than I have thoughts to put them in, -imagination to give them shape, or time to act them -in. What should such fellows as I do crawling -between earth and heaven? We are arrant knaves, -all; believe none of us. Go thy ways to a nunnery. -Where's your father? - - - -OPHELIA -At home, my lord. - - - -HAMLET -Let the doors be shut upon him, that he may play the -fool no where but in's own house. Farewell. - - - -OPHELIA -O, help him, you sweet heavens! - - - -HAMLET -If thou dost marry, I'll give thee this plague for -thy dowry: be thou as chaste as ice, as pure as -snow, thou shalt not escape calumny. Get thee to a -nunnery, go: farewell. Or, if thou wilt needs -marry, marry a fool; for wise men know well enough -what monsters you make of them. To a nunnery, go, -and quickly too. Farewell. - - - -OPHELIA -O heavenly powers, restore him! - - - -HAMLET -I have heard of your paintings too, well enough; God -has given you one face, and you make yourselves -another: you jig, you amble, and you lisp, and -nick-name God's creatures, and make your wantonness -your ignorance. Go to, I'll no more on't; it hath -made me mad. I say, we will have no more marriages: -those that are married already, all but one, shall -live; the rest shall keep as they are. To a -nunnery, go. - - -Exit - - -OPHELIA -O, what a noble mind is here o'erthrown! -The courtier's, soldier's, scholar's, eye, tongue, sword; -The expectancy and rose of the fair state, -The glass of fashion and the mould of form, -The observed of all observers, quite, quite down! -And I, of ladies most deject and wretched, -That suck'd the honey of his music vows, -Now see that noble and most sovereign reason, -Like sweet bells jangled, out of tune and harsh; -That unmatch'd form and feature of blown youth -Blasted with ecstasy: O, woe is me, -To have seen what I have seen, see what I see! - - -Re-enter KING CLAUDIUS and POLONIUS - - -KING CLAUDIUS -Love! his affections do not that way tend; -Nor what he spake, though it lack'd form a little, -Was not like madness. There's something in his soul, -O'er which his melancholy sits on brood; -And I do doubt the hatch and the disclose -Will be some danger: which for to prevent, -I have in quick determination -Thus set it down: he shall with speed to England, -For the demand of our neglected tribute -Haply the seas and countries different -With variable objects shall expel -This something-settled matter in his heart, -Whereon his brains still beating puts him thus -From fashion of himself. What think you on't? - - - -LORD POLONIUS -It shall do well: but yet do I believe -The origin and commencement of his grief -Sprung from neglected love. How now, Ophelia! -You need not tell us what Lord Hamlet said; -We heard it all. My lord, do as you please; -But, if you hold it fit, after the play -Let his queen mother all alone entreat him -To show his grief: let her be round with him; -And I'll be placed, so please you, in the ear -Of all their conference. If she find him not, -To England send him, or confine him where -Your wisdom best shall think. - - - -KING CLAUDIUS -It shall be so: -Madness in great ones must not unwatch'd go. - - -Exeunt - - -SCENE II. A hall in the castle. -Enter HAMLET and Players - - -HAMLET -Speak the speech, I pray you, as I pronounced it to -you, trippingly on the tongue: but if you mouth it, -as many of your players do, I had as lief the -town-crier spoke my lines. Nor do not saw the air -too much with your hand, thus, but use all gently; -for in the very torrent, tempest, and, as I may say, -the whirlwind of passion, you must acquire and beget -a temperance that may give it smoothness. O, it -offends me to the soul to hear a robustious -periwig-pated fellow tear a passion to tatters, to -very rags, to split the ears of the groundlings, who -for the most part are capable of nothing but -inexplicable dumbshows and noise: I would have such -a fellow whipped for o'erdoing Termagant; it -out-herods Herod: pray you, avoid it. - - - -First Player -I warrant your honour. - - - -HAMLET -Be not too tame neither, but let your own discretion -be your tutor: suit the action to the word, the -word to the action; with this special o'erstep not -the modesty of nature: for any thing so overdone is -from the purpose of playing, whose end, both at the -first and now, was and is, to hold, as 'twere, the -mirror up to nature; to show virtue her own feature, -scorn her own image, and the very age and body of -the time his form and pressure. Now this overdone, -or come tardy off, though it make the unskilful -laugh, cannot but make the judicious grieve; the -censure of the which one must in your allowance -o'erweigh a whole theatre of others. O, there be -players that I have seen play, and heard others -praise, and that highly, not to speak it profanely, -that, neither having the accent of Christians nor -the gait of Christian, pagan, nor man, have so -strutted and bellowed that I have thought some of -nature's journeymen had made men and not made them -well, they imitated humanity so abominably. - - - -First Player -I hope we have reformed that indifferently with us, -sir. - - - -HAMLET -O, reform it altogether. And let those that play -your clowns speak no more than is set down for them; -for there be of them that will themselves laugh, to -set on some quantity of barren spectators to laugh -too; though, in the mean time, some necessary -question of the play be then to be considered: -that's villanous, and shows a most pitiful ambition -in the fool that uses it. Go, make you ready. -Exeunt Players -Enter POLONIUS, ROSENCRANTZ, and GUILDENSTERN -How now, my lord! I will the king hear this piece of work? - - - -LORD POLONIUS -And the queen too, and that presently. - - - -HAMLET -Bid the players make haste. -Exit POLONIUS -Will you two help to hasten them? - - - -ROSENCRANTZ -GUILDENSTERN -We will, my lord. - - -Exeunt ROSENCRANTZ and GUILDENSTERN - - -HAMLET -What ho! Horatio! - - -Enter HORATIO - - -HORATIO -Here, sweet lord, at your service. - - - -HAMLET -Horatio, thou art e'en as just a man -As e'er my conversation coped withal. - - - -HORATIO -O, my dear lord,-- - - - -HAMLET -Nay, do not think I flatter; -For what advancement may I hope from thee -That no revenue hast but thy good spirits, -To feed and clothe thee? Why should the poor be flatter'd? -No, let the candied tongue lick absurd pomp, -And crook the pregnant hinges of the knee -Where thrift may follow fawning. Dost thou hear? -Since my dear soul was mistress of her choice -And could of men distinguish, her election -Hath seal'd thee for herself; for thou hast been -As one, in suffering all, that suffers nothing, -A man that fortune's buffets and rewards -Hast ta'en with equal thanks: and blest are those -Whose blood and judgment are so well commingled, -That they are not a pipe for fortune's finger -To sound what stop she please. Give me that man -That is not passion's slave, and I will wear him -In my heart's core, ay, in my heart of heart, -As I do thee.--Something too much of this.-- -There is a play to-night before the king; -One scene of it comes near the circumstance -Which I have told thee of my father's death: -I prithee, when thou seest that act afoot, -Even with the very comment of thy soul -Observe mine uncle: if his occulted guilt -Do not itself unkennel in one speech, -It is a damned ghost that we have seen, -And my imaginations are as foul -As Vulcan's stithy. Give him heedful note; -For I mine eyes will rivet to his face, -And after we will both our judgments join -In censure of his seeming. - - - -HORATIO -Well, my lord: -If he steal aught the whilst this play is playing, -And 'scape detecting, I will pay the theft. - - - -HAMLET -They are coming to the play; I must be idle: -Get you a place. - - -Danish march. A flourish. Enter KING CLAUDIUS, -QUEEN GERTRUDE, POLONIUS, OPHELIA, ROSENCRANTZ, -GUILDENSTERN, and others - - -KING CLAUDIUS -How fares our cousin Hamlet? - - - -HAMLET -Excellent, i' faith; of the chameleon's dish: I eat -the air, promise-crammed: you cannot feed capons so. - - - -KING CLAUDIUS -I have nothing with this answer, Hamlet; these words -are not mine. - - - -HAMLET -No, nor mine now. -To POLONIUS -My lord, you played once i' the university, you say? - - - -LORD POLONIUS -That did I, my lord; and was accounted a good actor. - - - -HAMLET -What did you enact? - - - -LORD POLONIUS -I did enact Julius Caesar: I was killed i' the -Capitol; Brutus killed me. - - - -HAMLET -It was a brute part of him to kill so capital a calf -there. Be the players ready? - - - -ROSENCRANTZ -Ay, my lord; they stay upon your patience. - - - -QUEEN GERTRUDE -Come hither, my dear Hamlet, sit by me. - - - -HAMLET -No, good mother, here's metal more attractive. - - - -LORD POLONIUS -To KING CLAUDIUS O, ho! do you mark that? - - - -HAMLET -Lady, shall I lie in your lap? - - -Lying down at OPHELIA's feet - - -OPHELIA -No, my lord. - - - -HAMLET -I mean, my head upon your lap? - - - -OPHELIA -Ay, my lord. - - - -HAMLET -Do you think I meant country matters? - - - -OPHELIA -I think nothing, my lord. - - - -HAMLET -That's a fair thought to lie between maids' legs. - - - -OPHELIA -What is, my lord? - - - -HAMLET -Nothing. - - - -OPHELIA -You are merry, my lord. - - - -HAMLET -Who, I? - - - -OPHELIA -Ay, my lord. - - - -HAMLET -O God, your only jig-maker. What should a man do -but be merry? for, look you, how cheerfully my -mother looks, and my father died within these two hours. - - - -OPHELIA -Nay, 'tis twice two months, my lord. - - - -HAMLET -So long? Nay then, let the devil wear black, for -I'll have a suit of sables. O heavens! die two -months ago, and not forgotten yet? Then there's -hope a great man's memory may outlive his life half -a year: but, by'r lady, he must build churches, -then; or else shall he suffer not thinking on, with -the hobby-horse, whose epitaph is 'For, O, for, O, -the hobby-horse is forgot.' -Hautboys play. The dumb-show enters - - -Enter a King and a Queen very lovingly; the Queen -embracing him, and he her. She kneels, and makes -show of protestation unto him. He takes her up, -and declines his head upon her neck: lays him down -upon a bank of flowers: she, seeing him asleep, -leaves him. Anon comes in a fellow, takes off his -crown, kisses it, and pours poison in the King's -ears, and exit. The Queen returns; finds the King -dead, and makes passionate action. The Poisoner, -with some two or three Mutes, comes in again, -seeming to lament with her. The dead body is -carried away. The Poisoner wooes the Queen with -gifts: she seems loath and unwilling awhile, but -in the end accepts his love -Exeunt - - -OPHELIA -What means this, my lord? - - - -HAMLET -Marry, this is miching mallecho; it means mischief. - - - -OPHELIA -Belike this show imports the argument of the play. - - -Enter Prologue - - -HAMLET -We shall know by this fellow: the players cannot -keep counsel; they'll tell all. - - - -OPHELIA -Will he tell us what this show meant? - - - -HAMLET -Ay, or any show that you'll show him: be not you -ashamed to show, he'll not shame to tell you what it means. - - - -OPHELIA -You are naught, you are naught: I'll mark the play. - - - -Prologue -For us, and for our tragedy, -Here stooping to your clemency, -We beg your hearing patiently. - - -Exit - - -HAMLET -Is this a prologue, or the posy of a ring? - - - -OPHELIA -'Tis brief, my lord. - - - -HAMLET -As woman's love. - - -Enter two Players, King and Queen - - -Player King -Full thirty times hath Phoebus' cart gone round -Neptune's salt wash and Tellus' orbed ground, -And thirty dozen moons with borrow'd sheen -About the world have times twelve thirties been, -Since love our hearts and Hymen did our hands -Unite commutual in most sacred bands. - - - -Player Queen -So many journeys may the sun and moon -Make us again count o'er ere love be done! -But, woe is me, you are so sick of late, -So far from cheer and from your former state, -That I distrust you. Yet, though I distrust, -Discomfort you, my lord, it nothing must: -For women's fear and love holds quantity; -In neither aught, or in extremity. -Now, what my love is, proof hath made you know; -And as my love is sized, my fear is so: -Where love is great, the littlest doubts are fear; -Where little fears grow great, great love grows there. - - - -Player King -'Faith, I must leave thee, love, and shortly too; -My operant powers their functions leave to do: -And thou shalt live in this fair world behind, -Honour'd, beloved; and haply one as kind -For husband shalt thou-- - - - -Player Queen -O, confound the rest! -Such love must needs be treason in my breast: -In second husband let me be accurst! -None wed the second but who kill'd the first. - - - -HAMLET -Aside Wormwood, wormwood. - - - -Player Queen -The instances that second marriage move -Are base respects of thrift, but none of love: -A second time I kill my husband dead, -When second husband kisses me in bed. - - - -Player King -I do believe you think what now you speak; -But what we do determine oft we break. -Purpose is but the slave to memory, -Of violent birth, but poor validity; -Which now, like fruit unripe, sticks on the tree; -But fall, unshaken, when they mellow be. -Most necessary 'tis that we forget -To pay ourselves what to ourselves is debt: -What to ourselves in passion we propose, -The passion ending, doth the purpose lose. -The violence of either grief or joy -Their own enactures with themselves destroy: -Where joy most revels, grief doth most lament; -Grief joys, joy grieves, on slender accident. -This world is not for aye, nor 'tis not strange -That even our loves should with our fortunes change; -For 'tis a question left us yet to prove, -Whether love lead fortune, or else fortune love. -The great man down, you mark his favourite flies; -The poor advanced makes friends of enemies. -And hitherto doth love on fortune tend; -For who not needs shall never lack a friend, -And who in want a hollow friend doth try, -Directly seasons him his enemy. -But, orderly to end where I begun, -Our wills and fates do so contrary run -That our devices still are overthrown; -Our thoughts are ours, their ends none of our own: -So think thou wilt no second husband wed; -But die thy thoughts when thy first lord is dead. - - - -Player Queen -Nor earth to me give food, nor heaven light! -Sport and repose lock from me day and night! -To desperation turn my trust and hope! -An anchor's cheer in prison be my scope! -Each opposite that blanks the face of joy -Meet what I would have well and it destroy! -Both here and hence pursue me lasting strife, -If, once a widow, ever I be wife! - - - -HAMLET -If she should break it now! - - - -Player King -'Tis deeply sworn. Sweet, leave me here awhile; -My spirits grow dull, and fain I would beguile -The tedious day with sleep. - - -Sleeps - - -Player Queen -Sleep rock thy brain, -And never come mischance between us twain! - - -Exit - - -HAMLET -Madam, how like you this play? - - - -QUEEN GERTRUDE -The lady protests too much, methinks. - - - -HAMLET -O, but she'll keep her word. - - - -KING CLAUDIUS -Have you heard the argument? Is there no offence in 't? - - - -HAMLET -No, no, they do but jest, poison in jest; no offence -i' the world. - - - -KING CLAUDIUS -What do you call the play? - - - -HAMLET -The Mouse-trap. Marry, how? Tropically. This play -is the image of a murder done in Vienna: Gonzago is -the duke's name; his wife, Baptista: you shall see -anon; 'tis a knavish piece of work: but what o' -that? your majesty and we that have free souls, it -touches us not: let the galled jade wince, our -withers are unwrung. -Enter LUCIANUS -This is one Lucianus, nephew to the king. - - - -OPHELIA -You are as good as a chorus, my lord. - - - -HAMLET -I could interpret between you and your love, if I -could see the puppets dallying. - - - -OPHELIA -You are keen, my lord, you are keen. - - - -HAMLET -It would cost you a groaning to take off my edge. - - - -OPHELIA -Still better, and worse. - - - -HAMLET -So you must take your husbands. Begin, murderer; -pox, leave thy damnable faces, and begin. Come: -'the croaking raven doth bellow for revenge.' - - - -LUCIANUS -Thoughts black, hands apt, drugs fit, and time agreeing; -Confederate season, else no creature seeing; -Thou mixture rank, of midnight weeds collected, -With Hecate's ban thrice blasted, thrice infected, -Thy natural magic and dire property, -On wholesome life usurp immediately. - - -Pours the poison into the sleeper's ears - - -HAMLET -He poisons him i' the garden for's estate. His -name's Gonzago: the story is extant, and writ in -choice Italian: you shall see anon how the murderer -gets the love of Gonzago's wife. - - - -OPHELIA -The king rises. - - - -HAMLET -What, frighted with false fire! - - - -QUEEN GERTRUDE -How fares my lord? - - - -LORD POLONIUS -Give o'er the play. - - - -KING CLAUDIUS -Give me some light: away! - - - -All -Lights, lights, lights! - - -Exeunt all but HAMLET and HORATIO - - -HAMLET -Why, let the stricken deer go weep, -The hart ungalled play; -For some must watch, while some must sleep: -So runs the world away. -Would not this, sir, and a forest of feathers-- if -the rest of my fortunes turn Turk with me--with two -Provincial roses on my razed shoes, get me a -fellowship in a cry of players, sir? - - - -HORATIO -Half a share. - - - -HAMLET -A whole one, I. -For thou dost know, O Damon dear, -This realm dismantled was -Of Jove himself; and now reigns here -A very, very--pajock. - - - -HORATIO -You might have rhymed. - - - -HAMLET -O good Horatio, I'll take the ghost's word for a -thousand pound. Didst perceive? - - - -HORATIO -Very well, my lord. - - - -HAMLET -Upon the talk of the poisoning? - - - -HORATIO -I did very well note him. - - - -HAMLET -Ah, ha! Come, some music! come, the recorders! -For if the king like not the comedy, -Why then, belike, he likes it not, perdy. -Come, some music! - - -Re-enter ROSENCRANTZ and GUILDENSTERN - - -GUILDENSTERN -Good my lord, vouchsafe me a word with you. - - - -HAMLET -Sir, a whole history. - - - -GUILDENSTERN -The king, sir,-- - - - -HAMLET -Ay, sir, what of him? - - - -GUILDENSTERN -Is in his retirement marvellous distempered. - - - -HAMLET -With drink, sir? - - - -GUILDENSTERN -No, my lord, rather with choler. - - - -HAMLET -Your wisdom should show itself more richer to -signify this to his doctor; for, for me to put him -to his purgation would perhaps plunge him into far -more choler. - - - -GUILDENSTERN -Good my lord, put your discourse into some frame and -start not so wildly from my affair. - - - -HAMLET -I am tame, sir: pronounce. - - - -GUILDENSTERN -The queen, your mother, in most great affliction of -spirit, hath sent me to you. - - - -HAMLET -You are welcome. - - - -GUILDENSTERN -Nay, good my lord, this courtesy is not of the right -breed. If it shall please you to make me a -wholesome answer, I will do your mother's -commandment: if not, your pardon and my return -shall be the end of my business. - - - -HAMLET -Sir, I cannot. - - - -GUILDENSTERN -What, my lord? - - - -HAMLET -Make you a wholesome answer; my wit's diseased: but, -sir, such answer as I can make, you shall command; -or, rather, as you say, my mother: therefore no -more, but to the matter: my mother, you say,-- - - - -ROSENCRANTZ -Then thus she says; your behavior hath struck her -into amazement and admiration. - - - -HAMLET -O wonderful son, that can so astonish a mother! But -is there no sequel at the heels of this mother's -admiration? Impart. - - - -ROSENCRANTZ -She desires to speak with you in her closet, ere you -go to bed. - - - -HAMLET -We shall obey, were she ten times our mother. Have -you any further trade with us? - - - -ROSENCRANTZ -My lord, you once did love me. - - - -HAMLET -So I do still, by these pickers and stealers. - - - -ROSENCRANTZ -Good my lord, what is your cause of distemper? you -do, surely, bar the door upon your own liberty, if -you deny your griefs to your friend. - - - -HAMLET -Sir, I lack advancement. - - - -ROSENCRANTZ -How can that be, when you have the voice of the king -himself for your succession in Denmark? - - - -HAMLET -Ay, but sir, 'While the grass grows,'--the proverb -is something musty. -Re-enter Players with recorders -O, the recorders! let me see one. To withdraw with -you:--why do you go about to recover the wind of me, -as if you would drive me into a toil? - - - -GUILDENSTERN -O, my lord, if my duty be too bold, my love is too -unmannerly. - - - -HAMLET -I do not well understand that. Will you play upon -this pipe? - - - -GUILDENSTERN -My lord, I cannot. - - - -HAMLET -I pray you. - - - -GUILDENSTERN -Believe me, I cannot. - - - -HAMLET -I do beseech you. - - - -GUILDENSTERN -I know no touch of it, my lord. - - - -HAMLET -'Tis as easy as lying: govern these ventages with -your lingers and thumb, give it breath with your -mouth, and it will discourse most eloquent music. -Look you, these are the stops. - - - -GUILDENSTERN -But these cannot I command to any utterance of -harmony; I have not the skill. - - - -HAMLET -Why, look you now, how unworthy a thing you make of -me! You would play upon me; you would seem to know -my stops; you would pluck out the heart of my -mystery; you would sound me from my lowest note to -the top of my compass: and there is much music, -excellent voice, in this little organ; yet cannot -you make it speak. 'Sblood, do you think I am -easier to be played on than a pipe? Call me what -instrument you will, though you can fret me, yet you -cannot play upon me. -Enter POLONIUS -God bless you, sir! - - - -LORD POLONIUS -My lord, the queen would speak with you, and -presently. - - - -HAMLET -Do you see yonder cloud that's almost in shape of a camel? - - - -LORD POLONIUS -By the mass, and 'tis like a camel, indeed. - - - -HAMLET -Methinks it is like a weasel. - - - -LORD POLONIUS -It is backed like a weasel. - - - -HAMLET -Or like a whale? - - - -LORD POLONIUS -Very like a whale. - - - -HAMLET -Then I will come to my mother by and by. They fool -me to the top of my bent. I will come by and by. - - - -LORD POLONIUS -I will say so. - - - -HAMLET -By and by is easily said. -Exit POLONIUS -Leave me, friends. -Exeunt all but HAMLET -Tis now the very witching time of night, -When churchyards yawn and hell itself breathes out -Contagion to this world: now could I drink hot blood, -And do such bitter business as the day -Would quake to look on. Soft! now to my mother. -O heart, lose not thy nature; let not ever -The soul of Nero enter this firm bosom: -Let me be cruel, not unnatural: -I will speak daggers to her, but use none; -My tongue and soul in this be hypocrites; -How in my words soever she be shent, -To give them seals never, my soul, consent! - - -Exit - - -SCENE III. A room in the castle. -Enter KING CLAUDIUS, ROSENCRANTZ, and GUILDENSTERN - - -KING CLAUDIUS -I like him not, nor stands it safe with us -To let his madness range. Therefore prepare you; -I your commission will forthwith dispatch, -And he to England shall along with you: -The terms of our estate may not endure -Hazard so dangerous as doth hourly grow -Out of his lunacies. - - - -GUILDENSTERN -We will ourselves provide: -Most holy and religious fear it is -To keep those many many bodies safe -That live and feed upon your majesty. - - - -ROSENCRANTZ -The single and peculiar life is bound, -With all the strength and armour of the mind, -To keep itself from noyance; but much more -That spirit upon whose weal depend and rest -The lives of many. The cease of majesty -Dies not alone; but, like a gulf, doth draw -What's near it with it: it is a massy wheel, -Fix'd on the summit of the highest mount, -To whose huge spokes ten thousand lesser things -Are mortised and adjoin'd; which, when it falls, -Each small annexment, petty consequence, -Attends the boisterous ruin. Never alone -Did the king sigh, but with a general groan. - - - -KING CLAUDIUS -Arm you, I pray you, to this speedy voyage; -For we will fetters put upon this fear, -Which now goes too free-footed. - - - -ROSENCRANTZ -GUILDENSTERN -We will haste us. - - -Exeunt ROSENCRANTZ and GUILDENSTERN -Enter POLONIUS - - -LORD POLONIUS -My lord, he's going to his mother's closet: -Behind the arras I'll convey myself, -To hear the process; and warrant she'll tax him home: -And, as you said, and wisely was it said, -'Tis meet that some more audience than a mother, -Since nature makes them partial, should o'erhear -The speech, of vantage. Fare you well, my liege: -I'll call upon you ere you go to bed, -And tell you what I know. - - - -KING CLAUDIUS -Thanks, dear my lord. -Exit POLONIUS -O, my offence is rank it smells to heaven; -It hath the primal eldest curse upon't, -A brother's murder. Pray can I not, -Though inclination be as sharp as will: -My stronger guilt defeats my strong intent; -And, like a man to double business bound, -I stand in pause where I shall first begin, -And both neglect. What if this cursed hand -Were thicker than itself with brother's blood, -Is there not rain enough in the sweet heavens -To wash it white as snow? Whereto serves mercy -But to confront the visage of offence? -And what's in prayer but this two-fold force, -To be forestalled ere we come to fall, -Or pardon'd being down? Then I'll look up; -My fault is past. But, O, what form of prayer -Can serve my turn? 'Forgive me my foul murder'? -That cannot be; since I am still possess'd -Of those effects for which I did the murder, -My crown, mine own ambition and my queen. -May one be pardon'd and retain the offence? -In the corrupted currents of this world -Offence's gilded hand may shove by justice, -And oft 'tis seen the wicked prize itself -Buys out the law: but 'tis not so above; -There is no shuffling, there the action lies -In his true nature; and we ourselves compell'd, -Even to the teeth and forehead of our faults, -To give in evidence. What then? what rests? -Try what repentance can: what can it not? -Yet what can it when one can not repent? -O wretched state! O bosom black as death! -O limed soul, that, struggling to be free, -Art more engaged! Help, angels! Make assay! -Bow, stubborn knees; and, heart with strings of steel, -Be soft as sinews of the newborn babe! -All may be well. - - -Retires and kneels -Enter HAMLET - - -HAMLET -Now might I do it pat, now he is praying; -And now I'll do't. And so he goes to heaven; -And so am I revenged. That would be scann'd: -A villain kills my father; and for that, -I, his sole son, do this same villain send -To heaven. -O, this is hire and salary, not revenge. -He took my father grossly, full of bread; -With all his crimes broad blown, as flush as May; -And how his audit stands who knows save heaven? -But in our circumstance and course of thought, -'Tis heavy with him: and am I then revenged, -To take him in the purging of his soul, -When he is fit and season'd for his passage? -No! -Up, sword; and know thou a more horrid hent: -When he is drunk asleep, or in his rage, -Or in the incestuous pleasure of his bed; -At gaming, swearing, or about some act -That has no relish of salvation in't; -Then trip him, that his heels may kick at heaven, -And that his soul may be as damn'd and black -As hell, whereto it goes. My mother stays: -This physic but prolongs thy sickly days. - - -Exit - - -KING CLAUDIUS -Rising My words fly up, my thoughts remain below: -Words without thoughts never to heaven go. - - -Exit - - -SCENE IV. The Queen's closet. -Enter QUEEN MARGARET and POLONIUS - - -LORD POLONIUS -He will come straight. Look you lay home to him: -Tell him his pranks have been too broad to bear with, -And that your grace hath screen'd and stood between -Much heat and him. I'll sconce me even here. -Pray you, be round with him. - - - -HAMLET -Within Mother, mother, mother! - - - -QUEEN GERTRUDE -I'll warrant you, -Fear me not: withdraw, I hear him coming. - - -POLONIUS hides behind the arras -Enter HAMLET - - -HAMLET -Now, mother, what's the matter? - - - -QUEEN GERTRUDE -Hamlet, thou hast thy father much offended. - - - -HAMLET -Mother, you have my father much offended. - - - -QUEEN GERTRUDE -Come, come, you answer with an idle tongue. - - - -HAMLET -Go, go, you question with a wicked tongue. - - - -QUEEN GERTRUDE -Why, how now, Hamlet! - - - -HAMLET -What's the matter now? - - - -QUEEN GERTRUDE -Have you forgot me? - - - -HAMLET -No, by the rood, not so: -You are the queen, your husband's brother's wife; -And--would it were not so!--you are my mother. - - - -QUEEN GERTRUDE -Nay, then, I'll set those to you that can speak. - - - -HAMLET -Come, come, and sit you down; you shall not budge; -You go not till I set you up a glass -Where you may see the inmost part of you. - - - -QUEEN GERTRUDE -What wilt thou do? thou wilt not murder me? -Help, help, ho! - - - -LORD POLONIUS -Behind What, ho! help, help, help! - - - -HAMLET -Drawing How now! a rat? Dead, for a ducat, dead! - - -Makes a pass through the arras - - -LORD POLONIUS -Behind O, I am slain! - - -Falls and dies - - -QUEEN GERTRUDE -O me, what hast thou done? - - - -HAMLET -Nay, I know not: -Is it the king? - - - -QUEEN GERTRUDE -O, what a rash and bloody deed is this! - - - -HAMLET -A bloody deed! almost as bad, good mother, -As kill a king, and marry with his brother. - - - -QUEEN GERTRUDE -As kill a king! - - - -HAMLET -Ay, lady, 'twas my word. -Lifts up the array and discovers POLONIUS -Thou wretched, rash, intruding fool, farewell! -I took thee for thy better: take thy fortune; -Thou find'st to be too busy is some danger. -Leave wringing of your hands: peace! sit you down, -And let me wring your heart; for so I shall, -If it be made of penetrable stuff, -If damned custom have not brass'd it so -That it is proof and bulwark against sense. - - - -QUEEN GERTRUDE -What have I done, that thou darest wag thy tongue -In noise so rude against me? - - - -HAMLET -Such an act -That blurs the grace and blush of modesty, -Calls virtue hypocrite, takes off the rose -From the fair forehead of an innocent love -And sets a blister there, makes marriage-vows -As false as dicers' oaths: O, such a deed -As from the body of contraction plucks -The very soul, and sweet religion makes -A rhapsody of words: heaven's face doth glow: -Yea, this solidity and compound mass, -With tristful visage, as against the doom, -Is thought-sick at the act. - - - -QUEEN GERTRUDE -Ay me, what act, -That roars so loud, and thunders in the index? - - - -HAMLET -Look here, upon this picture, and on this, -The counterfeit presentment of two brothers. -See, what a grace was seated on this brow; -Hyperion's curls; the front of Jove himself; -An eye like Mars, to threaten and command; -A station like the herald Mercury -New-lighted on a heaven-kissing hill; -A combination and a form indeed, -Where every god did seem to set his seal, -To give the world assurance of a man: -This was your husband. Look you now, what follows: -Here is your husband; like a mildew'd ear, -Blasting his wholesome brother. Have you eyes? -Could you on this fair mountain leave to feed, -And batten on this moor? Ha! have you eyes? -You cannot call it love; for at your age -The hey-day in the blood is tame, it's humble, -And waits upon the judgment: and what judgment -Would step from this to this? Sense, sure, you have, -Else could you not have motion; but sure, that sense -Is apoplex'd; for madness would not err, -Nor sense to ecstasy was ne'er so thrall'd -But it reserved some quantity of choice, -To serve in such a difference. What devil was't -That thus hath cozen'd you at hoodman-blind? -Eyes without feeling, feeling without sight, -Ears without hands or eyes, smelling sans all, -Or but a sickly part of one true sense -Could not so mope. -O shame! where is thy blush? Rebellious hell, -If thou canst mutine in a matron's bones, -To flaming youth let virtue be as wax, -And melt in her own fire: proclaim no shame -When the compulsive ardour gives the charge, -Since frost itself as actively doth burn -And reason panders will. - - - -QUEEN GERTRUDE -O Hamlet, speak no more: -Thou turn'st mine eyes into my very soul; -And there I see such black and grained spots -As will not leave their tinct. - - - -HAMLET -Nay, but to live -In the rank sweat of an enseamed bed, -Stew'd in corruption, honeying and making love -Over the nasty sty,-- - - - -QUEEN GERTRUDE -O, speak to me no more; -These words, like daggers, enter in mine ears; -No more, sweet Hamlet! - - - -HAMLET -A murderer and a villain; -A slave that is not twentieth part the tithe -Of your precedent lord; a vice of kings; -A cutpurse of the empire and the rule, -That from a shelf the precious diadem stole, -And put it in his pocket! - - - -QUEEN GERTRUDE -No more! - - - -HAMLET -A king of shreds and patches,-- -Enter Ghost -Save me, and hover o'er me with your wings, -You heavenly guards! What would your gracious figure? - - - -QUEEN GERTRUDE -Alas, he's mad! - - - -HAMLET -Do you not come your tardy son to chide, -That, lapsed in time and passion, lets go by -The important acting of your dread command? O, say! - - - -Ghost -Do not forget: this visitation -Is but to whet thy almost blunted purpose. -But, look, amazement on thy mother sits: -O, step between her and her fighting soul: -Conceit in weakest bodies strongest works: -Speak to her, Hamlet. - - - -HAMLET -How is it with you, lady? - - - -QUEEN GERTRUDE -Alas, how is't with you, -That you do bend your eye on vacancy -And with the incorporal air do hold discourse? -Forth at your eyes your spirits wildly peep; -And, as the sleeping soldiers in the alarm, -Your bedded hair, like life in excrements, -Starts up, and stands on end. O gentle son, -Upon the heat and flame of thy distemper -Sprinkle cool patience. Whereon do you look? - - - -HAMLET -On him, on him! Look you, how pale he glares! -His form and cause conjoin'd, preaching to stones, -Would make them capable. Do not look upon me; -Lest with this piteous action you convert -My stern effects: then what I have to do -Will want true colour; tears perchance for blood. - - - -QUEEN GERTRUDE -To whom do you speak this? - - - -HAMLET -Do you see nothing there? - - - -QUEEN GERTRUDE -Nothing at all; yet all that is I see. - - - -HAMLET -Nor did you nothing hear? - - - -QUEEN GERTRUDE -No, nothing but ourselves. - - - -HAMLET -Why, look you there! look, how it steals away! -My father, in his habit as he lived! -Look, where he goes, even now, out at the portal! - - -Exit Ghost - - -QUEEN GERTRUDE -This the very coinage of your brain: -This bodiless creation ecstasy -Is very cunning in. - - - -HAMLET -Ecstasy! -My pulse, as yours, doth temperately keep time, -And makes as healthful music: it is not madness -That I have utter'd: bring me to the test, -And I the matter will re-word; which madness -Would gambol from. Mother, for love of grace, -Lay not that mattering unction to your soul, -That not your trespass, but my madness speaks: -It will but skin and film the ulcerous place, -Whilst rank corruption, mining all within, -Infects unseen. Confess yourself to heaven; -Repent what's past; avoid what is to come; -And do not spread the compost on the weeds, -To make them ranker. Forgive me this my virtue; -For in the fatness of these pursy times -Virtue itself of vice must pardon beg, -Yea, curb and woo for leave to do him good. - - - -QUEEN GERTRUDE -O Hamlet, thou hast cleft my heart in twain. - - - -HAMLET -O, throw away the worser part of it, -And live the purer with the other half. -Good night: but go not to mine uncle's bed; -Assume a virtue, if you have it not. -That monster, custom, who all sense doth eat, -Of habits devil, is angel yet in this, -That to the use of actions fair and good -He likewise gives a frock or livery, -That aptly is put on. Refrain to-night, -And that shall lend a kind of easiness -To the next abstinence: the next more easy; -For use almost can change the stamp of nature, -And either ... the devil, or throw him out -With wondrous potency. Once more, good night: -And when you are desirous to be bless'd, -I'll blessing beg of you. For this same lord, -Pointing to POLONIUS -I do repent: but heaven hath pleased it so, -To punish me with this and this with me, -That I must be their scourge and minister. -I will bestow him, and will answer well -The death I gave him. So, again, good night. -I must be cruel, only to be kind: -Thus bad begins and worse remains behind. -One word more, good lady. - - - -QUEEN GERTRUDE -What shall I do? - - - -HAMLET -Not this, by no means, that I bid you do: -Let the bloat king tempt you again to bed; -Pinch wanton on your cheek; call you his mouse; -And let him, for a pair of reechy kisses, -Or paddling in your neck with his damn'd fingers, -Make you to ravel all this matter out, -That I essentially am not in madness, -But mad in craft. 'Twere good you let him know; -For who, that's but a queen, fair, sober, wise, -Would from a paddock, from a bat, a gib, -Such dear concernings hide? who would do so? -No, in despite of sense and secrecy, -Unpeg the basket on the house's top. -Let the birds fly, and, like the famous ape, -To try conclusions, in the basket creep, -And break your own neck down. - - - -QUEEN GERTRUDE -Be thou assured, if words be made of breath, -And breath of life, I have no life to breathe -What thou hast said to me. - - - -HAMLET -I must to England; you know that? - - - -QUEEN GERTRUDE -Alack, -I had forgot: 'tis so concluded on. - - - -HAMLET -There's letters seal'd: and my two schoolfellows, -Whom I will trust as I will adders fang'd, -They bear the mandate; they must sweep my way, -And marshal me to knavery. Let it work; -For 'tis the sport to have the engineer -Hoist with his own petard: and 't shall go hard -But I will delve one yard below their mines, -And blow them at the moon: O, 'tis most sweet, -When in one line two crafts directly meet. -This man shall set me packing: -I'll lug the guts into the neighbour room. -Mother, good night. Indeed this counsellor -Is now most still, most secret and most grave, -Who was in life a foolish prating knave. -Come, sir, to draw toward an end with you. -Good night, mother. - - -Exeunt severally; HAMLET dragging in POLONIUS - - - - -ACT IV - -SCENE I. A room in the castle. -Enter KING CLAUDIUS, QUEEN GERTRUDE, ROSENCRANTZ, -and GUILDENSTERN - - -KING CLAUDIUS -There's matter in these sighs, these profound heaves: -You must translate: 'tis fit we understand them. -Where is your son? - - - -QUEEN GERTRUDE -Bestow this place on us a little while. -Exeunt ROSENCRANTZ and GUILDENSTERN -Ah, my good lord, what have I seen to-night! - - - -KING CLAUDIUS -What, Gertrude? How does Hamlet? - - - -QUEEN GERTRUDE -Mad as the sea and wind, when both contend -Which is the mightier: in his lawless fit, -Behind the arras hearing something stir, -Whips out his rapier, cries, 'A rat, a rat!' -And, in this brainish apprehension, kills -The unseen good old man. - - - -KING CLAUDIUS -O heavy deed! -It had been so with us, had we been there: -His liberty is full of threats to all; -To you yourself, to us, to every one. -Alas, how shall this bloody deed be answer'd? -It will be laid to us, whose providence -Should have kept short, restrain'd and out of haunt, -This mad young man: but so much was our love, -We would not understand what was most fit; -But, like the owner of a foul disease, -To keep it from divulging, let it feed -Even on the pith of Life. Where is he gone? - - - -QUEEN GERTRUDE -To draw apart the body he hath kill'd: -O'er whom his very madness, like some ore -Among a mineral of metals base, -Shows itself pure; he weeps for what is done. - - - -KING CLAUDIUS -O Gertrude, come away! -The sun no sooner shall the mountains touch, -But we will ship him hence: and this vile deed -We must, with all our majesty and skill, -Both countenance and excuse. Ho, Guildenstern! -Re-enter ROSENCRANTZ and GUILDENSTERN -Friends both, go join you with some further aid: -Hamlet in madness hath Polonius slain, -And from his mother's closet hath he dragg'd him: -Go seek him out; speak fair, and bring the body -Into the chapel. I pray you, haste in this. -Exeunt ROSENCRANTZ and GUILDENSTERN -Come, Gertrude, we'll call up our wisest friends; -And let them know, both what we mean to do, -And what's untimely done... -Whose whisper o'er the world's diameter, -As level as the cannon to his blank, -Transports his poison'd shot, may miss our name, -And hit the woundless air. O, come away! -My soul is full of discord and dismay. - - -Exeunt - - -SCENE II. Another room in the castle. -Enter HAMLET - - -HAMLET -Safely stowed. - - - -ROSENCRANTZ -GUILDENSTERN -Within Hamlet! Lord Hamlet! - - - -HAMLET -What noise? who calls on Hamlet? -O, here they come. - - -Enter ROSENCRANTZ and GUILDENSTERN - - -ROSENCRANTZ -What have you done, my lord, with the dead body? - - - -HAMLET -Compounded it with dust, whereto 'tis kin. - - - -ROSENCRANTZ -Tell us where 'tis, that we may take it thence -And bear it to the chapel. - - - -HAMLET -Do not believe it. - - - -ROSENCRANTZ -Believe what? - - - -HAMLET -That I can keep your counsel and not mine own. -Besides, to be demanded of a sponge! what -replication should be made by the son of a king? - - - -ROSENCRANTZ -Take you me for a sponge, my lord? - - - -HAMLET -Ay, sir, that soaks up the king's countenance, his -rewards, his authorities. But such officers do the -king best service in the end: he keeps them, like -an ape, in the corner of his jaw; first mouthed, to -be last swallowed: when he needs what you have -gleaned, it is but squeezing you, and, sponge, you -shall be dry again. - - - -ROSENCRANTZ -I understand you not, my lord. - - - -HAMLET -I am glad of it: a knavish speech sleeps in a -foolish ear. - - - -ROSENCRANTZ -My lord, you must tell us where the body is, and go -with us to the king. - - - -HAMLET -The body is with the king, but the king is not with -the body. The king is a thing-- - - - -GUILDENSTERN -A thing, my lord! - - - -HAMLET -Of nothing: bring me to him. Hide fox, and all after. - - -Exeunt - - -SCENE III. Another room in the castle. -Enter KING CLAUDIUS, attended - - -KING CLAUDIUS -I have sent to seek him, and to find the body. -How dangerous is it that this man goes loose! -Yet must not we put the strong law on him: -He's loved of the distracted multitude, -Who like not in their judgment, but their eyes; -And where tis so, the offender's scourge is weigh'd, -But never the offence. To bear all smooth and even, -This sudden sending him away must seem -Deliberate pause: diseases desperate grown -By desperate appliance are relieved, -Or not at all. -Enter ROSENCRANTZ -How now! what hath befall'n? - - - -ROSENCRANTZ -Where the dead body is bestow'd, my lord, -We cannot get from him. - - - -KING CLAUDIUS -But where is he? - - - -ROSENCRANTZ -Without, my lord; guarded, to know your pleasure. - - - -KING CLAUDIUS -Bring him before us. - - - -ROSENCRANTZ -Ho, Guildenstern! bring in my lord. - - -Enter HAMLET and GUILDENSTERN - - -KING CLAUDIUS -Now, Hamlet, where's Polonius? - - - -HAMLET -At supper. - - - -KING CLAUDIUS -At supper! where? - - - -HAMLET -Not where he eats, but where he is eaten: a certain -convocation of politic worms are e'en at him. Your -worm is your only emperor for diet: we fat all -creatures else to fat us, and we fat ourselves for -maggots: your fat king and your lean beggar is but -variable service, two dishes, but to one table: -that's the end. - - - -KING CLAUDIUS -Alas, alas! - - - -HAMLET -A man may fish with the worm that hath eat of a -king, and cat of the fish that hath fed of that worm. - - - -KING CLAUDIUS -What dost you mean by this? - - - -HAMLET -Nothing but to show you how a king may go a -progress through the guts of a beggar. - - - -KING CLAUDIUS -Where is Polonius? - - - -HAMLET -In heaven; send hither to see: if your messenger -find him not there, seek him i' the other place -yourself. But indeed, if you find him not within -this month, you shall nose him as you go up the -stairs into the lobby. - - - -KING CLAUDIUS -Go seek him there. - - -To some Attendants - - -HAMLET -He will stay till ye come. - - -Exeunt Attendants - - -KING CLAUDIUS -Hamlet, this deed, for thine especial safety,-- -Which we do tender, as we dearly grieve -For that which thou hast done,--must send thee hence -With fiery quickness: therefore prepare thyself; -The bark is ready, and the wind at help, -The associates tend, and every thing is bent -For England. - - - -HAMLET -For England! - - - -KING CLAUDIUS -Ay, Hamlet. - - - -HAMLET -Good. - - - -KING CLAUDIUS -So is it, if thou knew'st our purposes. - - - -HAMLET -I see a cherub that sees them. But, come; for -England! Farewell, dear mother. - - - -KING CLAUDIUS -Thy loving father, Hamlet. - - - -HAMLET -My mother: father and mother is man and wife; man -and wife is one flesh; and so, my mother. Come, for England! - - -Exit - - -KING CLAUDIUS -Follow him at foot; tempt him with speed aboard; -Delay it not; I'll have him hence to-night: -Away! for every thing is seal'd and done -That else leans on the affair: pray you, make haste. -Exeunt ROSENCRANTZ and GUILDENSTERN -And, England, if my love thou hold'st at aught-- -As my great power thereof may give thee sense, -Since yet thy cicatrice looks raw and red -After the Danish sword, and thy free awe -Pays homage to us--thou mayst not coldly set -Our sovereign process; which imports at full, -By letters congruing to that effect, -The present death of Hamlet. Do it, England; -For like the hectic in my blood he rages, -And thou must cure me: till I know 'tis done, -Howe'er my haps, my joys were ne'er begun. - - -Exit - - -SCENE IV. A plain in Denmark. -Enter FORTINBRAS, a Captain, and Soldiers, marching - - -PRINCE FORTINBRAS -Go, captain, from me greet the Danish king; -Tell him that, by his licence, Fortinbras -Craves the conveyance of a promised march -Over his kingdom. You know the rendezvous. -If that his majesty would aught with us, -We shall express our duty in his eye; -And let him know so. - - - -Captain -I will do't, my lord. - - - -PRINCE FORTINBRAS -Go softly on. - - -Exeunt FORTINBRAS and Soldiers -Enter HAMLET, ROSENCRANTZ, GUILDENSTERN, and others - - -HAMLET -Good sir, whose powers are these? - - - -Captain -They are of Norway, sir. - - - -HAMLET -How purposed, sir, I pray you? - - - -Captain -Against some part of Poland. - - - -HAMLET -Who commands them, sir? - - - -Captain -The nephews to old Norway, Fortinbras. - - - -HAMLET -Goes it against the main of Poland, sir, -Or for some frontier? - - - -Captain -Truly to speak, and with no addition, -We go to gain a little patch of ground -That hath in it no profit but the name. -To pay five ducats, five, I would not farm it; -Nor will it yield to Norway or the Pole -A ranker rate, should it be sold in fee. - - - -HAMLET -Why, then the Polack never will defend it. - - - -Captain -Yes, it is already garrison'd. - - - -HAMLET -Two thousand souls and twenty thousand ducats -Will not debate the question of this straw: -This is the imposthume of much wealth and peace, -That inward breaks, and shows no cause without -Why the man dies. I humbly thank you, sir. - - - -Captain -God be wi' you, sir. - - -Exit - - -ROSENCRANTZ -Wilt please you go, my lord? - - - -HAMLET -I'll be with you straight go a little before. -Exeunt all except HAMLET -How all occasions do inform against me, -And spur my dull revenge! What is a man, -If his chief good and market of his time -Be but to sleep and feed? a beast, no more. -Sure, he that made us with such large discourse, -Looking before and after, gave us not -That capability and god-like reason -To fust in us unused. Now, whether it be -Bestial oblivion, or some craven scruple -Of thinking too precisely on the event, -A thought which, quarter'd, hath but one part wisdom -And ever three parts coward, I do not know -Why yet I live to say 'This thing's to do;' -Sith I have cause and will and strength and means -To do't. Examples gross as earth exhort me: -Witness this army of such mass and charge -Led by a delicate and tender prince, -Whose spirit with divine ambition puff'd -Makes mouths at the invisible event, -Exposing what is mortal and unsure -To all that fortune, death and danger dare, -Even for an egg-shell. Rightly to be great -Is not to stir without great argument, -But greatly to find quarrel in a straw -When honour's at the stake. How stand I then, -That have a father kill'd, a mother stain'd, -Excitements of my reason and my blood, -And let all sleep? while, to my shame, I see -The imminent death of twenty thousand men, -That, for a fantasy and trick of fame, -Go to their graves like beds, fight for a plot -Whereon the numbers cannot try the cause, -Which is not tomb enough and continent -To hide the slain? O, from this time forth, -My thoughts be bloody, or be nothing worth! - - -Exit - - -SCENE V. Elsinore. A room in the castle. -Enter QUEEN GERTRUDE, HORATIO, and a Gentleman - - -QUEEN GERTRUDE -I will not speak with her. - - - -Gentleman -She is importunate, indeed distract: -Her mood will needs be pitied. - - - -QUEEN GERTRUDE -What would she have? - - - -Gentleman -She speaks much of her father; says she hears -There's tricks i' the world; and hems, and beats her heart; -Spurns enviously at straws; speaks things in doubt, -That carry but half sense: her speech is nothing, -Yet the unshaped use of it doth move -The hearers to collection; they aim at it, -And botch the words up fit to their own thoughts; -Which, as her winks, and nods, and gestures -yield them, -Indeed would make one think there might be thought, -Though nothing sure, yet much unhappily. - - - -HORATIO -'Twere good she were spoken with; for she may strew -Dangerous conjectures in ill-breeding minds. - - - -QUEEN GERTRUDE -Let her come in. -Exit HORATIO -To my sick soul, as sin's true nature is, -Each toy seems prologue to some great amiss: -So full of artless jealousy is guilt, -It spills itself in fearing to be spilt. - - -Re-enter HORATIO, with OPHELIA - - -OPHELIA -Where is the beauteous majesty of Denmark? - - - -QUEEN GERTRUDE -How now, Ophelia! - - - -OPHELIA -Sings -How should I your true love know -From another one? -By his cockle hat and staff, -And his sandal shoon. - - - -QUEEN GERTRUDE -Alas, sweet lady, what imports this song? - - - -OPHELIA -Say you? nay, pray you, mark. -Sings -He is dead and gone, lady, -He is dead and gone; -At his head a grass-green turf, -At his heels a stone. - - - -QUEEN GERTRUDE -Nay, but, Ophelia,-- - - - -OPHELIA -Pray you, mark. -Sings -White his shroud as the mountain snow,-- - - -Enter KING CLAUDIUS - - -QUEEN GERTRUDE -Alas, look here, my lord. - - - -OPHELIA -Sings -Larded with sweet flowers -Which bewept to the grave did go -With true-love showers. - - - -KING CLAUDIUS -How do you, pretty lady? - - - -OPHELIA -Well, God 'ild you! They say the owl was a baker's -daughter. Lord, we know what we are, but know not -what we may be. God be at your table! - - - -KING CLAUDIUS -Conceit upon her father. - - - -OPHELIA -Pray you, let's have no words of this; but when they -ask you what it means, say you this: -Sings -To-morrow is Saint Valentine's day, -All in the morning betime, -And I a maid at your window, -To be your Valentine. -Then up he rose, and donn'd his clothes, -And dupp'd the chamber-door; -Let in the maid, that out a maid -Never departed more. - - - -KING CLAUDIUS -Pretty Ophelia! - - - -OPHELIA -Indeed, la, without an oath, I'll make an end on't: -Sings -By Gis and by Saint Charity, -Alack, and fie for shame! -Young men will do't, if they come to't; -By cock, they are to blame. -Quoth she, before you tumbled me, -You promised me to wed. -So would I ha' done, by yonder sun, -An thou hadst not come to my bed. - - - -KING CLAUDIUS -How long hath she been thus? - - - -OPHELIA -I hope all will be well. We must be patient: but I -cannot choose but weep, to think they should lay him -i' the cold ground. My brother shall know of it: -and so I thank you for your good counsel. Come, my -coach! Good night, ladies; good night, sweet ladies; -good night, good night. - - -Exit - - -KING CLAUDIUS -Follow her close; give her good watch, -I pray you. -Exit HORATIO -O, this is the poison of deep grief; it springs -All from her father's death. O Gertrude, Gertrude, -When sorrows come, they come not single spies -But in battalions. First, her father slain: -Next, your son gone; and he most violent author -Of his own just remove: the people muddied, -Thick and unwholesome in their thoughts and whispers, -For good Polonius' death; and we have done but greenly, -In hugger-mugger to inter him: poor Ophelia -Divided from herself and her fair judgment, -Without the which we are pictures, or mere beasts: -Last, and as much containing as all these, -Her brother is in secret come from France; -Feeds on his wonder, keeps himself in clouds, -And wants not buzzers to infect his ear -With pestilent speeches of his father's death; -Wherein necessity, of matter beggar'd, -Will nothing stick our person to arraign -In ear and ear. O my dear Gertrude, this, -Like to a murdering-piece, in many places -Gives me superfluous death. - - -A noise within - - -QUEEN GERTRUDE -Alack, what noise is this? - - - -KING CLAUDIUS -Where are my Switzers? Let them guard the door. -Enter another Gentleman -What is the matter? - - - -Gentleman -Save yourself, my lord: -The ocean, overpeering of his list, -Eats not the flats with more impetuous haste -Than young Laertes, in a riotous head, -O'erbears your officers. The rabble call him lord; -And, as the world were now but to begin, -Antiquity forgot, custom not known, -The ratifiers and props of every word, -They cry 'Choose we: Laertes shall be king:' -Caps, hands, and tongues, applaud it to the clouds: -'Laertes shall be king, Laertes king!' - - - -QUEEN GERTRUDE -How cheerfully on the false trail they cry! -O, this is counter, you false Danish dogs! - - - -KING CLAUDIUS -The doors are broke. - - -Noise within -Enter LAERTES, armed; Danes following - - -LAERTES -Where is this king? Sirs, stand you all without. - - - -Danes -No, let's come in. - - - -LAERTES -I pray you, give me leave. - - - -Danes -We will, we will. - - -They retire without the door - - -LAERTES -I thank you: keep the door. O thou vile king, -Give me my father! - - - -QUEEN GERTRUDE -Calmly, good Laertes. - - - -LAERTES -That drop of blood that's calm proclaims me bastard, -Cries cuckold to my father, brands the harlot -Even here, between the chaste unsmirched brow -Of my true mother. - - - -KING CLAUDIUS -What is the cause, Laertes, -That thy rebellion looks so giant-like? -Let him go, Gertrude; do not fear our person: -There's such divinity doth hedge a king, -That treason can but peep to what it would, -Acts little of his will. Tell me, Laertes, -Why thou art thus incensed. Let him go, Gertrude. -Speak, man. - - - -LAERTES -Where is my father? - - - -KING CLAUDIUS -Dead. - - - -QUEEN GERTRUDE -But not by him. - - - -KING CLAUDIUS -Let him demand his fill. - - - -LAERTES -How came he dead? I'll not be juggled with: -To hell, allegiance! vows, to the blackest devil! -Conscience and grace, to the profoundest pit! -I dare damnation. To this point I stand, -That both the worlds I give to negligence, -Let come what comes; only I'll be revenged -Most thoroughly for my father. - - - -KING CLAUDIUS -Who shall stay you? - - - -LAERTES -My will, not all the world: -And for my means, I'll husband them so well, -They shall go far with little. - - - -KING CLAUDIUS -Good Laertes, -If you desire to know the certainty -Of your dear father's death, is't writ in your revenge, -That, swoopstake, you will draw both friend and foe, -Winner and loser? - - - -LAERTES -None but his enemies. - - - -KING CLAUDIUS -Will you know them then? - - - -LAERTES -To his good friends thus wide I'll ope my arms; -And like the kind life-rendering pelican, -Repast them with my blood. - - - -KING CLAUDIUS -Why, now you speak -Like a good child and a true gentleman. -That I am guiltless of your father's death, -And am most sensible in grief for it, -It shall as level to your judgment pierce -As day does to your eye. - - - -Danes -Within Let her come in. - - - -LAERTES -How now! what noise is that? -Re-enter OPHELIA -O heat, dry up my brains! tears seven times salt, -Burn out the sense and virtue of mine eye! -By heaven, thy madness shall be paid by weight, -Till our scale turn the beam. O rose of May! -Dear maid, kind sister, sweet Ophelia! -O heavens! is't possible, a young maid's wits -Should be as moral as an old man's life? -Nature is fine in love, and where 'tis fine, -It sends some precious instance of itself -After the thing it loves. - - - -OPHELIA -Sings -They bore him barefaced on the bier; -Hey non nonny, nonny, hey nonny; -And in his grave rain'd many a tear:-- -Fare you well, my dove! - - - -LAERTES -Hadst thou thy wits, and didst persuade revenge, -It could not move thus. - - - -OPHELIA -Sings -You must sing a-down a-down, -An you call him a-down-a. -O, how the wheel becomes it! It is the false -steward, that stole his master's daughter. - - - -LAERTES -This nothing's more than matter. - - - -OPHELIA -There's rosemary, that's for remembrance; pray, -love, remember: and there is pansies. that's for thoughts. - - - -LAERTES -A document in madness, thoughts and remembrance fitted. - - - -OPHELIA -There's fennel for you, and columbines: there's rue -for you; and here's some for me: we may call it -herb-grace o' Sundays: O you must wear your rue with -a difference. There's a daisy: I would give you -some violets, but they withered all when my father -died: they say he made a good end,-- -Sings -For bonny sweet Robin is all my joy. - - - -LAERTES -Thought and affliction, passion, hell itself, -She turns to favour and to prettiness. - - - -OPHELIA -Sings -And will he not come again? -And will he not come again? -No, no, he is dead: -Go to thy death-bed: -He never will come again. -His beard was as white as snow, -All flaxen was his poll: -He is gone, he is gone, -And we cast away moan: -God ha' mercy on his soul! -And of all Christian souls, I pray God. God be wi' ye. - - -Exit - - -LAERTES -Do you see this, O God? - - - -KING CLAUDIUS -Laertes, I must commune with your grief, -Or you deny me right. Go but apart, -Make choice of whom your wisest friends you will. -And they shall hear and judge 'twixt you and me: -If by direct or by collateral hand -They find us touch'd, we will our kingdom give, -Our crown, our life, and all that we can ours, -To you in satisfaction; but if not, -Be you content to lend your patience to us, -And we shall jointly labour with your soul -To give it due content. - - - -LAERTES -Let this be so; -His means of death, his obscure funeral-- -No trophy, sword, nor hatchment o'er his bones, -No noble rite nor formal ostentation-- -Cry to be heard, as 'twere from heaven to earth, -That I must call't in question. - - - -KING CLAUDIUS -So you shall; -And where the offence is let the great axe fall. -I pray you, go with me. - - -Exeunt - - -SCENE VI. Another room in the castle. -Enter HORATIO and a Servant - - -HORATIO -What are they that would speak with me? - - - -Servant -Sailors, sir: they say they have letters for you. - - - -HORATIO -Let them come in. -Exit Servant -I do not know from what part of the world -I should be greeted, if not from Lord Hamlet. - - -Enter Sailors - - -First Sailor -God bless you, sir. - - - -HORATIO -Let him bless thee too. - - - -First Sailor -He shall, sir, an't please him. There's a letter for -you, sir; it comes from the ambassador that was -bound for England; if your name be Horatio, as I am -let to know it is. - - - -HORATIO -Reads 'Horatio, when thou shalt have overlooked -this, give these fellows some means to the king: -they have letters for him. Ere we were two days old -at sea, a pirate of very warlike appointment gave us -chase. Finding ourselves too slow of sail, we put on -a compelled valour, and in the grapple I boarded -them: on the instant they got clear of our ship; so -I alone became their prisoner. They have dealt with -me like thieves of mercy: but they knew what they -did; I am to do a good turn for them. Let the king -have the letters I have sent; and repair thou to me -with as much speed as thou wouldst fly death. I -have words to speak in thine ear will make thee -dumb; yet are they much too light for the bore of -the matter. These good fellows will bring thee -where I am. Rosencrantz and Guildenstern hold their -course for England: of them I have much to tell -thee. Farewell. -'He that thou knowest thine, HAMLET.' -Come, I will make you way for these your letters; -And do't the speedier, that you may direct me -To him from whom you brought them. - - -Exeunt - - -SCENE VII. Another room in the castle. -Enter KING CLAUDIUS and LAERTES - - -KING CLAUDIUS -Now must your conscience my acquaintance seal, -And you must put me in your heart for friend, -Sith you have heard, and with a knowing ear, -That he which hath your noble father slain -Pursued my life. - - - -LAERTES -It well appears: but tell me -Why you proceeded not against these feats, -So crimeful and so capital in nature, -As by your safety, wisdom, all things else, -You mainly were stirr'd up. - - - -KING CLAUDIUS -O, for two special reasons; -Which may to you, perhaps, seem much unsinew'd, -But yet to me they are strong. The queen his mother -Lives almost by his looks; and for myself-- -My virtue or my plague, be it either which-- -She's so conjunctive to my life and soul, -That, as the star moves not but in his sphere, -I could not but by her. The other motive, -Why to a public count I might not go, -Is the great love the general gender bear him; -Who, dipping all his faults in their affection, -Would, like the spring that turneth wood to stone, -Convert his gyves to graces; so that my arrows, -Too slightly timber'd for so loud a wind, -Would have reverted to my bow again, -And not where I had aim'd them. - - - -LAERTES -And so have I a noble father lost; -A sister driven into desperate terms, -Whose worth, if praises may go back again, -Stood challenger on mount of all the age -For her perfections: but my revenge will come. - - - -KING CLAUDIUS -Break not your sleeps for that: you must not think -That we are made of stuff so flat and dull -That we can let our beard be shook with danger -And think it pastime. You shortly shall hear more: -I loved your father, and we love ourself; -And that, I hope, will teach you to imagine-- -Enter a Messenger -How now! what news? - - - -Messenger -Letters, my lord, from Hamlet: -This to your majesty; this to the queen. - - - -KING CLAUDIUS -From Hamlet! who brought them? - - - -Messenger -Sailors, my lord, they say; I saw them not: -They were given me by Claudio; he received them -Of him that brought them. - - - -KING CLAUDIUS -Laertes, you shall hear them. Leave us. -Exit Messenger -Reads -'High and mighty, You shall know I am set naked on -your kingdom. To-morrow shall I beg leave to see -your kingly eyes: when I shall, first asking your -pardon thereunto, recount the occasion of my sudden -and more strange return. 'HAMLET.' -What should this mean? Are all the rest come back? -Or is it some abuse, and no such thing? - - - -LAERTES -Know you the hand? - - - -KING CLAUDIUS -'Tis Hamlets character. 'Naked! -And in a postscript here, he says 'alone.' -Can you advise me? - - - -LAERTES -I'm lost in it, my lord. But let him come; -It warms the very sickness in my heart, -That I shall live and tell him to his teeth, -'Thus didest thou.' - - - -KING CLAUDIUS -If it be so, Laertes-- -As how should it be so? how otherwise?-- -Will you be ruled by me? - - - -LAERTES -Ay, my lord; -So you will not o'errule me to a peace. - - - -KING CLAUDIUS -To thine own peace. If he be now return'd, -As checking at his voyage, and that he means -No more to undertake it, I will work him -To an exploit, now ripe in my device, -Under the which he shall not choose but fall: -And for his death no wind of blame shall breathe, -But even his mother shall uncharge the practise -And call it accident. - - - -LAERTES -My lord, I will be ruled; -The rather, if you could devise it so -That I might be the organ. - - - -KING CLAUDIUS -It falls right. -You have been talk'd of since your travel much, -And that in Hamlet's hearing, for a quality -Wherein, they say, you shine: your sum of parts -Did not together pluck such envy from him -As did that one, and that, in my regard, -Of the unworthiest siege. - - - -LAERTES -What part is that, my lord? - - - -KING CLAUDIUS -A very riband in the cap of youth, -Yet needful too; for youth no less becomes -The light and careless livery that it wears -Than settled age his sables and his weeds, -Importing health and graveness. Two months since, -Here was a gentleman of Normandy:-- -I've seen myself, and served against, the French, -And they can well on horseback: but this gallant -Had witchcraft in't; he grew unto his seat; -And to such wondrous doing brought his horse, -As he had been incorpsed and demi-natured -With the brave beast: so far he topp'd my thought, -That I, in forgery of shapes and tricks, -Come short of what he did. - - - -LAERTES -A Norman was't? - - - -KING CLAUDIUS -A Norman. - - - -LAERTES -Upon my life, Lamond. - - - -KING CLAUDIUS -The very same. - - - -LAERTES -I know him well: he is the brooch indeed -And gem of all the nation. - - - -KING CLAUDIUS -He made confession of you, -And gave you such a masterly report -For art and exercise in your defence -And for your rapier most especially, -That he cried out, 'twould be a sight indeed, -If one could match you: the scrimers of their nation, -He swore, had had neither motion, guard, nor eye, -If you opposed them. Sir, this report of his -Did Hamlet so envenom with his envy -That he could nothing do but wish and beg -Your sudden coming o'er, to play with him. -Now, out of this,-- - - - -LAERTES -What out of this, my lord? - - - -KING CLAUDIUS -Laertes, was your father dear to you? -Or are you like the painting of a sorrow, -A face without a heart? - - - -LAERTES -Why ask you this? - - - -KING CLAUDIUS -Not that I think you did not love your father; -But that I know love is begun by time; -And that I see, in passages of proof, -Time qualifies the spark and fire of it. -There lives within the very flame of love -A kind of wick or snuff that will abate it; -And nothing is at a like goodness still; -For goodness, growing to a plurisy, -Dies in his own too much: that we would do -We should do when we would; for this 'would' changes -And hath abatements and delays as many -As there are tongues, are hands, are accidents; -And then this 'should' is like a spendthrift sigh, -That hurts by easing. But, to the quick o' the ulcer:-- -Hamlet comes back: what would you undertake, -To show yourself your father's son in deed -More than in words? - - - -LAERTES -To cut his throat i' the church. - - - -KING CLAUDIUS -No place, indeed, should murder sanctuarize; -Revenge should have no bounds. But, good Laertes, -Will you do this, keep close within your chamber. -Hamlet return'd shall know you are come home: -We'll put on those shall praise your excellence -And set a double varnish on the fame -The Frenchman gave you, bring you in fine together -And wager on your heads: he, being remiss, -Most generous and free from all contriving, -Will not peruse the foils; so that, with ease, -Or with a little shuffling, you may choose -A sword unbated, and in a pass of practise -Requite him for your father. - - - -LAERTES -I will do't: -And, for that purpose, I'll anoint my sword. -I bought an unction of a mountebank, -So mortal that, but dip a knife in it, -Where it draws blood no cataplasm so rare, -Collected from all simples that have virtue -Under the moon, can save the thing from death -That is but scratch'd withal: I'll touch my point -With this contagion, that, if I gall him slightly, -It may be death. - - - -KING CLAUDIUS -Let's further think of this; -Weigh what convenience both of time and means -May fit us to our shape: if this should fail, -And that our drift look through our bad performance, -'Twere better not assay'd: therefore this project -Should have a back or second, that might hold, -If this should blast in proof. Soft! let me see: -We'll make a solemn wager on your cunnings: I ha't. -When in your motion you are hot and dry-- -As make your bouts more violent to that end-- -And that he calls for drink, I'll have prepared him -A chalice for the nonce, whereon but sipping, -If he by chance escape your venom'd stuck, -Our purpose may hold there. -Enter QUEEN GERTRUDE -How now, sweet queen! - - - -QUEEN GERTRUDE -One woe doth tread upon another's heel, -So fast they follow; your sister's drown'd, Laertes. - - - -LAERTES -Drown'd! O, where? - - - -QUEEN GERTRUDE -There is a willow grows aslant a brook, -That shows his hoar leaves in the glassy stream; -There with fantastic garlands did she come -Of crow-flowers, nettles, daisies, and long purples -That liberal shepherds give a grosser name, -But our cold maids do dead men's fingers call them: -There, on the pendent boughs her coronet weeds -Clambering to hang, an envious sliver broke; -When down her weedy trophies and herself -Fell in the weeping brook. Her clothes spread wide; -And, mermaid-like, awhile they bore her up: -Which time she chanted snatches of old tunes; -As one incapable of her own distress, -Or like a creature native and indued -Unto that element: but long it could not be -Till that her garments, heavy with their drink, -Pull'd the poor wretch from her melodious lay -To muddy death. - - - -LAERTES -Alas, then, she is drown'd? - - - -QUEEN GERTRUDE -Drown'd, drown'd. - - - -LAERTES -Too much of water hast thou, poor Ophelia, -And therefore I forbid my tears: but yet -It is our trick; nature her custom holds, -Let shame say what it will: when these are gone, -The woman will be out. Adieu, my lord: -I have a speech of fire, that fain would blaze, -But that this folly douts it. - - -Exit - - -KING CLAUDIUS -Let's follow, Gertrude: -How much I had to do to calm his rage! -Now fear I this will give it start again; -Therefore let's follow. - - -Exeunt - - - - -ACT V - -SCENE I. A churchyard. -Enter two Clowns, with spades, &c - - -First Clown -Is she to be buried in Christian burial that -wilfully seeks her own salvation? - - - -Second Clown -I tell thee she is: and therefore make her grave -straight: the crowner hath sat on her, and finds it -Christian burial. - - - -First Clown -How can that be, unless she drowned herself in her -own defence? - - - -Second Clown -Why, 'tis found so. - - - -First Clown -It must be 'se offendendo;' it cannot be else. For -here lies the point: if I drown myself wittingly, -it argues an act: and an act hath three branches: it -is, to act, to do, to perform: argal, she drowned -herself wittingly. - - - -Second Clown -Nay, but hear you, goodman delver,-- - - - -First Clown -Give me leave. Here lies the water; good: here -stands the man; good; if the man go to this water, -and drown himself, it is, will he, nill he, he -goes,--mark you that; but if the water come to him -and drown him, he drowns not himself: argal, he -that is not guilty of his own death shortens not his own life. - - - -Second Clown -But is this law? - - - -First Clown -Ay, marry, is't; crowner's quest law. - - - -Second Clown -Will you ha' the truth on't? If this had not been -a gentlewoman, she should have been buried out o' -Christian burial. - - - -First Clown -Why, there thou say'st: and the more pity that -great folk should have countenance in this world to -drown or hang themselves, more than their even -Christian. Come, my spade. There is no ancient -gentleman but gardeners, ditchers, and grave-makers: -they hold up Adam's profession. - - - -Second Clown -Was he a gentleman? - - - -First Clown -He was the first that ever bore arms. - - - -Second Clown -Why, he had none. - - - -First Clown -What, art a heathen? How dost thou understand the -Scripture? The Scripture says 'Adam digged:' -could he dig without arms? I'll put another -question to thee: if thou answerest me not to the -purpose, confess thyself-- - - - -Second Clown -Go to. - - - -First Clown -What is he that builds stronger than either the -mason, the shipwright, or the carpenter? - - - -Second Clown -The gallows-maker; for that frame outlives a -thousand tenants. - - - -First Clown -I like thy wit well, in good faith: the gallows -does well; but how does it well? it does well to -those that do in: now thou dost ill to say the -gallows is built stronger than the church: argal, -the gallows may do well to thee. To't again, come. - - - -Second Clown -'Who builds stronger than a mason, a shipwright, or -a carpenter?' - - - -First Clown -Ay, tell me that, and unyoke. - - - -Second Clown -Marry, now I can tell. - - - -First Clown -To't. - - - -Second Clown -Mass, I cannot tell. - - -Enter HAMLET and HORATIO, at a distance - - -First Clown -Cudgel thy brains no more about it, for your dull -ass will not mend his pace with beating; and, when -you are asked this question next, say 'a -grave-maker: 'the houses that he makes last till -doomsday. Go, get thee to Yaughan: fetch me a -stoup of liquor. -Exit Second Clown -He digs and sings -In youth, when I did love, did love, -Methought it was very sweet, -To contract, O, the time, for, ah, my behove, -O, methought, there was nothing meet. - - - -HAMLET -Has this fellow no feeling of his business, that he -sings at grave-making? - - - -HORATIO -Custom hath made it in him a property of easiness. - - - -HAMLET -'Tis e'en so: the hand of little employment hath -the daintier sense. - - - -First Clown -Sings -But age, with his stealing steps, -Hath claw'd me in his clutch, -And hath shipped me intil the land, -As if I had never been such. - - -Throws up a skull - - -HAMLET -That skull had a tongue in it, and could sing once: -how the knave jowls it to the ground, as if it were -Cain's jaw-bone, that did the first murder! It -might be the pate of a politician, which this ass -now o'er-reaches; one that would circumvent God, -might it not? - - - -HORATIO -It might, my lord. - - - -HAMLET -Or of a courtier; which could say 'Good morrow, -sweet lord! How dost thou, good lord?' This might -be my lord such-a-one, that praised my lord -such-a-one's horse, when he meant to beg it; might it not? - - - -HORATIO -Ay, my lord. - - - -HAMLET -Why, e'en so: and now my Lady Worm's; chapless, and -knocked about the mazzard with a sexton's spade: -here's fine revolution, an we had the trick to -see't. Did these bones cost no more the breeding, -but to play at loggats with 'em? mine ache to think on't. - - - -First Clown -Sings -A pick-axe, and a spade, a spade, -For and a shrouding sheet: -O, a pit of clay for to be made -For such a guest is meet. - - -Throws up another skull - - -HAMLET -There's another: why may not that be the skull of a -lawyer? Where be his quiddities now, his quillets, -his cases, his tenures, and his tricks? why does he -suffer this rude knave now to knock him about the -sconce with a dirty shovel, and will not tell him of -his action of battery? Hum! This fellow might be -in's time a great buyer of land, with his statutes, -his recognizances, his fines, his double vouchers, -his recoveries: is this the fine of his fines, and -the recovery of his recoveries, to have his fine -pate full of fine dirt? will his vouchers vouch him -no more of his purchases, and double ones too, than -the length and breadth of a pair of indentures? The -very conveyances of his lands will hardly lie in -this box; and must the inheritor himself have no more, ha? - - - -HORATIO -Not a jot more, my lord. - - - -HAMLET -Is not parchment made of sheepskins? - - - -HORATIO -Ay, my lord, and of calf-skins too. - - - -HAMLET -They are sheep and calves which seek out assurance -in that. I will speak to this fellow. Whose -grave's this, sirrah? - - - -First Clown -Mine, sir. -Sings -O, a pit of clay for to be made -For such a guest is meet. - - - -HAMLET -I think it be thine, indeed; for thou liest in't. - - - -First Clown -You lie out on't, sir, and therefore it is not -yours: for my part, I do not lie in't, and yet it is mine. - - - -HAMLET -'Thou dost lie in't, to be in't and say it is thine: -'tis for the dead, not for the quick; therefore thou liest. - - - -First Clown -'Tis a quick lie, sir; 'twill away gain, from me to -you. - - - -HAMLET -What man dost thou dig it for? - - - -First Clown -For no man, sir. - - - -HAMLET -What woman, then? - - - -First Clown -For none, neither. - - - -HAMLET -Who is to be buried in't? - - - -First Clown -One that was a woman, sir; but, rest her soul, she's dead. - - - -HAMLET -How absolute the knave is! we must speak by the -card, or equivocation will undo us. By the Lord, -Horatio, these three years I have taken a note of -it; the age is grown so picked that the toe of the -peasant comes so near the heel of the courtier, he -gaffs his kibe. How long hast thou been a -grave-maker? - - - -First Clown -Of all the days i' the year, I came to't that day -that our last king Hamlet overcame Fortinbras. - - - -HAMLET -How long is that since? - - - -First Clown -Cannot you tell that? every fool can tell that: it -was the very day that young Hamlet was born; he that -is mad, and sent into England. - - - -HAMLET -Ay, marry, why was he sent into England? - - - -First Clown -Why, because he was mad: he shall recover his wits -there; or, if he do not, it's no great matter there. - - - -HAMLET -Why? - - - -First Clown -'Twill, a not be seen in him there; there the men -are as mad as he. - - - -HAMLET -How came he mad? - - - -First Clown -Very strangely, they say. - - - -HAMLET -How strangely? - - - -First Clown -Faith, e'en with losing his wits. - - - -HAMLET -Upon what ground? - - - -First Clown -Why, here in Denmark: I have been sexton here, man -and boy, thirty years. - - - -HAMLET -How long will a man lie i' the earth ere he rot? - - - -First Clown -I' faith, if he be not rotten before he die--as we -have many pocky corses now-a-days, that will scarce -hold the laying in--he will last you some eight year -or nine year: a tanner will last you nine year. - - - -HAMLET -Why he more than another? - - - -First Clown -Why, sir, his hide is so tanned with his trade, that -he will keep out water a great while; and your water -is a sore decayer of your whoreson dead body. -Here's a skull now; this skull has lain in the earth -three and twenty years. - - - -HAMLET -Whose was it? - - - -First Clown -A whoreson mad fellow's it was: whose do you think it was? - - - -HAMLET -Nay, I know not. - - - -First Clown -A pestilence on him for a mad rogue! a' poured a -flagon of Rhenish on my head once. This same skull, -sir, was Yorick's skull, the king's jester. - - - -HAMLET -This? - - - -First Clown -E'en that. - - - -HAMLET -Let me see. -Takes the skull -Alas, poor Yorick! I knew him, Horatio: a fellow -of infinite jest, of most excellent fancy: he hath -borne me on his back a thousand times; and now, how -abhorred in my imagination it is! my gorge rims at -it. Here hung those lips that I have kissed I know -not how oft. Where be your gibes now? your -gambols? your songs? your flashes of merriment, -that were wont to set the table on a roar? Not one -now, to mock your own grinning? quite chap-fallen? -Now get you to my lady's chamber, and tell her, let -her paint an inch thick, to this favour she must -come; make her laugh at that. Prithee, Horatio, tell -me one thing. - - - -HORATIO -What's that, my lord? - - - -HAMLET -Dost thou think Alexander looked o' this fashion i' -the earth? - - - -HORATIO -E'en so. - - - -HAMLET -And smelt so? pah! - - -Puts down the skull - - -HORATIO -E'en so, my lord. - - - -HAMLET -To what base uses we may return, Horatio! Why may -not imagination trace the noble dust of Alexander, -till he find it stopping a bung-hole? - - - -HORATIO -'Twere to consider too curiously, to consider so. - - - -HAMLET -No, faith, not a jot; but to follow him thither with -modesty enough, and likelihood to lead it: as -thus: Alexander died, Alexander was buried, -Alexander returneth into dust; the dust is earth; of -earth we make loam; and why of that loam, whereto he -was converted, might they not stop a beer-barrel? -Imperious Caesar, dead and turn'd to clay, -Might stop a hole to keep the wind away: -O, that that earth, which kept the world in awe, -Should patch a wall to expel the winter flaw! -But soft! but soft! aside: here comes the king. -Enter Priest, &c. in procession; the Corpse of -OPHELIA, LAERTES and Mourners following; KING -CLAUDIUS, QUEEN GERTRUDE, their trains, &c -The queen, the courtiers: who is this they follow? -And with such maimed rites? This doth betoken -The corse they follow did with desperate hand -Fordo its own life: 'twas of some estate. -Couch we awhile, and mark. - - -Retiring with HORATIO - - -LAERTES -What ceremony else? - - - -HAMLET -That is Laertes, -A very noble youth: mark. - - - -LAERTES -What ceremony else? - - - -First Priest -Her obsequies have been as far enlarged -As we have warrantise: her death was doubtful; -And, but that great command o'ersways the order, -She should in ground unsanctified have lodged -Till the last trumpet: for charitable prayers, -Shards, flints and pebbles should be thrown on her; -Yet here she is allow'd her virgin crants, -Her maiden strewments and the bringing home -Of bell and burial. - - - -LAERTES -Must there no more be done? - - - -First Priest -No more be done: -We should profane the service of the dead -To sing a requiem and such rest to her -As to peace-parted souls. - - - -LAERTES -Lay her i' the earth: -And from her fair and unpolluted flesh -May violets spring! I tell thee, churlish priest, -A ministering angel shall my sister be, -When thou liest howling. - - - -HAMLET -What, the fair Ophelia! - - - -QUEEN GERTRUDE -Sweets to the sweet: farewell! -Scattering flowers -I hoped thou shouldst have been my Hamlet's wife; -I thought thy bride-bed to have deck'd, sweet maid, -And not have strew'd thy grave. - - - -LAERTES -O, treble woe -Fall ten times treble on that cursed head, -Whose wicked deed thy most ingenious sense -Deprived thee of! Hold off the earth awhile, -Till I have caught her once more in mine arms: -Leaps into the grave -Now pile your dust upon the quick and dead, -Till of this flat a mountain you have made, -To o'ertop old Pelion, or the skyish head -Of blue Olympus. - - - -HAMLET -Advancing What is he whose grief -Bears such an emphasis? whose phrase of sorrow -Conjures the wandering stars, and makes them stand -Like wonder-wounded hearers? This is I, -Hamlet the Dane. - - -Leaps into the grave - - -LAERTES -The devil take thy soul! - - -Grappling with him - - -HAMLET -Thou pray'st not well. -I prithee, take thy fingers from my throat; -For, though I am not splenitive and rash, -Yet have I something in me dangerous, -Which let thy wiseness fear: hold off thy hand. - - - -KING CLAUDIUS -Pluck them asunder. - - - -QUEEN GERTRUDE -Hamlet, Hamlet! - - - -All -Gentlemen,-- - - - -HORATIO -Good my lord, be quiet. - - -The Attendants part them, and they come out of the grave - - -HAMLET -Why I will fight with him upon this theme -Until my eyelids will no longer wag. - - - -QUEEN GERTRUDE -O my son, what theme? - - - -HAMLET -I loved Ophelia: forty thousand brothers -Could not, with all their quantity of love, -Make up my sum. What wilt thou do for her? - - - -KING CLAUDIUS -O, he is mad, Laertes. - - - -QUEEN GERTRUDE -For love of God, forbear him. - - - -HAMLET -'Swounds, show me what thou'lt do: -Woo't weep? woo't fight? woo't fast? woo't tear thyself? -Woo't drink up eisel? eat a crocodile? -I'll do't. Dost thou come here to whine? -To outface me with leaping in her grave? -Be buried quick with her, and so will I: -And, if thou prate of mountains, let them throw -Millions of acres on us, till our ground, -Singeing his pate against the burning zone, -Make Ossa like a wart! Nay, an thou'lt mouth, -I'll rant as well as thou. - - - -QUEEN GERTRUDE -This is mere madness: -And thus awhile the fit will work on him; -Anon, as patient as the female dove, -When that her golden couplets are disclosed, -His silence will sit drooping. - - - -HAMLET -Hear you, sir; -What is the reason that you use me thus? -I loved you ever: but it is no matter; -Let Hercules himself do what he may, -The cat will mew and dog will have his day. - - -Exit - - -KING CLAUDIUS -I pray you, good Horatio, wait upon him. -Exit HORATIO -To LAERTES -Strengthen your patience in our last night's speech; -We'll put the matter to the present push. -Good Gertrude, set some watch over your son. -This grave shall have a living monument: -An hour of quiet shortly shall we see; -Till then, in patience our proceeding be. - - -Exeunt - - -SCENE II. A hall in the castle. -Enter HAMLET and HORATIO - - -HAMLET -So much for this, sir: now shall you see the other; -You do remember all the circumstance? - - - -HORATIO -Remember it, my lord? - - - -HAMLET -Sir, in my heart there was a kind of fighting, -That would not let me sleep: methought I lay -Worse than the mutines in the bilboes. Rashly, -And praised be rashness for it, let us know, -Our indiscretion sometimes serves us well, -When our deep plots do pall: and that should teach us -There's a divinity that shapes our ends, -Rough-hew them how we will,-- - - - -HORATIO -That is most certain. - - - -HAMLET -Up from my cabin, -My sea-gown scarf'd about me, in the dark -Groped I to find out them; had my desire. -Finger'd their packet, and in fine withdrew -To mine own room again; making so bold, -My fears forgetting manners, to unseal -Their grand commission; where I found, Horatio,-- -O royal knavery!--an exact command, -Larded with many several sorts of reasons -Importing Denmark's health and England's too, -With, ho! such bugs and goblins in my life, -That, on the supervise, no leisure bated, -No, not to stay the grinding of the axe, -My head should be struck off. - - - -HORATIO -Is't possible? - - - -HAMLET -Here's the commission: read it at more leisure. -But wilt thou hear me how I did proceed? - - - -HORATIO -I beseech you. - - - -HAMLET -Being thus be-netted round with villanies,-- -Ere I could make a prologue to my brains, -They had begun the play--I sat me down, -Devised a new commission, wrote it fair: -I once did hold it, as our statists do, -A baseness to write fair and labour'd much -How to forget that learning, but, sir, now -It did me yeoman's service: wilt thou know -The effect of what I wrote? - - - -HORATIO -Ay, good my lord. - - - -HAMLET -An earnest conjuration from the king, -As England was his faithful tributary, -As love between them like the palm might flourish, -As peace should stiff her wheaten garland wear -And stand a comma 'tween their amities, -And many such-like 'As'es of great charge, -That, on the view and knowing of these contents, -Without debatement further, more or less, -He should the bearers put to sudden death, -Not shriving-time allow'd. - - - -HORATIO -How was this seal'd? - - - -HAMLET -Why, even in that was heaven ordinant. -I had my father's signet in my purse, -Which was the model of that Danish seal; -Folded the writ up in form of the other, -Subscribed it, gave't the impression, placed it safely, -The changeling never known. Now, the next day -Was our sea-fight; and what to this was sequent -Thou know'st already. - - - -HORATIO -So Guildenstern and Rosencrantz go to't. - - - -HAMLET -Why, man, they did make love to this employment; -They are not near my conscience; their defeat -Does by their own insinuation grow: -'Tis dangerous when the baser nature comes -Between the pass and fell incensed points -Of mighty opposites. - - - -HORATIO -Why, what a king is this! - - - -HAMLET -Does it not, think'st thee, stand me now upon-- -He that hath kill'd my king and whored my mother, -Popp'd in between the election and my hopes, -Thrown out his angle for my proper life, -And with such cozenage--is't not perfect conscience, -To quit him with this arm? and is't not to be damn'd, -To let this canker of our nature come -In further evil? - - - -HORATIO -It must be shortly known to him from England -What is the issue of the business there. - - - -HAMLET -It will be short: the interim is mine; -And a man's life's no more than to say 'One.' -But I am very sorry, good Horatio, -That to Laertes I forgot myself; -For, by the image of my cause, I see -The portraiture of his: I'll court his favours. -But, sure, the bravery of his grief did put me -Into a towering passion. - - - -HORATIO -Peace! who comes here? - - -Enter OSRIC - - -OSRIC -Your lordship is right welcome back to Denmark. - - - -HAMLET -I humbly thank you, sir. Dost know this water-fly? - - - -HORATIO -No, my good lord. - - - -HAMLET -Thy state is the more gracious; for 'tis a vice to -know him. He hath much land, and fertile: let a -beast be lord of beasts, and his crib shall stand at -the king's mess: 'tis a chough; but, as I say, -spacious in the possession of dirt. - - - -OSRIC -Sweet lord, if your lordship were at leisure, I -should impart a thing to you from his majesty. - - - -HAMLET -I will receive it, sir, with all diligence of -spirit. Put your bonnet to his right use; 'tis for the head. - - - -OSRIC -I thank your lordship, it is very hot. - - - -HAMLET -No, believe me, 'tis very cold; the wind is -northerly. - - - -OSRIC -It is indifferent cold, my lord, indeed. - - - -HAMLET -But yet methinks it is very sultry and hot for my -complexion. - - - -OSRIC -Exceedingly, my lord; it is very sultry,--as -'twere,--I cannot tell how. But, my lord, his -majesty bade me signify to you that he has laid a -great wager on your head: sir, this is the matter,-- - - - -HAMLET -I beseech you, remember-- - - -HAMLET moves him to put on his hat - - -OSRIC -Nay, good my lord; for mine ease, in good faith. -Sir, here is newly come to court Laertes; believe -me, an absolute gentleman, full of most excellent -differences, of very soft society and great showing: -indeed, to speak feelingly of him, he is the card or -calendar of gentry, for you shall find in him the -continent of what part a gentleman would see. - - - -HAMLET -Sir, his definement suffers no perdition in you; -though, I know, to divide him inventorially would -dizzy the arithmetic of memory, and yet but yaw -neither, in respect of his quick sail. But, in the -verity of extolment, I take him to be a soul of -great article; and his infusion of such dearth and -rareness, as, to make true diction of him, his -semblable is his mirror; and who else would trace -him, his umbrage, nothing more. - - - -OSRIC -Your lordship speaks most infallibly of him. - - - -HAMLET -The concernancy, sir? why do we wrap the gentleman -in our more rawer breath? - - - -OSRIC -Sir? - - - -HORATIO -Is't not possible to understand in another tongue? -You will do't, sir, really. - - - -HAMLET -What imports the nomination of this gentleman? - - - -OSRIC -Of Laertes? - - - -HORATIO -His purse is empty already; all's golden words are spent. - - - -HAMLET -Of him, sir. - - - -OSRIC -I know you are not ignorant-- - - - -HAMLET -I would you did, sir; yet, in faith, if you did, -it would not much approve me. Well, sir? - - - -OSRIC -You are not ignorant of what excellence Laertes is-- - - - -HAMLET -I dare not confess that, lest I should compare with -him in excellence; but, to know a man well, were to -know himself. - - - -OSRIC -I mean, sir, for his weapon; but in the imputation -laid on him by them, in his meed he's unfellowed. - - - -HAMLET -What's his weapon? - - - -OSRIC -Rapier and dagger. - - - -HAMLET -That's two of his weapons: but, well. - - - -OSRIC -The king, sir, hath wagered with him six Barbary -horses: against the which he has imponed, as I take -it, six French rapiers and poniards, with their -assigns, as girdle, hangers, and so: three of the -carriages, in faith, are very dear to fancy, very -responsive to the hilts, most delicate carriages, -and of very liberal conceit. - - - -HAMLET -What call you the carriages? - - - -HORATIO -I knew you must be edified by the margent ere you had done. - - - -OSRIC -The carriages, sir, are the hangers. - - - -HAMLET -The phrase would be more german to the matter, if we -could carry cannon by our sides: I would it might -be hangers till then. But, on: six Barbary horses -against six French swords, their assigns, and three -liberal-conceited carriages; that's the French bet -against the Danish. Why is this 'imponed,' as you call it? - - - -OSRIC -The king, sir, hath laid, that in a dozen passes -between yourself and him, he shall not exceed you -three hits: he hath laid on twelve for nine; and it -would come to immediate trial, if your lordship -would vouchsafe the answer. - - - -HAMLET -How if I answer 'no'? - - - -OSRIC -I mean, my lord, the opposition of your person in trial. - - - -HAMLET -Sir, I will walk here in the hall: if it please his -majesty, 'tis the breathing time of day with me; let -the foils be brought, the gentleman willing, and the -king hold his purpose, I will win for him an I can; -if not, I will gain nothing but my shame and the odd hits. - - - -OSRIC -Shall I re-deliver you e'en so? - - - -HAMLET -To this effect, sir; after what flourish your nature will. - - - -OSRIC -I commend my duty to your lordship. - - - -HAMLET -Yours, yours. -Exit OSRIC -He does well to commend it himself; there are no -tongues else for's turn. - - - -HORATIO -This lapwing runs away with the shell on his head. - - - -HAMLET -He did comply with his dug, before he sucked it. -Thus has he--and many more of the same bevy that I -know the dressy age dotes on--only got the tune of -the time and outward habit of encounter; a kind of -yesty collection, which carries them through and -through the most fond and winnowed opinions; and do -but blow them to their trial, the bubbles are out. - - -Enter a Lord - - -Lord -My lord, his majesty commended him to you by young -Osric, who brings back to him that you attend him in -the hall: he sends to know if your pleasure hold to -play with Laertes, or that you will take longer time. - - - -HAMLET -I am constant to my purpose; they follow the king's -pleasure: if his fitness speaks, mine is ready; now -or whensoever, provided I be so able as now. - - - -Lord -The king and queen and all are coming down. - - - -HAMLET -In happy time. - - - -Lord -The queen desires you to use some gentle -entertainment to Laertes before you fall to play. - - - -HAMLET -She well instructs me. - - -Exit Lord - - -HORATIO -You will lose this wager, my lord. - - - -HAMLET -I do not think so: since he went into France, I -have been in continual practise: I shall win at the -odds. But thou wouldst not think how ill all's here -about my heart: but it is no matter. - - - -HORATIO -Nay, good my lord,-- - - - -HAMLET -It is but foolery; but it is such a kind of -gain-giving, as would perhaps trouble a woman. - - - -HORATIO -If your mind dislike any thing, obey it: I will -forestall their repair hither, and say you are not -fit. - - - -HAMLET -Not a whit, we defy augury: there's a special -providence in the fall of a sparrow. If it be now, -'tis not to come; if it be not to come, it will be -now; if it be not now, yet it will come: the -readiness is all: since no man has aught of what he -leaves, what is't to leave betimes? - - -Enter KING CLAUDIUS, QUEEN GERTRUDE, LAERTES, -Lords, OSRIC, and Attendants with foils, &c - - -KING CLAUDIUS -Come, Hamlet, come, and take this hand from me. - - -KING CLAUDIUS puts LAERTES' hand into HAMLET's - - -HAMLET -Give me your pardon, sir: I've done you wrong; -But pardon't, as you are a gentleman. -This presence knows, -And you must needs have heard, how I am punish'd -With sore distraction. What I have done, -That might your nature, honour and exception -Roughly awake, I here proclaim was madness. -Was't Hamlet wrong'd Laertes? Never Hamlet: -If Hamlet from himself be ta'en away, -And when he's not himself does wrong Laertes, -Then Hamlet does it not, Hamlet denies it. -Who does it, then? His madness: if't be so, -Hamlet is of the faction that is wrong'd; -His madness is poor Hamlet's enemy. -Sir, in this audience, -Let my disclaiming from a purposed evil -Free me so far in your most generous thoughts, -That I have shot mine arrow o'er the house, -And hurt my brother. - - - -LAERTES -I am satisfied in nature, -Whose motive, in this case, should stir me most -To my revenge: but in my terms of honour -I stand aloof; and will no reconcilement, -Till by some elder masters, of known honour, -I have a voice and precedent of peace, -To keep my name ungored. But till that time, -I do receive your offer'd love like love, -And will not wrong it. - - - -HAMLET -I embrace it freely; -And will this brother's wager frankly play. -Give us the foils. Come on. - - - -LAERTES -Come, one for me. - - - -HAMLET -I'll be your foil, Laertes: in mine ignorance -Your skill shall, like a star i' the darkest night, -Stick fiery off indeed. - - - -LAERTES -You mock me, sir. - - - -HAMLET -No, by this hand. - - - -KING CLAUDIUS -Give them the foils, young Osric. Cousin Hamlet, -You know the wager? - - - -HAMLET -Very well, my lord -Your grace hath laid the odds o' the weaker side. - - - -KING CLAUDIUS -I do not fear it; I have seen you both: -But since he is better'd, we have therefore odds. - - - -LAERTES -This is too heavy, let me see another. - - - -HAMLET -This likes me well. These foils have all a length? - - -They prepare to play - - -OSRIC -Ay, my good lord. - - - -KING CLAUDIUS -Set me the stoops of wine upon that table. -If Hamlet give the first or second hit, -Or quit in answer of the third exchange, -Let all the battlements their ordnance fire: -The king shall drink to Hamlet's better breath; -And in the cup an union shall he throw, -Richer than that which four successive kings -In Denmark's crown have worn. Give me the cups; -And let the kettle to the trumpet speak, -The trumpet to the cannoneer without, -The cannons to the heavens, the heavens to earth, -'Now the king dunks to Hamlet.' Come, begin: -And you, the judges, bear a wary eye. - - - -HAMLET -Come on, sir. - - - -LAERTES -Come, my lord. - - -They play - - -HAMLET -One. - - - -LAERTES -No. - - - -HAMLET -Judgment. - - - -OSRIC -A hit, a very palpable hit. - - - -LAERTES -Well; again. - - - -KING CLAUDIUS -Stay; give me drink. Hamlet, this pearl is thine; -Here's to thy health. -Trumpets sound, and cannon shot off within -Give him the cup. - - - -HAMLET -I'll play this bout first; set it by awhile. Come. -They play -Another hit; what say you? - - - -LAERTES -A touch, a touch, I do confess. - - - -KING CLAUDIUS -Our son shall win. - - - -QUEEN GERTRUDE -He's fat, and scant of breath. -Here, Hamlet, take my napkin, rub thy brows; -The queen carouses to thy fortune, Hamlet. - - - -HAMLET -Good madam! - - - -KING CLAUDIUS -Gertrude, do not drink. - - - -QUEEN GERTRUDE -I will, my lord; I pray you, pardon me. - - - -KING CLAUDIUS -Aside It is the poison'd cup: it is too late. - - - -HAMLET -I dare not drink yet, madam; by and by. - - - -QUEEN GERTRUDE -Come, let me wipe thy face. - - - -LAERTES -My lord, I'll hit him now. - - - -KING CLAUDIUS -I do not think't. - - - -LAERTES -Aside And yet 'tis almost 'gainst my conscience. - - - -HAMLET -Come, for the third, Laertes: you but dally; -I pray you, pass with your best violence; -I am afeard you make a wanton of me. - - - -LAERTES -Say you so? come on. - - -They play - - -OSRIC -Nothing, neither way. - - - -LAERTES -Have at you now! - - -LAERTES wounds HAMLET; then in scuffling, they -change rapiers, and HAMLET wounds LAERTES - - -KING CLAUDIUS -Part them; they are incensed. - - - -HAMLET -Nay, come, again. - - -QUEEN GERTRUDE falls - - -OSRIC -Look to the queen there, ho! - - - -HORATIO -They bleed on both sides. How is it, my lord? - - - -OSRIC -How is't, Laertes? - - - -LAERTES -Why, as a woodcock to mine own springe, Osric; -I am justly kill'd with mine own treachery. - - - -HAMLET -How does the queen? - - - -KING CLAUDIUS -She swounds to see them bleed. - - - -QUEEN GERTRUDE -No, no, the drink, the drink,--O my dear Hamlet,-- -The drink, the drink! I am poison'd. - - -Dies - - -HAMLET -O villany! Ho! let the door be lock'd: -Treachery! Seek it out. - - - -LAERTES -It is here, Hamlet: Hamlet, thou art slain; -No medicine in the world can do thee good; -In thee there is not half an hour of life; -The treacherous instrument is in thy hand, -Unbated and envenom'd: the foul practise -Hath turn'd itself on me lo, here I lie, -Never to rise again: thy mother's poison'd: -I can no more: the king, the king's to blame. - - - -HAMLET -The point!--envenom'd too! -Then, venom, to thy work. - - -Stabs KING CLAUDIUS - - -All -Treason! treason! - - - -KING CLAUDIUS -O, yet defend me, friends; I am but hurt. - - - -HAMLET -Here, thou incestuous, murderous, damned Dane, -Drink off this potion. Is thy union here? -Follow my mother. - - -KING CLAUDIUS dies - - -LAERTES -He is justly served; -It is a poison temper'd by himself. -Exchange forgiveness with me, noble Hamlet: -Mine and my father's death come not upon thee, -Nor thine on me. - - -Dies - - -HAMLET -Heaven make thee free of it! I follow thee. -I am dead, Horatio. Wretched queen, adieu! -You that look pale and tremble at this chance, -That are but mutes or audience to this act, -Had I but time--as this fell sergeant, death, -Is strict in his arrest--O, I could tell you-- -But let it be. Horatio, I am dead; -Thou livest; report me and my cause aright -To the unsatisfied. - - - -HORATIO -Never believe it: -I am more an antique Roman than a Dane: -Here's yet some liquor left. - - - -HAMLET -As thou'rt a man, -Give me the cup: let go; by heaven, I'll have't. -O good Horatio, what a wounded name, -Things standing thus unknown, shall live behind me! -If thou didst ever hold me in thy heart -Absent thee from felicity awhile, -And in this harsh world draw thy breath in pain, -To tell my story. -March afar off, and shot within -What warlike noise is this? - - - -OSRIC -Young Fortinbras, with conquest come from Poland, -To the ambassadors of England gives -This warlike volley. - - - -HAMLET -O, I die, Horatio; -The potent poison quite o'er-crows my spirit: -I cannot live to hear the news from England; -But I do prophesy the election lights -On Fortinbras: he has my dying voice; -So tell him, with the occurrents, more and less, -Which have solicited. The rest is silence. - - -Dies - - -HORATIO -Now cracks a noble heart. Good night sweet prince: -And flights of angels sing thee to thy rest! -Why does the drum come hither? - - -March within -Enter FORTINBRAS, the English Ambassadors, -and others - - -PRINCE FORTINBRAS -Where is this sight? - - - -HORATIO -What is it ye would see? -If aught of woe or wonder, cease your search. - - - -PRINCE FORTINBRAS -This quarry cries on havoc. O proud death, -What feast is toward in thine eternal cell, -That thou so many princes at a shot -So bloodily hast struck? - - - -First Ambassador -The sight is dismal; -And our affairs from England come too late: -The ears are senseless that should give us hearing, -To tell him his commandment is fulfill'd, -That Rosencrantz and Guildenstern are dead: -Where should we have our thanks? - - - -HORATIO -Not from his mouth, -Had it the ability of life to thank you: -He never gave commandment for their death. -But since, so jump upon this bloody question, -You from the Polack wars, and you from England, -Are here arrived give order that these bodies -High on a stage be placed to the view; -And let me speak to the yet unknowing world -How these things came about: so shall you hear -Of carnal, bloody, and unnatural acts, -Of accidental judgments, casual slaughters, -Of deaths put on by cunning and forced cause, -And, in this upshot, purposes mistook -Fall'n on the inventors' reads: all this can I -Truly deliver. - - - -PRINCE FORTINBRAS -Let us haste to hear it, -And call the noblest to the audience. -For me, with sorrow I embrace my fortune: -I have some rights of memory in this kingdom, -Which now to claim my vantage doth invite me. - - - -HORATIO -Of that I shall have also cause to speak, -And from his mouth whose voice will draw on more; -But let this same be presently perform'd, -Even while men's minds are wild; lest more mischance -On plots and errors, happen. - - - -PRINCE FORTINBRAS -Let four captains -Bear Hamlet, like a soldier, to the stage; -For he was likely, had he been put on, -To have proved most royally: and, for his passage, -The soldiers' music and the rites of war -Speak loudly for him. -Take up the bodies: such a sight as this -Becomes the field, but here shows much amiss. -Go, bid the soldiers shoot. - - -A dead march. Exeunt, bearing off the dead -bodies; after which a peal of ordnance is shot off - - -
\ No newline at end of file diff --git a/script/benchmark/parsecount b/script/benchmark/parsecount deleted file mode 100755 index fd41a101..00000000 --- a/script/benchmark/parsecount +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env ruby -# -# Each test has an XML Parser open a 98k XML document and count one type of leaf -# element (466 entries). This is repeated a total of 100 times, twice for each Parser. -# Summary measurements are from the second test. -# -# Tests run on a MacBook Pro, Mac OS X 10.5.5, 4GB memory, 2.5 GHz Intel Core 2 Duo. -# -# Library versions: -# hpricot 0.6.164 -# libxml: 0.9.2 -# -# All benchmarks were run twice in sequence and the measurements presented here are from -# the second run. Java automatically optimizes JRuby code which is run many times and the -# speedup from the first to the second test is from 40 to 75%. There is no essential -# difference in the speed of the C version of Ruby between the first test and the second. -# -# Summary: -# -# 100 times: Open 98k XML document and count one type of leaf element (466 entries) -# -# JRuby (Java 1.6.0_03-p3-Soylatte using server mode): jdom_document_builder 0.360 -# MRI: libxml v0.9.2 0.383 -# JRuby (Java 1.6.0_07): jdom_document_builder 0.401 -# JRuby (Java 1.5.0_16): jdom_document_builder 0.428 -# JRuby (Java 1.6.0_03-p3-Soylatte using server mode): hpricot 1.977 -# JRuby (Java 1.5.0_16): hpricot 2.027 -# JRuby (Java 1.6.0_07): hpricot 2.094 -# MRI: hpricot 2.140 -# JRuby (Java 1.6.0_03-p3-Soylatte using server mode): rexml 5.488 -# JRuby (Java 1.5.0_16): rexml 5.569 -# JRuby (Java 1.5.0_16): rexml 5.578 -# MRI: rexml 8.606 -# -# Ruby version: MRI 1.8.6 (2008-03-03 rev 114), platform: universal-darwin9.0 -# -------------------------------------------------------------------------------- -# user system total real -# rexml 8.170000 0.100000 8.270000 ( 8.606676) -# hpricot 1.990000 0.040000 2.030000 ( 2.140865) -# libxml 0.350000 0.020000 0.370000 ( 0.383475) -# -# JRuby 1.1.5 (svn r8078) on Java 1.5.0_16 -# -------------------------------------------------------------------------------- -# user system total real -# rexml 5.578000 0.000000 5.578000 ( 5.578371) -# hpricot 2.028000 0.000000 2.028000 ( 2.027348) -# jdom_document_builder 0.429000 0.000000 0.429000 ( 0.428713) -# -# JRuby 1.1.5 (svn r8078) on Java 1.6.0_07 -# -------------------------------------------------------------------------------- -# user system total real -# rexml 5.569000 0.000000 5.569000 ( 5.569135) -# hpricot 2.094000 0.000000 2.094000 ( 2.093635) -# jdom_document_builder 0.401000 0.000000 0.401000 ( 0.401115) -# -# JRuby 1.1.5 (svn r8078) on Java 1.6.0_07 using server mode (-J-server) -# -------------------------------------------------------------------------------- -# user system total real -# rexml 5.489000 0.000000 5.489000 ( 5.488560) -# hpricot 1.977000 0.000000 1.977000 ( 1.976845) -# jdom_document_builder 0.377000 0.000000 0.377000 ( 0.377808) -# -# JRuby 1.1.5 (svn r8078) on Java 1.6.0_03-p3 (Soylatte) using server mode (-J-server) -# -------------------------------------------------------------------------------- -# user system total real -# rexml 5.596000 0.000000 5.596000 ( 5.596212) -# hpricot 1.937000 0.000000 1.937000 ( 1.937312) -# jdom_document_builder 0.360000 0.000000 0.360000 ( 0.360068) - -require 'rubygems' -require 'benchmark' -require "rexml/document" -require 'hpricot' - -if RUBY_PLATFORM =~ /java/ - include Java - import javax.xml.parsers.DocumentBuilder - import javax.xml.parsers.DocumentBuilderFactory - @dbf = DocumentBuilderFactory.new_instance - @ruby_info = "Ruby version: JRuby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL}) [i386-jruby#{JRUBY_VERSION}]" - @ruby_info << ", platform: Java, version #{java.lang.System.getProperty('java.version')}" - else - @ruby_info = "Ruby version: MRI #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL})" - @ruby_info << ", platform: #{RUBY_PLATFORM}" - - gem 'nokogiri', '>= 1.0.6' - require 'nokogiri' - - gem 'libxml-ruby', '>= 0.9.2' - require 'libxml' - @xml_parser = LibXML::XML::Parser.new -end - -file = File.expand_path(File.join(File.dirname(__FILE__), "sock_entries.xml")) -@bundle_with_466_sock_entries = File.read(file) - -def rexml_count_socks - doc = REXML::Document.new(@bundle_with_466_sock_entries).root - socks = doc.elements.to_a('./sockEntries').length -end - -unless RUBY_PLATFORM =~ /java/ - def nokogiri_count_socks - #doc = Nokogiri(@bundle_with_466_sock_entries) - #socks = doc.search('//sockEntries').length - end - - def libxml_count_socks - @xml_parser = LibXML::XML::Parser.new - @xml_parser.string = @bundle_with_466_sock_entries - doc = @xml_parser.parse - socks = doc.find('//sockEntries').length - end -end - -def hpricot_count_socks - doc = Hpricot.XML(@bundle_with_466_sock_entries) - socks = doc.search("//sockEntries").length -end - -if RUBY_PLATFORM =~ /java/ - def jdom_document_builder_count_socks - file = File.expand_path(File.join(File.dirname(__FILE__), "sock_entries.xml")) - doc = @dbf.new_document_builder.parse(file).get_document_element - socks = doc.getElementsByTagName("sockEntries") - socks.get_length - end -end - -n = 100 -test_iterations = ARGV.first.to_i -test_iterations = 1 unless test_iterations > 1 -puts -puts @ruby_info -puts -puts "#{n} times: Open 98k XML document and count one type of leaf element (466 entries)" -puts -print "running benchmark " -if test_iterations == 1 - puts "once.\n\n" -else - puts "#{test_iterations} times.\n\n" -end -test_iterations.times do - Benchmark.bmbm do |x| - x.report("rexml") { n.times {rexml_count_socks} } - x.report("hpricot") { n.times {hpricot_count_socks} } - x.report("jdom_document_builder") { n.times {jdom_document_builder_count_socks} } if RUBY_PLATFORM =~ /java/ - #x.report("nokogiri") { n.times {nokogiri_count_socks} } unless RUBY_PLATFORM =~ /java/ - x.report("libxml") { n.times {libxml_count_socks} } unless RUBY_PLATFORM =~ /java/ - end - puts -end - -# -# jrexml doesn't appear to have any speedup in this test -# -# if RUBY_PLATFORM =~ /java/ -# require 'jrexml' -# def rexml_with_jrexml_count_socks -# doc = REXML::Document.new(@bundle_with_466_sock_entries).root -# socks = doc.elements.to_a('./sockEntries').length -# end -# -# puts "\nNow add in JREXML to see if it speeds up rexml\n" -# Benchmark.bmbm do |x| -# x.report("rexml+jrexml") { n.times {rexml_with_jrexml_count_socks} } -# end -# puts -# end diff --git a/script/benchmark/sock_entries.xml b/script/benchmark/sock_entries.xml deleted file mode 100644 index 4bd5f8ec..00000000 --- a/script/benchmark/sock_entries.xml +++ /dev/null @@ -1,507 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a0a5c490-b78e-11db-b2b3-0014c2c34555 - - http://saildataservice.concord.org/3/offering/1562/bundle/3693/1 - - \ No newline at end of file diff --git a/script/benchmark/throughput b/script/benchmark/throughput deleted file mode 100755 index 82abb635..00000000 --- a/script/benchmark/throughput +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'hpricot' -require 'xml' -require 'rexml/document' - -ITERATIONS = 3 -NESTED_ITERATIONS = 5 - -def bm(name, filename, &block) - text = File.open(filename).read - length = text.length / 1024.0 / 1024.0 - puts "#{filename}: #{name} (#{(length * 1024).round} kb)" - for j in 0 .. NESTED_ITERATIONS - s = Time.now.to_f - for i in 0 .. ITERATIONS - block.call(text) - end - timer = Time.now.to_f - s - puts "\t#{length * ITERATIONS / timer} MB/s" - end -end - -def bm_suite(filenames) - filenames.each do |filename| - bm("LIBXML THROUGHPUT:", filename) do |text| - XML::Document.file(filename) - end - - bm("HPRICOT THROUGHPUT:", filename) do |text| - Hpricot.XML(text) - end - - bm("REXML THROUGHPUT:", filename) do |text| - REXML::Document.new(text) - end - end -end - -bm_suite("hamlet.xml") diff --git a/script/test b/script/test deleted file mode 100755 index 3c93833b..00000000 --- a/script/test +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby - -%w{test lib ext/libxml}.each{ |path| $LOAD_PATH.unshift(path) } - -load './test/test_suite.rb' - diff --git a/test/test_canonicalize.rb b/test/test_canonicalize.rb index 9a0683e1..b0109727 100644 --- a/test/test_canonicalize.rb +++ b/test/test_canonicalize.rb @@ -24,8 +24,7 @@ def test_canonicalize_with_w3c_c14n_3_1 expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-1')) mode = LibXML::XML::Document::XML_C14N_1_1 assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode)) - end#test_canonicalize_with_w3c_c14n_3_1 - + end # (www.w3.org) 3.2 Whitespace in Document Content # http://www.w3.org/TR/xml-c14n#Example-WhitespaceInContent @@ -68,26 +67,23 @@ def test_canonicalize_with_w3c_c14n_3_4 # (www.w3.org) 3.5 Entity References # http://www.w3.org/TR/xml-c14n#Example-Entities - # (2012-02-20) Failing likely due to a logic error - # - libxml2(c14n.c:1788) XML_ENTITY_REF_NODE is invalid node for parsing. def test_canonicalize_with_w3c_c14n_3_5 - #given_doc = LibXML::XML::Document.file(self.path('c14n/given/example-5.xml')) + # NOENT resolves entity references, DTDLOAD loads the external entity + options = LibXML::XML::Parser::Options::NOENT | LibXML::XML::Parser::Options::DTDLOAD + given_doc = LibXML::XML::Document.file(self.path('c14n/given/example-5.xml'), options: options) # With Comments - #expected_with_comments = IO.read(self.path('c14n/result/with-comments/example-5')) - - # TODO - CANNOT COMPLETE TEST unless libxml2 supports additional node types. - #assert_equal(expected_with_comments, given_doc.canonicalize(:comments => true)) + expected_with_comments = IO.read(self.path('c14n/result/with-comments/example-5')) + assert_equal(expected_with_comments, given_doc.canonicalize(:comments => true)) # Without Comments - #expected_without_comments = IO.read(self.path('c14n/result/without-comments/example-5')) - # TODO - CANNOT COMPLETE TEST unless libxml2 supports additional node types. - #assert_equal(expected_without_comments, given_doc.canonicalize(:comments => false)) - #expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-5')) - #mode = LibXML::XML::Document::XML_C14N_1_1 - - # TODO - CANNOT COMPLETE TEST unless libxml2 supports additional node types. - #assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode)) + expected_without_comments = IO.read(self.path('c14n/result/without-comments/example-5')) + assert_equal(expected_without_comments, given_doc.canonicalize(:comments => false)) + + # Without Comments (XML_C14N_1_1) + expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-5')) + mode = LibXML::XML::Document::XML_C14N_1_1 + assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode)) end # (www.w3.org) 3.6 UTF-8 Encoding @@ -105,16 +101,22 @@ def test_canonicalize_with_w3c_c14n_3_6 # (www.w3.org) 3.7 Document Subsets # http://www.w3.org/TR/xml-c14n#Example-DocSubsets def test_canonicalize_with_w3c_c14n_3_7 - # Non Canonicalized Document - # given_doc = LibXML::XML::Document.file(self.path('c14n/given/example-7.xml')) - #expected = IO.read(self.path('c14n/result/without-comments/example-7')) - - # e1_node = given_doc.find_first('ietf:e1', 'ietf:http://www.ietf.org') - - # Select current node, all child nodes, all attributes and namespace nodes - #subdoc_nodes = e1_node.find("(.//.|.//@id|namespace::*)") - - # TODO - This fails because the namespace nodes aren't taken into account - # assert_equal(expected, given_doc.canonicalize(:nodes => subdoc_nodes)) + # Parse with DTDATTR and DTDLOAD so default attributes and ID types + # from the internal DTD subset are materialized + options = LibXML::XML::Parser::Options::DTDATTR | LibXML::XML::Parser::Options::DTDLOAD + given_doc = LibXML::XML::Document.file(self.path('c14n/given/example-7.xml'), + options: options) + expected = IO.read(self.path('c14n/result/without-comments/example-7')) + + ctx = given_doc.context + ctx.register_namespace('ietf', 'http://www.ietf.org') + + # W3C C14N spec example 3.7 XPath expression for document subsets + subdoc_nodes = ctx.find( + "(//. | //@* | //namespace::*)" \ + "[self::ietf:e1 or (parent::ietf:e1 and not(self::text() or self::e2))" \ + " or count(id('E3')|ancestor-or-self::node()) = count(ancestor-or-self::node())]") + + assert_equal(expected, given_doc.canonicalize(:nodes => subdoc_nodes)) end end diff --git a/test/test_deprecated_require.rb b/test/test_deprecated_require.rb deleted file mode 100644 index a5eabb45..00000000 --- a/test/test_deprecated_require.rb +++ /dev/null @@ -1,12 +0,0 @@ -# encoding: UTF-8 - -require 'xml/libxml' - -class TestDeprecatedRequire < Minitest::Test - def test_basic - xp = LibXML::XML::Parser.string('onetwo') - assert_instance_of(LibXML::XML::Parser, xp) - @doc = xp.parse - assert_instance_of(LibXML::XML::Document, @doc) - end -end diff --git a/test/test_document.rb b/test/test_document.rb index 3367286d..231a7d0d 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -43,14 +43,12 @@ def test_compression end 10.upto(20) do |i| - # assert_equal(9, @doc.compression = i) - assert_equal(i, @doc.compression = i) # This works around a bug in Ruby 1.8 + assert_equal(i, @doc.compression = i) assert_equal(9, @doc.compression) end -1.downto(-10) do |i| - # assert_equal(0, @doc.compression = i) - assert_equal(i, @doc.compression = i) # FIXME This bug should get fixed ASAP + @doc.compression = i assert_equal(0, @doc.compression) end end diff --git a/test/test_dtd.rb b/test/test_dtd.rb index af996fd7..df6e39e9 100644 --- a/test/test_dtd.rb +++ b/test/test_dtd.rb @@ -44,6 +44,16 @@ def test_internal_subset assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.system_id end + def test_internal_subset_nil_ids + doc = LibXML::XML::Document.new + doc.root = LibXML::XML::Node.new('test') + dtd = LibXML::XML::Dtd.new(nil, nil, 'test', doc, true) + assert_equal('test', dtd.name) + assert_nil(dtd.external_id) + assert_nil(dtd.uri) + assert_equal("\n\n\n", doc.to_s) + end + def test_external_subset xhtml_dtd = LibXML::XML::Dtd.new("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", nil) assert xhtml_dtd.name.nil? diff --git a/test/test_error.rb b/test/test_error.rb index df74b9eb..9b0f5876 100644 --- a/test/test_error.rb +++ b/test/test_error.rb @@ -154,7 +154,7 @@ def test_double_parse end def test_double_parse_register_handler - LibXML::XML::Parser.register_error_handler(lambda {|msg| nil }) + LibXML::XML::Error.set_handler {|msg| nil } parser = LibXML::XML::Parser.string("something") parser.parse diff --git a/test/test_html_parser.rb b/test/test_html_parser.rb index e917b825..e2662c5d 100644 --- a/test/test_html_parser.rb +++ b/test/test_html_parser.rb @@ -138,11 +138,14 @@ def test_parse end def test_no_implied - skip("NOIMPLIED behavior changed in libxml2 2.14+") if Gem::Version.new(LibXML::XML::LIBXML_VERSION) >= Gem::Version.new("2.14") html = "hello world" parser = LibXML::XML::HTMLParser.string(html, :options => LibXML::XML::HTMLParser::Options::NOIMPLIED) doc = parser.parse - assert_equal("

#{html}

", doc.root.to_s) + if Gem::Version.new(LibXML::XML::LIBXML_VERSION) >= Gem::Version.new("2.14") + assert_nil(doc.root) + else + assert_equal("

#{html}

", doc.root.to_s) + end end def test_comment diff --git a/test/test_input_callbacks.rb b/test/test_input_callbacks.rb new file mode 100644 index 00000000..ee49261c --- /dev/null +++ b/test/test_input_callbacks.rb @@ -0,0 +1,36 @@ +# encoding: UTF-8 + +require_relative './test_helper' + +class InputCallbacksGCStressRepro + def run + scheme_name = 'input-callback-gc://' + + callback_class = Class.new do + def self.document_query(_uri) + '' + end + end + LibXML::XML::InputCallbacks.add_scheme(scheme_name, callback_class) + callback_class = nil + + document = LibXML::XML::Document.file("#{scheme_name}fixture.xml") + document.root.name + ensure + LibXML::XML::InputCallbacks.remove_scheme(scheme_name) + end +end + +class TestInputCallbacks < Minitest::Test + def setup + GC.stress = true + end + + def teardown + GC.stress = false + end + + def test_add_scheme_auto_registers_and_survives_gc_stress + assert_equal('root', InputCallbacksGCStressRepro.new.run) + end +end diff --git a/test/test_parser.rb b/test/test_parser.rb index 311dbddb..f94e54fd 100644 --- a/test/test_parser.rb +++ b/test/test_parser.rb @@ -220,38 +220,7 @@ def test_string_encoding assert_equal(Encoding::UTF_8, node.content.encoding) assert_equal("m\303\266tley_cr\303\274e", node.content) end - - def test_fd_gc - skip - # Test opening # of documents up to the file limit for the OS. - # Ideally it should run until libxml emits a warning, - # thereby knowing we've done a GC sweep. For the time being, - # re-open the same doc `limit descriptors` times. - # If we make it to the end, then we've succeeded, - # otherwise an exception will be thrown. - LibXML::XML::Error.set_handler {|error|} - - max_fd = if RUBY_PLATFORM.match(/mswin32|mswin64|mingw/i) - 500 - else - Process.getrlimit(Process::RLIMIT_NOFILE)[0] + 1 - end - - file = File.join(File.dirname(__FILE__), 'model/rubynet.xml') - max_fd.times do - LibXML::XML::Parser.file(file).parse - end - LibXML::XML::Error.reset_handler {|error|} - end - - def test_open_many_files - file = File.expand_path(File.join(File.dirname(__FILE__), 'model/atom.xml')) - 1000.times do - LibXML::XML::Parser.file(file).parse - end - end - - # ----- Errors ------ + def test_error error = assert_raises(LibXML::XML::Error) do LibXML::XML::Parser.string('').parse diff --git a/test/test_schema.rb b/test/test_schema.rb index 07f2563c..26b2d878 100644 --- a/test/test_schema.rb +++ b/test/test_schema.rb @@ -235,4 +235,31 @@ def test_schema_attribute assert_equal('1', attribute.default) assert_equal('integer', attribute.type.name) end + + def test_anonymous_subtypes + type = @schema.types['shiporderType'] + anon = type.anonymous_subtypes + + assert_instance_of(Hash, anon) + assert_equal(2, anon.length) + assert_includes(anon.keys, 'shipto') + assert_includes(anon.keys, 'item') + + anon.each_value do |element| + assert_instance_of(LibXML::XML::Schema::Element, element) + assert_nil(element.type.name) + end + end + + def test_anonymous_subtypes_recursively + type = @schema.types['shiporderType'] + result = type.anonymous_subtypes_recursively + + assert_instance_of(Array, result) + assert_operator(result.length, :>=, 2) + + keys = result.select { |r| r.is_a?(Hash) }.flat_map(&:keys) + assert_includes(keys, 'shipto') + assert_includes(keys, 'item') + end end