From c3ccf23d5807f2ff20127bf5e42df0977bf672fb Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sat, 11 Jan 2020 21:37:00 +0900 Subject: Make rexml library to the bundle gems [Feature #16485][ruby-core:96683] --- doc/maintainers.rdoc | 6 +- doc/standard_library.rdoc | 2 +- gems/bundled_gems | 1 + lib/rexml/attlistdecl.rb | 63 - lib/rexml/attribute.rb | 205 - lib/rexml/cdata.rb | 68 - lib/rexml/child.rb | 97 - lib/rexml/comment.rb | 80 - lib/rexml/doctype.rb | 287 - lib/rexml/document.rb | 291 - lib/rexml/dtd/attlistdecl.rb | 11 - lib/rexml/dtd/dtd.rb | 47 - lib/rexml/dtd/elementdecl.rb | 18 - lib/rexml/dtd/entitydecl.rb | 57 - lib/rexml/dtd/notationdecl.rb | 40 - lib/rexml/element.rb | 1269 -- lib/rexml/encoding.rb | 51 - lib/rexml/entity.rb | 171 - lib/rexml/formatters/default.rb | 116 - lib/rexml/formatters/pretty.rb | 142 - lib/rexml/formatters/transitive.rb | 58 - lib/rexml/functions.rb | 447 - lib/rexml/instruction.rb | 79 - lib/rexml/light/node.rb | 196 - lib/rexml/namespace.rb | 59 - lib/rexml/node.rb | 76 - lib/rexml/output.rb | 30 - lib/rexml/parent.rb | 166 - lib/rexml/parseexception.rb | 52 - lib/rexml/parsers/baseparser.rb | 594 - lib/rexml/parsers/lightparser.rb | 59 - lib/rexml/parsers/pullparser.rb | 197 - lib/rexml/parsers/sax2parser.rb | 273 - lib/rexml/parsers/streamparser.rb | 61 - lib/rexml/parsers/treeparser.rb | 101 - lib/rexml/parsers/ultralightparser.rb | 57 - lib/rexml/parsers/xpathparser.rb | 675 - lib/rexml/quickpath.rb | 266 - lib/rexml/rexml.gemspec | 84 - lib/rexml/rexml.rb | 32 - lib/rexml/sax2listener.rb | 98 - lib/rexml/security.rb | 28 - lib/rexml/source.rb | 298 - lib/rexml/streamlistener.rb | 93 - lib/rexml/text.rb | 424 - lib/rexml/undefinednamespaceexception.rb | 9 - lib/rexml/validation/relaxng.rb | 539 - lib/rexml/validation/validation.rb | 144 - lib/rexml/validation/validationexception.rb | 10 - lib/rexml/xmldecl.rb | 130 - lib/rexml/xmltokens.rb | 85 - lib/rexml/xpath.rb | 81 - lib/rexml/xpath_parser.rb | 968 -- test/rexml/data/LostineRiver.kml.gz | Bin 50154 -> 0 bytes test/rexml/data/ProductionSupport.xml | 29 - test/rexml/data/axis.xml | 25 - test/rexml/data/bad.xml | 5 - test/rexml/data/basic.xml | 11 - test/rexml/data/basicupdate.xml | 47 - test/rexml/data/broken.rss | 20 - test/rexml/data/contents.xml | 70 - test/rexml/data/dash.xml | 12 - test/rexml/data/defaultNamespace.xml | 6 - test/rexml/data/doctype_test.xml | 34 - test/rexml/data/documentation.xml | 542 - test/rexml/data/euc.xml | 296 - test/rexml/data/evaluate.xml | 28 - test/rexml/data/fibo.xml | 29 - test/rexml/data/foo.xml | 10 - test/rexml/data/google.2.xml | 156 - test/rexml/data/id.xml | 21 - test/rexml/data/iso8859-1.xml | 4 - test/rexml/data/jaxen24.xml | 2 - test/rexml/data/jaxen3.xml | 15 - test/rexml/data/lang.xml | 11 - test/rexml/data/lang0.xml | 18 - test/rexml/data/message.xml | 27 - test/rexml/data/moreover.xml | 244 - test/rexml/data/much_ado.xml | 6850 --------- test/rexml/data/namespaces.xml | 18 - test/rexml/data/nitf.xml | 67 - test/rexml/data/numbers.xml | 18 - test/rexml/data/ofbiz-issues-full-177.xml | 13971 ------------------- test/rexml/data/pi.xml | 13 - test/rexml/data/pi2.xml | 6 - test/rexml/data/project.xml | 1 - test/rexml/data/simple.xml | 2 - test/rexml/data/stream_accents.xml | 4 - test/rexml/data/t63-1.xml | Bin 161690 -> 0 bytes test/rexml/data/t63-2.svg | 2828 ---- test/rexml/data/t75.xml | 31 - test/rexml/data/test/tests.xml | 683 - test/rexml/data/test/tests.xsl | 369 - test/rexml/data/testNamespaces.xml | 22 - test/rexml/data/testsrc.xml | 64 - test/rexml/data/text.xml | 10 - test/rexml/data/ticket_61.xml | 4 - test/rexml/data/ticket_68.xml | 590 - test/rexml/data/tutorial.xml | 678 - test/rexml/data/underscore.xml | 6 - test/rexml/data/utf16.xml | Bin 207464 -> 0 bytes test/rexml/data/web.xml | 42 - test/rexml/data/web2.xml | 7 - test/rexml/data/working.rss | 202 - test/rexml/data/xmlfile-bug.xml | 15 - test/rexml/data/xp.tst | 27 - test/rexml/data/yahoo.xml | 80 - test/rexml/formatter/test_default.rb | 19 - test/rexml/functions/test_base.rb | 261 - test/rexml/functions/test_boolean.rb | 75 - test/rexml/functions/test_local_name.rb | 44 - test/rexml/functions/test_number.rb | 38 - test/rexml/listener.rb | 51 - test/rexml/parse/test_document_type_declaration.rb | 50 - test/rexml/parse/test_element.rb | 51 - test/rexml/parse/test_notation_declaration.rb | 100 - test/rexml/parse/test_processing_instruction.rb | 25 - test/rexml/parser/test_sax2.rb | 203 - test/rexml/parser/test_stream.rb | 32 - test/rexml/parser/test_tree.rb | 43 - test/rexml/parser/test_ultra_light.rb | 70 - test/rexml/rexml_test_utils.rb | 10 - test/rexml/test_attribute.rb | 14 - test/rexml/test_attributes.rb | 223 - test/rexml/test_attributes_mixin.rb | 32 - test/rexml/test_changing_encoding.rb | 45 - test/rexml/test_comment.rb | 26 - test/rexml/test_contrib.rb | 585 - test/rexml/test_core.rb | 1517 -- test/rexml/test_doctype.rb | 157 - test/rexml/test_document.rb | 416 - test/rexml/test_element.rb | 18 - test/rexml/test_elements.rb | 119 - test/rexml/test_encoding.rb | 108 - test/rexml/test_entity.rb | 206 - test/rexml/test_instruction.rb | 14 - test/rexml/test_jaxen.rb | 131 - test/rexml/test_light.rb | 107 - test/rexml/test_lightparser.rb | 16 - test/rexml/test_listener.rb | 131 - test/rexml/test_martin_fowler.rb | 40 - test/rexml/test_namespace.rb | 41 - test/rexml/test_order.rb | 110 - test/rexml/test_preceding_sibling.rb | 41 - test/rexml/test_pullparser.rb | 103 - test/rexml/test_rexml_issuezilla.rb | 19 - test/rexml/test_sax.rb | 287 - test/rexml/test_stream.rb | 130 - test/rexml/test_text.rb | 75 - test/rexml/test_ticket_80.rb | 59 - test/rexml/test_validation_rng.rb | 793 -- test/rexml/test_xml_declaration.rb | 48 - test/rexml/xpath/test_attribute.rb | 38 - test/rexml/xpath/test_axis_preceding_sibling.rb | 40 - test/rexml/xpath/test_base.rb | 1125 -- test/rexml/xpath/test_compare.rb | 256 - test/rexml/xpath/test_node.rb | 43 - test/rexml/xpath/test_predicate.rb | 83 - test/rexml/xpath/test_text.rb | 77 - tool/sync_default_gems.rb | 2 - 160 files changed, 4 insertions(+), 46104 deletions(-) delete mode 100644 lib/rexml/attlistdecl.rb delete mode 100644 lib/rexml/attribute.rb delete mode 100644 lib/rexml/cdata.rb delete mode 100644 lib/rexml/child.rb delete mode 100644 lib/rexml/comment.rb delete mode 100644 lib/rexml/doctype.rb delete mode 100644 lib/rexml/document.rb delete mode 100644 lib/rexml/dtd/attlistdecl.rb delete mode 100644 lib/rexml/dtd/dtd.rb delete mode 100644 lib/rexml/dtd/elementdecl.rb delete mode 100644 lib/rexml/dtd/entitydecl.rb delete mode 100644 lib/rexml/dtd/notationdecl.rb delete mode 100644 lib/rexml/element.rb delete mode 100644 lib/rexml/encoding.rb delete mode 100644 lib/rexml/entity.rb delete mode 100644 lib/rexml/formatters/default.rb delete mode 100644 lib/rexml/formatters/pretty.rb delete mode 100644 lib/rexml/formatters/transitive.rb delete mode 100644 lib/rexml/functions.rb delete mode 100644 lib/rexml/instruction.rb delete mode 100644 lib/rexml/light/node.rb delete mode 100644 lib/rexml/namespace.rb delete mode 100644 lib/rexml/node.rb delete mode 100644 lib/rexml/output.rb delete mode 100644 lib/rexml/parent.rb delete mode 100644 lib/rexml/parseexception.rb delete mode 100644 lib/rexml/parsers/baseparser.rb delete mode 100644 lib/rexml/parsers/lightparser.rb delete mode 100644 lib/rexml/parsers/pullparser.rb delete mode 100644 lib/rexml/parsers/sax2parser.rb delete mode 100644 lib/rexml/parsers/streamparser.rb delete mode 100644 lib/rexml/parsers/treeparser.rb delete mode 100644 lib/rexml/parsers/ultralightparser.rb delete mode 100644 lib/rexml/parsers/xpathparser.rb delete mode 100644 lib/rexml/quickpath.rb delete mode 100644 lib/rexml/rexml.gemspec delete mode 100644 lib/rexml/rexml.rb delete mode 100644 lib/rexml/sax2listener.rb delete mode 100644 lib/rexml/security.rb delete mode 100644 lib/rexml/source.rb delete mode 100644 lib/rexml/streamlistener.rb delete mode 100644 lib/rexml/text.rb delete mode 100644 lib/rexml/undefinednamespaceexception.rb delete mode 100644 lib/rexml/validation/relaxng.rb delete mode 100644 lib/rexml/validation/validation.rb delete mode 100644 lib/rexml/validation/validationexception.rb delete mode 100644 lib/rexml/xmldecl.rb delete mode 100644 lib/rexml/xmltokens.rb delete mode 100644 lib/rexml/xpath.rb delete mode 100644 lib/rexml/xpath_parser.rb delete mode 100644 test/rexml/data/LostineRiver.kml.gz delete mode 100644 test/rexml/data/ProductionSupport.xml delete mode 100644 test/rexml/data/axis.xml delete mode 100644 test/rexml/data/bad.xml delete mode 100644 test/rexml/data/basic.xml delete mode 100644 test/rexml/data/basicupdate.xml delete mode 100644 test/rexml/data/broken.rss delete mode 100644 test/rexml/data/contents.xml delete mode 100644 test/rexml/data/dash.xml delete mode 100644 test/rexml/data/defaultNamespace.xml delete mode 100644 test/rexml/data/doctype_test.xml delete mode 100644 test/rexml/data/documentation.xml delete mode 100644 test/rexml/data/euc.xml delete mode 100644 test/rexml/data/evaluate.xml delete mode 100644 test/rexml/data/fibo.xml delete mode 100644 test/rexml/data/foo.xml delete mode 100644 test/rexml/data/google.2.xml delete mode 100644 test/rexml/data/id.xml delete mode 100644 test/rexml/data/iso8859-1.xml delete mode 100644 test/rexml/data/jaxen24.xml delete mode 100644 test/rexml/data/jaxen3.xml delete mode 100644 test/rexml/data/lang.xml delete mode 100644 test/rexml/data/lang0.xml delete mode 100644 test/rexml/data/message.xml delete mode 100644 test/rexml/data/moreover.xml delete mode 100644 test/rexml/data/much_ado.xml delete mode 100644 test/rexml/data/namespaces.xml delete mode 100644 test/rexml/data/nitf.xml delete mode 100644 test/rexml/data/numbers.xml delete mode 100644 test/rexml/data/ofbiz-issues-full-177.xml delete mode 100644 test/rexml/data/pi.xml delete mode 100644 test/rexml/data/pi2.xml delete mode 100644 test/rexml/data/project.xml delete mode 100644 test/rexml/data/simple.xml delete mode 100644 test/rexml/data/stream_accents.xml delete mode 100644 test/rexml/data/t63-1.xml delete mode 100644 test/rexml/data/t63-2.svg delete mode 100644 test/rexml/data/t75.xml delete mode 100644 test/rexml/data/test/tests.xml delete mode 100644 test/rexml/data/test/tests.xsl delete mode 100644 test/rexml/data/testNamespaces.xml delete mode 100644 test/rexml/data/testsrc.xml delete mode 100644 test/rexml/data/text.xml delete mode 100644 test/rexml/data/ticket_61.xml delete mode 100644 test/rexml/data/ticket_68.xml delete mode 100644 test/rexml/data/tutorial.xml delete mode 100644 test/rexml/data/underscore.xml delete mode 100644 test/rexml/data/utf16.xml delete mode 100644 test/rexml/data/web.xml delete mode 100644 test/rexml/data/web2.xml delete mode 100644 test/rexml/data/working.rss delete mode 100644 test/rexml/data/xmlfile-bug.xml delete mode 100644 test/rexml/data/xp.tst delete mode 100644 test/rexml/data/yahoo.xml delete mode 100644 test/rexml/formatter/test_default.rb delete mode 100644 test/rexml/functions/test_base.rb delete mode 100644 test/rexml/functions/test_boolean.rb delete mode 100644 test/rexml/functions/test_local_name.rb delete mode 100644 test/rexml/functions/test_number.rb delete mode 100644 test/rexml/listener.rb delete mode 100644 test/rexml/parse/test_document_type_declaration.rb delete mode 100644 test/rexml/parse/test_element.rb delete mode 100644 test/rexml/parse/test_notation_declaration.rb delete mode 100644 test/rexml/parse/test_processing_instruction.rb delete mode 100644 test/rexml/parser/test_sax2.rb delete mode 100644 test/rexml/parser/test_stream.rb delete mode 100644 test/rexml/parser/test_tree.rb delete mode 100644 test/rexml/parser/test_ultra_light.rb delete mode 100644 test/rexml/rexml_test_utils.rb delete mode 100644 test/rexml/test_attribute.rb delete mode 100644 test/rexml/test_attributes.rb delete mode 100644 test/rexml/test_attributes_mixin.rb delete mode 100644 test/rexml/test_changing_encoding.rb delete mode 100644 test/rexml/test_comment.rb delete mode 100644 test/rexml/test_contrib.rb delete mode 100644 test/rexml/test_core.rb delete mode 100644 test/rexml/test_doctype.rb delete mode 100644 test/rexml/test_document.rb delete mode 100644 test/rexml/test_element.rb delete mode 100644 test/rexml/test_elements.rb delete mode 100644 test/rexml/test_encoding.rb delete mode 100644 test/rexml/test_entity.rb delete mode 100644 test/rexml/test_instruction.rb delete mode 100644 test/rexml/test_jaxen.rb delete mode 100644 test/rexml/test_light.rb delete mode 100644 test/rexml/test_lightparser.rb delete mode 100644 test/rexml/test_listener.rb delete mode 100644 test/rexml/test_martin_fowler.rb delete mode 100644 test/rexml/test_namespace.rb delete mode 100644 test/rexml/test_order.rb delete mode 100644 test/rexml/test_preceding_sibling.rb delete mode 100644 test/rexml/test_pullparser.rb delete mode 100644 test/rexml/test_rexml_issuezilla.rb delete mode 100644 test/rexml/test_sax.rb delete mode 100644 test/rexml/test_stream.rb delete mode 100644 test/rexml/test_text.rb delete mode 100644 test/rexml/test_ticket_80.rb delete mode 100644 test/rexml/test_validation_rng.rb delete mode 100644 test/rexml/test_xml_declaration.rb delete mode 100644 test/rexml/xpath/test_attribute.rb delete mode 100644 test/rexml/xpath/test_axis_preceding_sibling.rb delete mode 100644 test/rexml/xpath/test_base.rb delete mode 100644 test/rexml/xpath/test_compare.rb delete mode 100644 test/rexml/xpath/test_node.rb delete mode 100644 test/rexml/xpath/test_predicate.rb delete mode 100644 test/rexml/xpath/test_text.rb diff --git a/doc/maintainers.rdoc b/doc/maintainers.rdoc index 071c958d30..c8b4f9af20 100644 --- a/doc/maintainers.rdoc +++ b/doc/maintainers.rdoc @@ -239,10 +239,6 @@ Zachary Scott (zzak) aycabta https://github.com/ruby/reline https://rubygems.org/gems/reline -[lib/rexml/*] - Kouhei Sutou (kou) - https://github.com/ruby/rexml - https://rubygems.org/gems/rexml [lib/rss.rb, lib/rss/*] Kouhei Sutou (kou) https://github.com/ruby/rss @@ -357,3 +353,5 @@ Zachary Scott (zzak) https://github.com/test-unit/test-unit [xmlrpc] https://github.com/ruby/xmlrpc +[rexml] + https://github.com/ruby/rexml diff --git a/doc/standard_library.rdoc b/doc/standard_library.rdoc index f71cedebf7..82dda4b532 100644 --- a/doc/standard_library.rdoc +++ b/doc/standard_library.rdoc @@ -80,7 +80,6 @@ Prime:: Prime numbers and factorization library PStore:: Implements a file based persistence mechanism based on a Hash Racc:: A LALR(1) parser generator written in Ruby. RDoc:: Produces HTML and command-line documentation for Ruby -REXML:: An XML toolkit for Ruby RSS:: Family of libraries that support various formats of XML "feeds" Singleton:: Implementation of the Singleton pattern for Ruby Timeout:: Auto-terminate potentially long-running operations in Ruby @@ -119,3 +118,4 @@ PowerAssert:: Power Assert for Ruby. Rake:: Ruby build program with capabilities similar to make Test::Unit:: A compatibility layer for MiniTest XMLRPC:: Remote Procedure Call over HTTP support for Ruby +REXML:: An XML toolkit for Ruby diff --git a/gems/bundled_gems b/gems/bundled_gems index b2c6e2d5cb..635ff1d1c6 100644 --- a/gems/bundled_gems +++ b/gems/bundled_gems @@ -4,3 +4,4 @@ power_assert 1.1.5 https://github.com/k-tsj/power_assert rake 13.0.1 https://github.com/ruby/rake test-unit 3.3.4 https://github.com/test-unit/test-unit xmlrpc 0.3.0 https://github.com/ruby/xmlrpc +rexml 3.2.3 https://github.com/ruby/rexml diff --git a/lib/rexml/attlistdecl.rb b/lib/rexml/attlistdecl.rb deleted file mode 100644 index 44a91d66d6..0000000000 --- a/lib/rexml/attlistdecl.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: false -#vim:ts=2 sw=2 noexpandtab: -require_relative 'child' -require_relative 'source' - -module REXML - # This class needs: - # * Documentation - # * Work! Not all types of attlists are intelligently parsed, so we just - # spew back out what we get in. This works, but it would be better if - # we formatted the output ourselves. - # - # AttlistDecls provide *just* enough support to allow namespace - # declarations. If you need some sort of generalized support, or have an - # interesting idea about how to map the hideous, terrible design of DTD - # AttlistDecls onto an intuitive Ruby interface, let me know. I'm desperate - # for anything to make DTDs more palateable. - class AttlistDecl < Child - include Enumerable - - # What is this? Got me. - attr_reader :element_name - - # Create an AttlistDecl, pulling the information from a Source. Notice - # that this isn't very convenient; to create an AttlistDecl, you basically - # have to format it yourself, and then have the initializer parse it. - # Sorry, but for the foreseeable future, DTD support in REXML is pretty - # weak on convenience. Have I mentioned how much I hate DTDs? - def initialize(source) - super() - if (source.kind_of? Array) - @element_name, @pairs, @contents = *source - end - end - - # Access the attlist attribute/value pairs. - # value = attlist_decl[ attribute_name ] - def [](key) - @pairs[key] - end - - # Whether an attlist declaration includes the given attribute definition - # if attlist_decl.include? "xmlns:foobar" - def include?(key) - @pairs.keys.include? key - end - - # Iterate over the key/value pairs: - # attlist_decl.each { |attribute_name, attribute_value| ... } - def each(&block) - @pairs.each(&block) - end - - # Write out exactly what we got in. - def write out, indent=-1 - out << @contents - end - - def node_type - :attlistdecl - end - end -end diff --git a/lib/rexml/attribute.rb b/lib/rexml/attribute.rb deleted file mode 100644 index 8933a013a2..0000000000 --- a/lib/rexml/attribute.rb +++ /dev/null @@ -1,205 +0,0 @@ -# frozen_string_literal: false -require_relative "namespace" -require_relative 'text' - -module REXML - # Defines an Element Attribute; IE, a attribute=value pair, as in: - # . Attributes can be in their own - # namespaces. General users of REXML will not interact with the - # Attribute class much. - class Attribute - include Node - include Namespace - - # The element to which this attribute belongs - attr_reader :element - # The normalized value of this attribute. That is, the attribute with - # entities intact. - attr_writer :normalized - PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\2/um - - NEEDS_A_SECOND_CHECK = /(<|&((#{Entity::NAME});|(#0*((?:\d+)|(?:x[a-fA-F0-9]+)));)?)/um - - # Constructor. - # FIXME: The parser doesn't catch illegal characters in attributes - # - # first:: - # Either: an Attribute, which this new attribute will become a - # clone of; or a String, which is the name of this attribute - # second:: - # If +first+ is an Attribute, then this may be an Element, or nil. - # If nil, then the Element parent of this attribute is the parent - # of the +first+ Attribute. If the first argument is a String, - # then this must also be a String, and is the content of the attribute. - # If this is the content, it must be fully normalized (contain no - # illegal characters). - # parent:: - # Ignored unless +first+ is a String; otherwise, may be the Element - # parent of this attribute, or nil. - # - # - # Attribute.new( attribute_to_clone ) - # Attribute.new( attribute_to_clone, parent_element ) - # Attribute.new( "attr", "attr_value" ) - # Attribute.new( "attr", "attr_value", parent_element ) - def initialize( first, second=nil, parent=nil ) - @normalized = @unnormalized = @element = nil - if first.kind_of? Attribute - self.name = first.expanded_name - @unnormalized = first.value - if second.kind_of? Element - @element = second - else - @element = first.element - end - elsif first.kind_of? String - @element = parent - self.name = first - @normalized = second.to_s - else - raise "illegal argument #{first.class.name} to Attribute constructor" - end - end - - # Returns the namespace of the attribute. - # - # e = Element.new( "elns:myelement" ) - # e.add_attribute( "nsa:a", "aval" ) - # e.add_attribute( "b", "bval" ) - # e.attributes.get_attribute( "a" ).prefix # -> "nsa" - # e.attributes.get_attribute( "b" ).prefix # -> "" - # a = Attribute.new( "x", "y" ) - # a.prefix # -> "" - def prefix - super - end - - # Returns the namespace URL, if defined, or nil otherwise - # - # e = Element.new("el") - # e.add_namespace("ns", "http://url") - # e.add_attribute("ns:a", "b") - # e.add_attribute("nsx:a", "c") - # e.attribute("ns:a").namespace # => "http://url" - # e.attribute("nsx:a").namespace # => nil - # - # This method always returns "" for no namespace attribute. Because - # the default namespace doesn't apply to attribute names. - # - # From https://www.w3.org/TR/xml-names/#uniqAttrs - # - # > the default namespace does not apply to attribute names - # - # e = REXML::Element.new("el") - # e.add_namespace("", "http://example.com/") - # e.namespace # => "http://example.com/" - # e.add_attribute("a", "b") - # e.attribute("a").namespace # => "" - def namespace arg=nil - arg = prefix if arg.nil? - if arg == "" - "" - else - @element.namespace(arg) - end - end - - # Returns true if other is an Attribute and has the same name and value, - # false otherwise. - def ==( other ) - other.kind_of?(Attribute) and other.name==name and other.value==value - end - - # Creates (and returns) a hash from both the name and value - def hash - name.hash + value.hash - end - - # Returns this attribute out as XML source, expanding the name - # - # a = Attribute.new( "x", "y" ) - # a.to_string # -> "x='y'" - # b = Attribute.new( "ns:x", "y" ) - # b.to_string # -> "ns:x='y'" - def to_string - if @element and @element.context and @element.context[:attribute_quote] == :quote - %Q^#@expanded_name="#{to_s().gsub(/"/, '"')}"^ - else - "#@expanded_name='#{to_s().gsub(/'/, ''')}'" - end - end - - def doctype - if @element - doc = @element.document - doc.doctype if doc - end - end - - # Returns the attribute value, with entities replaced - def to_s - return @normalized if @normalized - - @normalized = Text::normalize( @unnormalized, doctype ) - @unnormalized = nil - @normalized - end - - # Returns the UNNORMALIZED value of this attribute. That is, entities - # have been expanded to their values - def value - return @unnormalized if @unnormalized - @unnormalized = Text::unnormalize( @normalized, doctype ) - @normalized = nil - @unnormalized - end - - # Returns a copy of this attribute - def clone - Attribute.new self - end - - # Sets the element of which this object is an attribute. Normally, this - # is not directly called. - # - # Returns this attribute - def element=( element ) - @element = element - - if @normalized - Text.check( @normalized, NEEDS_A_SECOND_CHECK, doctype ) - end - - self - end - - # Removes this Attribute from the tree, and returns true if successful - # - # This method is usually not called directly. - def remove - @element.attributes.delete self.name unless @element.nil? - end - - # Writes this attribute (EG, puts 'key="value"' to the output) - def write( output, indent=-1 ) - output << to_string - end - - def node_type - :attribute - end - - def inspect - rv = "" - write( rv ) - rv - end - - def xpath - path = @element.xpath - path += "/@#{self.expanded_name}" - return path - end - end -end -#vim:ts=2 sw=2 noexpandtab: diff --git a/lib/rexml/cdata.rb b/lib/rexml/cdata.rb deleted file mode 100644 index 997f5a08db..0000000000 --- a/lib/rexml/cdata.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: false -require_relative "text" - -module REXML - class CData < Text - START = '' - ILLEGAL = /(\]\]>)/ - - # Constructor. CData is data between - # - # _Examples_ - # CData.new( source ) - # CData.new( "Here is some CDATA" ) - # CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element ) - def initialize( first, whitespace=true, parent=nil ) - super( first, whitespace, parent, false, true, ILLEGAL ) - end - - # Make a copy of this object - # - # _Examples_ - # c = CData.new( "Some text" ) - # d = c.clone - # d.to_s # -> "Some text" - def clone - CData.new self - end - - # Returns the content of this CData object - # - # _Examples_ - # c = CData.new( "Some text" ) - # c.to_s # -> "Some text" - def to_s - @string - end - - def value - @string - end - - # == DEPRECATED - # See the rexml/formatters package - # - # Generates XML output of this object - # - # output:: - # Where to write the string. Defaults to $stdout - # indent:: - # The amount to indent this node by - # transitive:: - # Ignored - # ie_hack:: - # Ignored - # - # _Examples_ - # c = CData.new( " Some text " ) - # c.write( $stdout ) #-> - def write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) - Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1) - indent( output, indent ) - output << START - output << @string - output << STOP - end - end -end diff --git a/lib/rexml/child.rb b/lib/rexml/child.rb deleted file mode 100644 index cc6e9a4719..0000000000 --- a/lib/rexml/child.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: false -require_relative "node" - -module REXML - ## - # A Child object is something contained by a parent, and this class - # contains methods to support that. Most user code will not use this - # class directly. - class Child - include Node - attr_reader :parent # The Parent of this object - - # Constructor. Any inheritors of this class should call super to make - # sure this method is called. - # parent:: - # if supplied, the parent of this child will be set to the - # supplied value, and self will be added to the parent - def initialize( parent = nil ) - @parent = nil - # Declare @parent, but don't define it. The next line sets the - # parent. - parent.add( self ) if parent - end - - # Replaces this object with another object. Basically, calls - # Parent.replace_child - # - # Returns:: self - def replace_with( child ) - @parent.replace_child( self, child ) - self - end - - # Removes this child from the parent. - # - # Returns:: self - def remove - unless @parent.nil? - @parent.delete self - end - self - end - - # Sets the parent of this child to the supplied argument. - # - # other:: - # Must be a Parent object. If this object is the same object as the - # existing parent of this child, no action is taken. Otherwise, this - # child is removed from the current parent (if one exists), and is added - # to the new parent. - # Returns:: The parent added - def parent=( other ) - return @parent if @parent == other - @parent.delete self if defined? @parent and @parent - @parent = other - end - - alias :next_sibling :next_sibling_node - alias :previous_sibling :previous_sibling_node - - # Sets the next sibling of this child. This can be used to insert a child - # after some other child. - # a = Element.new("a") - # b = a.add_element("b") - # c = Element.new("c") - # b.next_sibling = c - # # => - def next_sibling=( other ) - parent.insert_after self, other - end - - # Sets the previous sibling of this child. This can be used to insert a - # child before some other child. - # a = Element.new("a") - # b = a.add_element("b") - # c = Element.new("c") - # b.previous_sibling = c - # # => - def previous_sibling=(other) - parent.insert_before self, other - end - - # Returns:: the document this child belongs to, or nil if this child - # belongs to no document - def document - return parent.document unless parent.nil? - nil - end - - # This doesn't yet handle encodings - def bytes - document.encoding - - to_s - end - end -end diff --git a/lib/rexml/comment.rb b/lib/rexml/comment.rb deleted file mode 100644 index 52c58b46f6..0000000000 --- a/lib/rexml/comment.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: false -require_relative "child" - -module REXML - ## - # Represents an XML comment; that is, text between \ - class Comment < Child - include Comparable - START = "" - - # The content text - - attr_accessor :string - - ## - # Constructor. The first argument can be one of three types: - # @param first If String, the contents of this comment are set to the - # argument. If Comment, the argument is duplicated. If - # Source, the argument is scanned for a comment. - # @param second If the first argument is a Source, this argument - # should be nil, not supplied, or a Parent to be set as the parent - # of this object - def initialize( first, second = nil ) - super(second) - if first.kind_of? String - @string = first - elsif first.kind_of? Comment - @string = first.string - end - end - - def clone - Comment.new self - end - - # == DEPRECATED - # See REXML::Formatters - # - # output:: - # Where to write the string - # indent:: - # An integer. If -1, no indenting will be used; otherwise, the - # indentation will be this number of spaces, and children will be - # indented an additional amount. - # transitive:: - # Ignored by this class. The contents of comments are never modified. - # ie_hack:: - # Needed for conformity to the child API, but not used by this class. - def write( output, indent=-1, transitive=false, ie_hack=false ) - Kernel.warn("Comment.write is deprecated. See REXML::Formatters", uplevel: 1) - indent( output, indent ) - output << START - output << @string - output << STOP - end - - alias :to_s :string - - ## - # Compares this Comment to another; the contents of the comment are used - # in the comparison. - def <=>(other) - other.to_s <=> @string - end - - ## - # Compares this Comment to another; the contents of the comment are used - # in the comparison. - def ==( other ) - other.kind_of? Comment and - (other <=> self) == 0 - end - - def node_type - :comment - end - end -end -#vim:ts=2 sw=2 noexpandtab: diff --git a/lib/rexml/doctype.rb b/lib/rexml/doctype.rb deleted file mode 100644 index 757b639639..0000000000 --- a/lib/rexml/doctype.rb +++ /dev/null @@ -1,287 +0,0 @@ -# frozen_string_literal: false -require_relative "parent" -require_relative "parseexception" -require_relative "namespace" -require_relative 'entity' -require_relative 'attlistdecl' -require_relative 'xmltokens' - -module REXML - # Represents an XML DOCTYPE declaration; that is, the contents of . DOCTYPES can be used to declare the DTD of a document, as well as - # being used to declare entities used in the document. - class DocType < Parent - include XMLTokens - START = "" - SYSTEM = "SYSTEM" - PUBLIC = "PUBLIC" - DEFAULT_ENTITIES = { - 'gt'=>EntityConst::GT, - 'lt'=>EntityConst::LT, - 'quot'=>EntityConst::QUOT, - "apos"=>EntityConst::APOS - } - - # name is the name of the doctype - # external_id is the referenced DTD, if given - attr_reader :name, :external_id, :entities, :namespaces - - # Constructor - # - # dt = DocType.new( 'foo', '-//I/Hate/External/IDs' ) - # # - # dt = DocType.new( doctype_to_clone ) - # # Incomplete. Shallow clone of doctype - # - # +Note+ that the constructor: - # - # Doctype.new( Source.new( "" ) ) - # - # is _deprecated_. Do not use it. It will probably disappear. - def initialize( first, parent=nil ) - @entities = DEFAULT_ENTITIES - @long_name = @uri = nil - if first.kind_of? String - super() - @name = first - @external_id = parent - elsif first.kind_of? DocType - super( parent ) - @name = first.name - @external_id = first.external_id - elsif first.kind_of? Array - super( parent ) - @name = first[0] - @external_id = first[1] - @long_name = first[2] - @uri = first[3] - elsif first.kind_of? Source - super( parent ) - parser = Parsers::BaseParser.new( first ) - event = parser.pull - if event[0] == :start_doctype - @name, @external_id, @long_name, @uri, = event[1..-1] - end - else - super() - end - end - - def node_type - :doctype - end - - def attributes_of element - rv = [] - each do |child| - child.each do |key,val| - rv << Attribute.new(key,val) - end if child.kind_of? AttlistDecl and child.element_name == element - end - rv - end - - def attribute_of element, attribute - att_decl = find do |child| - child.kind_of? AttlistDecl and - child.element_name == element and - child.include? attribute - end - return nil unless att_decl - att_decl[attribute] - end - - def clone - DocType.new self - end - - # output:: - # Where to write the string - # indent:: - # An integer. If -1, no indentation will be used; otherwise, the - # indentation will be this number of spaces, and children will be - # indented an additional amount. - # transitive:: - # Ignored - # ie_hack:: - # Ignored - def write( output, indent=0, transitive=false, ie_hack=false ) - f = REXML::Formatters::Default.new - c = context - if c and c[:prologue_quote] == :apostrophe - quote = "'" - else - quote = "\"" - end - indent( output, indent ) - output << START - output << ' ' - output << @name - output << " #{@external_id}" if @external_id - output << " #{quote}#{@long_name}#{quote}" if @long_name - output << " #{quote}#{@uri}#{quote}" if @uri - unless @children.empty? - output << ' [' - @children.each { |child| - output << "\n" - f.write( child, output ) - } - output << "\n]" - end - output << STOP - end - - def context - if @parent - @parent.context - else - nil - end - end - - def entity( name ) - @entities[name].unnormalized if @entities[name] - end - - def add child - super(child) - @entities = DEFAULT_ENTITIES.clone if @entities == DEFAULT_ENTITIES - @entities[ child.name ] = child if child.kind_of? Entity - end - - # This method retrieves the public identifier identifying the document's - # DTD. - # - # Method contributed by Henrik Martensson - def public - case @external_id - when "SYSTEM" - nil - when "PUBLIC" - strip_quotes(@long_name) - end - end - - # This method retrieves the system identifier identifying the document's DTD - # - # Method contributed by Henrik Martensson - def system - case @external_id - when "SYSTEM" - strip_quotes(@long_name) - when "PUBLIC" - @uri.kind_of?(String) ? strip_quotes(@uri) : nil - end - end - - # This method returns a list of notations that have been declared in the - # _internal_ DTD subset. Notations in the external DTD subset are not - # listed. - # - # Method contributed by Henrik Martensson - def notations - children().select {|node| node.kind_of?(REXML::NotationDecl)} - end - - # Retrieves a named notation. Only notations declared in the internal - # DTD subset can be retrieved. - # - # Method contributed by Henrik Martensson - def notation(name) - notations.find { |notation_decl| - notation_decl.name == name - } - end - - private - - # Method contributed by Henrik Martensson - def strip_quotes(quoted_string) - quoted_string =~ /^[\'\"].*[\'\"]$/ ? - quoted_string[1, quoted_string.length-2] : - quoted_string - end - end - - # We don't really handle any of these since we're not a validating - # parser, so we can be pretty dumb about them. All we need to be able - # to do is spew them back out on a write() - - # This is an abstract class. You never use this directly; it serves as a - # parent class for the specific declarations. - class Declaration < Child - def initialize src - super() - @string = src - end - - def to_s - @string+'>' - end - - # == DEPRECATED - # See REXML::Formatters - # - def write( output, indent ) - output << to_s - end - end - - public - class ElementDecl < Declaration - def initialize( src ) - super - end - end - - class ExternalEntity < Child - def initialize( src ) - super() - @entity = src - end - def to_s - @entity - end - def write( output, indent ) - output << @entity - end - end - - class NotationDecl < Child - attr_accessor :public, :system - def initialize name, middle, pub, sys - super(nil) - @name = name - @middle = middle - @public = pub - @system = sys - end - - def to_s - c = nil - c = parent.context if parent - if c and c[:prologue_quote] == :apostrophe - quote = "'" - else - quote = "\"" - end - notation = "" - notation - end - - def write( output, indent=-1 ) - output << to_s - end - - # This method retrieves the name of the notation. - # - # Method contributed by Henrik Martensson - def name - @name - end - end -end diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb deleted file mode 100644 index adec293066..0000000000 --- a/lib/rexml/document.rb +++ /dev/null @@ -1,291 +0,0 @@ -# frozen_string_literal: false -require_relative "security" -require_relative "element" -require_relative "xmldecl" -require_relative "source" -require_relative "comment" -require_relative "doctype" -require_relative "instruction" -require_relative "rexml" -require_relative "parseexception" -require_relative "output" -require_relative "parsers/baseparser" -require_relative "parsers/streamparser" -require_relative "parsers/treeparser" - -module REXML - # Represents a full XML document, including PIs, a doctype, etc. A - # Document has a single child that can be accessed by root(). - # Note that if you want to have an XML declaration written for a document - # you create, you must add one; REXML documents do not write a default - # declaration for you. See |DECLARATION| and |write|. - class Document < Element - # A convenient default XML declaration. If you want an XML declaration, - # the easiest way to add one is mydoc << Document::DECLARATION - # +DEPRECATED+ - # Use: mydoc << XMLDecl.default - DECLARATION = XMLDecl.default - - # Constructor - # @param source if supplied, must be a Document, String, or IO. - # Documents have their context and Element attributes cloned. - # Strings are expected to be valid XML documents. IOs are expected - # to be sources of valid XML documents. - # @param context if supplied, contains the context of the document; - # this should be a Hash. - def initialize( source = nil, context = {} ) - @entity_expansion_count = 0 - super() - @context = context - return if source.nil? - if source.kind_of? Document - @context = source.context - super source - else - build( source ) - end - end - - def node_type - :document - end - - # Should be obvious - def clone - Document.new self - end - - # According to the XML spec, a root node has no expanded name - def expanded_name - '' - #d = doc_type - #d ? d.name : "UNDEFINED" - end - - alias :name :expanded_name - - # We override this, because XMLDecls and DocTypes must go at the start - # of the document - def add( child ) - if child.kind_of? XMLDecl - if @children[0].kind_of? XMLDecl - @children[0] = child - else - @children.unshift child - end - child.parent = self - elsif child.kind_of? DocType - # Find first Element or DocType node and insert the decl right - # before it. If there is no such node, just insert the child at the - # end. If there is a child and it is an DocType, then replace it. - insert_before_index = @children.find_index { |x| - x.kind_of?(Element) || x.kind_of?(DocType) - } - if insert_before_index # Not null = not end of list - if @children[ insert_before_index ].kind_of? DocType - @children[ insert_before_index ] = child - else - @children[ insert_before_index-1, 0 ] = child - end - else # Insert at end of list - @children << child - end - child.parent = self - else - rv = super - raise "attempted adding second root element to document" if @elements.size > 1 - rv - end - end - alias :<< :add - - def add_element(arg=nil, arg2=nil) - rv = super - raise "attempted adding second root element to document" if @elements.size > 1 - rv - end - - # @return the root Element of the document, or nil if this document - # has no children. - def root - elements[1] - #self - #@children.find { |item| item.kind_of? Element } - end - - # @return the DocType child of the document, if one exists, - # and nil otherwise. - def doctype - @children.find { |item| item.kind_of? DocType } - end - - # @return the XMLDecl of this document; if no XMLDecl has been - # set, the default declaration is returned. - def xml_decl - rv = @children[0] - return rv if rv.kind_of? XMLDecl - @children.unshift(XMLDecl.default)[0] - end - - # @return the XMLDecl version of this document as a String. - # If no XMLDecl has been set, returns the default version. - def version - xml_decl().version - end - - # @return the XMLDecl encoding of this document as an - # Encoding object. - # If no XMLDecl has been set, returns the default encoding. - def encoding - xml_decl().encoding - end - - # @return the XMLDecl standalone value of this document as a String. - # If no XMLDecl has been set, returns the default setting. - def stand_alone? - xml_decl().stand_alone? - end - - # :call-seq: - # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil) - # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil}) - # - # Write the XML tree out, optionally with indent. This writes out the - # entire XML document, including XML declarations, doctype declarations, - # and processing instructions (if any are given). - # - # A controversial point is whether Document should always write the XML - # declaration () whether or not one is given by the - # user (or source document). REXML does not write one if one was not - # specified, because it adds unnecessary bandwidth to applications such - # as XML-RPC. - # - # Accept Nth argument style and options Hash style as argument. - # The recommended style is options Hash style for one or more - # arguments case. - # - # _Examples_ - # Document.new("").write - # - # output = "" - # Document.new("").write(output) - # - # output = "" - # Document.new("").write(:output => output, :indent => 2) - # - # See also the classes in the rexml/formatters package for the proper way - # to change the default formatting of XML output. - # - # _Examples_ - # - # output = "" - # tr = Transitive.new - # tr.write(Document.new(""), output) - # - # output:: - # output an object which supports '<< string'; this is where the - # document will be written. - # indent:: - # An integer. If -1, no indenting will be used; otherwise, the - # indentation will be twice this number of spaces, and children will be - # indented an additional amount. For a value of 3, every item will be - # indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1 - # transitive:: - # If transitive is true and indent is >= 0, then the output will be - # pretty-printed in such a way that the added whitespace does not affect - # the absolute *value* of the document -- that is, it leaves the value - # and number of Text nodes in the document unchanged. - # ie_hack:: - # This hack inserts a space before the /> on empty tags to address - # a limitation of Internet Explorer. Defaults to false - # encoding:: - # Encoding name as String. Change output encoding to specified encoding - # instead of encoding in XML declaration. - # Defaults to nil. It means encoding in XML declaration is used. - def write(*arguments) - if arguments.size == 1 and arguments[0].class == Hash - options = arguments[0] - - output = options[:output] - indent = options[:indent] - transitive = options[:transitive] - ie_hack = options[:ie_hack] - encoding = options[:encoding] - else - output, indent, transitive, ie_hack, encoding, = *arguments - end - - output ||= $stdout - indent ||= -1 - transitive = false if transitive.nil? - ie_hack = false if ie_hack.nil? - encoding ||= xml_decl.encoding - - if encoding != 'UTF-8' && !output.kind_of?(Output) - output = Output.new( output, encoding ) - end - formatter = if indent > -1 - if transitive - require_relative "formatters/transitive" - REXML::Formatters::Transitive.new( indent, ie_hack ) - else - REXML::Formatters::Pretty.new( indent, ie_hack ) - end - else - REXML::Formatters::Default.new( ie_hack ) - end - formatter.write( self, output ) - end - - - def Document::parse_stream( source, listener ) - Parsers::StreamParser.new( source, listener ).parse - end - - # Set the entity expansion limit. By default the limit is set to 10000. - # - # Deprecated. Use REXML::Security.entity_expansion_limit= instead. - def Document::entity_expansion_limit=( val ) - Security.entity_expansion_limit = val - end - - # Get the entity expansion limit. By default the limit is set to 10000. - # - # Deprecated. Use REXML::Security.entity_expansion_limit= instead. - def Document::entity_expansion_limit - return Security.entity_expansion_limit - end - - # Set the entity expansion limit. By default the limit is set to 10240. - # - # Deprecated. Use REXML::Security.entity_expansion_text_limit= instead. - def Document::entity_expansion_text_limit=( val ) - Security.entity_expansion_text_limit = val - end - - # Get the entity expansion limit. By default the limit is set to 10240. - # - # Deprecated. Use REXML::Security.entity_expansion_text_limit instead. - def Document::entity_expansion_text_limit - return Security.entity_expansion_text_limit - end - - attr_reader :entity_expansion_count - - def record_entity_expansion - @entity_expansion_count += 1 - if @entity_expansion_count > Security.entity_expansion_limit - raise "number of entity expansions exceeded, processing aborted." - end - end - - def document - self - end - - private - def build( source ) - Parsers::TreeParser.new( source, self ).parse - end - end -end diff --git a/lib/rexml/dtd/attlistdecl.rb b/lib/rexml/dtd/attlistdecl.rb deleted file mode 100644 index 1326cb21e4..0000000000 --- a/lib/rexml/dtd/attlistdecl.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: false -require_relative "../child" -module REXML - module DTD - class AttlistDecl < Child - START = ")/um - end - end -end diff --git a/lib/rexml/dtd/dtd.rb b/lib/rexml/dtd/dtd.rb deleted file mode 100644 index 8b0f2d753a..0000000000 --- a/lib/rexml/dtd/dtd.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: false -require_relative "elementdecl" -require_relative "entitydecl" -require_relative "../comment" -require_relative "notationdecl" -require_relative "attlistdecl" -require_relative "../parent" - -module REXML - module DTD - class Parser - def Parser.parse( input ) - case input - when String - parse_helper input - when File - parse_helper input.read - end - end - - # Takes a String and parses it out - def Parser.parse_helper( input ) - contents = Parent.new - while input.size > 0 - case input - when ElementDecl.PATTERN_RE - match = $& - contents << ElementDecl.new( match ) - when AttlistDecl.PATTERN_RE - matchdata = $~ - contents << AttlistDecl.new( matchdata ) - when EntityDecl.PATTERN_RE - matchdata = $~ - contents << EntityDecl.new( matchdata ) - when Comment.PATTERN_RE - matchdata = $~ - contents << Comment.new( matchdata ) - when NotationDecl.PATTERN_RE - matchdata = $~ - contents << NotationDecl.new( matchdata ) - end - end - contents - end - end - end -end diff --git a/lib/rexml/dtd/elementdecl.rb b/lib/rexml/dtd/elementdecl.rb deleted file mode 100644 index 20ed023244..0000000000 --- a/lib/rexml/dtd/elementdecl.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: false -require_relative "../child" -module REXML - module DTD - class ElementDecl < Child - START = "/um - PATTERN_RE = /^\s*#{START}\s+((?:[:\w][-\.\w]*:)?[-!\*\.\w]*)(.*?)>/ - #\s*((((["']).*?\5)|[^\/'">]*)*?)(\/)?>/um, true) - - def initialize match - @name = match[1] - @rest = match[2] - end - end - end -end diff --git a/lib/rexml/dtd/entitydecl.rb b/lib/rexml/dtd/entitydecl.rb deleted file mode 100644 index 312df655ff..0000000000 --- a/lib/rexml/dtd/entitydecl.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: false -require_relative "../child" -module REXML - module DTD - class EntityDecl < Child - START = "/um - SYSTEM = /^\s*#{START}\s+(?:%\s+)?(\w+)\s+SYSTEM\s+((["']).*?\3)(?:\s+NDATA\s+\w+)?\s*>/um - PLAIN = /^\s*#{START}\s+(\w+)\s+((["']).*?\3)\s*>/um - PERCENT = /^\s*#{START}\s+%\s+(\w+)\s+((["']).*?\3)\s*>/um - # - # - def initialize src - super() - md = nil - if src.match( PUBLIC ) - md = src.match( PUBLIC, true ) - @middle = "PUBLIC" - @content = "#{md[2]} #{md[4]}" - elsif src.match( SYSTEM ) - md = src.match( SYSTEM, true ) - @middle = "SYSTEM" - @content = md[2] - elsif src.match( PLAIN ) - md = src.match( PLAIN, true ) - @middle = "" - @content = md[2] - elsif src.match( PERCENT ) - md = src.match( PERCENT, true ) - @middle = "" - @content = md[2] - end - raise ParseException.new("failed Entity match", src) if md.nil? - @name = md[1] - end - - def to_s - rv = " 0 - rv << @content - rv - end - - def write( output, indent ) - indent( output, indent ) - output << to_s - end - - def EntityDecl.parse_source source, listener - md = source.match( PATTERN_RE, true ) - thing = md[0].squeeze(" \t\n\r") - listener.send inspect.downcase, thing - end - end - end -end diff --git a/lib/rexml/dtd/notationdecl.rb b/lib/rexml/dtd/notationdecl.rb deleted file mode 100644 index 04a9b08aa7..0000000000 --- a/lib/rexml/dtd/notationdecl.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: false -require_relative "../child" -module REXML - module DTD - class NotationDecl < Child - START = "/um - SYSTEM = /^\s*#{START}\s+(\w[\w-]*)\s+(SYSTEM)\s+((["']).*?\4)\s*>/um - def initialize src - super() - if src.match( PUBLIC ) - md = src.match( PUBLIC, true ) - elsif src.match( SYSTEM ) - md = src.match( SYSTEM, true ) - else - raise ParseException.new( "error parsing notation: no matching pattern", src ) - end - @name = md[1] - @middle = md[2] - @rest = md[3] - end - - def to_s - "" - end - - def write( output, indent ) - indent( output, indent ) - output << to_s - end - - def NotationDecl.parse_source source, listener - md = source.match( PATTERN_RE, true ) - thing = md[0].squeeze(" \t\n\r") - listener.send inspect.downcase, thing - end - end - end -end diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb deleted file mode 100644 index c706a7c245..0000000000 --- a/lib/rexml/element.rb +++ /dev/null @@ -1,1269 +0,0 @@ -# frozen_string_literal: false -require_relative "parent" -require_relative "namespace" -require_relative "attribute" -require_relative "cdata" -require_relative "xpath" -require_relative "parseexception" - -module REXML - # An implementation note about namespaces: - # As we parse, when we find namespaces we put them in a hash and assign - # them a unique ID. We then convert the namespace prefix for the node - # to the unique ID. This makes namespace lookup much faster for the - # cost of extra memory use. We save the namespace prefix for the - # context node and convert it back when we write it. - @@namespaces = {} - - # Represents a tagged XML element. Elements are characterized by - # having children, attributes, and names, and can themselves be - # children. - class Element < Parent - include Namespace - - UNDEFINED = "UNDEFINED"; # The default name - - # Mechanisms for accessing attributes and child elements of this - # element. - attr_reader :attributes, :elements - # The context holds information about the processing environment, such as - # whitespace handling. - attr_accessor :context - - # Constructor - # arg:: - # if not supplied, will be set to the default value. - # If a String, the name of this object will be set to the argument. - # If an Element, the object will be shallowly cloned; name, - # attributes, and namespaces will be copied. Children will +not+ be - # copied. - # parent:: - # if supplied, must be a Parent, and will be used as - # the parent of this object. - # context:: - # If supplied, must be a hash containing context items. Context items - # include: - # * :respect_whitespace the value of this is :+all+ or an array of - # strings being the names of the elements to respect - # whitespace for. Defaults to :+all+. - # * :compress_whitespace the value can be :+all+ or an array of - # strings being the names of the elements to ignore whitespace on. - # Overrides :+respect_whitespace+. - # * :ignore_whitespace_nodes the value can be :+all+ or an array - # of strings being the names of the elements in which to ignore - # whitespace-only nodes. If this is set, Text nodes which contain only - # whitespace will not be added to the document tree. - # * :raw can be :+all+, or an array of strings being the names of - # the elements to process in raw mode. In raw mode, special - # characters in text is not converted to or from entities. - def initialize( arg = UNDEFINED, parent=nil, context=nil ) - super(parent) - - @elements = Elements.new(self) - @attributes = Attributes.new(self) - @context = context - - if arg.kind_of? String - self.name = arg - elsif arg.kind_of? Element - self.name = arg.expanded_name - arg.attributes.each_attribute{ |attribute| - @attributes << Attribute.new( attribute ) - } - @context = arg.context - end - end - - def inspect - rv = "<#@expanded_name" - - @attributes.each_attribute do |attr| - rv << " " - attr.write( rv, 0 ) - end - - if children.size > 0 - rv << "> ... " - else - rv << "/>" - end - end - - - # Creates a shallow copy of self. - # d = Document.new "" - # new_a = d.root.clone - # puts new_a # => "" - def clone - self.class.new self - end - - # Evaluates to the root node of the document that this element - # belongs to. If this element doesn't belong to a document, but does - # belong to another Element, the parent's root will be returned, until the - # earliest ancestor is found. - # - # Note that this is not the same as the document element. - # In the following example, is the document element, and the root - # node is the parent node of the document element. You may ask yourself - # why the root node is useful: consider the doctype and XML declaration, - # and any processing instructions before the document element... they - # are children of the root node, or siblings of the document element. - # The only time this isn't true is when an Element is created that is - # not part of any Document. In this case, the ancestor that has no - # parent acts as the root node. - # d = Document.new '' - # a = d[1] ; c = a[1][1] - # d.root_node == d # TRUE - # a.root_node # namely, d - # c.root_node # again, d - def root_node - parent.nil? ? self : parent.root_node - end - - def root - return elements[1] if self.kind_of? Document - return self if parent.kind_of? Document or parent.nil? - return parent.root - end - - # Evaluates to the document to which this element belongs, or nil if this - # element doesn't belong to a document. - def document - rt = root - rt.parent if rt - end - - # Evaluates to +true+ if whitespace is respected for this element. This - # is the case if: - # 1. Neither :+respect_whitespace+ nor :+compress_whitespace+ has any value - # 2. The context has :+respect_whitespace+ set to :+all+ or - # an array containing the name of this element, and - # :+compress_whitespace+ isn't set to :+all+ or an array containing the - # name of this element. - # The evaluation is tested against +expanded_name+, and so is namespace - # sensitive. - def whitespace - @whitespace = nil - if @context - if @context[:respect_whitespace] - @whitespace = (@context[:respect_whitespace] == :all or - @context[:respect_whitespace].include? expanded_name) - end - @whitespace = false if (@context[:compress_whitespace] and - (@context[:compress_whitespace] == :all or - @context[:compress_whitespace].include? expanded_name) - ) - end - @whitespace = true unless @whitespace == false - @whitespace - end - - def ignore_whitespace_nodes - @ignore_whitespace_nodes = false - if @context - if @context[:ignore_whitespace_nodes] - @ignore_whitespace_nodes = - (@context[:ignore_whitespace_nodes] == :all or - @context[:ignore_whitespace_nodes].include? expanded_name) - end - end - end - - # Evaluates to +true+ if raw mode is set for this element. This - # is the case if the context has :+raw+ set to :+all+ or - # an array containing the name of this element. - # - # The evaluation is tested against +expanded_name+, and so is namespace - # sensitive. - def raw - @raw = (@context and @context[:raw] and - (@context[:raw] == :all or - @context[:raw].include? expanded_name)) - @raw - end - - #once :whitespace, :raw, :ignore_whitespace_nodes - - ################################################# - # Namespaces # - ################################################# - - # Evaluates to an +Array+ containing the prefixes (names) of all defined - # namespaces at this context node. - # doc = Document.new("") - # doc.elements['//b'].prefixes # -> ['x', 'y'] - def prefixes - prefixes = [] - prefixes = parent.prefixes if parent - prefixes |= attributes.prefixes - return prefixes - end - - def namespaces - namespaces = {} - namespaces = parent.namespaces if parent - namespaces = namespaces.merge( attributes.namespaces ) - return namespaces - end - - # Evaluates to the URI for a prefix, or the empty string if no such - # namespace is declared for this element. Evaluates recursively for - # ancestors. Returns the default namespace, if there is one. - # prefix:: - # the prefix to search for. If not supplied, returns the default - # namespace if one exists - # Returns:: - # the namespace URI as a String, or nil if no such namespace - # exists. If the namespace is undefined, returns an empty string - # doc = Document.new("") - # b = doc.elements['//b'] - # b.namespace # -> '1' - # b.namespace("y") # -> '2' - def namespace(prefix=nil) - if prefix.nil? - prefix = prefix() - end - if prefix == '' - prefix = "xmlns" - else - prefix = "xmlns:#{prefix}" unless prefix[0,5] == 'xmlns' - end - ns = attributes[ prefix ] - ns = parent.namespace(prefix) if ns.nil? and parent - ns = '' if ns.nil? and prefix == 'xmlns' - return ns - end - - # Adds a namespace to this element. - # prefix:: - # the prefix string, or the namespace URI if +uri+ is not - # supplied - # uri:: - # the namespace URI. May be nil, in which +prefix+ is used as - # the URI - # Evaluates to: this Element - # a = Element.new("a") - # a.add_namespace("xmlns:foo", "bar" ) - # a.add_namespace("foo", "bar") # shorthand for previous line - # a.add_namespace("twiddle") - # puts a #-> - def add_namespace( prefix, uri=nil ) - unless uri - @attributes["xmlns"] = prefix - else - prefix = "xmlns:#{prefix}" unless prefix =~ /^xmlns:/ - @attributes[ prefix ] = uri - end - self - end - - # Removes a namespace from this node. This only works if the namespace is - # actually declared in this node. If no argument is passed, deletes the - # default namespace. - # - # Evaluates to: this element - # doc = Document.new "" - # doc.root.delete_namespace - # puts doc # -> - # doc.root.delete_namespace 'foo' - # puts doc # -> - def delete_namespace namespace="xmlns" - namespace = "xmlns:#{namespace}" unless namespace == 'xmlns' - attribute = attributes.get_attribute(namespace) - attribute.remove unless attribute.nil? - self - end - - ################################################# - # Elements # - ################################################# - - # Adds a child to this element, optionally setting attributes in - # the element. - # element:: - # optional. If Element, the element is added. - # Otherwise, a new Element is constructed with the argument (see - # Element.initialize). - # attrs:: - # If supplied, must be a Hash containing String name,value - # pairs, which will be used to set the attributes of the new Element. - # Returns:: the Element that was added - # el = doc.add_element 'my-tag' - # el = doc.add_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'} - # el = Element.new 'my-tag' - # doc.add_element el - def add_element element, attrs=nil - raise "First argument must be either an element name, or an Element object" if element.nil? - el = @elements.add(element) - attrs.each do |key, value| - el.attributes[key]=value - end if attrs.kind_of? Hash - el - end - - # Deletes a child element. - # element:: - # Must be an +Element+, +String+, or +Integer+. If Element, - # the element is removed. If String, the element is found (via XPath) - # and removed. This means that any parent can remove any - # descendant. If Integer, the Element indexed by that number will be - # removed. - # Returns:: the element that was removed. - # doc.delete_element "/a/b/c[@id='4']" - # doc.delete_element doc.elements["//k"] - # doc.delete_element 1 - def delete_element element - @elements.delete element - end - - # Evaluates to +true+ if this element has at least one child Element - # doc = Document.new "Text" - # doc.root.has_elements # -> true - # doc.elements["/a/b"].has_elements # -> false - # doc.elements["/a/c"].has_elements # -> false - def has_elements? - !@elements.empty? - end - - # Iterates through the child elements, yielding for each Element that - # has a particular attribute set. - # key:: - # the name of the attribute to search for - # value:: - # the value of the attribute - # max:: - # (optional) causes this method to return after yielding - # for this number of matching children - # name:: - # (optional) if supplied, this is an XPath that filters - # the children to check. - # - # doc = Document.new "" - # # Yields b, c, d - # doc.root.each_element_with_attribute( 'id' ) {|e| p e} - # # Yields b, d - # doc.root.each_element_with_attribute( 'id', '1' ) {|e| p e} - # # Yields b - # doc.root.each_element_with_attribute( 'id', '1', 1 ) {|e| p e} - # # Yields d - # doc.root.each_element_with_attribute( 'id', '1', 0, 'd' ) {|e| p e} - def each_element_with_attribute( key, value=nil, max=0, name=nil, &block ) # :yields: Element - each_with_something( proc {|child| - if value.nil? - child.attributes[key] != nil - else - child.attributes[key]==value - end - }, max, name, &block ) - end - - # Iterates through the children, yielding for each Element that - # has a particular text set. - # text:: - # the text to search for. If nil, or not supplied, will iterate - # over all +Element+ children that contain at least one +Text+ node. - # max:: - # (optional) causes this method to return after yielding - # for this number of matching children - # name:: - # (optional) if supplied, this is an XPath that filters - # the children to check. - # - # doc = Document.new 'bbd' - # # Yields b, c, d - # doc.each_element_with_text {|e|p e} - # # Yields b, c - # doc.each_element_with_text('b'){|e|p e} - # # Yields b - # doc.each_element_with_text('b', 1){|e|p e} - # # Yields d - # doc.each_element_with_text(nil, 0, 'd'){|e|p e} - def each_element_with_text( text=nil, max=0, name=nil, &block ) # :yields: Element - each_with_something( proc {|child| - if text.nil? - child.has_text? - else - child.text == text - end - }, max, name, &block ) - end - - # Synonym for Element.elements.each - def each_element( xpath=nil, &block ) # :yields: Element - @elements.each( xpath, &block ) - end - - # Synonym for Element.to_a - # This is a little slower than calling elements.each directly. - # xpath:: any XPath by which to search for elements in the tree - # Returns:: an array of Elements that match the supplied path - def get_elements( xpath ) - @elements.to_a( xpath ) - end - - # Returns the next sibling that is an element, or nil if there is - # no Element sibling after this one - # doc = Document.new 'text' - # doc.root.elements['b'].next_element #-> - # doc.root.elements['c'].next_element #-> nil - def next_element - element = next_sibling - element = element.next_sibling until element.nil? or element.kind_of? Element - return element - end - - # Returns the previous sibling that is an element, or nil if there is - # no Element sibling prior to this one - # doc = Document.new 'text' - # doc.root.elements['c'].previous_element #-> - # doc.root.elements['b'].previous_element #-> nil - def previous_element - element = previous_sibling - element = element.previous_sibling until element.nil? or element.kind_of? Element - return element - end - - - ################################################# - # Text # - ################################################# - - # Evaluates to +true+ if this element has at least one Text child - def has_text? - not text().nil? - end - - # A convenience method which returns the String value of the _first_ - # child text element, if one exists, and +nil+ otherwise. - # - # Note that an element may have multiple Text elements, perhaps - # separated by other children. Be aware that this method only returns - # the first Text node. - # - # This method returns the +value+ of the first text child node, which - # ignores the +raw+ setting, so always returns normalized text. See - # the Text::value documentation. - # - # doc = Document.new "

some text this is bold! more text

" - # # The element 'p' has two text elements, "some text " and " more text". - # doc.root.text #-> "some text " - def text( path = nil ) - rv = get_text(path) - return rv.value unless rv.nil? - nil - end - - # Returns the first child Text node, if any, or +nil+ otherwise. - # This method returns the actual +Text+ node, rather than the String content. - # doc = Document.new "

some text this is bold! more text

" - # # The element 'p' has two text elements, "some text " and " more text". - # doc.root.get_text.value #-> "some text " - def get_text path = nil - rv = nil - if path - element = @elements[ path ] - rv = element.get_text unless element.nil? - else - rv = @children.find { |node| node.kind_of? Text } - end - return rv - end - - # Sets the first Text child of this object. See text() for a - # discussion about Text children. - # - # If a Text child already exists, the child is replaced by this - # content. This means that Text content can be deleted by calling - # this method with a nil argument. In this case, the next Text - # child becomes the first Text child. In no case is the order of - # any siblings disturbed. - # text:: - # If a String, a new Text child is created and added to - # this Element as the first Text child. If Text, the text is set - # as the first Child element. If nil, then any existing first Text - # child is removed. - # Returns:: this Element. - # doc = Document.new '' - # doc.root.text = 'Sean' #-> 'Sean' - # doc.root.text = 'Elliott' #-> 'Elliott' - # doc.root.add_element 'c' #-> 'Elliott' - # doc.root.text = 'Russell' #-> 'Russell' - # doc.root.text = nil #-> '' - def text=( text ) - if text.kind_of? String - text = Text.new( text, whitespace(), nil, raw() ) - elsif !text.nil? and !text.kind_of? Text - text = Text.new( text.to_s, whitespace(), nil, raw() ) - end - old_text = get_text - if text.nil? - old_text.remove unless old_text.nil? - else - if old_text.nil? - self << text - else - old_text.replace_with( text ) - end - end - return self - end - - # A helper method to add a Text child. Actual Text instances can - # be added with regular Parent methods, such as add() and <<() - # text:: - # if a String, a new Text instance is created and added - # to the parent. If Text, the object is added directly. - # Returns:: this Element - # e = Element.new('a') #-> - # e.add_text 'foo' #-> foo - # e.add_text Text.new(' bar') #-> foo bar - # Note that at the end of this example, the branch has 3 nodes; the 'e' - # element and 2 Text node children. - def add_text( text ) - if text.kind_of? String - if @children[-1].kind_of? Text - @children[-1] << text - return - end - text = Text.new( text, whitespace(), nil, raw() ) - end - self << text unless text.nil? - return self - end - - def node_type - :element - end - - def xpath - path_elements = [] - cur = self - path_elements << __to_xpath_helper( self ) - while cur.parent - cur = cur.parent - path_elements << __to_xpath_helper( cur ) - end - return path_elements.reverse.join( "/" ) - end - - ################################################# - # Attributes # - ################################################# - - # Fetches an attribute value or a child. - # - # If String or Symbol is specified, it's treated as attribute - # name. Attribute value as String or +nil+ is returned. This case - # is shortcut of +attributes[name]+. - # - # If Integer is specified, it's treated as the index of - # child. It returns Nth child. - # - # doc = REXML::Document.new("") - # doc.root["attr"] # => "1" - # doc.root.attributes["attr"] # => "1" - # doc.root[1] # => - def [](name_or_index) - case name_or_index - when String - attributes[name_or_index] - when Symbol - attributes[name_or_index.to_s] - else - super - end - end - - def attribute( name, namespace=nil ) - prefix = nil - if namespaces.respond_to? :key - prefix = namespaces.key(namespace) if namespace - else - prefix = namespaces.index(namespace) if namespace - end - prefix = nil if prefix == 'xmlns' - - ret_val = - attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" ) - - return ret_val unless ret_val.nil? - return nil if prefix.nil? - - # now check that prefix'es namespace is not the same as the - # default namespace - return nil unless ( namespaces[ prefix ] == namespaces[ 'xmlns' ] ) - - attributes.get_attribute( name ) - - end - - # Evaluates to +true+ if this element has any attributes set, false - # otherwise. - def has_attributes? - return !@attributes.empty? - end - - # Adds an attribute to this element, overwriting any existing attribute - # by the same name. - # key:: - # can be either an Attribute or a String. If an Attribute, - # the attribute is added to the list of Element attributes. If String, - # the argument is used as the name of the new attribute, and the value - # parameter must be supplied. - # value:: - # Required if +key+ is a String, and ignored if the first argument is - # an Attribute. This is a String, and is used as the value - # of the new Attribute. This should be the unnormalized value of the - # attribute (without entities). - # Returns:: the Attribute added - # e = Element.new 'e' - # e.add_attribute( 'a', 'b' ) #-> - # e.add_attribute( 'x:a', 'c' ) #-> - # e.add_attribute Attribute.new('b', 'd') #-> - def add_attribute( key, value=nil ) - if key.kind_of? Attribute - @attributes << key - else - @attributes[key] = value - end - end - - # Add multiple attributes to this element. - # hash:: is either a hash, or array of arrays - # el.add_attributes( {"name1"=>"value1", "name2"=>"value2"} ) - # el.add_attributes( [ ["name1","value1"], ["name2"=>"value2"] ] ) - def add_attributes hash - if hash.kind_of? Hash - hash.each_pair {|key, value| @attributes[key] = value } - elsif hash.kind_of? Array - hash.each { |value| @attributes[ value[0] ] = value[1] } - end - end - - # Removes an attribute - # key:: - # either an Attribute or a String. In either case, the - # attribute is found by matching the attribute name to the argument, - # and then removed. If no attribute is found, no action is taken. - # Returns:: - # the attribute removed, or nil if this Element did not contain - # a matching attribute - # e = Element.new('E') - # e.add_attribute( 'name', 'Sean' ) #-> - # r = e.add_attribute( 'sur:name', 'Russell' ) #-> - # e.delete_attribute( 'name' ) #-> - # e.delete_attribute( r ) #-> - def delete_attribute(key) - attr = @attributes.get_attribute(key) - attr.remove unless attr.nil? - end - - ################################################# - # Other Utilities # - ################################################# - - # Get an array of all CData children. - # IMMUTABLE - def cdatas - find_all { |child| child.kind_of? CData }.freeze - end - - # Get an array of all Comment children. - # IMMUTABLE - def comments - find_all { |child| child.kind_of? Comment }.freeze - end - - # Get an array of all Instruction children. - # IMMUTABLE - def instructions - find_all { |child| child.kind_of? Instruction }.freeze - end - - # Get an array of all Text children. - # IMMUTABLE - def texts - find_all { |child| child.kind_of? Text }.freeze - end - - # == DEPRECATED - # See REXML::Formatters - # - # Writes out this element, and recursively, all children. - # output:: - # output an object which supports '<< string'; this is where the - # document will be written. - # indent:: - # An integer. If -1, no indenting will be used; otherwise, the - # indentation will be this number of spaces, and children will be - # indented an additional amount. Defaults to -1 - # transitive:: - # If transitive is true and indent is >= 0, then the output will be - # pretty-printed in such a way that the added whitespace does not affect - # the parse tree of the document - # ie_hack:: - # This hack inserts a space before the /> on empty tags to address - # a limitation of Internet Explorer. Defaults to false - # - # out = '' - # doc.write( out ) #-> doc is written to the string 'out' - # doc.write( $stdout ) #-> doc written to the console - def write(output=$stdout, indent=-1, transitive=false, ie_hack=false) - Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters", uplevel: 1) - formatter = if indent > -1 - if transitive - require_relative "formatters/transitive" - REXML::Formatters::Transitive.new( indent, ie_hack ) - else - REXML::Formatters::Pretty.new( indent, ie_hack ) - end - else - REXML::Formatters::Default.new( ie_hack ) - end - formatter.write( self, output ) - end - - - private - def __to_xpath_helper node - rv = node.expanded_name.clone - if node.parent - results = node.parent.find_all {|n| - n.kind_of?(REXML::Element) and n.expanded_name == node.expanded_name - } - if results.length > 1 - idx = results.index( node ) - rv << "[#{idx+1}]" - end - end - rv - end - - # A private helper method - def each_with_something( test, max=0, name=nil ) - num = 0 - @elements.each( name ){ |child| - yield child if test.call(child) and num += 1 - return if max>0 and num == max - } - end - end - - ######################################################################## - # ELEMENTS # - ######################################################################## - - # A class which provides filtering of children for Elements, and - # XPath search support. You are expected to only encounter this class as - # the element.elements object. Therefore, you are - # _not_ expected to instantiate this yourself. - class Elements - include Enumerable - # Constructor - # parent:: the parent Element - def initialize parent - @element = parent - end - - # Fetches a child element. Filters only Element children, regardless of - # the XPath match. - # index:: - # the search parameter. This is either an Integer, which - # will be used to find the index'th child Element, or an XPath, - # which will be used to search for the Element. Because - # of the nature of XPath searches, any element in the connected XML - # document can be fetched through any other element. The - # Integer index is 1-based, not 0-based. This means that the first - # child element is at index 1, not 0, and the +n+th element is at index - # +n+, not n-1. This is because XPath indexes element children - # starting from 1, not 0, and the indexes should be the same. - # name:: - # optional, and only used in the first argument is an - # Integer. In that case, the index'th child Element that has the - # supplied name will be returned. Note again that the indexes start at 1. - # Returns:: the first matching Element, or nil if no child matched - # doc = Document.new '' - # doc.root.elements[1] #-> - # doc.root.elements['c'] #-> - # doc.root.elements[2,'c'] #-> - def []( index, name=nil) - if index.kind_of? Integer - raise "index (#{index}) must be >= 1" if index < 1 - name = literalize(name) if name - num = 0 - @element.find { |child| - child.kind_of? Element and - (name.nil? ? true : child.has_name?( name )) and - (num += 1) == index - } - else - return XPath::first( @element, index ) - #{ |element| - # return element if element.kind_of? Element - #} - #return nil - end - end - - # Sets an element, replacing any previous matching element. If no - # existing element is found ,the element is added. - # index:: Used to find a matching element to replace. See [](). - # element:: - # The element to replace the existing element with - # the previous element - # Returns:: nil if no previous element was found. - # - # doc = Document.new '' - # doc.root.elements[10] = Element.new('b') #-> - # doc.root.elements[1] #-> - # doc.root.elements[1] = Element.new('c') #-> - # doc.root.elements['c'] = Element.new('d') #-> - def []=( index, element ) - previous = self[index] - if previous.nil? - @element.add element - else - previous.replace_with element - end - return previous - end - - # Returns +true+ if there are no +Element+ children, +false+ otherwise - def empty? - @element.find{ |child| child.kind_of? Element}.nil? - end - - # Returns the index of the supplied child (starting at 1), or -1 if - # the element is not a child - # element:: an +Element+ child - def index element - rv = 0 - found = @element.find do |child| - child.kind_of? Element and - (rv += 1) and - child == element - end - return rv if found == element - return -1 - end - - # Deletes a child Element - # element:: - # Either an Element, which is removed directly; an - # xpath, where the first matching child is removed; or an Integer, - # where the n'th Element is removed. - # Returns:: the removed child - # doc = Document.new '' - # b = doc.root.elements[1] - # doc.root.elements.delete b #-> - # doc.elements.delete("a/c[@id='1']") #-> - # doc.root.elements.delete 1 #-> - def delete element - if element.kind_of? Element - @element.delete element - else - el = self[element] - el.remove if el - end - end - - # Removes multiple elements. Filters for Element children, regardless of - # XPath matching. - # xpath:: all elements matching this String path are removed. - # Returns:: an Array of Elements that have been removed - # doc = Document.new '' - # deleted = doc.elements.delete_all 'a/c' #-> [, , , ] - def delete_all( xpath ) - rv = [] - XPath::each( @element, xpath) {|element| - rv << element if element.kind_of? Element - } - rv.each do |element| - @element.delete element - element.remove - end - return rv - end - - # Adds an element - # element:: - # if supplied, is either an Element, String, or - # Source (see Element.initialize). If not supplied or nil, a - # new, default Element will be constructed - # Returns:: the added Element - # a = Element.new('a') - # a.elements.add(Element.new('b')) #-> - # a.elements.add('c') #-> - def add element=nil - if element.nil? - Element.new("", self, @element.context) - elsif not element.kind_of?(Element) - Element.new(element, self, @element.context) - else - @element << element - element.context = @element.context - element - end - end - - alias :<< :add - - # Iterates through all of the child Elements, optionally filtering - # them by a given XPath - # xpath:: - # optional. If supplied, this is a String XPath, and is used to - # filter the children, so that only matching children are yielded. Note - # that XPaths are automatically filtered for Elements, so that - # non-Element children will not be yielded - # doc = Document.new 'sean' - # doc.root.elements.each {|e|p e} #-> Yields b, c, d, b, c, d elements - # doc.root.elements.each('b') {|e|p e} #-> Yields b, b elements - # doc.root.elements.each('child::node()') {|e|p e} - # #-> Yields , , , , , - # XPath.each(doc.root, 'child::node()', &block) - # #-> Yields , , , sean, , , - def each( xpath=nil ) - XPath::each( @element, xpath ) {|e| yield e if e.kind_of? Element } - end - - def collect( xpath=nil ) - collection = [] - XPath::each( @element, xpath ) {|e| - collection << yield(e) if e.kind_of?(Element) - } - collection - end - - def inject( xpath=nil, initial=nil ) - first = true - XPath::each( @element, xpath ) {|e| - if (e.kind_of? Element) - if (first and initial == nil) - initial = e - first = false - else - initial = yield( initial, e ) if e.kind_of? Element - end - end - } - initial - end - - # Returns the number of +Element+ children of the parent object. - # doc = Document.new 'seanelliottrussell' - # doc.root.size #-> 6, 3 element and 3 text nodes - # doc.root.elements.size #-> 3 - def size - count = 0 - @element.each {|child| count+=1 if child.kind_of? Element } - count - end - - # Returns an Array of Element children. An XPath may be supplied to - # filter the children. Only Element children are returned, even if the - # supplied XPath matches non-Element children. - # doc = Document.new 'seanelliott' - # doc.root.elements.to_a #-> [ , ] - # doc.root.elements.to_a("child::node()") #-> [ , ] - # XPath.match(doc.root, "child::node()") #-> [ sean, , elliott, ] - def to_a( xpath=nil ) - rv = XPath.match( @element, xpath ) - return rv.find_all{|e| e.kind_of? Element} if xpath - rv - end - - private - # Private helper class. Removes quotes from quoted strings - def literalize name - name = name[1..-2] if name[0] == ?' or name[0] == ?" #' - name - end - end - - ######################################################################## - # ATTRIBUTES # - ######################################################################## - - # A class that defines the set of Attributes of an Element and provides - # operations for accessing elements in that set. - class Attributes < Hash - # Constructor - # element:: the Element of which this is an Attribute - def initialize element - @element = element - end - - # Fetches an attribute value. If you want to get the Attribute itself, - # use get_attribute() - # name:: an XPath attribute name. Namespaces are relevant here. - # Returns:: - # the String value of the matching attribute, or +nil+ if no - # matching attribute was found. This is the unnormalized value - # (with entities expanded). - # - # doc = Document.new "" - # doc.root.attributes['att'] #-> '<' - # doc.root.attributes['bar:att'] #-> '2' - def [](name) - attr = get_attribute(name) - return attr.value unless attr.nil? - return nil - end - - def to_a - enum_for(:each_attribute).to_a - end - - # Returns the number of attributes the owning Element contains. - # doc = Document "" - # doc.root.attributes.length #-> 3 - def length - c = 0 - each_attribute { c+=1 } - c - end - alias :size :length - - # Iterates over the attributes of an Element. Yields actual Attribute - # nodes, not String values. - # - # doc = Document.new '' - # doc.root.attributes.each_attribute {|attr| - # p attr.expanded_name+" => "+attr.value - # } - def each_attribute # :yields: attribute - return to_enum(__method__) unless block_given? - each_value do |val| - if val.kind_of? Attribute - yield val - else - val.each_value { |atr| yield atr } - end - end - end - - # Iterates over each attribute of an Element, yielding the expanded name - # and value as a pair of Strings. - # - # doc = Document.new '' - # doc.root.attributes.each {|name, value| p name+" => "+value } - def each - return to_enum(__method__) unless block_given? - each_attribute do |attr| - yield [attr.expanded_name, attr.value] - end - end - - # Fetches an attribute - # name:: - # the name by which to search for the attribute. Can be a - # prefix:name namespace name. - # Returns:: The first matching attribute, or nil if there was none. This - # value is an Attribute node, not the String value of the attribute. - # doc = Document.new '' - # doc.root.attributes.get_attribute("foo").value #-> "2" - # doc.root.attributes.get_attribute("x:foo").value #-> "1" - def get_attribute( name ) - attr = fetch( name, nil ) - if attr.nil? - return nil if name.nil? - # Look for prefix - name =~ Namespace::NAMESPLIT - prefix, n = $1, $2 - if prefix - attr = fetch( n, nil ) - # check prefix - if attr == nil - elsif attr.kind_of? Attribute - return attr if prefix == attr.prefix - else - attr = attr[ prefix ] - return attr - end - end - element_document = @element.document - if element_document and element_document.doctype - expn = @element.expanded_name - expn = element_document.doctype.name if expn.size == 0 - attr_val = element_document.doctype.attribute_of(expn, name) - return Attribute.new( name, attr_val ) if attr_val - end - return nil - end - if attr.kind_of? Hash - attr = attr[ @element.prefix ] - end - return attr - end - - # Sets an attribute, overwriting any existing attribute value by the - # same name. Namespace is significant. - # name:: the name of the attribute - # value:: - # (optional) If supplied, the value of the attribute. If - # nil, any existing matching attribute is deleted. - # Returns:: - # Owning element - # doc = Document.new "" - # doc.root.attributes['y:foo'] = '2' - # doc.root.attributes['foo'] = '4' - # doc.root.attributes['x:foo'] = nil - def []=( name, value ) - if value.nil? # Delete the named attribute - attr = get_attribute(name) - delete attr - return - end - - unless value.kind_of? Attribute - if @element.document and @element.document.doctype - value = Text::normalize( value, @element.document.doctype ) - else - value = Text::normalize( value, nil ) - end - value = Attribute.new(name, value) - end - value.element = @element - old_attr = fetch(value.name, nil) - if old_attr.nil? - store(value.name, value) - elsif old_attr.kind_of? Hash - old_attr[value.prefix] = value - elsif old_attr.prefix != value.prefix - # Check for conflicting namespaces - if value.prefix != "xmlns" and old_attr.prefix != "xmlns" - old_namespace = old_attr.namespace - new_namespace = value.namespace - if old_namespace == new_namespace - raise ParseException.new( - "Namespace conflict in adding attribute \"#{value.name}\": "+ - "Prefix \"#{old_attr.prefix}\" = \"#{old_namespace}\" and "+ - "prefix \"#{value.prefix}\" = \"#{new_namespace}\"") - end - end - store value.name, {old_attr.prefix => old_attr, - value.prefix => value} - else - store value.name, value - end - return @element - end - - # Returns an array of Strings containing all of the prefixes declared - # by this set of # attributes. The array does not include the default - # namespace declaration, if one exists. - # doc = Document.new("") - # prefixes = doc.root.attributes.prefixes #-> ['x', 'y'] - def prefixes - ns = [] - each_attribute do |attribute| - ns << attribute.name if attribute.prefix == 'xmlns' - end - if @element.document and @element.document.doctype - expn = @element.expanded_name - expn = @element.document.doctype.name if expn.size == 0 - @element.document.doctype.attributes_of(expn).each { - |attribute| - ns << attribute.name if attribute.prefix == 'xmlns' - } - end - ns - end - - def namespaces - namespaces = {} - each_attribute do |attribute| - namespaces[attribute.name] = attribute.value if attribute.prefix == 'xmlns' or attribute.name == 'xmlns' - end - if @element.document and @element.document.doctype - expn = @element.expanded_name - expn = @element.document.doctype.name if expn.size == 0 - @element.document.doctype.attributes_of(expn).each { - |attribute| - namespaces[attribute.name] = attribute.value if attribute.prefix == 'xmlns' or attribute.name == 'xmlns' - } - end - namespaces - end - - # Removes an attribute - # attribute:: - # either a String, which is the name of the attribute to remove -- - # namespaces are significant here -- or the attribute to remove. - # Returns:: the owning element - # doc = Document.new "" - # doc.root.attributes.delete 'foo' #-> " - # doc.root.attributes.delete 'x:foo' #-> " - # attr = doc.root.attributes.get_attribute('y:foo') - # doc.root.attributes.delete attr #-> " - def delete( attribute ) - name = nil - prefix = nil - if attribute.kind_of? Attribute - name = attribute.name - prefix = attribute.prefix - else - attribute =~ Namespace::NAMESPLIT - prefix, name = $1, $2 - prefix = '' unless prefix - end - old = fetch(name, nil) - if old.kind_of? Hash # the supplied attribute is one of many - old.delete(prefix) - if old.size == 1 - repl = nil - old.each_value{|v| repl = v} - store name, repl - end - elsif old.nil? - return @element - else # the supplied attribute is a top-level one - super(name) - end - @element - end - - # Adds an attribute, overriding any existing attribute by the - # same name. Namespaces are significant. - # attribute:: An Attribute - def add( attribute ) - self[attribute.name] = attribute - end - - alias :<< :add - - # Deletes all attributes matching a name. Namespaces are significant. - # name:: - # A String; all attributes that match this path will be removed - # Returns:: an Array of the Attributes that were removed - def delete_all( name ) - rv = [] - each_attribute { |attribute| - rv << attribute if attribute.expanded_name == name - } - rv.each{ |attr| attr.remove } - return rv - end - - # The +get_attribute_ns+ method retrieves a method by its namespace - # and name. Thus it is possible to reliably identify an attribute - # even if an XML processor has changed the prefix. - # - # Method contributed by Henrik Martensson - def get_attribute_ns(namespace, name) - result = nil - each_attribute() { |attribute| - if name == attribute.name && - namespace == attribute.namespace() && - ( !namespace.empty? || !attribute.fully_expanded_name.index(':') ) - # foo will match xmlns:foo, but only if foo isn't also an attribute - result = attribute if !result or !namespace.empty? or - !attribute.fully_expanded_name.index(':') - end - } - result - end - end -end diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb deleted file mode 100644 index da2d70d6c9..0000000000 --- a/lib/rexml/encoding.rb +++ /dev/null @@ -1,51 +0,0 @@ -# coding: US-ASCII -# frozen_string_literal: false -module REXML - module Encoding - # ID ---> Encoding name - attr_reader :encoding - def encoding=(encoding) - encoding = encoding.name if encoding.is_a?(Encoding) - if encoding.is_a?(String) - original_encoding = encoding - encoding = find_encoding(encoding) - unless encoding - raise ArgumentError, "Bad encoding name #{original_encoding}" - end - end - return false if defined?(@encoding) and encoding == @encoding - if encoding - @encoding = encoding.upcase - else - @encoding = 'UTF-8' - end - true - end - - def encode(string) - string.encode(@encoding) - end - - def decode(string) - string.encode(::Encoding::UTF_8, @encoding) - end - - private - def find_encoding(name) - case name - when /\Ashift-jis\z/i - return "SHIFT_JIS" - when /\ACP-(\d+)\z/ - name = "CP#{$1}" - when /\AUTF-8\z/i - return name - end - begin - ::Encoding::Converter.search_convpath(name, 'UTF-8') - rescue ::Encoding::ConverterNotFoundError - return nil - end - name - end - end -end diff --git a/lib/rexml/entity.rb b/lib/rexml/entity.rb deleted file mode 100644 index 89a9e84c57..0000000000 --- a/lib/rexml/entity.rb +++ /dev/null @@ -1,171 +0,0 @@ -# frozen_string_literal: false -require_relative 'child' -require_relative 'source' -require_relative 'xmltokens' - -module REXML - class Entity < Child - include XMLTokens - PUBIDCHAR = "\x20\x0D\x0Aa-zA-Z0-9\\-()+,./:=?;!*@$_%#" - SYSTEMLITERAL = %Q{((?:"[^"]*")|(?:'[^']*'))} - PUBIDLITERAL = %Q{("[#{PUBIDCHAR}']*"|'[#{PUBIDCHAR}]*')} - EXTERNALID = "(?:(?:(SYSTEM)\\s+#{SYSTEMLITERAL})|(?:(PUBLIC)\\s+#{PUBIDLITERAL}\\s+#{SYSTEMLITERAL}))" - NDATADECL = "\\s+NDATA\\s+#{NAME}" - PEREFERENCE = "%#{NAME};" - ENTITYVALUE = %Q{((?:"(?:[^%&"]|#{PEREFERENCE}|#{REFERENCE})*")|(?:'([^%&']|#{PEREFERENCE}|#{REFERENCE})*'))} - PEDEF = "(?:#{ENTITYVALUE}|#{EXTERNALID})" - ENTITYDEF = "(?:#{ENTITYVALUE}|(?:#{EXTERNALID}(#{NDATADECL})?))" - PEDECL = "" - GEDECL = "" - ENTITYDECL = /\s*(?:#{GEDECL})|(?:#{PEDECL})/um - - attr_reader :name, :external, :ref, :ndata, :pubid - - # Create a new entity. Simple entities can be constructed by passing a - # name, value to the constructor; this creates a generic, plain entity - # reference. For anything more complicated, you have to pass a Source to - # the constructor with the entity definition, or use the accessor methods. - # +WARNING+: There is no validation of entity state except when the entity - # is read from a stream. If you start poking around with the accessors, - # you can easily create a non-conformant Entity. - # - # e = Entity.new( 'amp', '&' ) - def initialize stream, value=nil, parent=nil, reference=false - super(parent) - @ndata = @pubid = @value = @external = nil - if stream.kind_of? Array - @name = stream[1] - if stream[-1] == '%' - @reference = true - stream.pop - else - @reference = false - end - if stream[2] =~ /SYSTEM|PUBLIC/ - @external = stream[2] - if @external == 'SYSTEM' - @ref = stream[3] - @ndata = stream[4] if stream.size == 5 - else - @pubid = stream[3] - @ref = stream[4] - end - else - @value = stream[2] - end - else - @reference = reference - @external = nil - @name = stream - @value = value - end - end - - # Evaluates whether the given string matches an entity definition, - # returning true if so, and false otherwise. - def Entity::matches? string - (ENTITYDECL =~ string) == 0 - end - - # Evaluates to the unnormalized value of this entity; that is, replacing - # all entities -- both %ent; and &ent; entities. This differs from - # +value()+ in that +value+ only replaces %ent; entities. - def unnormalized - document.record_entity_expansion unless document.nil? - v = value() - return nil if v.nil? - @unnormalized = Text::unnormalize(v, parent) - @unnormalized - end - - #once :unnormalized - - # Returns the value of this entity unprocessed -- raw. This is the - # normalized value; that is, with all %ent; and &ent; entities intact - def normalized - @value - end - - # Write out a fully formed, correct entity definition (assuming the Entity - # object itself is valid.) - # - # out:: - # An object implementing << to which the entity will be - # output - # indent:: - # *DEPRECATED* and ignored - def write out, indent=-1 - out << '' - end - - # Returns this entity as a string. See write(). - def to_s - rv = '' - write rv - rv - end - - PEREFERENCE_RE = /#{PEREFERENCE}/um - # Returns the value of this entity. At the moment, only internal entities - # are processed. If the value contains internal references (IE, - # %blah;), those are replaced with their values. IE, if the doctype - # contains: - # - # - # then: - # doctype.entity('yada').value #-> "nanoo bar nanoo" - def value - if @value - matches = @value.scan(PEREFERENCE_RE) - rv = @value.clone - if @parent - sum = 0 - matches.each do |entity_reference| - entity_value = @parent.entity( entity_reference[0] ) - if sum + entity_value.bytesize > Security.entity_expansion_text_limit - raise "entity expansion has grown too large" - else - sum += entity_value.bytesize - end - rv.gsub!( /%#{entity_reference.join};/um, entity_value ) - end - end - return rv - end - nil - end - end - - # This is a set of entity constants -- the ones defined in the XML - # specification. These are +gt+, +lt+, +amp+, +quot+ and +apos+. - # CAUTION: these entities does not have parent and document - module EntityConst - # +>+ - GT = Entity.new( 'gt', '>' ) - # +<+ - LT = Entity.new( 'lt', '<' ) - # +&+ - AMP = Entity.new( 'amp', '&' ) - # +"+ - QUOT = Entity.new( 'quot', '"' ) - # +'+ - APOS = Entity.new( 'apos', "'" ) - end -end diff --git a/lib/rexml/formatters/default.rb b/lib/rexml/formatters/default.rb deleted file mode 100644 index 811b2ff3d5..0000000000 --- a/lib/rexml/formatters/default.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: false - -module REXML - module Formatters - class Default - # Prints out the XML document with no formatting -- except if ie_hack is - # set. - # - # ie_hack:: - # If set to true, then inserts whitespace before the close of an empty - # tag, so that IE's bad XML parser doesn't choke. - def initialize( ie_hack=false ) - @ie_hack = ie_hack - end - - # Writes the node to some output. - # - # node:: - # The node to write - # output:: - # A class implementing <<. Pass in an Output object to - # change the output encoding. - def write( node, output ) - case node - - when Document - if node.xml_decl.encoding != 'UTF-8' && !output.kind_of?(Output) - output = Output.new( output, node.xml_decl.encoding ) - end - write_document( node, output ) - - when Element - write_element( node, output ) - - when Declaration, ElementDecl, NotationDecl, ExternalEntity, Entity, - Attribute, AttlistDecl - node.write( output,-1 ) - - when Instruction - write_instruction( node, output ) - - when DocType, XMLDecl - node.write( output ) - - when Comment - write_comment( node, output ) - - when CData - write_cdata( node, output ) - - when Text - write_text( node, output ) - - else - raise Exception.new("XML FORMATTING ERROR") - - end - end - - protected - def write_document( node, output ) - node.children.each { |child| write( child, output ) } - end - - def write_element( node, output ) - output << "<#{node.expanded_name}" - - node.attributes.to_a.map { |a| - Hash === a ? a.values : a - }.flatten.sort_by {|attr| attr.name}.each do |attr| - output << " " - attr.write( output ) - end unless node.attributes.empty? - - if node.children.empty? - output << " " if @ie_hack - output << "/" - else - output << ">" - node.children.each { |child| - write( child, output ) - } - output << "" - end - - def write_text( node, output ) - output << node.to_s() - end - - def write_comment( node, output ) - output << Comment::START - output << node.to_s - output << Comment::STOP - end - - def write_cdata( node, output ) - output << CData::START - output << node.to_s - output << CData::STOP - end - - def write_instruction( node, output ) - output << Instruction::START - output << node.target - content = node.content - if content - output << ' ' - output << content - end - output << Instruction::STOP - end - end - end -end diff --git a/lib/rexml/formatters/pretty.rb b/lib/rexml/formatters/pretty.rb deleted file mode 100644 index 562ef9462e..0000000000 --- a/lib/rexml/formatters/pretty.rb +++ /dev/null @@ -1,142 +0,0 @@ -# frozen_string_literal: false -require_relative 'default' - -module REXML - module Formatters - # Pretty-prints an XML document. This destroys whitespace in text nodes - # and will insert carriage returns and indentations. - # - # TODO: Add an option to print attributes on new lines - class Pretty < Default - - # If compact is set to true, then the formatter will attempt to use as - # little space as possible - attr_accessor :compact - # The width of a page. Used for formatting text - attr_accessor :width - - # Create a new pretty printer. - # - # output:: - # An object implementing '<<(String)', to which the output will be written. - # indentation:: - # An integer greater than 0. The indentation of each level will be - # this number of spaces. If this is < 1, the behavior of this object - # is undefined. Defaults to 2. - # ie_hack:: - # If true, the printer will insert whitespace before closing empty - # tags, thereby allowing Internet Explorer's XML parser to - # function. Defaults to false. - def initialize( indentation=2, ie_hack=false ) - @indentation = indentation - @level = 0 - @ie_hack = ie_hack - @width = 80 - @compact = false - end - - protected - def write_element(node, output) - output << ' '*@level - output << "<#{node.expanded_name}" - - node.attributes.each_attribute do |attr| - output << " " - attr.write( output ) - end unless node.attributes.empty? - - if node.children.empty? - if @ie_hack - output << " " - end - output << "/" - else - output << ">" - # If compact and all children are text, and if the formatted output - # is less than the specified width, then try to print everything on - # one line - skip = false - if compact - if node.children.inject(true) {|s,c| s & c.kind_of?(Text)} - string = "" - old_level = @level - @level = 0 - node.children.each { |child| write( child, string ) } - @level = old_level - if string.length < @width - output << string - skip = true - end - end - end - unless skip - output << "\n" - @level += @indentation - node.children.each { |child| - next if child.kind_of?(Text) and child.to_s.strip.length == 0 - write( child, output ) - output << "\n" - } - @level -= @indentation - output << ' '*@level - end - output << "" - end - - def write_text( node, output ) - s = node.to_s() - s.gsub!(/\s/,' ') - s.squeeze!(" ") - s = wrap(s, @width - @level) - s = indent_text(s, @level, " ", true) - output << (' '*@level + s) - end - - def write_comment( node, output) - output << ' ' * @level - super - end - - def write_cdata( node, output) - output << ' ' * @level - super - end - - def write_document( node, output ) - # Ok, this is a bit odd. All XML documents have an XML declaration, - # but it may not write itself if the user didn't specifically add it, - # either through the API or in the input document. If it doesn't write - # itself, then we don't need a carriage return... which makes this - # logic more complex. - node.children.each { |child| - next if child == node.children[-1] and child.instance_of?(Text) - unless child == node.children[0] or child.instance_of?(Text) or - (child == node.children[1] and !node.children[0].writethis) - output << "\n" - end - write( child, output ) - } - end - - private - def indent_text(string, level=1, style="\t", indentfirstline=true) - return string if level < 0 - string.gsub(/\n/, "\n#{style*level}") - end - - def wrap(string, width) - parts = [] - while string.length > width and place = string.rindex(' ', width) - parts << string[0...place] - string = string[place+1..-1] - end - parts << string - parts.join("\n") - end - - end - end -end - diff --git a/lib/rexml/formatters/transitive.rb b/lib/rexml/formatters/transitive.rb deleted file mode 100644 index 5ff51e10f3..0000000000 --- a/lib/rexml/formatters/transitive.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: false -require_relative 'pretty' - -module REXML - module Formatters - # The Transitive formatter writes an XML document that parses to an - # identical document as the source document. This means that no extra - # whitespace nodes are inserted, and whitespace within text nodes is - # preserved. Within these constraints, the document is pretty-printed, - # with whitespace inserted into the metadata to introduce formatting. - # - # Note that this is only useful if the original XML is not already - # formatted. Since this formatter does not alter whitespace nodes, the - # results of formatting already formatted XML will be odd. - class Transitive < Default - def initialize( indentation=2, ie_hack=false ) - @indentation = indentation - @level = 0 - @ie_hack = ie_hack - end - - protected - def write_element( node, output ) - output << "<#{node.expanded_name}" - - node.attributes.each_attribute do |attr| - output << " " - attr.write( output ) - end unless node.attributes.empty? - - output << "\n" - output << ' '*@level - if node.children.empty? - output << " " if @ie_hack - output << "/" - else - output << ">" - # If compact and all children are text, and if the formatted output - # is less than the specified width, then try to print everything on - # one line - @level += @indentation - node.children.each { |child| - write( child, output ) - } - @level -= @indentation - output << "" - end - - def write_text( node, output ) - output << node.to_s() - end - end - end -end diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb deleted file mode 100644 index 77926bf2af..0000000000 --- a/lib/rexml/functions.rb +++ /dev/null @@ -1,447 +0,0 @@ -# frozen_string_literal: false -module REXML - # If you add a method, keep in mind two things: - # (1) the first argument will always be a list of nodes from which to - # filter. In the case of context methods (such as position), the function - # should return an array with a value for each child in the array. - # (2) all method calls from XML will have "-" replaced with "_". - # Therefore, in XML, "local-name()" is identical (and actually becomes) - # "local_name()" - module Functions - @@available_functions = {} - @@context = nil - @@namespace_context = {} - @@variables = {} - - INTERNAL_METHODS = [ - :namespace_context, - :namespace_context=, - :variables, - :variables=, - :context=, - :get_namespace, - :send, - ] - class << self - def singleton_method_added(name) - unless INTERNAL_METHODS.include?(name) - @@available_functions[name] = true - end - end - end - - def Functions::namespace_context=(x) ; @@namespace_context=x ; end - def Functions::variables=(x) ; @@variables=x ; end - def Functions::namespace_context ; @@namespace_context ; end - def Functions::variables ; @@variables ; end - - def Functions::context=(value); @@context = value; end - - def Functions::text( ) - if @@context[:node].node_type == :element - return @@context[:node].find_all{|n| n.node_type == :text}.collect{|n| n.value} - elsif @@context[:node].node_type == :text - return @@context[:node].value - else - return false - end - end - - # Returns the last node of the given list of nodes. - def Functions::last( ) - @@context[:size] - end - - def Functions::position( ) - @@context[:index] - end - - # Returns the size of the given list of nodes. - def Functions::count( node_set ) - node_set.size - end - - # Since REXML is non-validating, this method is not implemented as it - # requires a DTD - def Functions::id( object ) - end - - def Functions::local_name(node_set=nil) - get_namespace(node_set) do |node| - return node.local_name - end - "" - end - - def Functions::namespace_uri( node_set=nil ) - get_namespace( node_set ) {|node| node.namespace} - end - - def Functions::name( node_set=nil ) - get_namespace( node_set ) do |node| - node.expanded_name - end - end - - # Helper method. - def Functions::get_namespace( node_set = nil ) - if node_set == nil - yield @@context[:node] if @@context[:node].respond_to?(:namespace) - else - if node_set.respond_to? :each - result = [] - node_set.each do |node| - result << yield(node) if node.respond_to?(:namespace) - end - result - elsif node_set.respond_to? :namespace - yield node_set - end - end - end - - # A node-set is converted to a string by returning the string-value of the - # node in the node-set that is first in document order. If the node-set is - # empty, an empty string is returned. - # - # A number is converted to a string as follows - # - # NaN is converted to the string NaN - # - # positive zero is converted to the string 0 - # - # negative zero is converted to the string 0 - # - # positive infinity is converted to the string Infinity - # - # negative infinity is converted to the string -Infinity - # - # if the number is an integer, the number is represented in decimal form - # as a Number with no decimal point and no leading zeros, preceded by a - # minus sign (-) if the number is negative - # - # otherwise, the number is represented in decimal form as a Number - # including a decimal point with at least one digit before the decimal - # point and at least one digit after the decimal point, preceded by a - # minus sign (-) if the number is negative; there must be no leading zeros - # before the decimal point apart possibly from the one required digit - # immediately before the decimal point; beyond the one required digit - # after the decimal point there must be as many, but only as many, more - # digits as are needed to uniquely distinguish the number from all other - # IEEE 754 numeric values. - # - # The boolean false value is converted to the string false. The boolean - # true value is converted to the string true. - # - # An object of a type other than the four basic types is converted to a - # string in a way that is dependent on that type. - def Functions::string( object=@@context[:node] ) - if object.respond_to?(:node_type) - case object.node_type - when :attribute - object.value - when :element - string_value(object) - when :document - string_value(object.root) - when :processing_instruction - object.content - else - object.to_s - end - else - case object - when Array - string(object[0]) - when Float - if object.nan? - "NaN" - else - integer = object.to_i - if object == integer - "%d" % integer - else - object.to_s - end - end - else - object.to_s - end - end - end - - # A node-set is converted to a string by - # returning the concatenation of the string-value - # of each of the children of the node in the - # node-set that is first in document order. - # If the node-set is empty, an empty string is returned. - def Functions::string_value( o ) - rv = "" - o.children.each { |e| - if e.node_type == :text - rv << e.to_s - elsif e.node_type == :element - rv << string_value( e ) - end - } - rv - end - - def Functions::concat( *objects ) - concatenated = "" - objects.each do |object| - concatenated << string(object) - end - concatenated - end - - # Fixed by Mike Stok - def Functions::starts_with( string, test ) - string(string).index(string(test)) == 0 - end - - # Fixed by Mike Stok - def Functions::contains( string, test ) - string(string).include?(string(test)) - end - - # Kouhei fixed this - def Functions::substring_before( string, test ) - ruby_string = string(string) - ruby_index = ruby_string.index(string(test)) - if ruby_index.nil? - "" - else - ruby_string[ 0...ruby_index ] - end - end - - # Kouhei fixed this too - def Functions::substring_after( string, test ) - ruby_string = string(string) - return $1 if ruby_string =~ /#{test}(.*)/ - "" - end - - # Take equal portions of Mike Stok and Sean Russell; mix - # vigorously, and pour into a tall, chilled glass. Serves 10,000. - def Functions::substring( string, start, length=nil ) - ruby_string = string(string) - ruby_length = if length.nil? - ruby_string.length.to_f - else - number(length) - end - ruby_start = number(start) - - # Handle the special cases - return '' if ( - ruby_length.nan? or - ruby_start.nan? or - ruby_start.infinite? - ) - - infinite_length = ruby_length.infinite? == 1 - ruby_length = ruby_string.length if infinite_length - - # Now, get the bounds. The XPath bounds are 1..length; the ruby bounds - # are 0..length. Therefore, we have to offset the bounds by one. - ruby_start = round(ruby_start) - 1 - ruby_length = round(ruby_length) - - if ruby_start < 0 - ruby_length += ruby_start unless infinite_length - ruby_start = 0 - end - return '' if ruby_length <= 0 - ruby_string[ruby_start,ruby_length] - end - - # UNTESTED - def Functions::string_length( string ) - string(string).length - end - - # UNTESTED - def Functions::normalize_space( string=nil ) - string = string(@@context[:node]) if string.nil? - if string.kind_of? Array - string.collect{|x| string.to_s.strip.gsub(/\s+/um, ' ') if string} - else - string.to_s.strip.gsub(/\s+/um, ' ') - end - end - - # This is entirely Mike Stok's beast - def Functions::translate( string, tr1, tr2 ) - from = string(tr1) - to = string(tr2) - - # the map is our translation table. - # - # if a character occurs more than once in the - # from string then we ignore the second & - # subsequent mappings - # - # if a character maps to nil then we delete it - # in the output. This happens if the from - # string is longer than the to string - # - # there's nothing about - or ^ being special in - # http://www.w3.org/TR/xpath#function-translate - # so we don't build ranges or negated classes - - map = Hash.new - 0.upto(from.length - 1) { |pos| - from_char = from[pos] - unless map.has_key? from_char - map[from_char] = - if pos < to.length - to[pos] - else - nil - end - end - } - - if ''.respond_to? :chars - string(string).chars.collect { |c| - if map.has_key? c then map[c] else c end - }.compact.join - else - string(string).unpack('U*').collect { |c| - if map.has_key? c then map[c] else c end - }.compact.pack('U*') - end - end - - def Functions::boolean(object=@@context[:node]) - case object - when true, false - object - when Float - return false if object.zero? - return false if object.nan? - true - when Numeric - not object.zero? - when String - not object.empty? - when Array - not object.empty? - else - object ? true : false - end - end - - # UNTESTED - def Functions::not( object ) - not boolean( object ) - end - - # UNTESTED - def Functions::true( ) - true - end - - # UNTESTED - def Functions::false( ) - false - end - - # UNTESTED - def Functions::lang( language ) - lang = false - node = @@context[:node] - attr = nil - until node.nil? - if node.node_type == :element - attr = node.attributes["xml:lang"] - unless attr.nil? - lang = compare_language(string(language), attr) - break - else - end - end - node = node.parent - end - lang - end - - def Functions::compare_language lang1, lang2 - lang2.downcase.index(lang1.downcase) == 0 - end - - # a string that consists of optional whitespace followed by an optional - # minus sign followed by a Number followed by whitespace is converted to - # the IEEE 754 number that is nearest (according to the IEEE 754 - # round-to-nearest rule) to the mathematical value represented by the - # string; any other string is converted to NaN - # - # boolean true is converted to 1; boolean false is converted to 0 - # - # a node-set is first converted to a string as if by a call to the string - # function and then converted in the same way as a string argument - # - # an object of a type other than the four basic types is converted to a - # number in a way that is dependent on that type - def Functions::number(object=@@context[:node]) - case object - when true - Float(1) - when false - Float(0) - when Array - number(string(object)) - when Numeric - object.to_f - else - str = string(object) - case str.strip - when /\A\s*(-?(?:\d+(?:\.\d*)?|\.\d+))\s*\z/ - $1.to_f - else - Float::NAN - end - end - end - - def Functions::sum( nodes ) - nodes = [nodes] unless nodes.kind_of? Array - nodes.inject(0) { |r,n| r + number(string(n)) } - end - - def Functions::floor( number ) - number(number).floor - end - - def Functions::ceiling( number ) - number(number).ceil - end - - def Functions::round( number ) - number = number(number) - begin - neg = number.negative? - number = number.abs.round - neg ? -number : number - rescue FloatDomainError - number - end - end - - def Functions::processing_instruction( node ) - node.node_type == :processing_instruction - end - - def Functions::send(name, *args) - if @@available_functions[name.to_sym] - super - else - # TODO: Maybe, this is not XPath spec behavior. - # This behavior must be reconsidered. - XPath.match(@@context[:node], name.to_s) - end - end - end -end diff --git a/lib/rexml/instruction.rb b/lib/rexml/instruction.rb deleted file mode 100644 index 318741f03b..0000000000 --- a/lib/rexml/instruction.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: false - -require_relative "child" -require_relative "source" - -module REXML - # Represents an XML Instruction; IE, - # TODO: Add parent arg (3rd arg) to constructor - class Instruction < Child - START = "" - - # target is the "name" of the Instruction; IE, the "tag" in - # content is everything else. - attr_accessor :target, :content - - # Constructs a new Instruction - # @param target can be one of a number of things. If String, then - # the target of this instruction is set to this. If an Instruction, - # then the Instruction is shallowly cloned (target and content are - # copied). - # @param content Must be either a String, or a Parent. Can only - # be a Parent if the target argument is a Source. Otherwise, this - # String is set as the content of this instruction. - def initialize(target, content=nil) - case target - when String - super() - @target = target - @content = content - when Instruction - super(content) - @target = target.target - @content = target.content - else - message = - "processing instruction target must be String or REXML::Instruction: " - message << "<#{target.inspect}>" - raise ArgumentError, message - end - @content.strip! if @content - end - - def clone - Instruction.new self - end - - # == DEPRECATED - # See the rexml/formatters package - # - def write writer, indent=-1, transitive=false, ie_hack=false - Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1) - indent(writer, indent) - writer << START - writer << @target - if @content - writer << ' ' - writer << @content - end - writer << STOP - end - - # @return true if other is an Instruction, and the content and target - # of the other matches the target and content of this object. - def ==( other ) - other.kind_of? Instruction and - other.target == @target and - other.content == @content - end - - def node_type - :processing_instruction - end - - def inspect - "" - end - end -end diff --git a/lib/rexml/light/node.rb b/lib/rexml/light/node.rb deleted file mode 100644 index 01177c64d2..0000000000 --- a/lib/rexml/light/node.rb +++ /dev/null @@ -1,196 +0,0 @@ -# frozen_string_literal: false -require_relative '../xmltokens' - -# [ :element, parent, name, attributes, children* ] - # a = Node.new - # a << "B" # => B - # a.b # => B - # a.b[1] # => B - # a.b[1]["x"] = "y" # => B - # a.b[0].c # => B - # a.b.c << "D" # => BD -module REXML - module Light - # Represents a tagged XML element. Elements are characterized by - # having children, attributes, and names, and can themselves be - # children. - class Node - NAMESPLIT = /^(?:(#{XMLTokens::NCNAME_STR}):)?(#{XMLTokens::NCNAME_STR})/u - PARENTS = [ :element, :document, :doctype ] - # Create a new element. - def initialize node=nil - @node = node - if node.kind_of? String - node = [ :text, node ] - elsif node.nil? - node = [ :document, nil, nil ] - elsif node[0] == :start_element - node[0] = :element - elsif node[0] == :start_doctype - node[0] = :doctype - elsif node[0] == :start_document - node[0] = :document - end - end - - def size - if PARENTS.include? @node[0] - @node[-1].size - else - 0 - end - end - - def each - size.times { |x| yield( at(x+4) ) } - end - - def name - at(2) - end - - def name=( name_str, ns=nil ) - pfx = '' - pfx = "#{prefix(ns)}:" if ns - _old_put(2, "#{pfx}#{name_str}") - end - - def parent=( node ) - _old_put(1,node) - end - - def local_name - namesplit - @name - end - - def local_name=( name_str ) - _old_put( 1, "#@prefix:#{name_str}" ) - end - - def prefix( namespace=nil ) - prefix_of( self, namespace ) - end - - def namespace( prefix=prefix() ) - namespace_of( self, prefix ) - end - - def namespace=( namespace ) - @prefix = prefix( namespace ) - pfx = '' - pfx = "#@prefix:" if @prefix.size > 0 - _old_put(1, "#{pfx}#@name") - end - - def []( reference, ns=nil ) - if reference.kind_of? String - pfx = '' - pfx = "#{prefix(ns)}:" if ns - at(3)["#{pfx}#{reference}"] - elsif reference.kind_of? Range - _old_get( Range.new(4+reference.begin, reference.end, reference.exclude_end?) ) - else - _old_get( 4+reference ) - end - end - - def =~( path ) - XPath.match( self, path ) - end - - # Doesn't handle namespaces yet - def []=( reference, ns, value=nil ) - if reference.kind_of? String - value = ns unless value - at( 3 )[reference] = value - elsif reference.kind_of? Range - _old_put( Range.new(3+reference.begin, reference.end, reference.exclude_end?), ns ) - else - if value - _old_put( 4+reference, ns, value ) - else - _old_put( 4+reference, ns ) - end - end - end - - # Append a child to this element, optionally under a provided namespace. - # The namespace argument is ignored if the element argument is an Element - # object. Otherwise, the element argument is a string, the namespace (if - # provided) is the namespace the element is created in. - def << element - if node_type() == :text - at(-1) << element - else - newnode = Node.new( element ) - newnode.parent = self - self.push( newnode ) - end - at(-1) - end - - def node_type - _old_get(0) - end - - def text=( foo ) - replace = at(4).kind_of?(String)? 1 : 0 - self._old_put(4,replace, normalizefoo) - end - - def root - context = self - context = context.at(1) while context.at(1) - end - - def has_name?( name, namespace = '' ) - at(3) == name and namespace() == namespace - end - - def children - self - end - - def parent - at(1) - end - - def to_s - - end - - private - - def namesplit - return if @name.defined? - at(2) =~ NAMESPLIT - @prefix = '' || $1 - @name = $2 - end - - def namespace_of( node, prefix=nil ) - if not prefix - name = at(2) - name =~ NAMESPLIT - prefix = $1 - end - to_find = 'xmlns' - to_find = "xmlns:#{prefix}" if not prefix.nil? - ns = at(3)[ to_find ] - ns ? ns : namespace_of( @node[0], prefix ) - end - - def prefix_of( node, namespace=nil ) - if not namespace - name = node.name - name =~ NAMESPLIT - $1 - else - ns = at(3).find { |k,v| v == namespace } - ns ? ns : prefix_of( node.parent, namespace ) - end - end - end - end -end diff --git a/lib/rexml/namespace.rb b/lib/rexml/namespace.rb deleted file mode 100644 index 924edf9506..0000000000 --- a/lib/rexml/namespace.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: false - -require_relative 'xmltokens' - -module REXML - # Adds named attributes to an object. - module Namespace - # The name of the object, valid if set - attr_reader :name, :expanded_name - # The expanded name of the object, valid if name is set - attr_accessor :prefix - include XMLTokens - NAMESPLIT = /^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u - - # Sets the name and the expanded name - def name=( name ) - @expanded_name = name - case name - when NAMESPLIT - if $1 - @prefix = $1 - else - @prefix = "" - @namespace = "" - end - @name = $2 - when "" - @prefix = nil - @namespace = nil - @name = nil - else - message = "name must be \#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: " - message += "<#{name.inspect}>" - raise ArgumentError, message - end - end - - # Compares names optionally WITH namespaces - def has_name?( other, ns=nil ) - if ns - return (namespace() == ns and name() == other) - elsif other.include? ":" - return fully_expanded_name == other - else - return name == other - end - end - - alias :local_name :name - - # Fully expand the name, even if the prefix wasn't specified in the - # source file. - def fully_expanded_name - ns = prefix - return "#{ns}:#@name" if ns.size > 0 - return @name - end - end -end diff --git a/lib/rexml/node.rb b/lib/rexml/node.rb deleted file mode 100644 index 081caba6cb..0000000000 --- a/lib/rexml/node.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: false -require_relative "parseexception" -require_relative "formatters/pretty" -require_relative "formatters/default" - -module REXML - # Represents a node in the tree. Nodes are never encountered except as - # superclasses of other objects. Nodes have siblings. - module Node - # @return the next sibling (nil if unset) - def next_sibling_node - return nil if @parent.nil? - @parent[ @parent.index(self) + 1 ] - end - - # @return the previous sibling (nil if unset) - def previous_sibling_node - return nil if @parent.nil? - ind = @parent.index(self) - return nil if ind == 0 - @parent[ ind - 1 ] - end - - # indent:: - # *DEPRECATED* This parameter is now ignored. See the formatters in the - # REXML::Formatters package for changing the output style. - def to_s indent=nil - unless indent.nil? - Kernel.warn( "#{self.class.name}.to_s(indent) parameter is deprecated", uplevel: 1) - f = REXML::Formatters::Pretty.new( indent ) - f.write( self, rv = "" ) - else - f = REXML::Formatters::Default.new - f.write( self, rv = "" ) - end - return rv - end - - def indent to, ind - if @parent and @parent.context and not @parent.context[:indentstyle].nil? then - indentstyle = @parent.context[:indentstyle] - else - indentstyle = ' ' - end - to << indentstyle*ind unless ind<1 - end - - def parent? - false; - end - - - # Visit all subnodes of +self+ recursively - def each_recursive(&block) # :yields: node - self.elements.each {|node| - block.call(node) - node.each_recursive(&block) - } - end - - # Find (and return) first subnode (recursively) for which the block - # evaluates to true. Returns +nil+ if none was found. - def find_first_recursive(&block) # :yields: node - each_recursive {|node| - return node if block.call(node) - } - return nil - end - - # Returns the position that +self+ holds in its parent's array, indexed - # from 1. - def index_in_parent - parent.index(self)+1 - end - end -end diff --git a/lib/rexml/output.rb b/lib/rexml/output.rb deleted file mode 100644 index 88a5fb378d..0000000000 --- a/lib/rexml/output.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: false -require_relative 'encoding' - -module REXML - class Output - include Encoding - - attr_reader :encoding - - def initialize real_IO, encd="iso-8859-1" - @output = real_IO - self.encoding = encd - - @to_utf = encoding != 'UTF-8' - - if encoding == "UTF-16" - @output << "\ufeff".encode("UTF-16BE") - self.encoding = "UTF-16BE" - end - end - - def <<( content ) - @output << (@to_utf ? self.encode(content) : content) - end - - def to_s - "Output[#{encoding}]" - end - end -end diff --git a/lib/rexml/parent.rb b/lib/rexml/parent.rb deleted file mode 100644 index 6a53b37a12..0000000000 --- a/lib/rexml/parent.rb +++ /dev/null @@ -1,166 +0,0 @@ -# frozen_string_literal: false -require_relative "child" - -module REXML - # A parent has children, and has methods for accessing them. The Parent - # class is never encountered except as the superclass for some other - # object. - class Parent < Child - include Enumerable - - # Constructor - # @param parent if supplied, will be set as the parent of this object - def initialize parent=nil - super(parent) - @children = [] - end - - def add( object ) - object.parent = self - @children << object - object - end - - alias :push :add - alias :<< :push - - def unshift( object ) - object.parent = self - @children.unshift object - end - - def delete( object ) - found = false - @children.delete_if {|c| c.equal?(object) and found = true } - object.parent = nil if found - found ? object : nil - end - - def each(&block) - @children.each(&block) - end - - def delete_if( &block ) - @children.delete_if(&block) - end - - def delete_at( index ) - @children.delete_at index - end - - def each_index( &block ) - @children.each_index(&block) - end - - # Fetches a child at a given index - # @param index the Integer index of the child to fetch - def []( index ) - @children[index] - end - - alias :each_child :each - - - - # Set an index entry. See Array.[]= - # @param index the index of the element to set - # @param opt either the object to set, or an Integer length - # @param child if opt is an Integer, this is the child to set - # @return the parent (self) - def []=( *args ) - args[-1].parent = self - @children[*args[0..-2]] = args[-1] - end - - # Inserts an child before another child - # @param child1 this is either an xpath or an Element. If an Element, - # child2 will be inserted before child1 in the child list of the parent. - # If an xpath, child2 will be inserted before the first child to match - # the xpath. - # @param child2 the child to insert - # @return the parent (self) - def insert_before( child1, child2 ) - if child1.kind_of? String - child1 = XPath.first( self, child1 ) - child1.parent.insert_before child1, child2 - else - ind = index(child1) - child2.parent.delete(child2) if child2.parent - @children[ind,0] = child2 - child2.parent = self - end - self - end - - # Inserts an child after another child - # @param child1 this is either an xpath or an Element. If an Element, - # child2 will be inserted after child1 in the child list of the parent. - # If an xpath, child2 will be inserted after the first child to match - # the xpath. - # @param child2 the child to insert - # @return the parent (self) - def insert_after( child1, child2 ) - if child1.kind_of? String - child1 = XPath.first( self, child1 ) - child1.parent.insert_after child1, child2 - else - ind = index(child1)+1 - child2.parent.delete(child2) if child2.parent - @children[ind,0] = child2 - child2.parent = self - end - self - end - - def to_a - @children.dup - end - - # Fetches the index of a given child - # @param child the child to get the index of - # @return the index of the child, or nil if the object is not a child - # of this parent. - def index( child ) - count = -1 - @children.find { |i| count += 1 ; i.hash == child.hash } - count - end - - # @return the number of children of this parent - def size - @children.size - end - - alias :length :size - - # Replaces one child with another, making sure the nodelist is correct - # @param to_replace the child to replace (must be a Child) - # @param replacement the child to insert into the nodelist (must be a - # Child) - def replace_child( to_replace, replacement ) - @children.map! {|c| c.equal?( to_replace ) ? replacement : c } - to_replace.parent = nil - replacement.parent = self - end - - # Deeply clones this object. This creates a complete duplicate of this - # Parent, including all descendants. - def deep_clone - cl = clone() - each do |child| - if child.kind_of? Parent - cl << child.deep_clone - else - cl << child.clone - end - end - cl - end - - alias :children :to_a - - def parent? - true - end - end -end diff --git a/lib/rexml/parseexception.rb b/lib/rexml/parseexception.rb deleted file mode 100644 index 7b16cd1a41..0000000000 --- a/lib/rexml/parseexception.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: false -module REXML - class ParseException < RuntimeError - attr_accessor :source, :parser, :continued_exception - - def initialize( message, source=nil, parser=nil, exception=nil ) - super(message) - @source = source - @parser = parser - @continued_exception = exception - end - - def to_s - # Quote the original exception, if there was one - if @continued_exception - err = @continued_exception.inspect - err << "\n" - err << @continued_exception.backtrace.join("\n") - err << "\n...\n" - else - err = "" - end - - # Get the stack trace and error message - err << super - - # Add contextual information - if @source - err << "\nLine: #{line}\n" - err << "Position: #{position}\n" - err << "Last 80 unconsumed characters:\n" - err << @source.buffer[0..80].force_encoding("ASCII-8BIT").gsub(/\n/, ' ') - end - - err - end - - def position - @source.current_line[0] if @source and defined? @source.current_line and - @source.current_line - end - - def line - @source.current_line[2] if @source and defined? @source.current_line and - @source.current_line - end - - def context - @source.current_line - end - end -end diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb deleted file mode 100644 index f76aed0787..0000000000 --- a/lib/rexml/parsers/baseparser.rb +++ /dev/null @@ -1,594 +0,0 @@ -# frozen_string_literal: false -require_relative '../parseexception' -require_relative '../undefinednamespaceexception' -require_relative '../source' -require 'set' -require "strscan" - -module REXML - module Parsers - # = Using the Pull Parser - # This API is experimental, and subject to change. - # parser = PullParser.new( "texttxet" ) - # while parser.has_next? - # res = parser.next - # puts res[1]['att'] if res.start_tag? and res[0] == 'b' - # end - # See the PullEvent class for information on the content of the results. - # The data is identical to the arguments passed for the various events to - # the StreamListener API. - # - # Notice that: - # parser = PullParser.new( "BAD DOCUMENT" ) - # while parser.has_next? - # res = parser.next - # raise res[1] if res.error? - # end - # - # Nat Price gave me some good ideas for the API. - class BaseParser - LETTER = '[:alpha:]' - DIGIT = '[:digit:]' - - COMBININGCHAR = '' # TODO - EXTENDER = '' # TODO - - NCNAME_STR= "[#{LETTER}_][-[:alnum:]._#{COMBININGCHAR}#{EXTENDER}]*" - QNAME_STR= "(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})" - QNAME = /(#{QNAME_STR})/ - - # Just for backward compatibility. For example, kramdown uses this. - # It's not used in REXML. - UNAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" - - NAMECHAR = '[\-\w\.:]' - NAME = "([\\w:]#{NAMECHAR}*)" - NMTOKEN = "(?:#{NAMECHAR})+" - NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*" - REFERENCE = "&(?:#{NAME};|#\\d+;|#x[0-9a-fA-F]+;)" - REFERENCE_RE = /#{REFERENCE}/ - - DOCTYPE_START = /\A\s*/um - DOCTYPE_PATTERN = /\s*)/um - ATTRIBUTE_PATTERN = /\s*(#{QNAME_STR})\s*=\s*(["'])(.*?)\4/um - COMMENT_START = /\A/um - CDATA_START = /\A/um - CDATA_PATTERN = //um - XMLDECL_START = /\A<\?xml\s/u; - XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>/um - INSTRUCTION_START = /\A<\?/u - INSTRUCTION_PATTERN = /<\?#{NAME}(\s+.*?)?\?>/um - TAG_MATCH = /^<((?>#{QNAME_STR}))/um - CLOSE_MATCH = /^\s*<\/(#{QNAME_STR})\s*>/um - - VERSION = /\bversion\s*=\s*["'](.*?)['"]/um - ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um - STANDALONE = /\bstandalone\s*=\s*["'](.*?)['"]/um - - ENTITY_START = /\A\s*/um - SYSTEMENTITY = /\A\s*(%.*?;)\s*$/um - ENUMERATION = "\\(\\s*#{NMTOKEN}(?:\\s*\\|\\s*#{NMTOKEN})*\\s*\\)" - NOTATIONTYPE = "NOTATION\\s+\\(\\s*#{NAME}(?:\\s*\\|\\s*#{NAME})*\\s*\\)" - ENUMERATEDTYPE = "(?:(?:#{NOTATIONTYPE})|(?:#{ENUMERATION}))" - ATTTYPE = "(CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS|#{ENUMERATEDTYPE})" - ATTVALUE = "(?:\"((?:[^<&\"]|#{REFERENCE})*)\")|(?:'((?:[^<&']|#{REFERENCE})*)')" - DEFAULTDECL = "(#REQUIRED|#IMPLIED|(?:(#FIXED\\s+)?#{ATTVALUE}))" - ATTDEF = "\\s+#{NAME}\\s+#{ATTTYPE}\\s+#{DEFAULTDECL}" - ATTDEF_RE = /#{ATTDEF}/ - ATTLISTDECL_START = /\A\s*/um - NOTATIONDECL_START = /\A\s*/um - SYSTEM = /\A\s*/um - - TEXT_PATTERN = /\A([^<]*)/um - - # Entity constants - PUBIDCHAR = "\x20\x0D\x0Aa-zA-Z0-9\\-()+,./:=?;!*@$_%#" - SYSTEMLITERAL = %Q{((?:"[^"]*")|(?:'[^']*'))} - PUBIDLITERAL = %Q{("[#{PUBIDCHAR}']*"|'[#{PUBIDCHAR}]*')} - EXTERNALID = "(?:(?:(SYSTEM)\\s+#{SYSTEMLITERAL})|(?:(PUBLIC)\\s+#{PUBIDLITERAL}\\s+#{SYSTEMLITERAL}))" - NDATADECL = "\\s+NDATA\\s+#{NAME}" - PEREFERENCE = "%#{NAME};" - ENTITYVALUE = %Q{((?:"(?:[^%&"]|#{PEREFERENCE}|#{REFERENCE})*")|(?:'([^%&']|#{PEREFERENCE}|#{REFERENCE})*'))} - PEDEF = "(?:#{ENTITYVALUE}|#{EXTERNALID})" - ENTITYDEF = "(?:#{ENTITYVALUE}|(?:#{EXTERNALID}(#{NDATADECL})?))" - PEDECL = "" - GEDECL = "" - ENTITYDECL = /\s*(?:#{GEDECL})|(?:#{PEDECL})/um - - EREFERENCE = /&(?!#{NAME};)/ - - DEFAULT_ENTITIES = { - 'gt' => [/>/, '>', '>', />/], - 'lt' => [/</, '<', '<', / [/"/, '"', '"', /"/], - "apos" => [/'/, "'", "'", /'/] - } - - def initialize( source ) - self.stream = source - @listeners = [] - end - - def add_listener( listener ) - @listeners << listener - end - - attr_reader :source - - def stream=( source ) - @source = SourceFactory.create_from( source ) - @closed = nil - @document_status = nil - @tags = [] - @stack = [] - @entities = [] - @nsstack = [] - end - - def position - if @source.respond_to? :position - @source.position - else - # FIXME - 0 - end - end - - # Returns true if there are no more events - def empty? - return (@source.empty? and @stack.empty?) - end - - # Returns true if there are more events. Synonymous with !empty? - def has_next? - return !(@source.empty? and @stack.empty?) - end - - # Push an event back on the head of the stream. This method - # has (theoretically) infinite depth. - def unshift token - @stack.unshift(token) - end - - # Peek at the +depth+ event in the stack. The first element on the stack - # is at depth 0. If +depth+ is -1, will parse to the end of the input - # stream and return the last event, which is always :end_document. - # Be aware that this causes the stream to be parsed up to the +depth+ - # event, so you can effectively pre-parse the entire document (pull the - # entire thing into memory) using this method. - def peek depth=0 - raise %Q[Illegal argument "#{depth}"] if depth < -1 - temp = [] - if depth == -1 - temp.push(pull()) until empty? - else - while @stack.size+temp.size < depth+1 - temp.push(pull()) - end - end - @stack += temp if temp.size > 0 - @stack[depth] - end - - # Returns the next event. This is a +PullEvent+ object. - def pull - pull_event.tap do |event| - @listeners.each do |listener| - listener.receive event - end - end - end - - def pull_event - if @closed - x, @closed = @closed, nil - return [ :end_element, x ] - end - return [ :end_document ] if empty? - return @stack.shift if @stack.size > 0 - #STDERR.puts @source.encoding - @source.read if @source.buffer.size<2 - #STDERR.puts "BUFFER = #{@source.buffer.inspect}" - if @document_status == nil - #@source.consume( /^\s*/um ) - word = @source.match( /^((?:\s+)|(?:<[^>]*>))/um ) - word = word[1] unless word.nil? - #STDERR.puts "WORD = #{word.inspect}" - case word - when COMMENT_START - return [ :comment, @source.match( COMMENT_PATTERN, true )[1] ] - when XMLDECL_START - #STDERR.puts "XMLDECL" - results = @source.match( XMLDECL_PATTERN, true )[1] - version = VERSION.match( results ) - version = version[1] unless version.nil? - encoding = ENCODING.match(results) - encoding = encoding[1] unless encoding.nil? - if need_source_encoding_update?(encoding) - @source.encoding = encoding - end - if encoding.nil? and /\AUTF-16(?:BE|LE)\z/i =~ @source.encoding - encoding = "UTF-16" - end - standalone = STANDALONE.match(results) - standalone = standalone[1] unless standalone.nil? - return [ :xmldecl, version, encoding, standalone ] - when INSTRUCTION_START - return process_instruction - when DOCTYPE_START - md = @source.match( DOCTYPE_PATTERN, true ) - @nsstack.unshift(curr_ns=Set.new) - identity = md[1] - close = md[2] - identity =~ IDENTITY - name = $1 - raise REXML::ParseException.new("DOCTYPE is missing a name") if name.nil? - pub_sys = $2.nil? ? nil : $2.strip - long_name = $4.nil? ? nil : $4.strip - uri = $6.nil? ? nil : $6.strip - args = [ :start_doctype, name, pub_sys, long_name, uri ] - if close == ">" - @document_status = :after_doctype - @source.read if @source.buffer.size<2 - md = @source.match(/^\s*/um, true) - @stack << [ :end_doctype ] - else - @document_status = :in_doctype - end - return args - when /^\s+/ - else - @document_status = :after_doctype - @source.read if @source.buffer.size<2 - md = @source.match(/\s*/um, true) - if @source.encoding == "UTF-8" - @source.buffer.force_encoding(::Encoding::UTF_8) - end - end - end - if @document_status == :in_doctype - md = @source.match(/\s*(.*?>)/um) - case md[1] - when SYSTEMENTITY - match = @source.match( SYSTEMENTITY, true )[1] - return [ :externalentity, match ] - - when ELEMENTDECL_START - return [ :elementdecl, @source.match( ELEMENTDECL_PATTERN, true )[1] ] - - when ENTITY_START - match = @source.match( ENTITYDECL, true ).to_a.compact - match[0] = :entitydecl - ref = false - if match[1] == '%' - ref = true - match.delete_at 1 - end - # Now we have to sort out what kind of entity reference this is - if match[2] == 'SYSTEM' - # External reference - match[3] = match[3][1..-2] # PUBID - match.delete_at(4) if match.size > 4 # Chop out NDATA decl - # match is [ :entity, name, SYSTEM, pubid(, ndata)? ] - elsif match[2] == 'PUBLIC' - # External reference - match[3] = match[3][1..-2] # PUBID - match[4] = match[4][1..-2] # HREF - match.delete_at(5) if match.size > 5 # Chop out NDATA decl - # match is [ :entity, name, PUBLIC, pubid, href(, ndata)? ] - else - match[2] = match[2][1..-2] - match.pop if match.size == 4 - # match is [ :entity, name, value ] - end - match << '%' if ref - return match - when ATTLISTDECL_START - md = @source.match( ATTLISTDECL_PATTERN, true ) - raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil? - element = md[1] - contents = md[0] - - pairs = {} - values = md[0].scan( ATTDEF_RE ) - values.each do |attdef| - unless attdef[3] == "#IMPLIED" - attdef.compact! - val = attdef[3] - val = attdef[4] if val == "#FIXED " - pairs[attdef[0]] = val - if attdef[0] =~ /^xmlns:(.*)/ - @nsstack[0] << $1 - end - end - end - return [ :attlistdecl, element, pairs, contents ] - when NOTATIONDECL_START - md = nil - if @source.match( PUBLIC ) - md = @source.match( PUBLIC, true ) - vals = [md[1],md[2],md[4],md[6]] - elsif @source.match( SYSTEM ) - md = @source.match( SYSTEM, true ) - vals = [md[1],md[2],nil,md[4]] - else - raise REXML::ParseException.new( "error parsing notation: no matching pattern", @source ) - end - return [ :notationdecl, *vals ] - when DOCTYPE_END - @document_status = :after_doctype - @source.match( DOCTYPE_END, true ) - return [ :end_doctype ] - end - end - begin - if @source.buffer[0] == ?< - if @source.buffer[1] == ?/ - @nsstack.shift - last_tag = @tags.pop - md = @source.match( CLOSE_MATCH, true ) - if md and !last_tag - message = "Unexpected top-level end tag (got '#{md[1]}')" - raise REXML::ParseException.new(message, @source) - end - if md.nil? or last_tag != md[1] - message = "Missing end tag for '#{last_tag}'" - message << " (got '#{md[1]}')" if md - raise REXML::ParseException.new(message, @source) - end - return [ :end_element, last_tag ] - elsif @source.buffer[1] == ?! - md = @source.match(/\A(\s*[^>]*>)/um) - #STDERR.puts "SOURCE BUFFER = #{source.buffer}, #{source.buffer.size}" - raise REXML::ParseException.new("Malformed node", @source) unless md - if md[0][2] == ?- - md = @source.match( COMMENT_PATTERN, true ) - - case md[1] - when /--/, /-\z/ - raise REXML::ParseException.new("Malformed comment", @source) - end - - return [ :comment, md[1] ] if md - else - md = @source.match( CDATA_PATTERN, true ) - return [ :cdata, md[1] ] if md - end - raise REXML::ParseException.new( "Declarations can only occur "+ - "in the doctype declaration.", @source) - elsif @source.buffer[1] == ?? - return process_instruction - else - # Get the next tag - md = @source.match(TAG_MATCH, true) - unless md - raise REXML::ParseException.new("malformed XML: missing tag start", @source) - end - prefixes = Set.new - prefixes << md[2] if md[2] - @nsstack.unshift(curr_ns=Set.new) - attributes, closed = parse_attributes(prefixes, curr_ns) - # Verify that all of the prefixes have been defined - for prefix in prefixes - unless @nsstack.find{|k| k.member?(prefix)} - raise UndefinedNamespaceException.new(prefix,@source,self) - end - end - - if closed - @closed = md[1] - @nsstack.shift - else - @tags.push( md[1] ) - end - return [ :start_element, md[1], attributes ] - end - else - md = @source.match( TEXT_PATTERN, true ) - if md[0].length == 0 - @source.match( /(\s+)/, true ) - end - #STDERR.puts "GOT #{md[1].inspect}" unless md[0].length == 0 - #return [ :text, "" ] if md[0].length == 0 - # unnormalized = Text::unnormalize( md[1], self ) - # return PullEvent.new( :text, md[1], unnormalized ) - return [ :text, md[1] ] - end - rescue REXML::UndefinedNamespaceException - raise - rescue REXML::ParseException - raise - rescue => error - raise REXML::ParseException.new( "Exception parsing", - @source, self, (error ? error : $!) ) - end - return [ :dummy ] - end - private :pull_event - - def entity( reference, entities ) - value = nil - value = entities[ reference ] if entities - if not value - value = DEFAULT_ENTITIES[ reference ] - value = value[2] if value - end - unnormalize( value, entities ) if value - end - - # Escapes all possible entities - def normalize( input, entities=nil, entity_filter=nil ) - copy = input.clone - # Doing it like this rather than in a loop improves the speed - copy.gsub!( EREFERENCE, '&' ) - entities.each do |key, value| - copy.gsub!( value, "&#{key};" ) unless entity_filter and - entity_filter.include?(entity) - end if entities - copy.gsub!( EREFERENCE, '&' ) - DEFAULT_ENTITIES.each do |key, value| - copy.gsub!( value[3], value[1] ) - end - copy - end - - # Unescapes all possible entities - def unnormalize( string, entities=nil, filter=nil ) - rv = string.clone - rv.gsub!( /\r\n?/, "\n" ) - matches = rv.scan( REFERENCE_RE ) - return rv if matches.size == 0 - rv.gsub!( /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ ) { - m=$1 - m = "0#{m}" if m[0] == ?x - [Integer(m)].pack('U*') - } - matches.collect!{|x|x[0]}.compact! - if matches.size > 0 - matches.each do |entity_reference| - unless filter and filter.include?(entity_reference) - entity_value = entity( entity_reference, entities ) - if entity_value - re = /&#{entity_reference};/ - rv.gsub!( re, entity_value ) - else - er = DEFAULT_ENTITIES[entity_reference] - rv.gsub!( er[0], er[2] ) if er - end - end - end - rv.gsub!( /&/, '&' ) - end - rv - end - - private - def need_source_encoding_update?(xml_declaration_encoding) - return false if xml_declaration_encoding.nil? - return false if /\AUTF-16\z/i =~ xml_declaration_encoding - true - end - - def process_instruction - match_data = @source.match(INSTRUCTION_PATTERN, true) - unless match_data - message = "Invalid processing instruction node" - raise REXML::ParseException.new(message, @source) - end - [:processing_instruction, match_data[1], match_data[2]] - end - - def parse_attributes(prefixes, curr_ns) - attributes = {} - closed = false - match_data = @source.match(/^(.*?)(\/)?>/um, true) - if match_data.nil? - message = "Start tag isn't ended" - raise REXML::ParseException.new(message, @source) - end - - raw_attributes = match_data[1] - closed = !match_data[2].nil? - return attributes, closed if raw_attributes.nil? - return attributes, closed if raw_attributes.empty? - - scanner = StringScanner.new(raw_attributes) - until scanner.eos? - if scanner.scan(/\s+/) - break if scanner.eos? - end - - pos = scanner.pos - loop do - break if scanner.scan(ATTRIBUTE_PATTERN) - unless scanner.scan(QNAME) - message = "Invalid attribute name: <#{scanner.rest}>" - raise REXML::ParseException.new(message, @source) - end - name = scanner[0] - unless scanner.scan(/\s*=\s*/um) - message = "Missing attribute equal: <#{name}>" - raise REXML::ParseException.new(message, @source) - end - quote = scanner.scan(/['"]/) - unless quote - message = "Missing attribute value start quote: <#{name}>" - raise REXML::ParseException.new(message, @source) - end - unless scanner.scan(/.*#{Regexp.escape(quote)}/um) - match_data = @source.match(/^(.*?)(\/)?>/um, true) - if match_data - scanner << "/" if closed - scanner << ">" - scanner << match_data[1] - scanner.pos = pos - closed = !match_data[2].nil? - next - end - message = - "Missing attribute value end quote: <#{name}>: <#{quote}>" - raise REXML::ParseException.new(message, @source) - end - end - name = scanner[1] - prefix = scanner[2] - local_part = scanner[3] - # quote = scanner[4] - value = scanner[5] - if prefix == "xmlns" - if local_part == "xml" - if value != "http://www.w3.org/XML/1998/namespace" - msg = "The 'xml' prefix must not be bound to any other namespace "+ - "(http://www.w3.org/TR/REC-xml-names/#ns-decl)" - raise REXML::ParseException.new( msg, @source, self ) - end - elsif local_part == "xmlns" - msg = "The 'xmlns' prefix must not be declared "+ - "(http://www.w3.org/TR/REC-xml-names/#ns-decl)" - raise REXML::ParseException.new( msg, @source, self) - end - curr_ns << local_part - elsif prefix - prefixes << prefix unless prefix == "xml" - end - - if attributes.has_key?(name) - msg = "Duplicate attribute #{name.inspect}" - raise REXML::ParseException.new(msg, @source, self) - end - - attributes[name] = value - end - return attributes, closed - end - end - end -end - -=begin - case event[0] - when :start_element - when :text - when :end_element - when :processing_instruction - when :cdata - when :comment - when :xmldecl - when :start_doctype - when :end_doctype - when :externalentity - when :elementdecl - when :entity - when :attlistdecl - when :notationdecl - when :end_doctype - end -=end diff --git a/lib/rexml/parsers/lightparser.rb b/lib/rexml/parsers/lightparser.rb deleted file mode 100644 index bdc08276a9..0000000000 --- a/lib/rexml/parsers/lightparser.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: false -require_relative 'streamparser' -require_relative 'baseparser' -require_relative '../light/node' - -module REXML - module Parsers - class LightParser - def initialize stream - @stream = stream - @parser = REXML::Parsers::BaseParser.new( stream ) - end - - def add_listener( listener ) - @parser.add_listener( listener ) - end - - def rewind - @stream.rewind - @parser.stream = @stream - end - - def parse - root = context = [ :document ] - while true - event = @parser.pull - case event[0] - when :end_document - break - when :start_element, :start_doctype - new_node = event - context << new_node - new_node[1,0] = [context] - context = new_node - when :end_element, :end_doctype - context = context[1] - else - new_node = event - context << new_node - new_node[1,0] = [context] - end - end - root - end - end - - # An element is an array. The array contains: - # 0 The parent element - # 1 The tag name - # 2 A hash of attributes - # 3..-1 The child elements - # An element is an array of size > 3 - # Text is a String - # PIs are [ :processing_instruction, target, data ] - # Comments are [ :comment, data ] - # DocTypes are DocType structs - # The root is an array with XMLDecls, Text, DocType, Array, Text - end -end diff --git a/lib/rexml/parsers/pullparser.rb b/lib/rexml/parsers/pullparser.rb deleted file mode 100644 index f8b232a2cd..0000000000 --- a/lib/rexml/parsers/pullparser.rb +++ /dev/null @@ -1,197 +0,0 @@ -# frozen_string_literal: false -require 'forwardable' - -require_relative '../parseexception' -require_relative 'baseparser' -require_relative '../xmltokens' - -module REXML - module Parsers - # = Using the Pull Parser - # This API is experimental, and subject to change. - # parser = PullParser.new( "texttxet" ) - # while parser.has_next? - # res = parser.next - # puts res[1]['att'] if res.start_tag? and res[0] == 'b' - # end - # See the PullEvent class for information on the content of the results. - # The data is identical to the arguments passed for the various events to - # the StreamListener API. - # - # Notice that: - # parser = PullParser.new( "BAD DOCUMENT" ) - # while parser.has_next? - # res = parser.next - # raise res[1] if res.error? - # end - # - # Nat Price gave me some good ideas for the API. - class PullParser - include XMLTokens - extend Forwardable - - def_delegators( :@parser, :has_next? ) - def_delegators( :@parser, :entity ) - def_delegators( :@parser, :empty? ) - def_delegators( :@parser, :source ) - - def initialize stream - @entities = {} - @listeners = nil - @parser = BaseParser.new( stream ) - @my_stack = [] - end - - def add_listener( listener ) - @listeners = [] unless @listeners - @listeners << listener - end - - def each - while has_next? - yield self.pull - end - end - - def peek depth=0 - if @my_stack.length <= depth - (depth - @my_stack.length + 1).times { - e = PullEvent.new(@parser.pull) - @my_stack.push(e) - } - end - @my_stack[depth] - end - - def pull - return @my_stack.shift if @my_stack.length > 0 - - event = @parser.pull - case event[0] - when :entitydecl - @entities[ event[1] ] = - event[2] unless event[2] =~ /PUBLIC|SYSTEM/ - when :text - unnormalized = @parser.unnormalize( event[1], @entities ) - event << unnormalized - end - PullEvent.new( event ) - end - - def unshift token - @my_stack.unshift token - end - end - - # A parsing event. The contents of the event are accessed as an +Array?, - # and the type is given either by the ...? methods, or by accessing the - # +type+ accessor. The contents of this object vary from event to event, - # but are identical to the arguments passed to +StreamListener+s for each - # event. - class PullEvent - # The type of this event. Will be one of :tag_start, :tag_end, :text, - # :processing_instruction, :comment, :doctype, :attlistdecl, :entitydecl, - # :notationdecl, :entity, :cdata, :xmldecl, or :error. - def initialize(arg) - @contents = arg - end - - def []( start, endd=nil) - if start.kind_of? Range - @contents.slice( start.begin+1 .. start.end ) - elsif start.kind_of? Numeric - if endd.nil? - @contents.slice( start+1 ) - else - @contents.slice( start+1, endd ) - end - else - raise "Illegal argument #{start.inspect} (#{start.class})" - end - end - - def event_type - @contents[0] - end - - # Content: [ String tag_name, Hash attributes ] - def start_element? - @contents[0] == :start_element - end - - # Content: [ String tag_name ] - def end_element? - @contents[0] == :end_element - end - - # Content: [ String raw_text, String unnormalized_text ] - def text? - @contents[0] == :text - end - - # Content: [ String text ] - def instruction? - @contents[0] == :processing_instruction - end - - # Content: [ String text ] - def comment? - @contents[0] == :comment - end - - # Content: [ String name, String pub_sys, String long_name, String uri ] - def doctype? - @contents[0] == :start_doctype - end - - # Content: [ String text ] - def attlistdecl? - @contents[0] == :attlistdecl - end - - # Content: [ String text ] - def elementdecl? - @contents[0] == :elementdecl - end - - # Due to the wonders of DTDs, an entity declaration can be just about - # anything. There's no way to normalize it; you'll have to interpret the - # content yourself. However, the following is true: - # - # * If the entity declaration is an internal entity: - # [ String name, String value ] - # Content: [ String text ] - def entitydecl? - @contents[0] == :entitydecl - end - - # Content: [ String text ] - def notationdecl? - @contents[0] == :notationdecl - end - - # Content: [ String text ] - def entity? - @contents[0] == :entity - end - - # Content: [ String text ] - def cdata? - @contents[0] == :cdata - end - - # Content: [ String version, String encoding, String standalone ] - def xmldecl? - @contents[0] == :xmldecl - end - - def error? - @contents[0] == :error - end - - def inspect - @contents[0].to_s + ": " + @contents[1..-1].inspect - end - end - end -end diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb deleted file mode 100644 index 6a24ce2227..0000000000 --- a/lib/rexml/parsers/sax2parser.rb +++ /dev/null @@ -1,273 +0,0 @@ -# frozen_string_literal: false -require_relative 'baseparser' -require_relative '../parseexception' -require_relative '../namespace' -require_relative '../text' - -module REXML - module Parsers - # SAX2Parser - class SAX2Parser - def initialize source - @parser = BaseParser.new(source) - @listeners = [] - @procs = [] - @namespace_stack = [] - @has_listeners = false - @tag_stack = [] - @entities = {} - end - - def source - @parser.source - end - - def add_listener( listener ) - @parser.add_listener( listener ) - end - - # Listen arguments: - # - # Symbol, Array, Block - # Listen to Symbol events on Array elements - # Symbol, Block - # Listen to Symbol events - # Array, Listener - # Listen to all events on Array elements - # Array, Block - # Listen to :start_element events on Array elements - # Listener - # Listen to All events - # - # Symbol can be one of: :start_element, :end_element, - # :start_prefix_mapping, :end_prefix_mapping, :characters, - # :processing_instruction, :doctype, :attlistdecl, :elementdecl, - # :entitydecl, :notationdecl, :cdata, :xmldecl, :comment - # - # There is an additional symbol that can be listened for: :progress. - # This will be called for every event generated, passing in the current - # stream position. - # - # Array contains regular expressions or strings which will be matched - # against fully qualified element names. - # - # Listener must implement the methods in SAX2Listener - # - # Block will be passed the same arguments as a SAX2Listener method would - # be, where the method name is the same as the matched Symbol. - # See the SAX2Listener for more information. - def listen( *args, &blok ) - if args[0].kind_of? Symbol - if args.size == 2 - args[1].each { |match| @procs << [args[0], match, blok] } - else - add( [args[0], nil, blok] ) - end - elsif args[0].kind_of? Array - if args.size == 2 - args[0].each { |match| add( [nil, match, args[1]] ) } - else - args[0].each { |match| add( [ :start_element, match, blok ] ) } - end - else - add([nil, nil, args[0]]) - end - end - - def deafen( listener=nil, &blok ) - if listener - @listeners.delete_if {|item| item[-1] == listener } - @has_listeners = false if @listeners.size == 0 - else - @procs.delete_if {|item| item[-1] == blok } - end - end - - def parse - @procs.each { |sym,match,block| block.call if sym == :start_document } - @listeners.each { |sym,match,block| - block.start_document if sym == :start_document or sym.nil? - } - context = [] - while true - event = @parser.pull - case event[0] - when :end_document - handle( :end_document ) - break - when :start_doctype - handle( :doctype, *event[1..-1]) - when :end_doctype - context = context[1] - when :start_element - @tag_stack.push(event[1]) - # find the observers for namespaces - procs = get_procs( :start_prefix_mapping, event[1] ) - listeners = get_listeners( :start_prefix_mapping, event[1] ) - if procs or listeners - # break out the namespace declarations - # The attributes live in event[2] - event[2].each {|n, v| event[2][n] = @parser.normalize(v)} - nsdecl = event[2].find_all { |n, value| n =~ /^xmlns(:|$)/ } - nsdecl.collect! { |n, value| [ n[6..-1], value ] } - @namespace_stack.push({}) - nsdecl.each do |n,v| - @namespace_stack[-1][n] = v - # notify observers of namespaces - procs.each { |ob| ob.call( n, v ) } if procs - listeners.each { |ob| ob.start_prefix_mapping(n, v) } if listeners - end - end - event[1] =~ Namespace::NAMESPLIT - prefix = $1 - local = $2 - uri = get_namespace(prefix) - # find the observers for start_element - procs = get_procs( :start_element, event[1] ) - listeners = get_listeners( :start_element, event[1] ) - # notify observers - procs.each { |ob| ob.call( uri, local, event[1], event[2] ) } if procs - listeners.each { |ob| - ob.start_element( uri, local, event[1], event[2] ) - } if listeners - when :end_element - @tag_stack.pop - event[1] =~ Namespace::NAMESPLIT - prefix = $1 - local = $2 - uri = get_namespace(prefix) - # find the observers for start_element - procs = get_procs( :end_element, event[1] ) - listeners = get_listeners( :end_element, event[1] ) - # notify observers - procs.each { |ob| ob.call( uri, local, event[1] ) } if procs - listeners.each { |ob| - ob.end_element( uri, local, event[1] ) - } if listeners - - namespace_mapping = @namespace_stack.pop - # find the observers for namespaces - procs = get_procs( :end_prefix_mapping, event[1] ) - listeners = get_listeners( :end_prefix_mapping, event[1] ) - if procs or listeners - namespace_mapping.each do |ns_prefix, ns_uri| - # notify observers of namespaces - procs.each { |ob| ob.call( ns_prefix ) } if procs - listeners.each { |ob| ob.end_prefix_mapping(ns_prefix) } if listeners - end - end - when :text - #normalized = @parser.normalize( event[1] ) - #handle( :characters, normalized ) - copy = event[1].clone - - esub = proc { |match| - if @entities.has_key?($1) - @entities[$1].gsub(Text::REFERENCE, &esub) - else - match - end - } - - copy.gsub!( Text::REFERENCE, &esub ) - copy.gsub!( Text::NUMERICENTITY ) {|m| - m=$1 - m = "0#{m}" if m[0] == ?x - [Integer(m)].pack('U*') - } - handle( :characters, copy ) - when :entitydecl - handle_entitydecl( event ) - when :processing_instruction, :comment, :attlistdecl, - :elementdecl, :cdata, :notationdecl, :xmldecl - handle( *event ) - end - handle( :progress, @parser.position ) - end - end - - private - def handle( symbol, *arguments ) - tag = @tag_stack[-1] - procs = get_procs( symbol, tag ) - listeners = get_listeners( symbol, tag ) - # notify observers - procs.each { |ob| ob.call( *arguments ) } if procs - listeners.each { |l| - l.send( symbol.to_s, *arguments ) - } if listeners - end - - def handle_entitydecl( event ) - @entities[ event[1] ] = event[2] if event.size == 3 - parameter_reference_p = false - case event[2] - when "SYSTEM" - if event.size == 5 - if event.last == "%" - parameter_reference_p = true - else - event[4, 0] = "NDATA" - end - end - when "PUBLIC" - if event.size == 6 - if event.last == "%" - parameter_reference_p = true - else - event[5, 0] = "NDATA" - end - end - else - parameter_reference_p = (event.size == 4) - end - event[1, 0] = event.pop if parameter_reference_p - handle( event[0], event[1..-1] ) - end - - # The following methods are duplicates, but it is faster than using - # a helper - def get_procs( symbol, name ) - return nil if @procs.size == 0 - @procs.find_all do |sym, match, block| - ( - (sym.nil? or symbol == sym) and - ((name.nil? and match.nil?) or match.nil? or ( - (name == match) or - (match.kind_of? Regexp and name =~ match) - ) - ) - ) - end.collect{|x| x[-1]} - end - def get_listeners( symbol, name ) - return nil if @listeners.size == 0 - @listeners.find_all do |sym, match, block| - ( - (sym.nil? or symbol == sym) and - ((name.nil? and match.nil?) or match.nil? or ( - (name == match) or - (match.kind_of? Regexp and name =~ match) - ) - ) - ) - end.collect{|x| x[-1]} - end - - def add( pair ) - if pair[-1].respond_to? :call - @procs << pair unless @procs.include? pair - else - @listeners << pair unless @listeners.include? pair - @has_listeners = true - end - end - - def get_namespace( prefix ) - uris = (@namespace_stack.find_all { |ns| not ns[prefix].nil? }) || - (@namespace_stack.find { |ns| not ns[nil].nil? }) - uris[-1][prefix] unless uris.nil? or 0 == uris.size - end - end - end -end diff --git a/lib/rexml/parsers/streamparser.rb b/lib/rexml/parsers/streamparser.rb deleted file mode 100644 index 9e0eb0b363..0000000000 --- a/lib/rexml/parsers/streamparser.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: false -require_relative "baseparser" - -module REXML - module Parsers - class StreamParser - def initialize source, listener - @listener = listener - @parser = BaseParser.new( source ) - @tag_stack = [] - end - - def add_listener( listener ) - @parser.add_listener( listener ) - end - - def parse - # entity string - while true - event = @parser.pull - case event[0] - when :end_document - unless @tag_stack.empty? - tag_path = "/" + @tag_stack.join("/") - raise ParseException.new("Missing end tag for '#{tag_path}'", - @parser.source) - end - return - when :start_element - @tag_stack << event[1] - attrs = event[2].each do |n, v| - event[2][n] = @parser.unnormalize( v ) - end - @listener.tag_start( event[1], attrs ) - when :end_element - @listener.tag_end( event[1] ) - @tag_stack.pop - when :text - normalized = @parser.unnormalize( event[1] ) - @listener.text( normalized ) - when :processing_instruction - @listener.instruction( *event[1,2] ) - when :start_doctype - @listener.doctype( *event[1..-1] ) - when :end_doctype - # FIXME: remove this condition for milestone:3.2 - @listener.doctype_end if @listener.respond_to? :doctype_end - when :comment, :attlistdecl, :cdata, :xmldecl, :elementdecl - @listener.send( event[0].to_s, *event[1..-1] ) - when :entitydecl, :notationdecl - @listener.send( event[0].to_s, event[1..-1] ) - when :externalentity - entity_reference = event[1] - content = entity_reference.gsub(/\A%|;\z/, "") - @listener.entity(content) - end - end - end - end - end -end diff --git a/lib/rexml/parsers/treeparser.rb b/lib/rexml/parsers/treeparser.rb deleted file mode 100644 index bf9a42545b..0000000000 --- a/lib/rexml/parsers/treeparser.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: false -require_relative '../validation/validationexception' -require_relative '../undefinednamespaceexception' - -module REXML - module Parsers - class TreeParser - def initialize( source, build_context = Document.new ) - @build_context = build_context - @parser = Parsers::BaseParser.new( source ) - end - - def add_listener( listener ) - @parser.add_listener( listener ) - end - - def parse - tag_stack = [] - in_doctype = false - entities = nil - begin - while true - event = @parser.pull - #STDERR.puts "TREEPARSER GOT #{event.inspect}" - case event[0] - when :end_document - unless tag_stack.empty? - raise ParseException.new("No close tag for #{@build_context.xpath}", - @parser.source, @parser) - end - return - when :start_element - tag_stack.push(event[1]) - el = @build_context = @build_context.add_element( event[1] ) - event[2].each do |key, value| - el.attributes[key]=Attribute.new(key,value,self) - end - when :end_element - tag_stack.pop - @build_context = @build_context.parent - when :text - if not in_doctype - if @build_context[-1].instance_of? Text - @build_context[-1] << event[1] - else - @build_context.add( - Text.new(event[1], @build_context.whitespace, nil, true) - ) unless ( - @build_context.ignore_whitespace_nodes and - event[1].strip.size==0 - ) - end - end - when :comment - c = Comment.new( event[1] ) - @build_context.add( c ) - when :cdata - c = CData.new( event[1] ) - @build_context.add( c ) - when :processing_instruction - @build_context.add( Instruction.new( event[1], event[2] ) ) - when :end_doctype - in_doctype = false - entities.each { |k,v| entities[k] = @build_context.entities[k].value } - @build_context = @build_context.parent - when :start_doctype - doctype = DocType.new( event[1..-1], @build_context ) - @build_context = doctype - entities = {} - in_doctype = true - when :attlistdecl - n = AttlistDecl.new( event[1..-1] ) - @build_context.add( n ) - when :externalentity - n = ExternalEntity.new( event[1] ) - @build_context.add( n ) - when :elementdecl - n = ElementDecl.new( event[1] ) - @build_context.add(n) - when :entitydecl - entities[ event[1] ] = event[2] unless event[2] =~ /PUBLIC|SYSTEM/ - @build_context.add(Entity.new(event)) - when :notationdecl - n = NotationDecl.new( *event[1..-1] ) - @build_context.add( n ) - when :xmldecl - x = XMLDecl.new( event[1], event[2], event[3] ) - @build_context.add( x ) - end - end - rescue REXML::Validation::ValidationException - raise - rescue REXML::ParseException - raise - rescue - raise ParseException.new( $!.message, @parser.source, @parser, $! ) - end - end - end - end -end diff --git a/lib/rexml/parsers/ultralightparser.rb b/lib/rexml/parsers/ultralightparser.rb deleted file mode 100644 index e0029f43da..0000000000 --- a/lib/rexml/parsers/ultralightparser.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: false -require_relative 'streamparser' -require_relative 'baseparser' - -module REXML - module Parsers - class UltraLightParser - def initialize stream - @stream = stream - @parser = REXML::Parsers::BaseParser.new( stream ) - end - - def add_listener( listener ) - @parser.add_listener( listener ) - end - - def rewind - @stream.rewind - @parser.stream = @stream - end - - def parse - root = context = [] - while true - event = @parser.pull - case event[0] - when :end_document - break - when :end_doctype - context = context[1] - when :start_element, :start_doctype - context << event - event[1,0] = [context] - context = event - when :end_element - context = context[1] - else - context << event - end - end - root - end - end - - # An element is an array. The array contains: - # 0 The parent element - # 1 The tag name - # 2 A hash of attributes - # 3..-1 The child elements - # An element is an array of size > 3 - # Text is a String - # PIs are [ :processing_instruction, target, data ] - # Comments are [ :comment, data ] - # DocTypes are DocType structs - # The root is an array with XMLDecls, Text, DocType, Array, Text - end -end diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb deleted file mode 100644 index d01d325e04..0000000000 --- a/lib/rexml/parsers/xpathparser.rb +++ /dev/null @@ -1,675 +0,0 @@ -# frozen_string_literal: false -require_relative '../namespace' -require_relative '../xmltokens' - -module REXML - module Parsers - # You don't want to use this class. Really. Use XPath, which is a wrapper - # for this class. Believe me. You don't want to poke around in here. - # There is strange, dark magic at work in this code. Beware. Go back! Go - # back while you still can! - class XPathParser - include XMLTokens - LITERAL = /^'([^']*)'|^"([^"]*)"/u - - def namespaces=( namespaces ) - Functions::namespace_context = namespaces - @namespaces = namespaces - end - - def parse path - path = path.dup - path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces - path.gsub!( /\s+([\]\)])/, '\1') - parsed = [] - OrExpr(path, parsed) - parsed - end - - def predicate path - parsed = [] - Predicate( "[#{path}]", parsed ) - parsed - end - - def abbreviate( path ) - path = path.kind_of?(String) ? parse( path ) : path - string = "" - document = false - while path.size > 0 - op = path.shift - case op - when :node - when :attribute - string << "/" if string.size > 0 - string << "@" - when :child - string << "/" if string.size > 0 - when :descendant_or_self - string << "/" - when :self - string << "." - when :parent - string << ".." - when :any - string << "*" - when :text - string << "text()" - when :following, :following_sibling, - :ancestor, :ancestor_or_self, :descendant, - :namespace, :preceding, :preceding_sibling - string << "/" unless string.size == 0 - string << op.to_s.tr("_", "-") - string << "::" - when :qname - prefix = path.shift - name = path.shift - string << prefix+":" if prefix.size > 0 - string << name - when :predicate - string << '[' - string << predicate_to_string( path.shift ) {|x| abbreviate( x ) } - string << ']' - when :document - document = true - when :function - string << path.shift - string << "( " - string << predicate_to_string( path.shift[0] ) {|x| abbreviate( x )} - string << " )" - when :literal - string << %Q{ "#{path.shift}" } - else - string << "/" unless string.size == 0 - string << "UNKNOWN(" - string << op.inspect - string << ")" - end - end - string = "/"+string if document - return string - end - - def expand( path ) - path = path.kind_of?(String) ? parse( path ) : path - string = "" - document = false - while path.size > 0 - op = path.shift - case op - when :node - string << "node()" - when :attribute, :child, :following, :following_sibling, - :ancestor, :ancestor_or_self, :descendant, :descendant_or_self, - :namespace, :preceding, :preceding_sibling, :self, :parent - string << "/" unless string.size == 0 - string << op.to_s.tr("_", "-") - string << "::" - when :any - string << "*" - when :qname - prefix = path.shift - name = path.shift - string << prefix+":" if prefix.size > 0 - string << name - when :predicate - string << '[' - string << predicate_to_string( path.shift ) { |x| expand(x) } - string << ']' - when :document - document = true - else - string << "/" unless string.size == 0 - string << "UNKNOWN(" - string << op.inspect - string << ")" - end - end - string = "/"+string if document - return string - end - - def predicate_to_string( path, &block ) - string = "" - case path[0] - when :and, :or, :mult, :plus, :minus, :neq, :eq, :lt, :gt, :lteq, :gteq, :div, :mod, :union - op = path.shift - case op - when :eq - op = "=" - when :lt - op = "<" - when :gt - op = ">" - when :lteq - op = "<=" - when :gteq - op = ">=" - when :neq - op = "!=" - when :union - op = "|" - end - left = predicate_to_string( path.shift, &block ) - right = predicate_to_string( path.shift, &block ) - string << " " - string << left - string << " " - string << op.to_s - string << " " - string << right - string << " " - when :function - path.shift - name = path.shift - string << name - string << "( " - string << predicate_to_string( path.shift, &block ) - string << " )" - when :literal - path.shift - string << " " - string << path.shift.inspect - string << " " - else - string << " " - string << yield( path ) - string << " " - end - return string.squeeze(" ") - end - - private - #LocationPath - # | RelativeLocationPath - # | '/' RelativeLocationPath? - # | '//' RelativeLocationPath - def LocationPath path, parsed - path = path.lstrip - if path[0] == ?/ - parsed << :document - if path[1] == ?/ - parsed << :descendant_or_self - parsed << :node - path = path[2..-1] - else - path = path[1..-1] - end - end - return RelativeLocationPath( path, parsed ) if path.size > 0 - end - - #RelativeLocationPath - # | Step - # | (AXIS_NAME '::' | '@' | '') AxisSpecifier - # NodeTest - # Predicate - # | '.' | '..' AbbreviatedStep - # | RelativeLocationPath '/' Step - # | RelativeLocationPath '//' Step - AXIS = /^(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::/ - def RelativeLocationPath path, parsed - loop do - original_path = path - path = path.lstrip - - return original_path if path.empty? - - # (axis or @ or ) nodetest predicate > - # OR > / Step - # (. or ..) > - if path[0] == ?. - if path[1] == ?. - parsed << :parent - parsed << :node - path = path[2..-1] - else - parsed << :self - parsed << :node - path = path[1..-1] - end - else - if path[0] == ?@ - parsed << :attribute - path = path[1..-1] - # Goto Nodetest - elsif path =~ AXIS - parsed << $1.tr('-','_').intern - path = $' - # Goto Nodetest - else - parsed << :child - end - - n = [] - path = NodeTest( path, n) - - path = Predicate( path, n ) - - parsed.concat(n) - end - - original_path = path - path = path.lstrip - return original_path if path.empty? - - return original_path if path[0] != ?/ - - if path[1] == ?/ - parsed << :descendant_or_self - parsed << :node - path = path[2..-1] - else - path = path[1..-1] - end - end - end - - # Returns a 1-1 map of the nodeset - # The contents of the resulting array are either: - # true/false, if a positive match - # String, if a name match - #NodeTest - # | ('*' | NCNAME ':' '*' | QNAME) NameTest - # | '*' ':' NCNAME NameTest since XPath 2.0 - # | NODE_TYPE '(' ')' NodeType - # | PI '(' LITERAL ')' PI - # | '[' expr ']' Predicate - PREFIX_WILDCARD = /^\*:(#{NCNAME_STR})/u - LOCAL_NAME_WILDCARD = /^(#{NCNAME_STR}):\*/u - QNAME = Namespace::NAMESPLIT - NODE_TYPE = /^(comment|text|node)\(\s*\)/m - PI = /^processing-instruction\(/ - def NodeTest path, parsed - original_path = path - path = path.lstrip - case path - when PREFIX_WILDCARD - prefix = nil - name = $1 - path = $' - parsed << :qname - parsed << prefix - parsed << name - when /^\*/ - path = $' - parsed << :any - when NODE_TYPE - type = $1 - path = $' - parsed << type.tr('-', '_').intern - when PI - path = $' - literal = nil - if path !~ /^\s*\)/ - path =~ LITERAL - literal = $1 - path = $' - raise ParseException.new("Missing ')' after processing instruction") if path[0] != ?) - path = path[1..-1] - end - parsed << :processing_instruction - parsed << (literal || '') - when LOCAL_NAME_WILDCARD - prefix = $1 - path = $' - parsed << :namespace - parsed << prefix - when QNAME - prefix = $1 - name = $2 - path = $' - prefix = "" unless prefix - parsed << :qname - parsed << prefix - parsed << name - else - path = original_path - end - return path - end - - # Filters the supplied nodeset on the predicate(s) - def Predicate path, parsed - original_path = path - path = path.lstrip - return original_path unless path[0] == ?[ - predicates = [] - while path[0] == ?[ - path, expr = get_group(path) - predicates << expr[1..-2] if expr - end - predicates.each{ |pred| - preds = [] - parsed << :predicate - parsed << preds - OrExpr(pred, preds) - } - path - end - - # The following return arrays of true/false, a 1-1 mapping of the - # supplied nodeset, except for axe(), which returns a filtered - # nodeset - - #| OrExpr S 'or' S AndExpr - #| AndExpr - def OrExpr path, parsed - n = [] - rest = AndExpr( path, n ) - if rest != path - while rest =~ /^\s*( or )/ - n = [ :or, n, [] ] - rest = AndExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace(n) - elsif n.size > 0 - parsed << n - end - rest - end - - #| AndExpr S 'and' S EqualityExpr - #| EqualityExpr - def AndExpr path, parsed - n = [] - rest = EqualityExpr( path, n ) - if rest != path - while rest =~ /^\s*( and )/ - n = [ :and, n, [] ] - rest = EqualityExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace(n) - elsif n.size > 0 - parsed << n - end - rest - end - - #| EqualityExpr ('=' | '!=') RelationalExpr - #| RelationalExpr - def EqualityExpr path, parsed - n = [] - rest = RelationalExpr( path, n ) - if rest != path - while rest =~ /^\s*(!?=)\s*/ - if $1[0] == ?! - n = [ :neq, n, [] ] - else - n = [ :eq, n, [] ] - end - rest = RelationalExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace(n) - elsif n.size > 0 - parsed << n - end - rest - end - - #| RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr - #| AdditiveExpr - def RelationalExpr path, parsed - n = [] - rest = AdditiveExpr( path, n ) - if rest != path - while rest =~ /^\s*([<>]=?)\s*/ - if $1[0] == ?< - sym = "lt" - else - sym = "gt" - end - sym << "eq" if $1[-1] == ?= - n = [ sym.intern, n, [] ] - rest = AdditiveExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace(n) - elsif n.size > 0 - parsed << n - end - rest - end - - #| AdditiveExpr ('+' | '-') MultiplicativeExpr - #| MultiplicativeExpr - def AdditiveExpr path, parsed - n = [] - rest = MultiplicativeExpr( path, n ) - if rest != path - while rest =~ /^\s*(\+|-)\s*/ - if $1[0] == ?+ - n = [ :plus, n, [] ] - else - n = [ :minus, n, [] ] - end - rest = MultiplicativeExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace(n) - elsif n.size > 0 - parsed << n - end - rest - end - - #| MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr - #| UnaryExpr - def MultiplicativeExpr path, parsed - n = [] - rest = UnaryExpr( path, n ) - if rest != path - while rest =~ /^\s*(\*| div | mod )\s*/ - if $1[0] == ?* - n = [ :mult, n, [] ] - elsif $1.include?( "div" ) - n = [ :div, n, [] ] - else - n = [ :mod, n, [] ] - end - rest = UnaryExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace(n) - elsif n.size > 0 - parsed << n - end - rest - end - - #| '-' UnaryExpr - #| UnionExpr - def UnaryExpr path, parsed - path =~ /^(\-*)/ - path = $' - if $1 and (($1.size % 2) != 0) - mult = -1 - else - mult = 1 - end - parsed << :neg if mult < 0 - - n = [] - path = UnionExpr( path, n ) - parsed.concat( n ) - path - end - - #| UnionExpr '|' PathExpr - #| PathExpr - def UnionExpr path, parsed - n = [] - rest = PathExpr( path, n ) - if rest != path - while rest =~ /^\s*(\|)\s*/ - n = [ :union, n, [] ] - rest = PathExpr( $', n[-1] ) - end - end - if parsed.size == 0 and n.size != 0 - parsed.replace( n ) - elsif n.size > 0 - parsed << n - end - rest - end - - #| LocationPath - #| FilterExpr ('/' | '//') RelativeLocationPath - def PathExpr path, parsed - path = path.lstrip - n = [] - rest = FilterExpr( path, n ) - if rest != path - if rest and rest[0] == ?/ - rest = RelativeLocationPath(rest, n) - parsed.concat(n) - return rest - end - end - rest = LocationPath(rest, n) if rest =~ /\A[\/\.\@\[\w*]/ - parsed.concat(n) - return rest - end - - #| FilterExpr Predicate - #| PrimaryExpr - def FilterExpr path, parsed - n = [] - path = PrimaryExpr( path, n ) - path = Predicate(path, n) - parsed.concat(n) - path - end - - #| VARIABLE_REFERENCE - #| '(' expr ')' - #| LITERAL - #| NUMBER - #| FunctionCall - VARIABLE_REFERENCE = /^\$(#{NAME_STR})/u - NUMBER = /^(\d*\.?\d+)/ - NT = /^comment|text|processing-instruction|node$/ - def PrimaryExpr path, parsed - case path - when VARIABLE_REFERENCE - varname = $1 - path = $' - parsed << :variable - parsed << varname - #arry << @variables[ varname ] - when /^(\w[-\w]*)(?:\()/ - fname = $1 - tmp = $' - return path if fname =~ NT - path = tmp - parsed << :function - parsed << fname - path = FunctionCall(path, parsed) - when NUMBER - varname = $1.nil? ? $2 : $1 - path = $' - parsed << :literal - parsed << (varname.include?('.') ? varname.to_f : varname.to_i) - when LITERAL - varname = $1.nil? ? $2 : $1 - path = $' - parsed << :literal - parsed << varname - when /^\(/ #/ - path, contents = get_group(path) - contents = contents[1..-2] - n = [] - OrExpr( contents, n ) - parsed.concat(n) - end - path - end - - #| FUNCTION_NAME '(' ( expr ( ',' expr )* )? ')' - def FunctionCall rest, parsed - path, arguments = parse_args(rest) - argset = [] - for argument in arguments - args = [] - OrExpr( argument, args ) - argset << args - end - parsed << argset - path - end - - # get_group( '[foo]bar' ) -> ['bar', '[foo]'] - def get_group string - ind = 0 - depth = 0 - st = string[0,1] - en = (st == "(" ? ")" : "]") - begin - case string[ind,1] - when st - depth += 1 - when en - depth -= 1 - end - ind += 1 - end while depth > 0 and ind < string.length - return nil unless depth==0 - [string[ind..-1], string[0..ind-1]] - end - - def parse_args( string ) - arguments = [] - ind = 0 - inquot = false - inapos = false - depth = 1 - begin - case string[ind] - when ?" - inquot = !inquot unless inapos - when ?' - inapos = !inapos unless inquot - else - unless inquot or inapos - case string[ind] - when ?( - depth += 1 - if depth == 1 - string = string[1..-1] - ind -= 1 - end - when ?) - depth -= 1 - if depth == 0 - s = string[0,ind].strip - arguments << s unless s == "" - string = string[ind+1..-1] - end - when ?, - if depth == 1 - s = string[0,ind].strip - arguments << s unless s == "" - string = string[ind+1..-1] - ind = -1 - end - end - end - end - ind += 1 - end while depth > 0 and ind < string.length - return nil unless depth==0 - [string,arguments] - end - end - end -end diff --git a/lib/rexml/quickpath.rb b/lib/rexml/quickpath.rb deleted file mode 100644 index a0466b25d9..0000000000 --- a/lib/rexml/quickpath.rb +++ /dev/null @@ -1,266 +0,0 @@ -# frozen_string_literal: false -require_relative 'functions' -require_relative 'xmltokens' - -module REXML - class QuickPath - include Functions - include XMLTokens - - # A base Hash object to be used when initializing a - # default empty namespaces set. - EMPTY_HASH = {} - - def QuickPath::first element, path, namespaces=EMPTY_HASH - match(element, path, namespaces)[0] - end - - def QuickPath::each element, path, namespaces=EMPTY_HASH, &block - path = "*" unless path - match(element, path, namespaces).each( &block ) - end - - def QuickPath::match element, path, namespaces=EMPTY_HASH - raise "nil is not a valid xpath" unless path - results = nil - Functions::namespace_context = namespaces - case path - when /^\/([^\/]|$)/u - # match on root - path = path[1..-1] - return [element.root.parent] if path == '' - results = filter([element.root], path) - when /^[-\w]*::/u - results = filter([element], path) - when /^\*/u - results = filter(element.to_a, path) - when /^[\[!\w:]/u - # match on child - children = element.to_a - results = filter(children, path) - else - results = filter([element], path) - end - return results - end - - # Given an array of nodes it filters the array based on the path. The - # result is that when this method returns, the array will contain elements - # which match the path - def QuickPath::filter elements, path - return elements if path.nil? or path == '' or elements.size == 0 - case path - when /^\/\//u # Descendant - return axe( elements, "descendant-or-self", $' ) - when /^\/?\b(\w[-\w]*)\b::/u # Axe - return axe( elements, $1, $' ) - when /^\/(?=\b([:!\w][-\.\w]*:)?[-!\*\.\w]*\b([^:(]|$)|\*)/u # Child - rest = $' - results = [] - elements.each do |element| - results |= filter( element.to_a, rest ) - end - return results - when /^\/?(\w[-\w]*)\(/u # / Function - return function( elements, $1, $' ) - when Namespace::NAMESPLIT # Element name - name = $2 - ns = $1 - rest = $' - elements.delete_if do |element| - !(element.kind_of? Element and - (element.expanded_name == name or - (element.name == name and - element.namespace == Functions.namespace_context[ns]))) - end - return filter( elements, rest ) - when /^\/\[/u - matches = [] - elements.each do |element| - matches |= predicate( element.to_a, path[1..-1] ) if element.kind_of? Element - end - return matches - when /^\[/u # Predicate - return predicate( elements, path ) - when /^\/?\.\.\./u # Ancestor - return axe( elements, "ancestor", $' ) - when /^\/?\.\./u # Parent - return filter( elements.collect{|e|e.parent}, $' ) - when /^\/?\./u # Self - return filter( elements, $' ) - when /^\*/u # Any - results = [] - elements.each do |element| - results |= filter( [element], $' ) if element.kind_of? Element - #if element.kind_of? Element - # children = element.to_a - # children.delete_if { |child| !child.kind_of?(Element) } - # results |= filter( children, $' ) - #end - end - return results - end - return [] - end - - def QuickPath::axe( elements, axe_name, rest ) - matches = [] - matches = filter( elements.dup, rest ) if axe_name =~ /-or-self$/u - case axe_name - when /^descendant/u - elements.each do |element| - matches |= filter( element.to_a, "descendant-or-self::#{rest}" ) if element.kind_of? Element - end - when /^ancestor/u - elements.each do |element| - while element.parent - matches << element.parent - element = element.parent - end - end - matches = filter( matches, rest ) - when "self" - matches = filter( elements, rest ) - when "child" - elements.each do |element| - matches |= filter( element.to_a, rest ) if element.kind_of? Element - end - when "attribute" - elements.each do |element| - matches << element.attributes[ rest ] if element.kind_of? Element - end - when "parent" - matches = filter(elements.collect{|element| element.parent}.uniq, rest) - when "following-sibling" - matches = filter(elements.collect{|element| element.next_sibling}.uniq, - rest) - when "previous-sibling" - matches = filter(elements.collect{|element| - element.previous_sibling}.uniq, rest ) - end - return matches.uniq - end - - OPERAND_ = '((?=(?:(?!and|or).)*[^\s<>=])[^\s<>=]+)' - # A predicate filters a node-set with respect to an axis to produce a - # new node-set. For each node in the node-set to be filtered, the - # PredicateExpr is evaluated with that node as the context node, with - # the number of nodes in the node-set as the context size, and with the - # proximity position of the node in the node-set with respect to the - # axis as the context position; if PredicateExpr evaluates to true for - # that node, the node is included in the new node-set; otherwise, it is - # not included. - # - # A PredicateExpr is evaluated by evaluating the Expr and converting - # the result to a boolean. If the result is a number, the result will - # be converted to true if the number is equal to the context position - # and will be converted to false otherwise; if the result is not a - # number, then the result will be converted as if by a call to the - # boolean function. Thus a location path para[3] is equivalent to - # para[position()=3]. - def QuickPath::predicate( elements, path ) - ind = 1 - bcount = 1 - while bcount > 0 - bcount += 1 if path[ind] == ?[ - bcount -= 1 if path[ind] == ?] - ind += 1 - end - ind -= 1 - predicate = path[1..ind-1] - rest = path[ind+1..-1] - - # have to change 'a [=<>] b [=<>] c' into 'a [=<>] b and b [=<>] c' - # - predicate.gsub!( - /#{OPERAND_}\s*([<>=])\s*#{OPERAND_}\s*([<>=])\s*#{OPERAND_}/u, - '\1 \2 \3 and \3 \4 \5' ) - # Let's do some Ruby trickery to avoid some work: - predicate.gsub!( /&/u, "&&" ) - predicate.gsub!( /=/u, "==" ) - predicate.gsub!( /@(\w[-\w.]*)/u, 'attribute("\1")' ) - predicate.gsub!( /\bmod\b/u, "%" ) - predicate.gsub!( /\b(\w[-\w.]*\()/u ) { - fname = $1 - fname.gsub( /-/u, "_" ) - } - - Functions.pair = [ 0, elements.size ] - results = [] - elements.each do |element| - Functions.pair[0] += 1 - Functions.node = element - res = eval( predicate ) - case res - when true - results << element - when Integer - results << element if Functions.pair[0] == res - when String - results << element - end - end - return filter( results, rest ) - end - - def QuickPath::attribute( name ) - return Functions.node.attributes[name] if Functions.node.kind_of? Element - end - - def QuickPath::name() - return Functions.node.name if Functions.node.kind_of? Element - end - - def QuickPath::method_missing( id, *args ) - begin - Functions.send( id.id2name, *args ) - rescue Exception - raise "METHOD: #{id.id2name}(#{args.join ', '})\n#{$!.message}" - end - end - - def QuickPath::function( elements, fname, rest ) - args = parse_args( elements, rest ) - Functions.pair = [0, elements.size] - results = [] - elements.each do |element| - Functions.pair[0] += 1 - Functions.node = element - res = Functions.send( fname, *args ) - case res - when true - results << element - when Integer - results << element if Functions.pair[0] == res - end - end - return results - end - - def QuickPath::parse_args( element, string ) - # /.*?(?:\)|,)/ - arguments = [] - buffer = "" - while string and string != "" - c = string[0] - string.sub!(/^./u, "") - case c - when ?, - # if depth = 1, then we start a new argument - arguments << evaluate( buffer ) - #arguments << evaluate( string[0..count] ) - when ?( - # start a new method call - function( element, buffer, string ) - buffer = "" - when ?) - # close the method call and return arguments - return arguments - else - buffer << c - end - end - "" - end - end -end diff --git a/lib/rexml/rexml.gemspec b/lib/rexml/rexml.gemspec deleted file mode 100644 index 263f013aae..0000000000 --- a/lib/rexml/rexml.gemspec +++ /dev/null @@ -1,84 +0,0 @@ -begin - require_relative "lib/rexml/rexml" -rescue LoadError - # for Ruby core repository - require_relative "rexml" -end - -Gem::Specification.new do |spec| - spec.name = "rexml" - spec.version = REXML::VERSION - spec.authors = ["Kouhei Sutou"] - spec.email = ["kou@cozmixng.org"] - - spec.summary = %q{An XML toolkit for Ruby} - spec.description = %q{An XML toolkit for Ruby} - spec.homepage = "https://github.com/ruby/rexml" - spec.license = "BSD-2-Clause" - - spec.files = [ - ".gitignore", - ".travis.yml", - "Gemfile", - "LICENSE.txt", - "NEWS.md", - "README.md", - "Rakefile", - "lib/rexml/attlistdecl.rb", - "lib/rexml/attribute.rb", - "lib/rexml/cdata.rb", - "lib/rexml/child.rb", - "lib/rexml/comment.rb", - "lib/rexml/doctype.rb", - "lib/rexml/document.rb", - "lib/rexml/dtd/attlistdecl.rb", - "lib/rexml/dtd/dtd.rb", - "lib/rexml/dtd/elementdecl.rb", - "lib/rexml/dtd/entitydecl.rb", - "lib/rexml/dtd/notationdecl.rb", - "lib/rexml/element.rb", - "lib/rexml/encoding.rb", - "lib/rexml/entity.rb", - "lib/rexml/formatters/default.rb", - "lib/rexml/formatters/pretty.rb", - "lib/rexml/formatters/transitive.rb", - "lib/rexml/functions.rb", - "lib/rexml/instruction.rb", - "lib/rexml/light/node.rb", - "lib/rexml/namespace.rb", - "lib/rexml/node.rb", - "lib/rexml/output.rb", - "lib/rexml/parent.rb", - "lib/rexml/parseexception.rb", - "lib/rexml/parsers/baseparser.rb", - "lib/rexml/parsers/lightparser.rb", - "lib/rexml/parsers/pullparser.rb", - "lib/rexml/parsers/sax2parser.rb", - "lib/rexml/parsers/streamparser.rb", - "lib/rexml/parsers/treeparser.rb", - "lib/rexml/parsers/ultralightparser.rb", - "lib/rexml/parsers/xpathparser.rb", - "lib/rexml/quickpath.rb", - "lib/rexml/rexml.rb", - "lib/rexml/sax2listener.rb", - "lib/rexml/security.rb", - "lib/rexml/source.rb", - "lib/rexml/streamlistener.rb", - "lib/rexml/text.rb", - "lib/rexml/undefinednamespaceexception.rb", - "lib/rexml/validation/relaxng.rb", - "lib/rexml/validation/validation.rb", - "lib/rexml/validation/validationexception.rb", - "lib/rexml/xmldecl.rb", - "lib/rexml/xmltokens.rb", - "lib/rexml/xpath.rb", - "lib/rexml/xpath_parser.rb", - "rexml.gemspec", - ] - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] - - spec.add_development_dependency "bundler" - spec.add_development_dependency "rake" -end diff --git a/lib/rexml/rexml.rb b/lib/rexml/rexml.rb deleted file mode 100644 index 944d88a869..0000000000 --- a/lib/rexml/rexml.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# frozen_string_literal: false -# REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby. -# -# REXML is a _pure_ Ruby, XML 1.0 conforming, -# non-validating[http://www.w3.org/TR/2004/REC-xml-20040204/#sec-conformance] -# toolkit with an intuitive API. REXML passes 100% of the non-validating Oasis -# tests[http://www.oasis-open.org/committees/xml-conformance/xml-test-suite.shtml], -# and provides tree, stream, SAX2, pull, and lightweight APIs. REXML also -# includes a full XPath[http://www.w3c.org/tr/xpath] 1.0 implementation. Since -# Ruby 1.8, REXML is included in the standard Ruby distribution. -# -# Main page:: http://www.germane-software.com/software/rexml -# Author:: Sean Russell -# Date:: 2008/019 -# Version:: 3.1.7.3 -# -# This API documentation can be downloaded from the REXML home page, or can -# be accessed online[http://www.germane-software.com/software/rexml_doc] -# -# A tutorial is available in the REXML distribution in docs/tutorial.html, -# or can be accessed -# online[http://www.germane-software.com/software/rexml/docs/tutorial.html] -module REXML - COPYRIGHT = "Copyright © 2001-2008 Sean Russell " - DATE = "2008/019" - VERSION = "3.2.3" - REVISION = "" - - Copyright = COPYRIGHT - Version = VERSION -end diff --git a/lib/rexml/sax2listener.rb b/lib/rexml/sax2listener.rb deleted file mode 100644 index 5afdc80890..0000000000 --- a/lib/rexml/sax2listener.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: false -module REXML - # A template for stream parser listeners. - # Note that the declarations (attlistdecl, elementdecl, etc) are trivially - # processed; REXML doesn't yet handle doctype entity declarations, so you - # have to parse them out yourself. - # === Missing methods from SAX2 - # ignorable_whitespace - # === Methods extending SAX2 - # +WARNING+ - # These methods are certainly going to change, until DTDs are fully - # supported. Be aware of this. - # start_document - # end_document - # doctype - # elementdecl - # attlistdecl - # entitydecl - # notationdecl - # cdata - # xmldecl - # comment - module SAX2Listener - def start_document - end - def end_document - end - def start_prefix_mapping prefix, uri - end - def end_prefix_mapping prefix - end - def start_element uri, localname, qname, attributes - end - def end_element uri, localname, qname - end - def characters text - end - def processing_instruction target, data - end - # Handles a doctype declaration. Any attributes of the doctype which are - # not supplied will be nil. # EG, - # @p name the name of the doctype; EG, "me" - # @p pub_sys "PUBLIC", "SYSTEM", or nil. EG, "PUBLIC" - # @p long_name the supplied long name, or nil. EG, "foo" - # @p uri the uri of the doctype, or nil. EG, "bar" - def doctype name, pub_sys, long_name, uri - end - # If a doctype includes an ATTLIST declaration, it will cause this - # method to be called. The content is the declaration itself, unparsed. - # EG, will come to this method as "el - # attr CDATA #REQUIRED". This is the same for all of the .*decl - # methods. - def attlistdecl(element, pairs, contents) - end - # - def elementdecl content - end - # - # The argument passed to this method is an array of the entity - # declaration. It can be in a number of formats, but in general it - # returns (example, result): - # - # ["%", "YN", "\"Yes\""] - # - # ["%", "YN", "Yes"] - # - # ["WhatHeSaid", "He said %YN;"] - # - # ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"] - # - # ["open-hatch", "PUBLIC", "-//Textuality//TEXT Standard open-hatch boilerplate//EN", "http://www.textuality.com/boilerplate/OpenHatch.xml"] - # - # ["hatch-pic", "SYSTEM", "../grafix/OpenHatch.gif", "NDATA", "gif"] - def entitydecl declaration - end - # - def notationdecl name, public_or_system, public_id, system_id - end - # Called when is encountered in a document. - # @p content "..." - def cdata content - end - # Called when an XML PI is encountered in the document. - # EG: - # @p version the version attribute value. EG, "1.0" - # @p encoding the encoding attribute value, or nil. EG, "utf" - # @p standalone the standalone attribute value, or nil. EG, nil - # @p spaced the declaration is followed by a line break - def xmldecl version, encoding, standalone - end - # Called when a comment is encountered. - # @p comment The content of the comment - def comment comment - end - def progress position - end - end -end diff --git a/lib/rexml/security.rb b/lib/rexml/security.rb deleted file mode 100644 index 99b7460772..0000000000 --- a/lib/rexml/security.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: false -module REXML - module Security - @@entity_expansion_limit = 10_000 - - # Set the entity expansion limit. By default the limit is set to 10000. - def self.entity_expansion_limit=( val ) - @@entity_expansion_limit = val - end - - # Get the entity expansion limit. By default the limit is set to 10000. - def self.entity_expansion_limit - return @@entity_expansion_limit - end - - @@entity_expansion_text_limit = 10_240 - - # Set the entity expansion limit. By default the limit is set to 10240. - def self.entity_expansion_text_limit=( val ) - @@entity_expansion_text_limit = val - end - - # Get the entity expansion limit. By default the limit is set to 10240. - def self.entity_expansion_text_limit - return @@entity_expansion_text_limit - end - end -end diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb deleted file mode 100644 index 90b370b989..0000000000 --- a/lib/rexml/source.rb +++ /dev/null @@ -1,298 +0,0 @@ -# coding: US-ASCII -# frozen_string_literal: false -require_relative 'encoding' - -module REXML - # Generates Source-s. USE THIS CLASS. - class SourceFactory - # Generates a Source object - # @param arg Either a String, or an IO - # @return a Source, or nil if a bad argument was given - def SourceFactory::create_from(arg) - if arg.respond_to? :read and - arg.respond_to? :readline and - arg.respond_to? :nil? and - arg.respond_to? :eof? - IOSource.new(arg) - elsif arg.respond_to? :to_str - require 'stringio' - IOSource.new(StringIO.new(arg)) - elsif arg.kind_of? Source - arg - else - raise "#{arg.class} is not a valid input stream. It must walk \n"+ - "like either a String, an IO, or a Source." - end - end - end - - # A Source can be searched for patterns, and wraps buffers and other - # objects and provides consumption of text - class Source - include Encoding - # The current buffer (what we're going to read next) - attr_reader :buffer - # The line number of the last consumed text - attr_reader :line - attr_reader :encoding - - # Constructor - # @param arg must be a String, and should be a valid XML document - # @param encoding if non-null, sets the encoding of the source to this - # value, overriding all encoding detection - def initialize(arg, encoding=nil) - @orig = @buffer = arg - if encoding - self.encoding = encoding - else - detect_encoding - end - @line = 0 - end - - - # Inherited from Encoding - # Overridden to support optimized en/decoding - def encoding=(enc) - return unless super - encoding_updated - end - - # Scans the source for a given pattern. Note, that this is not your - # usual scan() method. For one thing, the pattern argument has some - # requirements; for another, the source can be consumed. You can easily - # confuse this method. Originally, the patterns were easier - # to construct and this method more robust, because this method - # generated search regexps on the fly; however, this was - # computationally expensive and slowed down the entire REXML package - # considerably, since this is by far the most commonly called method. - # @param pattern must be a Regexp, and must be in the form of - # /^\s*(#{your pattern, with no groups})(.*)/. The first group - # will be returned; the second group is used if the consume flag is - # set. - # @param consume if true, the pattern returned will be consumed, leaving - # everything after it in the Source. - # @return the pattern, if found, or nil if the Source is empty or the - # pattern is not found. - def scan(pattern, cons=false) - return nil if @buffer.nil? - rv = @buffer.scan(pattern) - @buffer = $' if cons and rv.size>0 - rv - end - - def read - end - - def consume( pattern ) - @buffer = $' if pattern.match( @buffer ) - end - - def match_to( char, pattern ) - return pattern.match(@buffer) - end - - def match_to_consume( char, pattern ) - md = pattern.match(@buffer) - @buffer = $' - return md - end - - def match(pattern, cons=false) - md = pattern.match(@buffer) - @buffer = $' if cons and md - return md - end - - # @return true if the Source is exhausted - def empty? - @buffer == "" - end - - def position - @orig.index( @buffer ) - end - - # @return the current line in the source - def current_line - lines = @orig.split - res = lines.grep @buffer[0..30] - res = res[-1] if res.kind_of? Array - lines.index( res ) if res - end - - private - def detect_encoding - buffer_encoding = @buffer.encoding - detected_encoding = "UTF-8" - begin - @buffer.force_encoding("ASCII-8BIT") - if @buffer[0, 2] == "\xfe\xff" - @buffer[0, 2] = "" - detected_encoding = "UTF-16BE" - elsif @buffer[0, 2] == "\xff\xfe" - @buffer[0, 2] = "" - detected_encoding = "UTF-16LE" - elsif @buffer[0, 3] == "\xef\xbb\xbf" - @buffer[0, 3] = "" - detected_encoding = "UTF-8" - end - ensure - @buffer.force_encoding(buffer_encoding) - end - self.encoding = detected_encoding - end - - def encoding_updated - if @encoding != 'UTF-8' - @buffer = decode(@buffer) - @to_utf = true - else - @to_utf = false - @buffer.force_encoding ::Encoding::UTF_8 - end - end - end - - # A Source that wraps an IO. See the Source class for method - # documentation - class IOSource < Source - #attr_reader :block_size - - # block_size has been deprecated - def initialize(arg, block_size=500, encoding=nil) - @er_source = @source = arg - @to_utf = false - @pending_buffer = nil - - if encoding - super("", encoding) - else - super(@source.read(3) || "") - end - - if !@to_utf and - @buffer.respond_to?(:force_encoding) and - @source.respond_to?(:external_encoding) and - @source.external_encoding != ::Encoding::UTF_8 - @force_utf8 = true - else - @force_utf8 = false - end - end - - def scan(pattern, cons=false) - rv = super - # You'll notice that this next section is very similar to the same - # section in match(), but just a liiittle different. This is - # because it is a touch faster to do it this way with scan() - # than the way match() does it; enough faster to warrant duplicating - # some code - if rv.size == 0 - until @buffer =~ pattern or @source.nil? - begin - @buffer << readline - rescue Iconv::IllegalSequence - raise - rescue - @source = nil - end - end - rv = super - end - rv.taint if RUBY_VERSION < '2.7' - rv - end - - def read - begin - @buffer << readline - rescue Exception, NameError - @source = nil - end - end - - def consume( pattern ) - match( pattern, true ) - end - - def match( pattern, cons=false ) - rv = pattern.match(@buffer) - @buffer = $' if cons and rv - while !rv and @source - begin - @buffer << readline - rv = pattern.match(@buffer) - @buffer = $' if cons and rv - rescue - @source = nil - end - end - rv.taint if RUBY_VERSION < '2.7' - rv - end - - def empty? - super and ( @source.nil? || @source.eof? ) - end - - def position - @er_source.pos rescue 0 - end - - # @return the current line in the source - def current_line - begin - pos = @er_source.pos # The byte position in the source - lineno = @er_source.lineno # The XML < position in the source - @er_source.rewind - line = 0 # The \r\n position in the source - begin - while @er_source.pos < pos - @er_source.readline - line += 1 - end - rescue - end - @er_source.seek(pos) - rescue IOError - pos = -1 - line = -1 - end - [pos, lineno, line] - end - - private - def readline - str = @source.readline(@line_break) - if @pending_buffer - if str.nil? - str = @pending_buffer - else - str = @pending_buffer + str - end - @pending_buffer = nil - end - return nil if str.nil? - - if @to_utf - decode(str) - else - str.force_encoding(::Encoding::UTF_8) if @force_utf8 - str - end - end - - def encoding_updated - case @encoding - when "UTF-16BE", "UTF-16LE" - @source.binmode - @source.set_encoding(@encoding, @encoding) - end - @line_break = encode(">") - @pending_buffer, @buffer = @buffer, "" - @pending_buffer.force_encoding(@encoding) - super - end - end -end diff --git a/lib/rexml/streamlistener.rb b/lib/rexml/streamlistener.rb deleted file mode 100644 index 30c8945179..0000000000 --- a/lib/rexml/streamlistener.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: false -module REXML - # A template for stream parser listeners. - # Note that the declarations (attlistdecl, elementdecl, etc) are trivially - # processed; REXML doesn't yet handle doctype entity declarations, so you - # have to parse them out yourself. - module StreamListener - # Called when a tag is encountered. - # @p name the tag name - # @p attrs an array of arrays of attribute/value pairs, suitable for - # use with assoc or rassoc. IE, - # will result in - # tag_start( "tag", # [["attr1","value1"],["attr2","value2"]]) - def tag_start name, attrs - end - # Called when the end tag is reached. In the case of , tag_end - # will be called immediately after tag_start - # @p the name of the tag - def tag_end name - end - # Called when text is encountered in the document - # @p text the text content. - def text text - end - # Called when an instruction is encountered. EG: - # @p name the instruction name; in the example, "xsl" - # @p instruction the rest of the instruction. In the example, - # "sheet='foo'" - def instruction name, instruction - end - # Called when a comment is encountered. - # @p comment The content of the comment - def comment comment - end - # Handles a doctype declaration. Any attributes of the doctype which are - # not supplied will be nil. # EG, - # @p name the name of the doctype; EG, "me" - # @p pub_sys "PUBLIC", "SYSTEM", or nil. EG, "PUBLIC" - # @p long_name the supplied long name, or nil. EG, "foo" - # @p uri the uri of the doctype, or nil. EG, "bar" - def doctype name, pub_sys, long_name, uri - end - # Called when the doctype is done - def doctype_end - end - # If a doctype includes an ATTLIST declaration, it will cause this - # method to be called. The content is the declaration itself, unparsed. - # EG, will come to this method as "el - # attr CDATA #REQUIRED". This is the same for all of the .*decl - # methods. - def attlistdecl element_name, attributes, raw_content - end - # - def elementdecl content - end - # - # The argument passed to this method is an array of the entity - # declaration. It can be in a number of formats, but in general it - # returns (example, result): - # - # ["YN", "\"Yes\"", "%"] - # - # ["YN", "Yes", "%"] - # - # ["WhatHeSaid", "He said %YN;"] - # - # ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"] - # - # ["open-hatch", "PUBLIC", "-//Textuality//TEXT Standard open-hatch boilerplate//EN", "http://www.textuality.com/boilerplate/OpenHatch.xml"] - # - # ["hatch-pic", "SYSTEM", "../grafix/OpenHatch.gif", "gif"] - def entitydecl content - end - # - def notationdecl content - end - # Called when %foo; is encountered in a doctype declaration. - # @p content "foo" - def entity content - end - # Called when is encountered in a document. - # @p content "..." - def cdata content - end - # Called when an XML PI is encountered in the document. - # EG: - # @p version the version attribute value. EG, "1.0" - # @p encoding the encoding attribute value, or nil. EG, "utf" - # @p standalone the standalone attribute value, or nil. EG, nil - def xmldecl version, encoding, standalone - end - end -end diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb deleted file mode 100644 index 050b09c97e..0000000000 --- a/lib/rexml/text.rb +++ /dev/null @@ -1,424 +0,0 @@ -# frozen_string_literal: false -require_relative 'security' -require_relative 'entity' -require_relative 'doctype' -require_relative 'child' -require_relative 'doctype' -require_relative 'parseexception' - -module REXML - # Represents text nodes in an XML document - class Text < Child - include Comparable - # The order in which the substitutions occur - SPECIALS = [ /&(?!#?[\w-]+;)/u, //u, /"/u, /'/u, /\r/u ] - SUBSTITUTES = ['&', '<', '>', '"', ''', ' '] - # Characters which are substituted in written strings - SLAICEPS = [ '<', '>', '"', "'", '&' ] - SETUTITSBUS = [ /</u, />/u, /"/u, /'/u, /&/u ] - - # If +raw+ is true, then REXML leaves the value alone - attr_accessor :raw - - NEEDS_A_SECOND_CHECK = /(<|&((#{Entity::NAME});|(#0*((?:\d+)|(?:x[a-fA-F0-9]+)));)?)/um - NUMERICENTITY = /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ - VALID_CHAR = [ - 0x9, 0xA, 0xD, - (0x20..0xD7FF), - (0xE000..0xFFFD), - (0x10000..0x10FFFF) - ] - - if String.method_defined? :encode - VALID_XML_CHARS = Regexp.new('^['+ - VALID_CHAR.map { |item| - case item - when Integer - [item].pack('U').force_encoding('utf-8') - when Range - [item.first, '-'.ord, item.last].pack('UUU').force_encoding('utf-8') - end - }.join + - ']*$') - else - VALID_XML_CHARS = /^( - [\x09\x0A\x0D\x20-\x7E] # ASCII - | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte - | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs - | [\xE1-\xEC\xEE][\x80-\xBF]{2} # straight 3-byte - | \xEF[\x80-\xBE]{2} # - | \xEF\xBF[\x80-\xBD] # excluding U+fffe and U+ffff - | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates - | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 - | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 - | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 - )*$/nx; - end - - # Constructor - # +arg+ if a String, the content is set to the String. If a Text, - # the object is shallowly cloned. - # - # +respect_whitespace+ (boolean, false) if true, whitespace is - # respected - # - # +parent+ (nil) if this is a Parent object, the parent - # will be set to this. - # - # +raw+ (nil) This argument can be given three values. - # If true, then the value of used to construct this object is expected to - # contain no unescaped XML markup, and REXML will not change the text. If - # this value is false, the string may contain any characters, and REXML will - # escape any and all defined entities whose values are contained in the - # text. If this value is nil (the default), then the raw value of the - # parent will be used as the raw value for this node. If there is no raw - # value for the parent, and no value is supplied, the default is false. - # Use this field if you have entities defined for some text, and you don't - # want REXML to escape that text in output. - # Text.new( "<&", false, nil, false ) #-> "<&" - # Text.new( "<&", false, nil, false ) #-> "&lt;&amp;" - # Text.new( "<&", false, nil, true ) #-> Parse exception - # Text.new( "<&", false, nil, true ) #-> "<&" - # # Assume that the entity "s" is defined to be "sean" - # # and that the entity "r" is defined to be "russell" - # Text.new( "sean russell" ) #-> "&s; &r;" - # Text.new( "sean russell", false, nil, true ) #-> "sean russell" - # - # +entity_filter+ (nil) This can be an array of entities to match in the - # supplied text. This argument is only useful if +raw+ is set to false. - # Text.new( "sean russell", false, nil, false, ["s"] ) #-> "&s; russell" - # Text.new( "sean russell", false, nil, true, ["s"] ) #-> "sean russell" - # In the last example, the +entity_filter+ argument is ignored. - # - # +illegal+ INTERNAL USE ONLY - def initialize(arg, respect_whitespace=false, parent=nil, raw=nil, - entity_filter=nil, illegal=NEEDS_A_SECOND_CHECK ) - - @raw = false - @parent = nil - @entity_filter = nil - - if parent - super( parent ) - @raw = parent.raw - end - - if arg.kind_of? String - @string = arg.dup - elsif arg.kind_of? Text - @string = arg.instance_variable_get(:@string).dup - @raw = arg.raw - @entity_filter = arg.instance_variable_get(:@entity_filter) - else - raise "Illegal argument of type #{arg.type} for Text constructor (#{arg})" - end - - @string.squeeze!(" \n\t") unless respect_whitespace - @string.gsub!(/\r\n?/, "\n") - @raw = raw unless raw.nil? - @entity_filter = entity_filter if entity_filter - clear_cache - - Text.check(@string, illegal, doctype) if @raw - end - - def parent= parent - super(parent) - Text.check(@string, NEEDS_A_SECOND_CHECK, doctype) if @raw and @parent - end - - # check for illegal characters - def Text.check string, pattern, doctype - - # illegal anywhere - if string !~ VALID_XML_CHARS - if String.method_defined? :encode - string.chars.each do |c| - case c.ord - when *VALID_CHAR - else - raise "Illegal character #{c.inspect} in raw string #{string.inspect}" - end - end - else - string.scan(/[\x00-\x7F]|[\x80-\xBF][\xC0-\xF0]*|[\xC0-\xF0]/n) do |c| - case c.unpack('U') - when *VALID_CHAR - else - raise "Illegal character #{c.inspect} in raw string #{string.inspect}" - end - end - end - end - - # context sensitive - string.scan(pattern) do - if $1[-1] != ?; - raise "Illegal character #{$1.inspect} in raw string #{string.inspect}" - elsif $1[0] == ?& - if $5 and $5[0] == ?# - case ($5[1] == ?x ? $5[2..-1].to_i(16) : $5[1..-1].to_i) - when *VALID_CHAR - else - raise "Illegal character #{$1.inspect} in raw string #{string.inspect}" - end - # FIXME: below can't work but this needs API change. - # elsif @parent and $3 and !SUBSTITUTES.include?($1) - # if !doctype or !doctype.entities.has_key?($3) - # raise "Undeclared entity '#{$1}' in raw string \"#{string}\"" - # end - end - end - end - end - - def node_type - :text - end - - def empty? - @string.size==0 - end - - - def clone - return Text.new(self, true) - end - - - # Appends text to this text node. The text is appended in the +raw+ mode - # of this text node. - # - # +returns+ the text itself to enable method chain like - # 'text << "XXX" << "YYY"'. - def <<( to_append ) - @string << to_append.gsub( /\r\n?/, "\n" ) - clear_cache - self - end - - - # +other+ a String or a Text - # +returns+ the result of (to_s <=> arg.to_s) - def <=>( other ) - to_s() <=> other.to_s - end - - def doctype - if @parent - doc = @parent.document - doc.doctype if doc - end - end - - REFERENCE = /#{Entity::REFERENCE}/ - # Returns the string value of this text node. This string is always - # escaped, meaning that it is a valid XML text node string, and all - # entities that can be escaped, have been inserted. This method respects - # the entity filter set in the constructor. - # - # # Assume that the entity "s" is defined to be "sean", and that the - # # entity "r" is defined to be "russell" - # t = Text.new( "< & sean russell", false, nil, false, ['s'] ) - # t.to_s #-> "< & &s; russell" - # t = Text.new( "< & &s; russell", false, nil, false ) - # t.to_s #-> "< & &s; russell" - # u = Text.new( "sean russell", false, nil, true ) - # u.to_s #-> "sean russell" - def to_s - return @string if @raw - @normalized ||= Text::normalize( @string, doctype, @entity_filter ) - end - - def inspect - @string.inspect - end - - # Returns the string value of this text. This is the text without - # entities, as it might be used programmatically, or printed to the - # console. This ignores the 'raw' attribute setting, and any - # entity_filter. - # - # # Assume that the entity "s" is defined to be "sean", and that the - # # entity "r" is defined to be "russell" - # t = Text.new( "< & sean russell", false, nil, false, ['s'] ) - # t.value #-> "< & sean russell" - # t = Text.new( "< & &s; russell", false, nil, false ) - # t.value #-> "< & sean russell" - # u = Text.new( "sean russell", false, nil, true ) - # u.value #-> "sean russell" - def value - @unnormalized ||= Text::unnormalize( @string, doctype ) - end - - # Sets the contents of this text node. This expects the text to be - # unnormalized. It returns self. - # - # e = Element.new( "a" ) - # e.add_text( "foo" ) # foo - # e[0].value = "bar" # bar - # e[0].value = "" # <a> - def value=( val ) - @string = val.gsub( /\r\n?/, "\n" ) - clear_cache - @raw = false - end - - def wrap(string, width, addnewline=false) - # Recursively wrap string at width. - return string if string.length <= width - place = string.rindex(' ', width) # Position in string with last ' ' before cutoff - if addnewline then - return "\n" + string[0,place] + "\n" + wrap(string[place+1..-1], width) - else - return string[0,place] + "\n" + wrap(string[place+1..-1], width) - end - end - - def indent_text(string, level=1, style="\t", indentfirstline=true) - return string if level < 0 - new_string = '' - string.each_line { |line| - indent_string = style * level - new_line = (indent_string + line).sub(/[\s]+$/,'') - new_string << new_line - } - new_string.strip! unless indentfirstline - return new_string - end - - # == DEPRECATED - # See REXML::Formatters - # - def write( writer, indent=-1, transitive=false, ie_hack=false ) - Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters", uplevel: 1) - formatter = if indent > -1 - REXML::Formatters::Pretty.new( indent ) - else - REXML::Formatters::Default.new - end - formatter.write( self, writer ) - end - - # FIXME - # This probably won't work properly - def xpath - path = @parent.xpath - path += "/text()" - return path - end - - # Writes out text, substituting special characters beforehand. - # +out+ A String, IO, or any other object supporting <<( String ) - # +input+ the text to substitute and the write out - # - # z=utf8.unpack("U*") - # ascOut="" - # z.each{|r| - # if r < 0x100 - # ascOut.concat(r.chr) - # else - # ascOut.concat(sprintf("&#x%x;", r)) - # end - # } - # puts ascOut - def write_with_substitution out, input - copy = input.clone - # Doing it like this rather than in a loop improves the speed - copy.gsub!( SPECIALS[0], SUBSTITUTES[0] ) - copy.gsub!( SPECIALS[1], SUBSTITUTES[1] ) - copy.gsub!( SPECIALS[2], SUBSTITUTES[2] ) - copy.gsub!( SPECIALS[3], SUBSTITUTES[3] ) - copy.gsub!( SPECIALS[4], SUBSTITUTES[4] ) - copy.gsub!( SPECIALS[5], SUBSTITUTES[5] ) - out << copy - end - - private - def clear_cache - @normalized = nil - @unnormalized = nil - end - - # Reads text, substituting entities - def Text::read_with_substitution( input, illegal=nil ) - copy = input.clone - - if copy =~ illegal - raise ParseException.new( "malformed text: Illegal character #$& in \"#{copy}\"" ) - end if illegal - - copy.gsub!( /\r\n?/, "\n" ) - if copy.include? ?& - copy.gsub!( SETUTITSBUS[0], SLAICEPS[0] ) - copy.gsub!( SETUTITSBUS[1], SLAICEPS[1] ) - copy.gsub!( SETUTITSBUS[2], SLAICEPS[2] ) - copy.gsub!( SETUTITSBUS[3], SLAICEPS[3] ) - copy.gsub!( SETUTITSBUS[4], SLAICEPS[4] ) - copy.gsub!( /�*((?:\d+)|(?:x[a-f0-9]+));/ ) { - m=$1 - #m='0' if m=='' - m = "0#{m}" if m[0] == ?x - [Integer(m)].pack('U*') - } - end - copy - end - - EREFERENCE = /&(?!#{Entity::NAME};)/ - # Escapes all possible entities - def Text::normalize( input, doctype=nil, entity_filter=nil ) - copy = input.to_s - # Doing it like this rather than in a loop improves the speed - #copy = copy.gsub( EREFERENCE, '&' ) - copy = copy.gsub( "&", "&" ) - if doctype - # Replace all ampersands that aren't part of an entity - doctype.entities.each_value do |entity| - copy = copy.gsub( entity.value, - "&#{entity.name};" ) if entity.value and - not( entity_filter and entity_filter.include?(entity.name) ) - end - else - # Replace all ampersands that aren't part of an entity - DocType::DEFAULT_ENTITIES.each_value do |entity| - copy = copy.gsub(entity.value, "&#{entity.name};" ) - end - end - copy - end - - # Unescapes all possible entities - def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil ) - sum = 0 - string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) { - s = Text.expand($&, doctype, filter) - if sum + s.bytesize > Security.entity_expansion_text_limit - raise "entity expansion has grown too large" - else - sum += s.bytesize - end - s - } - end - - def Text.expand(ref, doctype, filter) - if ref[1] == ?# - if ref[2] == ?x - [ref[3...-1].to_i(16)].pack('U*') - else - [ref[2...-1].to_i].pack('U*') - end - elsif ref == '&' - '&' - elsif filter and filter.include?( ref[1...-1] ) - ref - elsif doctype - doctype.entity( ref[1...-1] ) or ref - else - entity_value = DocType::DEFAULT_ENTITIES[ ref[1...-1] ] - entity_value ? entity_value.value : ref - end - end - end -end diff --git a/lib/rexml/undefinednamespaceexception.rb b/lib/rexml/undefinednamespaceexception.rb deleted file mode 100644 index 492a098183..0000000000 --- a/lib/rexml/undefinednamespaceexception.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: false -require_relative 'parseexception' -module REXML - class UndefinedNamespaceException < ParseException - def initialize( prefix, source, parser ) - super( "Undefined prefix #{prefix} found" ) - end - end -end diff --git a/lib/rexml/validation/relaxng.rb b/lib/rexml/validation/relaxng.rb deleted file mode 100644 index f29a2c05e5..0000000000 --- a/lib/rexml/validation/relaxng.rb +++ /dev/null @@ -1,539 +0,0 @@ -# frozen_string_literal: false -require_relative "validation" -require_relative "../parsers/baseparser" - -module REXML - module Validation - # Implemented: - # * empty - # * element - # * attribute - # * text - # * optional - # * choice - # * oneOrMore - # * zeroOrMore - # * group - # * value - # * interleave - # * mixed - # * ref - # * grammar - # * start - # * define - # - # Not implemented: - # * data - # * param - # * include - # * externalRef - # * notAllowed - # * anyName - # * nsName - # * except - # * name - class RelaxNG - include Validator - - INFINITY = 1.0 / 0.0 - EMPTY = Event.new( nil ) - TEXT = [:start_element, "text"] - attr_accessor :current - attr_accessor :count - attr_reader :references - - # FIXME: Namespaces - def initialize source - parser = REXML::Parsers::BaseParser.new( source ) - - @count = 0 - @references = {} - @root = @current = Sequence.new(self) - @root.previous = true - states = [ @current ] - begin - event = parser.pull - case event[0] - when :start_element - case event[1] - when "empty" - when "element", "attribute", "text", "value" - states[-1] << event - when "optional" - states << Optional.new( self ) - states[-2] << states[-1] - when "choice" - states << Choice.new( self ) - states[-2] << states[-1] - when "oneOrMore" - states << OneOrMore.new( self ) - states[-2] << states[-1] - when "zeroOrMore" - states << ZeroOrMore.new( self ) - states[-2] << states[-1] - when "group" - states << Sequence.new( self ) - states[-2] << states[-1] - when "interleave" - states << Interleave.new( self ) - states[-2] << states[-1] - when "mixed" - states << Interleave.new( self ) - states[-2] << states[-1] - states[-1] << TEXT - when "define" - states << [ event[2]["name"] ] - when "ref" - states[-1] << Ref.new( event[2]["name"] ) - when "anyName" - states << AnyName.new( self ) - states[-2] << states[-1] - when "nsName" - when "except" - when "name" - when "data" - when "param" - when "include" - when "grammar" - when "start" - when "externalRef" - when "notAllowed" - end - when :end_element - case event[1] - when "element", "attribute" - states[-1] << event - when "zeroOrMore", "oneOrMore", "choice", "optional", - "interleave", "group", "mixed" - states.pop - when "define" - ref = states.pop - @references[ ref.shift ] = ref - #when "empty" - end - when :end_document - states[-1] << event - when :text - states[-1] << event - end - end while event[0] != :end_document - end - - def receive event - validate( event ) - end - end - - class State - def initialize( context ) - @previous = [] - @events = [] - @current = 0 - @count = context.count += 1 - @references = context.references - @value = false - end - - def reset - return if @current == 0 - @current = 0 - @events.each {|s| s.reset if s.kind_of? State } - end - - def previous=( previous ) - @previous << previous - end - - def next( event ) - #print "In next with #{event.inspect}. " - #p @previous - return @previous.pop.next( event ) if @events[@current].nil? - expand_ref_in( @events, @current ) if @events[@current].class == Ref - if ( @events[@current].kind_of? State ) - @current += 1 - @events[@current-1].previous = self - return @events[@current-1].next( event ) - end - if ( @events[@current].matches?(event) ) - @current += 1 - if @events[@current].nil? - return @previous.pop - elsif @events[@current].kind_of? State - @current += 1 - @events[@current-1].previous = self - return @events[@current-1] - else - return self - end - else - return nil - end - end - - def to_s - # Abbreviated: - self.class.name =~ /(?:::)(\w)\w+$/ - # Full: - #self.class.name =~ /(?:::)(\w+)$/ - "#$1.#@count" - end - - def inspect - "< #{to_s} #{@events.collect{|e| - pre = e == @events[@current] ? '#' : '' - pre + e.inspect unless self == e - }.join(', ')} >" - end - - def expected - return [@events[@current]] - end - - def <<( event ) - add_event_to_arry( @events, event ) - end - - - protected - def expand_ref_in( arry, ind ) - new_events = [] - @references[ arry[ind].to_s ].each{ |evt| - add_event_to_arry(new_events,evt) - } - arry[ind,1] = new_events - end - - def add_event_to_arry( arry, evt ) - evt = generate_event( evt ) - if evt.kind_of? String - arry[-1].event_arg = evt if arry[-1].kind_of? Event and @value - @value = false - else - arry << evt - end - end - - def generate_event( event ) - return event if event.kind_of? State or event.class == Ref - evt = nil - arg = nil - case event[0] - when :start_element - case event[1] - when "element" - evt = :start_element - arg = event[2]["name"] - when "attribute" - evt = :start_attribute - arg = event[2]["name"] - when "text" - evt = :text - when "value" - evt = :text - @value = true - end - when :text - return event[1] - when :end_document - return Event.new( event[0] ) - else # then :end_element - case event[1] - when "element" - evt = :end_element - when "attribute" - evt = :end_attribute - end - end - return Event.new( evt, arg ) - end - end - - - class Sequence < State - def matches?(event) - @events[@current].matches?( event ) - end - end - - - class Optional < State - def next( event ) - if @current == 0 - rv = super - return rv if rv - @prior = @previous.pop - return @prior.next( event ) - end - super - end - - def matches?(event) - @events[@current].matches?(event) || - (@current == 0 and @previous[-1].matches?(event)) - end - - def expected - return [ @prior.expected, @events[0] ].flatten if @current == 0 - return [@events[@current]] - end - end - - - class ZeroOrMore < Optional - def next( event ) - expand_ref_in( @events, @current ) if @events[@current].class == Ref - if ( @events[@current].matches?(event) ) - @current += 1 - if @events[@current].nil? - @current = 0 - return self - elsif @events[@current].kind_of? State - @current += 1 - @events[@current-1].previous = self - return @events[@current-1] - else - return self - end - else - @prior = @previous.pop - return @prior.next( event ) if @current == 0 - return nil - end - end - - def expected - return [ @prior.expected, @events[0] ].flatten if @current == 0 - return [@events[@current]] - end - end - - - class OneOrMore < State - def initialize context - super - @ord = 0 - end - - def reset - super - @ord = 0 - end - - def next( event ) - expand_ref_in( @events, @current ) if @events[@current].class == Ref - if ( @events[@current].matches?(event) ) - @current += 1 - @ord += 1 - if @events[@current].nil? - @current = 0 - return self - elsif @events[@current].kind_of? State - @current += 1 - @events[@current-1].previous = self - return @events[@current-1] - else - return self - end - else - return @previous.pop.next( event ) if @current == 0 and @ord > 0 - return nil - end - end - - def matches?( event ) - @events[@current].matches?(event) || - (@current == 0 and @ord > 0 and @previous[-1].matches?(event)) - end - - def expected - if @current == 0 and @ord > 0 - return [@previous[-1].expected, @events[0]].flatten - else - return [@events[@current]] - end - end - end - - - class Choice < State - def initialize context - super - @choices = [] - end - - def reset - super - @events = [] - @choices.each { |c| c.each { |s| s.reset if s.kind_of? State } } - end - - def <<( event ) - add_event_to_arry( @choices, event ) - end - - def next( event ) - # Make the choice if we haven't - if @events.size == 0 - c = 0 ; max = @choices.size - while c < max - if @choices[c][0].class == Ref - expand_ref_in( @choices[c], 0 ) - @choices += @choices[c] - @choices.delete( @choices[c] ) - max -= 1 - else - c += 1 - end - end - @events = @choices.find { |evt| evt[0].matches? event } - # Remove the references - # Find the events - end - unless @events - @events = [] - return nil - end - super - end - - def matches?( event ) - return @events[@current].matches?( event ) if @events.size > 0 - !@choices.find{|evt| evt[0].matches?(event)}.nil? - end - - def expected - return [@events[@current]] if @events.size > 0 - return @choices.collect do |x| - if x[0].kind_of? State - x[0].expected - else - x[0] - end - end.flatten - end - - def inspect - "< #{to_s} #{@choices.collect{|e| e.collect{|f|f.to_s}.join(', ')}.join(' or ')} >" - end - - protected - def add_event_to_arry( arry, evt ) - if evt.kind_of? State or evt.class == Ref - arry << [evt] - elsif evt[0] == :text - if arry[-1] and - arry[-1][-1].kind_of?( Event ) and - arry[-1][-1].event_type == :text and @value - - arry[-1][-1].event_arg = evt[1] - @value = false - end - else - arry << [] if evt[0] == :start_element - arry[-1] << generate_event( evt ) - end - end - end - - - class Interleave < Choice - def initialize context - super - @choice = 0 - end - - def reset - @choice = 0 - end - - def next_current( event ) - # Expand references - c = 0 ; max = @choices.size - while c < max - if @choices[c][0].class == Ref - expand_ref_in( @choices[c], 0 ) - @choices += @choices[c] - @choices.delete( @choices[c] ) - max -= 1 - else - c += 1 - end - end - @events = @choices[@choice..-1].find { |evt| evt[0].matches? event } - @current = 0 - if @events - # reorder the choices - old = @choices[@choice] - idx = @choices.index( @events ) - @choices[@choice] = @events - @choices[idx] = old - @choice += 1 - end - - @events = [] unless @events - end - - - def next( event ) - # Find the next series - next_current(event) unless @events[@current] - return nil unless @events[@current] - - expand_ref_in( @events, @current ) if @events[@current].class == Ref - if ( @events[@current].kind_of? State ) - @current += 1 - @events[@current-1].previous = self - return @events[@current-1].next( event ) - end - return @previous.pop.next( event ) if @events[@current].nil? - if ( @events[@current].matches?(event) ) - @current += 1 - if @events[@current].nil? - return self unless @choices[@choice].nil? - return @previous.pop - elsif @events[@current].kind_of? State - @current += 1 - @events[@current-1].previous = self - return @events[@current-1] - else - return self - end - else - return nil - end - end - - def matches?( event ) - return @events[@current].matches?( event ) if @events[@current] - !@choices[@choice..-1].find{|evt| evt[0].matches?(event)}.nil? - end - - def expected - return [@events[@current]] if @events[@current] - return @choices[@choice..-1].collect do |x| - if x[0].kind_of? State - x[0].expected - else - x[0] - end - end.flatten - end - - def inspect - "< #{to_s} #{@choices.collect{|e| e.collect{|f|f.to_s}.join(', ')}.join(' and ')} >" - end - end - - class Ref - def initialize value - @value = value - end - def to_s - @value - end - def inspect - "{#{to_s}}" - end - end - end -end diff --git a/lib/rexml/validation/validation.rb b/lib/rexml/validation/validation.rb deleted file mode 100644 index 0ad6ada427..0000000000 --- a/lib/rexml/validation/validation.rb +++ /dev/null @@ -1,144 +0,0 @@ -# frozen_string_literal: false -require_relative 'validationexception' - -module REXML - module Validation - module Validator - NILEVENT = [ nil ] - def reset - @current = @root - @root.reset - @root.previous = true - @attr_stack = [] - self - end - def dump - puts @root.inspect - end - def validate( event ) - @attr_stack = [] unless defined? @attr_stack - match = @current.next(event) - raise ValidationException.new( "Validation error. Expected: "+ - @current.expected.join( " or " )+" from #{@current.inspect} "+ - " but got #{Event.new( event[0], event[1] ).inspect}" ) unless match - @current = match - - # Check for attributes - case event[0] - when :start_element - @attr_stack << event[2] - begin - sattr = [:start_attribute, nil] - eattr = [:end_attribute] - text = [:text, nil] - k, = event[2].find { |key,value| - sattr[1] = key - m = @current.next( sattr ) - if m - # If the state has text children... - if m.matches?( eattr ) - @current = m - else - text[1] = value - m = m.next( text ) - text[1] = nil - return false unless m - @current = m if m - end - m = @current.next( eattr ) - if m - @current = m - true - else - false - end - else - false - end - } - event[2].delete(k) if k - end while k - when :end_element - attrs = @attr_stack.pop - raise ValidationException.new( "Validation error. Illegal "+ - " attributes: #{attrs.inspect}") if attrs.length > 0 - end - end - end - - class Event - def initialize(event_type, event_arg=nil ) - @event_type = event_type - @event_arg = event_arg - end - - attr_reader :event_type - attr_accessor :event_arg - - def done? - @done - end - - def single? - return (@event_type != :start_element and @event_type != :start_attribute) - end - - def matches?( event ) - return false unless event[0] == @event_type - case event[0] - when nil - return true - when :start_element - return true if event[1] == @event_arg - when :end_element - return true - when :start_attribute - return true if event[1] == @event_arg - when :end_attribute - return true - when :end_document - return true - when :text - return (@event_arg.nil? or @event_arg == event[1]) -=begin - when :processing_instruction - false - when :xmldecl - false - when :start_doctype - false - when :end_doctype - false - when :externalentity - false - when :elementdecl - false - when :entity - false - when :attlistdecl - false - when :notationdecl - false - when :end_doctype - false -=end - else - false - end - end - - def ==( other ) - return false unless other.kind_of? Event - @event_type == other.event_type and @event_arg == other.event_arg - end - - def to_s - inspect - end - - def inspect - "#{@event_type.inspect}( #@event_arg )" - end - end - end -end diff --git a/lib/rexml/validation/validationexception.rb b/lib/rexml/validation/validationexception.rb deleted file mode 100644 index 78cd63fd04..0000000000 --- a/lib/rexml/validation/validationexception.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: false -module REXML - module Validation - class ValidationException < RuntimeError - def initialize msg - super - end - end - end -end diff --git a/lib/rexml/xmldecl.rb b/lib/rexml/xmldecl.rb deleted file mode 100644 index d19407cefd..0000000000 --- a/lib/rexml/xmldecl.rb +++ /dev/null @@ -1,130 +0,0 @@ -# frozen_string_literal: false - -require_relative 'encoding' -require_relative 'source' - -module REXML - # NEEDS DOCUMENTATION - class XMLDecl < Child - include Encoding - - DEFAULT_VERSION = "1.0" - DEFAULT_ENCODING = "UTF-8" - DEFAULT_STANDALONE = "no" - START = "" - - attr_accessor :version, :standalone - attr_reader :writeencoding, :writethis - - def initialize(version=DEFAULT_VERSION, encoding=nil, standalone=nil) - @writethis = true - @writeencoding = !encoding.nil? - if version.kind_of? XMLDecl - super() - @version = version.version - self.encoding = version.encoding - @writeencoding = version.writeencoding - @standalone = version.standalone - @writethis = version.writethis - else - super() - @version = version - self.encoding = encoding - @standalone = standalone - end - @version = DEFAULT_VERSION if @version.nil? - end - - def clone - XMLDecl.new(self) - end - - # indent:: - # Ignored. There must be no whitespace before an XML declaration - # transitive:: - # Ignored - # ie_hack:: - # Ignored - def write(writer, indent=-1, transitive=false, ie_hack=false) - return nil unless @writethis or writer.kind_of? Output - writer << START - writer << " #{content encoding}" - writer << STOP - end - - def ==( other ) - other.kind_of?(XMLDecl) and - other.version == @version and - other.encoding == self.encoding and - other.standalone == @standalone - end - - def xmldecl version, encoding, standalone - @version = version - self.encoding = encoding - @standalone = standalone - end - - def node_type - :xmldecl - end - - alias :stand_alone? :standalone - alias :old_enc= :encoding= - - def encoding=( enc ) - if enc.nil? - self.old_enc = "UTF-8" - @writeencoding = false - else - self.old_enc = enc - @writeencoding = true - end - self.dowrite - end - - # Only use this if you do not want the XML declaration to be written; - # this object is ignored by the XML writer. Otherwise, instantiate your - # own XMLDecl and add it to the document. - # - # Note that XML 1.1 documents *must* include an XML declaration - def XMLDecl.default - rv = XMLDecl.new( "1.0" ) - rv.nowrite - rv - end - - def nowrite - @writethis = false - end - - def dowrite - @writethis = true - end - - def inspect - "#{START} ... #{STOP}" - end - - private - def content(enc) - context = nil - context = parent.context if parent - if context and context[:prologue_quote] == :quote - quote = "\"" - else - quote = "'" - end - - rv = "version=#{quote}#{@version}#{quote}" - if @writeencoding or enc !~ /\Autf-8\z/i - rv << " encoding=#{quote}#{enc}#{quote}" - end - if @standalone - rv << " standalone=#{quote}#{@standalone}#{quote}" - end - rv - end - end -end diff --git a/lib/rexml/xmltokens.rb b/lib/rexml/xmltokens.rb deleted file mode 100644 index 392b47b1d3..0000000000 --- a/lib/rexml/xmltokens.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: false -module REXML - # Defines a number of tokens used for parsing XML. Not for general - # consumption. - module XMLTokens - # From http://www.w3.org/TR/REC-xml/#sec-common-syn - # - # [4] NameStartChar ::= - # ":" | - # [A-Z] | - # "_" | - # [a-z] | - # [#xC0-#xD6] | - # [#xD8-#xF6] | - # [#xF8-#x2FF] | - # [#x370-#x37D] | - # [#x37F-#x1FFF] | - # [#x200C-#x200D] | - # [#x2070-#x218F] | - # [#x2C00-#x2FEF] | - # [#x3001-#xD7FF] | - # [#xF900-#xFDCF] | - # [#xFDF0-#xFFFD] | - # [#x10000-#xEFFFF] - name_start_chars = [ - ":", - "A-Z", - "_", - "a-z", - "\\u00C0-\\u00D6", - "\\u00D8-\\u00F6", - "\\u00F8-\\u02FF", - "\\u0370-\\u037D", - "\\u037F-\\u1FFF", - "\\u200C-\\u200D", - "\\u2070-\\u218F", - "\\u2C00-\\u2FEF", - "\\u3001-\\uD7FF", - "\\uF900-\\uFDCF", - "\\uFDF0-\\uFFFD", - "\\u{10000}-\\u{EFFFF}", - ] - # From http://www.w3.org/TR/REC-xml/#sec-common-syn - # - # [4a] NameChar ::= - # NameStartChar | - # "-" | - # "." | - # [0-9] | - # #xB7 | - # [#x0300-#x036F] | - # [#x203F-#x2040] - name_chars = name_start_chars + [ - "\\-", - "\\.", - "0-9", - "\\u00B7", - "\\u0300-\\u036F", - "\\u203F-\\u2040", - ] - NAME_START_CHAR = "[#{name_start_chars.join('')}]" - NAME_CHAR = "[#{name_chars.join('')}]" - NAMECHAR = NAME_CHAR # deprecated. Use NAME_CHAR instead. - - # From http://www.w3.org/TR/xml-names11/#NT-NCName - # - # [6] NCNameStartChar ::= NameStartChar - ':' - ncname_start_chars = name_start_chars - [":"] - # From http://www.w3.org/TR/xml-names11/#NT-NCName - # - # [5] NCNameChar ::= NameChar - ':' - ncname_chars = name_chars - [":"] - NCNAME_STR = "[#{ncname_start_chars.join('')}][#{ncname_chars.join('')}]*" - NAME_STR = "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" - - NAME = "(#{NAME_START_CHAR}#{NAME_CHAR}*)" - NMTOKEN = "(?:#{NAME_CHAR})+" - NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*" - REFERENCE = "(?:&#{NAME};|&#\\d+;|&#x[0-9a-fA-F]+;)" - - #REFERENCE = "(?:#{ENTITYREF}|#{CHARREF})" - #ENTITYREF = "&#{NAME};" - #CHARREF = "&#\\d+;|&#x[0-9a-fA-F]+;" - end -end diff --git a/lib/rexml/xpath.rb b/lib/rexml/xpath.rb deleted file mode 100644 index a0921bd8e1..0000000000 --- a/lib/rexml/xpath.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: false -require_relative 'functions' -require_relative 'xpath_parser' - -module REXML - # Wrapper class. Use this class to access the XPath functions. - class XPath - include Functions - # A base Hash object, supposing to be used when initializing a - # default empty namespaces set, but is currently unused. - # TODO: either set the namespaces=EMPTY_HASH, or deprecate this. - EMPTY_HASH = {} - - # Finds and returns the first node that matches the supplied xpath. - # element:: - # The context element - # path:: - # The xpath to search for. If not supplied or nil, returns the first - # node matching '*'. - # namespaces:: - # If supplied, a Hash which defines a namespace mapping. - # variables:: - # If supplied, a Hash which maps $variables in the query - # to values. This can be used to avoid XPath injection attacks - # or to automatically handle escaping string values. - # - # XPath.first( node ) - # XPath.first( doc, "//b"} ) - # XPath.first( node, "a/x:b", { "x"=>"http://doofus" } ) - # XPath.first( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"}) - def XPath::first(element, path=nil, namespaces=nil, variables={}, options={}) - raise "The namespaces argument, if supplied, must be a hash object." unless namespaces.nil? or namespaces.kind_of?(Hash) - raise "The variables argument, if supplied, must be a hash object." unless variables.kind_of?(Hash) - parser = XPathParser.new(**options) - parser.namespaces = namespaces - parser.variables = variables - path = "*" unless path - element = [element] unless element.kind_of? Array - parser.parse(path, element).flatten[0] - end - - # Iterates over nodes that match the given path, calling the supplied - # block with the match. - # element:: - # The context element - # path:: - # The xpath to search for. If not supplied or nil, defaults to '*' - # namespaces:: - # If supplied, a Hash which defines a namespace mapping - # variables:: - # If supplied, a Hash which maps $variables in the query - # to values. This can be used to avoid XPath injection attacks - # or to automatically handle escaping string values. - # - # XPath.each( node ) { |el| ... } - # XPath.each( node, '/*[@attr='v']' ) { |el| ... } - # XPath.each( node, 'ancestor::x' ) { |el| ... } - # XPath.each( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"}) \ - # {|el| ... } - def XPath::each(element, path=nil, namespaces=nil, variables={}, options={}, &block) - raise "The namespaces argument, if supplied, must be a hash object." unless namespaces.nil? or namespaces.kind_of?(Hash) - raise "The variables argument, if supplied, must be a hash object." unless variables.kind_of?(Hash) - parser = XPathParser.new(**options) - parser.namespaces = namespaces - parser.variables = variables - path = "*" unless path - element = [element] unless element.kind_of? Array - parser.parse(path, element).each( &block ) - end - - # Returns an array of nodes matching a given XPath. - def XPath::match(element, path=nil, namespaces=nil, variables={}, options={}) - parser = XPathParser.new(**options) - parser.namespaces = namespaces - parser.variables = variables - path = "*" unless path - element = [element] unless element.kind_of? Array - parser.parse(path,element) - end - end -end diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb deleted file mode 100644 index b989725403..0000000000 --- a/lib/rexml/xpath_parser.rb +++ /dev/null @@ -1,968 +0,0 @@ -# frozen_string_literal: false - -require "pp" - -require_relative 'namespace' -require_relative 'xmltokens' -require_relative 'attribute' -require_relative 'parsers/xpathparser' - -class Object - # provides a unified +clone+ operation, for REXML::XPathParser - # to use across multiple Object types - def dclone - clone - end -end -class Symbol - # provides a unified +clone+ operation, for REXML::XPathParser - # to use across multiple Object types - def dclone ; self ; end -end -class Integer - # provides a unified +clone+ operation, for REXML::XPathParser - # to use across multiple Object types - def dclone ; self ; end -end -class Float - # provides a unified +clone+ operation, for REXML::XPathParser - # to use across multiple Object types - def dclone ; self ; end -end -class Array - # provides a unified +clone+ operation, for REXML::XPathParser - # to use across multiple Object+ types - def dclone - klone = self.clone - klone.clear - self.each{|v| klone << v.dclone} - klone - end -end - -module REXML - # You don't want to use this class. Really. Use XPath, which is a wrapper - # for this class. Believe me. You don't want to poke around in here. - # There is strange, dark magic at work in this code. Beware. Go back! Go - # back while you still can! - class XPathParser - include XMLTokens - LITERAL = /^'([^']*)'|^"([^"]*)"/u - - DEBUG = (ENV["REXML_XPATH_PARSER_DEBUG"] == "true") - - def initialize(strict: false) - @debug = DEBUG - @parser = REXML::Parsers::XPathParser.new - @namespaces = nil - @variables = {} - @nest = 0 - @strict = strict - end - - def namespaces=( namespaces={} ) - Functions::namespace_context = namespaces - @namespaces = namespaces - end - - def variables=( vars={} ) - Functions::variables = vars - @variables = vars - end - - def parse path, nodeset - path_stack = @parser.parse( path ) - match( path_stack, nodeset ) - end - - def get_first path, nodeset - path_stack = @parser.parse( path ) - first( path_stack, nodeset ) - end - - def predicate path, nodeset - path_stack = @parser.parse( path ) - match( path_stack, nodeset ) - end - - def []=( variable_name, value ) - @variables[ variable_name ] = value - end - - - # Performs a depth-first (document order) XPath search, and returns the - # first match. This is the fastest, lightest way to return a single result. - # - # FIXME: This method is incomplete! - def first( path_stack, node ) - return nil if path.size == 0 - - case path[0] - when :document - # do nothing - return first( path[1..-1], node ) - when :child - for c in node.children - r = first( path[1..-1], c ) - return r if r - end - when :qname - name = path[2] - if node.name == name - return node if path.size == 3 - return first( path[3..-1], node ) - else - return nil - end - when :descendant_or_self - r = first( path[1..-1], node ) - return r if r - for c in node.children - r = first( path, c ) - return r if r - end - when :node - return first( path[1..-1], node ) - when :any - return first( path[1..-1], node ) - end - return nil - end - - - def match(path_stack, nodeset) - nodeset = nodeset.collect.with_index do |node, i| - position = i + 1 - XPathNode.new(node, position: position) - end - result = expr(path_stack, nodeset) - case result - when Array # nodeset - unnode(result) - else - [result] - end - end - - private - def strict? - @strict - end - - # Returns a String namespace for a node, given a prefix - # The rules are: - # - # 1. Use the supplied namespace mapping first. - # 2. If no mapping was supplied, use the context node to look up the namespace - def get_namespace( node, prefix ) - if @namespaces - return @namespaces[prefix] || '' - else - return node.namespace( prefix ) if node.node_type == :element - return '' - end - end - - - # Expr takes a stack of path elements and a set of nodes (either a Parent - # or an Array and returns an Array of matching nodes - def expr( path_stack, nodeset, context=nil ) - enter(:expr, path_stack, nodeset) if @debug - return nodeset if path_stack.length == 0 || nodeset.length == 0 - while path_stack.length > 0 - trace(:while, path_stack, nodeset) if @debug - if nodeset.length == 0 - path_stack.clear - return [] - end - op = path_stack.shift - case op - when :document - first_raw_node = nodeset.first.raw_node - nodeset = [XPathNode.new(first_raw_node.root_node, position: 1)] - when :self - nodeset = step(path_stack) do - [nodeset] - end - when :child - nodeset = step(path_stack) do - child(nodeset) - end - when :literal - trace(:literal, path_stack, nodeset) if @debug - return path_stack.shift - when :attribute - nodeset = step(path_stack, any_type: :attribute) do - nodesets = [] - nodeset.each do |node| - raw_node = node.raw_node - next unless raw_node.node_type == :element - attributes = raw_node.attributes - next if attributes.empty? - nodesets << attributes.each_attribute.collect.with_index do |attribute, i| - XPathNode.new(attribute, position: i + 1) - end - end - nodesets - end - when :namespace - pre_defined_namespaces = { - "xml" => "http://www.w3.org/XML/1998/namespace", - } - nodeset = step(path_stack, any_type: :namespace) do - nodesets = [] - nodeset.each do |node| - raw_node = node.raw_node - case raw_node.node_type - when :element - if @namespaces - nodesets << pre_defined_namespaces.merge(@namespaces) - else - nodesets << pre_defined_namespaces.merge(raw_node.namespaces) - end - when :attribute - if @namespaces - nodesets << pre_defined_namespaces.merge(@namespaces) - else - nodesets << pre_defined_namespaces.merge(raw_node.element.namespaces) - end - end - end - nodesets - end - when :parent - nodeset = step(path_stack) do - nodesets = [] - nodeset.each do |node| - raw_node = node.raw_node - if raw_node.node_type == :attribute - parent = raw_node.element - else - parent = raw_node.parent - end - nodesets << [XPathNode.new(parent, position: 1)] if parent - end - nodesets - end - when :ancestor - nodeset = step(path_stack) do - nodesets = [] - # new_nodes = {} - nodeset.each do |node| - raw_node = node.raw_node - new_nodeset = [] - while raw_node.parent - raw_node = raw_node.parent - # next if new_nodes.key?(node) - new_nodeset << XPathNode.new(raw_node, - position: new_nodeset.size + 1) - # new_nodes[node] = true - end - nodesets << new_nodeset unless new_nodeset.empty? - end - nodesets - end - when :ancestor_or_self - nodeset = step(path_stack) do - nodesets = [] - # new_nodes = {} - nodeset.each do |node| - raw_node = node.raw_node - next unless raw_node.node_type == :element - new_nodeset = [XPathNode.new(raw_node, position: 1)] - # new_nodes[node] = true - while raw_node.parent - raw_node = raw_node.parent - # next if new_nodes.key?(node) - new_nodeset << XPathNode.new(raw_node, - position: new_nodeset.size + 1) - # new_nodes[node] = true - end - nodesets << new_nodeset unless new_nodeset.empty? - end - nodesets - end - when :descendant_or_self - nodeset = step(path_stack) do - descendant(nodeset, true) - end - when :descendant - nodeset = step(path_stack) do - descendant(nodeset, false) - end - when :following_sibling - nodeset = step(path_stack) do - nodesets = [] - nodeset.each do |node| - raw_node = node.raw_node - next unless raw_node.respond_to?(:parent) - next if raw_node.parent.nil? - all_siblings = raw_node.parent.children - current_index = all_siblings.index(raw_node) - following_siblings = all_siblings[(current_index + 1)..-1] - next if following_siblings.empty? - nodesets << following_siblings.collect.with_index do |sibling, i| - XPathNode.new(sibling, position: i + 1) - end - end - nodesets - end - when :preceding_sibling - nodeset = step(path_stack, order: :reverse) do - nodesets = [] - nodeset.each do |node| - raw_node = node.raw_node - next unless raw_node.respond_to?(:parent) - next if raw_node.parent.nil? - all_siblings = raw_node.parent.children - current_index = all_siblings.index(raw_node) - preceding_siblings = all_siblings[0, current_index].reverse - next if preceding_siblings.empty? - nodesets << preceding_siblings.collect.with_index do |sibling, i| - XPathNode.new(sibling, position: i + 1) - end - end - nodesets - end - when :preceding - nodeset = step(path_stack, order: :reverse) do - unnode(nodeset) do |node| - preceding(node) - end - end - when :following - nodeset = step(path_stack) do - unnode(nodeset) do |node| - following(node) - end - end - when :variable - var_name = path_stack.shift - return [@variables[var_name]] - - when :eq, :neq, :lt, :lteq, :gt, :gteq - left = expr( path_stack.shift, nodeset.dup, context ) - right = expr( path_stack.shift, nodeset.dup, context ) - res = equality_relational_compare( left, op, right ) - trace(op, left, right, res) if @debug - return res - - when :or - left = expr(path_stack.shift, nodeset.dup, context) - return true if Functions.boolean(left) - right = expr(path_stack.shift, nodeset.dup, context) - return Functions.boolean(right) - - when :and - left = expr(path_stack.shift, nodeset.dup, context) - return false unless Functions.boolean(left) - right = expr(path_stack.shift, nodeset.dup, context) - return Functions.boolean(right) - - when :div, :mod, :mult, :plus, :minus - left = expr(path_stack.shift, nodeset, context) - right = expr(path_stack.shift, nodeset, context) - left = unnode(left) if left.is_a?(Array) - right = unnode(right) if right.is_a?(Array) - left = Functions::number(left) - right = Functions::number(right) - case op - when :div - return left / right - when :mod - return left % right - when :mult - return left * right - when :plus - return left + right - when :minus - return left - right - else - raise "[BUG] Unexpected operator: <#{op.inspect}>" - end - when :union - left = expr( path_stack.shift, nodeset, context ) - right = expr( path_stack.shift, nodeset, context ) - left = unnode(left) if left.is_a?(Array) - right = unnode(right) if right.is_a?(Array) - return (left | right) - when :neg - res = expr( path_stack, nodeset, context ) - res = unnode(res) if res.is_a?(Array) - return -Functions.number(res) - when :not - when :function - func_name = path_stack.shift.tr('-','_') - arguments = path_stack.shift - - if nodeset.size != 1 - message = "[BUG] Node set size must be 1 for function call: " - message += "<#{func_name}>: <#{nodeset.inspect}>: " - message += "<#{arguments.inspect}>" - raise message - end - - node = nodeset.first - if context - target_context = context - else - target_context = {:size => nodeset.size} - if node.is_a?(XPathNode) - target_context[:node] = node.raw_node - target_context[:index] = node.position - else - target_context[:node] = node - target_context[:index] = 1 - end - end - args = arguments.dclone.collect do |arg| - result = expr(arg, nodeset, target_context) - result = unnode(result) if result.is_a?(Array) - result - end - Functions.context = target_context - return Functions.send(func_name, *args) - - else - raise "[BUG] Unexpected path: <#{op.inspect}>: <#{path_stack.inspect}>" - end - end # while - return nodeset - ensure - leave(:expr, path_stack, nodeset) if @debug - end - - def step(path_stack, any_type: :element, order: :forward) - nodesets = yield - begin - enter(:step, path_stack, nodesets) if @debug - nodesets = node_test(path_stack, nodesets, any_type: any_type) - while path_stack[0] == :predicate - path_stack.shift # :predicate - predicate_expression = path_stack.shift.dclone - nodesets = evaluate_predicate(predicate_expression, nodesets) - end - if nodesets.size == 1 - ordered_nodeset = nodesets[0] - else - raw_nodes = [] - nodesets.each do |nodeset| - nodeset.each do |node| - if node.respond_to?(:raw_node) - raw_nodes << node.raw_node - else - raw_nodes << node - end - end - end - ordered_nodeset = sort(raw_nodes, order) - end - new_nodeset = [] - ordered_nodeset.each do |node| - # TODO: Remove duplicated - new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1) - end - new_nodeset - ensure - leave(:step, path_stack, new_nodeset) if @debug - end - end - - def node_test(path_stack, nodesets, any_type: :element) - enter(:node_test, path_stack, nodesets) if @debug - operator = path_stack.shift - case operator - when :qname - prefix = path_stack.shift - name = path_stack.shift - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - raw_node = node.raw_node - case raw_node.node_type - when :element - if prefix.nil? - raw_node.name == name - elsif prefix.empty? - if strict? - raw_node.name == name and raw_node.namespace == "" - else - # FIXME: This DOUBLES the time XPath searches take - ns = get_namespace(raw_node, prefix) - raw_node.name == name and raw_node.namespace == ns - end - else - # FIXME: This DOUBLES the time XPath searches take - ns = get_namespace(raw_node, prefix) - raw_node.name == name and raw_node.namespace == ns - end - when :attribute - if prefix.nil? - raw_node.name == name - elsif prefix.empty? - raw_node.name == name and raw_node.namespace == "" - else - # FIXME: This DOUBLES the time XPath searches take - ns = get_namespace(raw_node.element, prefix) - raw_node.name == name and raw_node.namespace == ns - end - else - false - end - end - end - when :namespace - prefix = path_stack.shift - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - raw_node = node.raw_node - case raw_node.node_type - when :element - namespaces = @namespaces || raw_node.namespaces - raw_node.namespace == namespaces[prefix] - when :attribute - namespaces = @namespaces || raw_node.element.namespaces - raw_node.namespace == namespaces[prefix] - else - false - end - end - end - when :any - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - raw_node = node.raw_node - raw_node.node_type == any_type - end - end - when :comment - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - raw_node = node.raw_node - raw_node.node_type == :comment - end - end - when :text - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - raw_node = node.raw_node - raw_node.node_type == :text - end - end - when :processing_instruction - target = path_stack.shift - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - raw_node = node.raw_node - (raw_node.node_type == :processing_instruction) and - (target.empty? or (raw_node.target == target)) - end - end - when :node - new_nodesets = nodesets.collect do |nodeset| - filter_nodeset(nodeset) do |node| - true - end - end - else - message = "[BUG] Unexpected node test: " + - "<#{operator.inspect}>: <#{path_stack.inspect}>" - raise message - end - new_nodesets - ensure - leave(:node_test, path_stack, new_nodesets) if @debug - end - - def filter_nodeset(nodeset) - new_nodeset = [] - nodeset.each do |node| - next unless yield(node) - new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1) - end - new_nodeset - end - - def evaluate_predicate(expression, nodesets) - enter(:predicate, expression, nodesets) if @debug - new_nodesets = nodesets.collect do |nodeset| - new_nodeset = [] - subcontext = { :size => nodeset.size } - nodeset.each_with_index do |node, index| - if node.is_a?(XPathNode) - subcontext[:node] = node.raw_node - subcontext[:index] = node.position - else - subcontext[:node] = node - subcontext[:index] = index + 1 - end - result = expr(expression.dclone, [node], subcontext) - trace(:predicate_evaluate, expression, node, subcontext, result) if @debug - result = result[0] if result.kind_of? Array and result.length == 1 - if result.kind_of? Numeric - if result == node.position - new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1) - end - elsif result.instance_of? Array - if result.size > 0 and result.inject(false) {|k,s| s or k} - if result.size > 0 - new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1) - end - end - else - if result - new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1) - end - end - end - new_nodeset - end - new_nodesets - ensure - leave(:predicate, new_nodesets) if @debug - end - - def trace(*args) - indent = " " * @nest - PP.pp(args, "").each_line do |line| - puts("#{indent}#{line}") - end - end - - def enter(tag, *args) - trace(:enter, tag, *args) - @nest += 1 - end - - def leave(tag, *args) - @nest -= 1 - trace(:leave, tag, *args) - end - - # Reorders an array of nodes so that they are in document order - # It tries to do this efficiently. - # - # FIXME: I need to get rid of this, but the issue is that most of the XPath - # interpreter functions as a filter, which means that we lose context going - # in and out of function calls. If I knew what the index of the nodes was, - # I wouldn't have to do this. Maybe add a document IDX for each node? - # Problems with mutable documents. Or, rewrite everything. - def sort(array_of_nodes, order) - new_arry = [] - array_of_nodes.each { |node| - node_idx = [] - np = node.node_type == :attribute ? node.element : node - while np.parent and np.parent.node_type == :element - node_idx << np.parent.index( np ) - np = np.parent - end - new_arry << [ node_idx.reverse, node ] - } - ordered = new_arry.sort_by do |index, node| - if order == :forward - index - else - -index - end - end - ordered.collect do |_index, node| - node - end - end - - def descendant(nodeset, include_self) - nodesets = [] - nodeset.each do |node| - new_nodeset = [] - new_nodes = {} - descendant_recursive(node.raw_node, new_nodeset, new_nodes, include_self) - nodesets << new_nodeset unless new_nodeset.empty? - end - nodesets - end - - def descendant_recursive(raw_node, new_nodeset, new_nodes, include_self) - if include_self - return if new_nodes.key?(raw_node) - new_nodeset << XPathNode.new(raw_node, position: new_nodeset.size + 1) - new_nodes[raw_node] = true - end - - node_type = raw_node.node_type - if node_type == :element or node_type == :document - raw_node.children.each do |child| - descendant_recursive(child, new_nodeset, new_nodes, true) - end - end - end - - # Builds a nodeset of all of the preceding nodes of the supplied node, - # in reverse document order - # preceding:: includes every element in the document that precedes this node, - # except for ancestors - def preceding(node) - ancestors = [] - parent = node.parent - while parent - ancestors << parent - parent = parent.parent - end - - precedings = [] - preceding_node = preceding_node_of(node) - while preceding_node - if ancestors.include?(preceding_node) - ancestors.delete(preceding_node) - else - precedings << XPathNode.new(preceding_node, - position: precedings.size + 1) - end - preceding_node = preceding_node_of(preceding_node) - end - precedings - end - - def preceding_node_of( node ) - psn = node.previous_sibling_node - if psn.nil? - if node.parent.nil? or node.parent.class == Document - return nil - end - return node.parent - #psn = preceding_node_of( node.parent ) - end - while psn and psn.kind_of? Element and psn.children.size > 0 - psn = psn.children[-1] - end - psn - end - - def following(node) - followings = [] - following_node = next_sibling_node(node) - while following_node - followings << XPathNode.new(following_node, - position: followings.size + 1) - following_node = following_node_of(following_node) - end - followings - end - - def following_node_of( node ) - if node.kind_of? Element and node.children.size > 0 - return node.children[0] - end - return next_sibling_node(node) - end - - def next_sibling_node(node) - psn = node.next_sibling_node - while psn.nil? - if node.parent.nil? or node.parent.class == Document - return nil - end - node = node.parent - psn = node.next_sibling_node - end - return psn - end - - def child(nodeset) - nodesets = [] - nodeset.each do |node| - raw_node = node.raw_node - node_type = raw_node.node_type - # trace(:child, node_type, node) - case node_type - when :element - nodesets << raw_node.children.collect.with_index do |child_node, i| - XPathNode.new(child_node, position: i + 1) - end - when :document - new_nodeset = [] - raw_node.children.each do |child| - case child - when XMLDecl, Text - # Ignore - else - new_nodeset << XPathNode.new(child, position: new_nodeset.size + 1) - end - end - nodesets << new_nodeset unless new_nodeset.empty? - end - end - nodesets - end - - def norm b - case b - when true, false - return b - when 'true', 'false' - return Functions::boolean( b ) - when /^\d+(\.\d+)?$/, Numeric - return Functions::number( b ) - else - return Functions::string( b ) - end - end - - def equality_relational_compare(set1, op, set2) - set1 = unnode(set1) if set1.is_a?(Array) - set2 = unnode(set2) if set2.is_a?(Array) - - if set1.kind_of? Array and set2.kind_of? Array - # If both objects to be compared are node-sets, then the - # comparison will be true if and only if there is a node in the - # first node-set and a node in the second node-set such that the - # result of performing the comparison on the string-values of - # the two nodes is true. - set1.product(set2).any? do |node1, node2| - node_string1 = Functions.string(node1) - node_string2 = Functions.string(node2) - compare(node_string1, op, node_string2) - end - elsif set1.kind_of? Array or set2.kind_of? Array - # If one is nodeset and other is number, compare number to each item - # in nodeset s.t. number op number(string(item)) - # If one is nodeset and other is string, compare string to each item - # in nodeset s.t. string op string(item) - # If one is nodeset and other is boolean, compare boolean to each item - # in nodeset s.t. boolean op boolean(item) - if set1.kind_of? Array - a = set1 - b = set2 - else - a = set2 - b = set1 - end - - case b - when true, false - each_unnode(a).any? do |unnoded| - compare(Functions.boolean(unnoded), op, b) - end - when Numeric - each_unnode(a).any? do |unnoded| - compare(Functions.number(unnoded), op, b) - end - when /\A\d+(\.\d+)?\z/ - b = Functions.number(b) - each_unnode(a).any? do |unnoded| - compare(Functions.number(unnoded), op, b) - end - else - b = Functions::string(b) - each_unnode(a).any? do |unnoded| - compare(Functions::string(unnoded), op, b) - end - end - else - # If neither is nodeset, - # If op is = or != - # If either boolean, convert to boolean - # If either number, convert to number - # Else, convert to string - # Else - # Convert both to numbers and compare - compare(set1, op, set2) - end - end - - def value_type(value) - case value - when true, false - :boolean - when Numeric - :number - when String - :string - else - raise "[BUG] Unexpected value type: <#{value.inspect}>" - end - end - - def normalize_compare_values(a, operator, b) - a_type = value_type(a) - b_type = value_type(b) - case operator - when :eq, :neq - if a_type == :boolean or b_type == :boolean - a = Functions.boolean(a) unless a_type == :boolean - b = Functions.boolean(b) unless b_type == :boolean - elsif a_type == :number or b_type == :number - a = Functions.number(a) unless a_type == :number - b = Functions.number(b) unless b_type == :number - else - a = Functions.string(a) unless a_type == :string - b = Functions.string(b) unless b_type == :string - end - when :lt, :lteq, :gt, :gteq - a = Functions.number(a) unless a_type == :number - b = Functions.number(b) unless b_type == :number - else - message = "[BUG] Unexpected compare operator: " + - "<#{operator.inspect}>: <#{a.inspect}>: <#{b.inspect}>" - raise message - end - [a, b] - end - - def compare(a, operator, b) - a, b = normalize_compare_values(a, operator, b) - case operator - when :eq - a == b - when :neq - a != b - when :lt - a < b - when :lteq - a <= b - when :gt - a > b - when :gteq - a >= b - else - message = "[BUG] Unexpected compare operator: " + - "<#{operator.inspect}>: <#{a.inspect}>: <#{b.inspect}>" - raise message - end - end - - def each_unnode(nodeset) - return to_enum(__method__, nodeset) unless block_given? - nodeset.each do |node| - if node.is_a?(XPathNode) - unnoded = node.raw_node - else - unnoded = node - end - yield(unnoded) - end - end - - def unnode(nodeset) - each_unnode(nodeset).collect do |unnoded| - unnoded = yield(unnoded) if block_given? - unnoded - end - end - end - - # @private - class XPathNode - attr_reader :raw_node, :context - def initialize(node, context=nil) - if node.is_a?(XPathNode) - @raw_node = node.raw_node - else - @raw_node = node - end - @context = context || {} - end - - def position - @context[:position] - end - end -end diff --git a/test/rexml/data/LostineRiver.kml.gz b/test/rexml/data/LostineRiver.kml.gz deleted file mode 100644 index 68a00c51db..0000000000 Binary files a/test/rexml/data/LostineRiver.kml.gz and /dev/null differ diff --git a/test/rexml/data/ProductionSupport.xml b/test/rexml/data/ProductionSupport.xml deleted file mode 100644 index 083cf64a6e..0000000000 --- a/test/rexml/data/ProductionSupport.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - >#error:]]> - - - - - Update Policy request 9997: Please check CICS log - - - - - MotorInsuranceContract(Object)>>#error: - - Have not got a complete - - - Have not got a complete and consistent set of price matrices for policy period - ask back-end prod supp to sort out - - - - - - diff --git a/test/rexml/data/axis.xml b/test/rexml/data/axis.xml deleted file mode 100644 index bc996c571d..0000000000 --- a/test/rexml/data/axis.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/rexml/data/bad.xml b/test/rexml/data/bad.xml deleted file mode 100644 index 18786f2b43..0000000000 --- a/test/rexml/data/bad.xml +++ /dev/null @@ -1,5 +0,0 @@ - - Here is an XML document. - - It has some elements, but it also has a hidden < error! (or two) - diff --git a/test/rexml/data/basic.xml b/test/rexml/data/basic.xml deleted file mode 100644 index 88385fb6e1..0000000000 --- a/test/rexml/data/basic.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/test/rexml/data/basicupdate.xml b/test/rexml/data/basicupdate.xml deleted file mode 100644 index 57d458cf2a..0000000000 --- a/test/rexml/data/basicupdate.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - Goudse kaas - Rond - - - - - - - More cheese! - - - - - Even more cheese! - - - - - No sausages today - - - - - - - - - - - - - - - - - - diff --git a/test/rexml/data/broken.rss b/test/rexml/data/broken.rss deleted file mode 100644 index d5f29e5d1f..0000000000 --- a/test/rexml/data/broken.rss +++ /dev/null @@ -1,20 +0,0 @@ - - - %HTMLlat1; -]> - - - - - O'Reilly Network Articles - http://www.oreillynet.com/ - - diff --git a/test/rexml/data/contents.xml b/test/rexml/data/contents.xml deleted file mode 100644 index 35e3ac7044..0000000000 --- a/test/rexml/data/contents.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - Java and XML - - - Introduction - - What Is It? - - - How Do I Use It? - - - Why Should I Use It? - - - What's Next? - - - - - Creating XML - An XML Document - The Header - The Content - What's Next? - - - - Parsing XML - Getting Prepared - SAX Readers - Content Handlers - Error Handlers - - A Better Way to Load a Parser - - "Gotcha!" - What's Next? - - - - - - Web Publishing Frameworks - Selecting a Framework - Installation - - Using a Publishing Framework - - XSP - Cocoon 2.0 and Beyond - What's Next? - - - diff --git a/test/rexml/data/dash.xml b/test/rexml/data/dash.xml deleted file mode 100644 index e1be655750..0000000000 --- a/test/rexml/data/dash.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - content-1-text - - - content-2-text - - - content-3-text - - diff --git a/test/rexml/data/defaultNamespace.xml b/test/rexml/data/defaultNamespace.xml deleted file mode 100644 index 1e32981506..0000000000 --- a/test/rexml/data/defaultNamespace.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - Hello - - diff --git a/test/rexml/data/doctype_test.xml b/test/rexml/data/doctype_test.xml deleted file mode 100644 index a690cab99d..0000000000 --- a/test/rexml/data/doctype_test.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - diff --git a/test/rexml/data/documentation.xml b/test/rexml/data/documentation.xml deleted file mode 100644 index a1ad6e878b..0000000000 --- a/test/rexml/data/documentation.xml +++ /dev/null @@ -1,542 +0,0 @@ - - - - - - - - REXML - - - - @ANT_VERSION@ - - @ANT_DATE@ - - http://www.germane-software.com/software/rexml - - rexml - - ruby - - Sean - Russell - - - - -

REXML is a conformant XML processor for the Ruby programming - language. REXML passes 100% of the Oasis non-validating tests and - includes full XPath support. It is reasonably fast, and is implemented - in pure Ruby. Best of all, it has a clean, intuitive API. REXML is - included in the standard library of Ruby

- -

This software is distribute under the Ruby - license.

-
- - -

REXML arose out of a desire for a straightforward XML API, and is an - attempt at an API that doesn't require constant referencing of - documentation to do common tasks. "Keep the common case simple, and the - uncommon, possible."

- -

REXML avoids The DOM API, which violates the maxim of simplicity. It - does provide a DOM model, but one that is Ruby-ized. It is an - XML API oriented for Ruby programmers, not for XML programmers coming - from Java.

- -

Some of the common differences are that the Ruby API relies on block - enumerations, rather than iterators. For example, the Java code:

- - for (Enumeration e=parent.getChildren(); e.hasMoreElements(); ) { - Element child = (Element)e.nextElement(); // Do something with child -} - -

in Ruby becomes:

- - parent.each_child{ |child| # Do something with child } - -

Can't you feel the peace and contentment in this block of code? Ruby - is the language Buddha would have programmed in.

- -

One last thing. If you use and like this software, and you're in a - position of power in a company in Western Europe and are looking for a - software architect or developer, drop me a line. I took a lot of French - classes in college (all of which I've forgotten), and I lived in Munich - long enough that I was pretty fluent by the time I left, and I'd love to - get back over there.

-
- - - Four intuitive parsing APIs. - - Intuitive, powerful, and reasonably fast tree parsing API (a-la - DOM - - Fast stream parsing API (a-la SAX)This is not a SAX - API. - - SAX2-based APIIn addition to the native REXML streaming - API. This is slower than the native REXML API, but does a lot more work - for you. - - Pull parsing API. - - Small - - Reasonably fast (for interpreted code) - - Native Ruby - - Full XPath supportCurrently only available for the tree - API - - XML 1.0 conformantREXML passes all of the non-validating - OASIS tests. There are probably places where REXML isn't conformant, but - I try to fix them as they're reported. - - ISO-8859-1, UNILE, UTF-16 and UTF-8 input and output; also, - support for any encoding the iconv supports. - - Documentation - -
- - - -

You don't have to install anything; if you're running a - version of Ruby greater than 1.8, REXML is included. However, if you - choose to upgrade from the REXML distribution, run the command: - ruby bin/install.rb. By the way, you really should look at - these sorts of files before you run them as root. They could contain - anything, and since (in Ruby, at least) they tend to be mercifully - short, it doesn't hurt to glance over them. If you want to uninstall - REXML, run ruby bin/install.rb -u.

-
- - -

If you have Test::Unit installed, you can run the unit test cases. - Run the command: ruby bin/suite.rb; it runs against the - distribution, not against the installed version.

-
- - -

There is a benchmark suite in benchmarks/. To run the - benchmarks, change into that directory and run ruby - comparison.rb. If you have nothing else installed, only the - benchmarks for REXML will be run. However, if you have any of the - following installed, benchmarks for those tools will also be run:

- - - NQXML - - XMLParser - - Electric XML (you must copy EXML.jar into the - benchmarks directory and compile - flatbench.java before running the test) - - -

The results will be written to index.html.

-
- - -

Please see the Tutorial.

- -

The API documentation is available on-line, - or it can be downloaded as an archive in - tgz format (~70Kb) or (if you're a masochist) in - zip format (~280Kb). The best solution is to download and install - Dave Thomas' most excellent rdoc and generate the API docs - yourself; then you'll be sure to have the latest API docs and won't have - to keep downloading the doc archive.

- -

The unit tests in test/ and the benchmarking code in - benchmark/ provide additional examples of using REXML. The - Tutorial provides examples with commentary. The documentation unpacks - into rexml/doc.

- -

Kouhei Sutou maintains a Japanese - version of the REXML API docs. Kou's - documentation page contains links to binary archives for various - versions of the documentation.

-
-
- - - -

Unfortunately, NQXML is the only package REXML can be compared - against; XMLParser uses expat, which is a native library, and really is - a different beast altogether. So in comparing NQXML and REXML you can - look at four things: speed, size, completeness, and API.

- -

Benchmarks

- -

REXML is faster than NQXML in some things, and slower than NQXML in a - couple of things. You can see this for yourself by running the supplied - benchmarks. Most of the places where REXML are slower are because of the - convenience methodsFor example, - element.elements[index] isn't really an array operation; - index can be an Integer or an XPath, and this feature is relatively time - expensive.. On the positive side, most of the convenience - methods can be bypassed if you know what you are doing. Check the benchmark comparison page for a - general comparison. You can look at the benchmark code yourself - to decide how much salt to take with them.

- -

The sizes of the XML parsers are closeAs measured with - ruby -nle 'print unless /^\s*(#.*|)$/' *.rb | wc -l - . NQXML 1.1.3 has 1580 non-blank, non-comment lines of code; - REXML 2.0 has 2340REXML started out with about 1200, but that - number has been steadily increasing as features are added. XPath - accounts for 541 lines of that code, so the core REXML has about 1800 - LOC..

- -

REXML is a conformant XML 1.0 parser. It supports multiple language - encodings, and internal processing uses the required UTF-8 and UTF-16 - encodings. It passes 100% of the Oasis non-validating tests. - Furthermore, it provides a full implementation of XPath, a SAX2 and a - PullParser API.

-
- - -

As of release 2.0, XPath 1.0 is fully implemented.

- -

I fully expect bugs to crop up from time to time, so if you see any - bogus XPath results, please let me know. That said, since I'm now - following the XPath grammar and spec fairly closely, I suspect that you - won't be surprised by REXML's XPath very often, and it should become - rock solid fairly quickly.

- -

Check the "bugs" section for known problems; there are little bits of - XPath here and there that are not yet implemented, but I'll get to them - soon.

- -

Namespace support is rather odd, but it isn't my fault. I can only do - so much and still conform to the specs. In particular, XPath attempts to - help as much as possible. Therefore, in the trivial cases, you can pass - namespace prefixes to Element.elements[...] and so on -- in these cases, - XPath will use the namespace environment of the base element you're - starting your XPath search from. However, if you want to do something - more complex, like pass in your own namespace environment, you have to - use the XPath first(), each(), and match() methods. Also, default - namespaces force you to use the XPath methods, rather than the - convenience methods, because there is no way for XPath to know what the - mappings for the default namespaces should be. This is exactly why I - loath namespaces -- a pox on the person(s) who thought them up!

-
- - -

Namespace support is now fairly stable. One thing to be aware of is - that REXML is not (yet) a validating parser. This means that some - invalid namespace declarations are not caught.

-
- - -

There is a low-volume mailing list dedicated to REXML. To subscribe, - send an empty email to ser-rexml-subscribe@germane-software.com. - This list is more or less spam proof. To unsubscribe, similarly send a - message to ser-rexml-unsubscribe@germane-software.com.

-
- - -

An RSS - file for REXML is now being generated from the change log. This - allows you to be alerted of bug fixes and feature additions via "pull". - Another - RSS is available which contains a single item: the release notice - for the most recent release. This is an abuse of the RSS - mechanism, which was intended to be a distribution system for headlines - linked back to full articles, but it works. The headline for REXML is - the version number, and the description is the change log. The links all - link back to the REXML home page. The URL for the RSS itself is - http://www.germane-software.com/software/rexml/rss.xml.

- -

The changelog itself is here.

- -

For those who are interested, there's a SLOCCount (by David A. Wheeler) file - with stats on the REXML sourcecode. Note that the SLOCCount output - includes the files in the test/, benchmarks/, and bin/ directories, as - well as the main sourcecode for REXML itself.

-
- - - - Raggle is a - console-based RSS aggregator. - - getrss - is an RSS aggregator - - Ned Konz's ruby-htmltools - uses REXML - - Hiroshi NAKAMURA's SOAP4R - package can use REXML as the XML processor. - - Chris Morris' XML - Serializer. XML Serializer provides a serialization mechanism - for Ruby that provides a bidirectional mapping between Ruby classes - and XML documents. - - Much of the RubyXML - site is generated with scripts that use REXML. RubyXML is a great - place to find information about th intersection between Ruby and - XML. - - - - -

You can submit bug reports and feature requests, and view the list of - known bugs, at the REXML bug report - page. Please do submit bug reports. If you really want your bug - fixed fast, include an runit or Test::Unit method (or methods) that - illustrates the problem. At the very least, send me some XML that REXML - doesn't process properly.

- -

You don't have to send an entire test suite -- just the unit test - methods. If you don't send me a unit test, I'll have to write one - myself, which will mean that your bug will take longer to fix.

- -

When submitting bug reports, please include the version of Ruby and - of REXML that you're using, and the operating system you're running on. - Just run: ruby -vrrexml/rexml -e 'p - REXML::VERSION,PLATFORM' and paste the results in your bug - report. Include your email if you want a response about the bug.

- - Attributes are not handled internally as nodes, so you can't - perform node functions on them. This will have to change. It'll also - probably mean that, rather than returning attribute values, XPath will - return the Attribute nodes. - - Some of the XPath functions are untestedMike - Stok has been testing, debugging, and implementing some of these - Functions (and he's been doing a good job) so there's steady improvement - in this area.. Any XPath functions that don't work are also - bugs... please report them. If you send a unit test that illustrates the - problem, I'll try to fix the problem within a couple of days (if I can) - and send you a patch, personally. - - Accessing prefixes for which there is no defined namespace in an - XPath should throw an exception. It currently doesn't -- it just fails - to match. -
- - - Reparsing a tree with a pull/SAX parser - - Better namespace support in SAX - - Lazy tree parsing - - Segregate parsers, for optimized minimal distributions - - XML <-> Ruby - - Validation support - - True XML character support - - Add XPath support for streaming APIs - - XQuery support - - XUpdate support - - Make sure namespaces are supported in pull parser - - Add document start and entity replacement events - in pull parser - - Better stream parsing exception handling - - I'd like to hack XMLRPC4R to use REXML, for my own - purposes. - -
- - - REXML is hanging while parsing one of my XML files. - - Your XML is probably malformed. Some malformed XML, especially XML that - contains literal '<' embedded in the document, causes REXML to hang. - REXML should be throwing an exception, but it doesn't; this is a bug. I'm - aware that it is an extremely annoying bug, and it is one I'm trying to - solve in a way that doesn't significantly reduce REXML's parsing - speed. - - I'm using the XPath '//foo' on an XML branch node X, and keep getting - all of the 'foo' elements in the entire document. Why? Shouldn't it return - only the 'foo' element descendants of X? - - No. XPath specifies that '/' returns the document root, regardless of - the context node. '//' also starts at the document root. If you want to - limit your search to a branch, you need to use the self:: axe. EG, - 'self::node()//foo', or the shorthand './/foo'. - - I want to parse a document both as a tree, and as a stream. Can I do - this? - - Yes, and no. There is no mechanism that directly supports this in - REXML. However, aside from writing your own traversal layer, there is a - way of doing this. To turn a tree into a stream, just turn the branch you - want to process as a stream back into a string, and re-parse it with your - preferred API. EG: pp = PullParser.new( some_element.to_s ). The other - direction is more difficult; you basically have to build a tree from the - events. REXML will have one of these builders, eventually, but it doesn't - currently exist. - - Why is Element.elements indexed off of '1' instead of '0'? - - Because of XPath. The XPath specification states that the index of the - first child node is '1'. Although it may be counter-intuitive to base - elements on 1, it is more undesireable to have element.elements[0] == - element.elements[ 'node()[1]' ]. Since I can't change the XPath - specification, the result is that Element.elements[1] is the first child - element. - - Why isn't REXML a validating parser? - - Because validating parsers must include code that parses and interprets - DTDs. I hate DTDs. REXML supports the barest minimum of DTD parsing, and - even that isn't complete. There is DTD parsing code in the works, but I - only work on it when I'm really, really bored. Rumor has it that a - contributor is working on a DTD parser for REXML; rest assured that any - such contribution will be included with REXML as soon as it is - available. - - I'm trying to create an ISO-8859-1 document, but when I add text to the - document it isn't being properly encoded. - - Regardless of what the encoding of your document is, when you add text - programmatically to a REXML document you must ensure that you are - only adding UTF-8 to the tree. In particular, you can't add ISO-8859-1 - encoded text that contains characters above 0x80 to REXML trees -- you - must convert it to UTF-8 before doing so. Luckily, this is easy: - text.unpack('C*').pack('U*') will do the trick. 7-bit ASCII - is identical to UTF-8, so you probably won't need to worry about this. - - How do I get the tag name of an Element? - - You take a look at the APIs, and notice that Element - includes Namespace. Then you click on the - Namespace link and look at the methods that - Element includes from Namespace. One of these is - name(). Another is expanded_name(). Yet another - is prefix(). Then, you email the author of rdoc and ask him - to extend rdoc so that it lists methods in the API that are included from - other files, so that you don't have to do all of that looking around for - your method. - - - -

I've had help from a number of resources; if I haven't listed you here, - it means that I just haven't gotten around to adding you, or that I'm a - dork and have forgotten. In either case, feel free to write me and - complain.

- - - Mike Stok has been very active, sending not only fixes for bugs - (especially in Functions), but also by providing unit tests and making - sure REXML runs under Ruby 1.7. He also sent the most awesome hand - knitted tea cozy, with "REXML" and the Ruby knitted into it. - - Kouhei Sutou translated the REXML API documentation to Japanese! - Links are in the API docs section of the main documentation. He has also - contributed a large number of bug reports and patches to fix bugs in - REXML. - - Erik Terpstra heard my pleas and submitted several logos for - REXML. After sagely procrastinating for several weeks, I finally forced - my poor slave of a wife to pick one (this is what we call "delegation"). - She did, with caveats; Erik quickly made the changes, and the result is - what you now see at the top of this page. He also supplied a smaller version that you can include - with your projects that use REXML, if you'd like. - - Ernest Ellingson contributed the sourcecode for turning UTF16 and - UNILE encodings into UTF8, which allowed REXML to get the 100% OASIS - valid tests rating. - - Ian Macdonald provided me with a comprehensive, well written RPM - spec file. - - Oliver M . Bolzer is maintaining a Debian package distribution of - REXML. He also has provided good feedback and bug reports about - namespace support. - - Michael Granger supplied a patch for REXML that make the unit - tests pass under Ruby 1.7. - - James Britt contributed code that makes using - Document.parse_stream easier to use by allowing it to be passed either a - Source, File, or String. - - Tobias Reif: Numerous bug reports, and suggestions for - improvement. - - Stefan Scholl, who provided a lot of feedback and bug reports - while I was trying to get ISO-8859-1 support working. - - Steven E Lumos for volunteering information about XPath - particulars. - - Fumitoshi UKAI provided some bug fixes for CData metacharacter - quoting. - - TAKAHASHI Masayoshi, for information on UTF - - Robert Feldt: Bug reports and suggestions/recommendations about - improving REXML. Testing is one of the most important aspects of - software development. - - Electric - XML: This was, after all, the inspiration for REXML. Originally, - I was just going to do a straight port, and although REXML doesn't in - any way, shape or form resemble Electric XML, still the basic framework - and philosophy was inspired by E-XML. And I still use E-XML in my Java - projects. - - NQXML: - While I may complain about the NQXML API, I wrote a few applications - using it that wouldn't have been written otherwise, and it was very - useful to me. It also encouraged me to write REXML. Never complain about - free software *slap*. - - See my technologies - page for a more comprehensive list of computer technologies that - I depend on for my day-to-day work. - - rdoc, an excellent JavaDoc analogWhen I was first - working on REXML, rdoc wasn't, IMO, very good, so I wrote API2XML. - API2XML was good enough for a while, and then there was a flurry of work - on rdoc, and it quickly surpassed API2XML in features. Since I was never - really interested in maintaining a JavaDoc analog, I stopped support of - API2XML, and am now recommending that people use - rdoc.. - - Many, many other people who've submitted bug reports, suggestions, - and positive feedback. You're all co-developers! - -
-
diff --git a/test/rexml/data/euc.xml b/test/rexml/data/euc.xml deleted file mode 100644 index a3c3419498..0000000000 --- a/test/rexml/data/euc.xml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - -Ruby-mswin32 - - - -

Ruby-mswin32

-

뤤ϡWindowsȤνʤ襤 ;-(

-

[ܸ / English]

- - - -

ܼ

- - - - -

ջ

-

ΥڡǤϡmswin32rubyۤѹΤΤ餻ԤäƤޤ

-

̤˸ڡǤʤǤʤơ䤬˽񤤤ƤڡǤǤץࡦ(̵)ˤĤƤϡƼȽǤǤѤ
-䤤碌ءְäƤ¾οͤǤ򤫤褦ʤȤϤʤǤ͡

- - - -

RubyȤ?

-

RubyΥ

- - - -

mswin32rubyȤ?

-

mswin32rubyȤϡ32bitWindows(Windows95Windows98WindowsMeWindows NTWindows 2000WindowsXPWindows 2003 ServerʲWindowsɽ)ưRubyΥХʥΰĤǤ
-WindowsưRubyȤƤϡߡ5ΥХʥ꤬¸ߤޤϤ줾mswin32ǡcygwinǡmingw32ǡbccwin32ǡdjgppǤȸƤФƤޤ
-줾ΰ㤤ޤȤȰʲΤ褦ˤʤޤ(¸ǧФΤ餻)

-
-
mswin32
-

VC++ǥѥ뤵롣Windows鸫ФäȤ̡פΥХʥȸ뤬ȿ̡RubyUNIXħŪʵǽΰѤǤʤ1.7.3ʹߤmingw32Ǥȳĥ饤֥ˤĤƤϥХʥߴ롣
-RUBY_PLATFORM*-mswin32

-
-
cygwin
-

gccǥѥ뤵졢cygwinĶư롣cygwinĶUNIX饤ʴĶWindowsǹۤΤǤΤǡcygwinrubyϰ̤UNIXѤΤΤȤƱ褦ư(ȤԤǤ)
-RUBY_PLATFORM*-cygwin

-
-
mingw32
-

gccǥѥ뤵롣ϤۤȤmswin32Ǥȶ̤Ǥꡢ󥿥饤֥ⶦ(MSVCRT.dll)ʤΤǡư(餯)mswin32ǤȤۤƱ1.7.3ʹߤmswin32Ǥȳĥ饤֥ˤĤƤϥХʥߴ롣
-RUBY_PLATFORM*-mingw32

-
-
bccwin32
-

BC++ǥѥ뤵롣Ϥʤʬmswin32Ǥȶ̤ǤϤ뤬󥿥饤֥꤬ۤʤΤǡ٤Ȥǵưmswin32ǤȤϰۤʤ(Ϥ)1.7ʹߤǥݡȤ롣
-RUBY_PLATFORM*-bccwin32

-
-
djgpp
-

DJGPPǥѥ뤵롣DOSѤΥХʥʤΤǡDOSǤư롣ȿ̡WindowsˤäDOSˤʤǽ¿Ȥʤ(ͥåȥϢʤ)
-RUBY_PLATFORM*-msdosdjgpp

-
-
-

ΥڡǤϡ嵭Τmswin32ǤΤߤ򰷤äƤޤ
-ʤcygwinǡmingw32ǡdjgppǤˤĤƤϤ錄ʤ٤Ruby binariesǽǤޤbccwin32ǤˤĤƤϾRubyǽǤ

- - - -

Хʥ

-

ƤΥХʥVC++ 5.0(Version 11.00.7022 for 80x86)makeΤǤrubyΤ˴ؤƤϡɸۤΥCVSΥ)餽Τޤ޺Ƥޤĥ饤֥ˤĤƤϳơΥ򻲾ȤƤ
-ΥХʥzipǥ֤Ƥޤ

-

md5sumΥåˡǤ㤨ruby󥹥ȡ뤵Ƥʤ鲼Τ褦ˡޤ
-ruby -r md5 -e "puts MD5.new(File.open('filename', 'rb').read).hexdigest"

- - - -

Release

- - - - - - - - -

Developing versions snapshots

- - - - -

Stable versions snapshots

-

1.8.0

- -

1.6.8

- - - - -

Extension libraries

-

1.8.0

- -

1.6.8

- - - - -

󥹥ȡ

-

嵭ΥХʥ򥤥󥹥ȡ뤹ϡߤΥǥ쥯ȥ(ʲ$TOPDIRȵ)ŸƤǥ쥯ȥդǰ̤ƤޤΤǡŸˤϥǥ쥯ȥդŸΤ˺줺(̣狼ʤͤϵˤʤƤǤ)
-Ÿϡ$TOPDIR\binPATH̤ƤƤ

-

ʤʲγĥ饤֥ϡʪ˴ޤޤʤΥ饤֥˰¸Ƥޤ

-
    -
  • curses.so : PDCurses˰¸Ƥޤ
  • -
  • dbm.so : GDBM˰¸Ƥޤ
  • -
  • gdbm.so : GDBM˰¸Ƥޤ
  • -
  • iconv.so : Iconv˰¸Ƥޤ
  • -
  • openssl.so : OpenSSL˰¸Ƥޤ
  • -
  • readline.so : readline˰¸Ƥޤ
  • -
  • tcltklib.so : Tcl/Tk˰¸Ƥޤ
  • -
  • zlib.so : Zlib˰¸Ƥޤ
  • -
-

嵭ΤPDCursesGDBMOpenSSLreadlineZlibˤĤƤϡPorting Libraries to Win32˥Хʥ꤬¸ߤޤ
-IconvˤĤƤϡMeadowy.orgۤƤiconv-1.8.win32.zipѤƤޤ
-Tcl/TkˤĤƤϡActiveStateۤƤActiveTclѤƤޤ

- - - -

Ƕν

- - - -

2004-01-27

-

ޤƤǤȤޤä٤!

-

ruby-1.8.1-20040127ruby-1.9.0-20040126֤ޤ
-Ԥϼ1.8.1꡼Ǥȯ줿ԶνǤԤϳȯǡ

- -

2003-12-25

-

꡼ꥹޥ! ruby-1.8.1꡼ޤ!
-(previewФ㤤ޤʤ...)

- -

2003-12-06

-

ruby-1.8.1-preview3֤ޤפΤ֤ۤ㤤ޤ͡

- -

2003-11-01

-

ruby-1.8.1-preview2֤ޤ

- -

2003-10-28

-

ruby-1.8.1-20031027֤ޤ
-racc-1.4.4-all֤ޤ

- -

2003-09-07

-

eruby-1.0.4vrswin-030906vruby-030906֤ޤ

- -

2003-08-12

-

ruby-1.8.0-20030812֤ޤ

-

vrswin-030811vruby-030811֤ޤ󤫤֤ĥ饤֥1.8Ѥˤʤޤ

- -

2003-08-04

-

ruby-1.8.0֤ޤRuby 1.8ϺǽΥ꡼Ȥʤޤ
-1.6ϤѹˤĤƤϡchanges.1.8.0ʤɤ

- -

2003-07-31

-

ruby-1.8.0-preview6֤ޤȡޤƤ2previewФͤǤ :)

- -

2003-07-28

-

ruby-1.8.0-preview5֤ޤ餯줬1.8.0κǸpreviewˤʤǤ礦
-ruby-1.6.8-20030727֤ޤ

- - - -

ĤƤν

-

ɤ

- - - -

-

mswin32Ǥ˴ؤ(Ȼפ)󥯤ǤĥäƤޤΤǡԹ礬ޤǤϢ

- - - - - -
written by U.Nakamura
-

-ruby 1.9.0 (2004-01-13)
-ERb 2.0.4
-RDtool 0.6.11
-rublog 0.0.2 -

- - - diff --git a/test/rexml/data/evaluate.xml b/test/rexml/data/evaluate.xml deleted file mode 100644 index 90d06bd652..0000000000 --- a/test/rexml/data/evaluate.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - brown - - - moderate - - diff --git a/test/rexml/data/fibo.xml b/test/rexml/data/fibo.xml deleted file mode 100644 index 9b5d0ecd87..0000000000 --- a/test/rexml/data/fibo.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 0 - 1 - 1 - 2 - 3 - 5 - 8 - 13 - 21 - 34 - 55 - 89 - 144 - 233 - 377 - 610 - 987 - 1597 - 2584 - 4181 - 6765 - 10946 - 17711 - 28657 - 46368 - 75025 - diff --git a/test/rexml/data/foo.xml b/test/rexml/data/foo.xml deleted file mode 100644 index 53b9a4e003..0000000000 --- a/test/rexml/data/foo.xml +++ /dev/null @@ -1,10 +0,0 @@ - - -]> - - human leg - table leg - diff --git a/test/rexml/data/google.2.xml b/test/rexml/data/google.2.xml deleted file mode 100644 index a1df93b107..0000000000 --- a/test/rexml/data/google.2.xml +++ /dev/null @@ -1,156 +0,0 @@ -
- - - - - - - - Campaign Name - - - - Current Status - - - Current Budget - - [?] - - - - Clicks - - - - - - Impr. - - - CTR - - - Avg. CPC - - - Cost - - - Conv. Rate - - - Cost/Conv. - - - - - - - - Test - - - - Paused - - - - Test - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - - - - Test - - - - Paused - - - - Test - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - - - - Test - - - - Test - - - - Test - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - -
diff --git a/test/rexml/data/id.xml b/test/rexml/data/id.xml deleted file mode 100644 index 749ab207ce..0000000000 --- a/test/rexml/data/id.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - -]> - - - - baz - gouda - baz - cheddar - baz - - diff --git a/test/rexml/data/iso8859-1.xml b/test/rexml/data/iso8859-1.xml deleted file mode 100644 index 5fb04ec9ba..0000000000 --- a/test/rexml/data/iso8859-1.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/test/rexml/data/jaxen24.xml b/test/rexml/data/jaxen24.xml deleted file mode 100644 index 9b819967ee..0000000000 --- a/test/rexml/data/jaxen24.xml +++ /dev/null @@ -1,2 +0,0 @@ - -

diff --git a/test/rexml/data/jaxen3.xml b/test/rexml/data/jaxen3.xml deleted file mode 100644 index a87723a3b9..0000000000 --- a/test/rexml/data/jaxen3.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - 2 - - CE-A - - - - 1 - - CE-B - - - diff --git a/test/rexml/data/lang.xml b/test/rexml/data/lang.xml deleted file mode 100644 index 49b45db291..0000000000 --- a/test/rexml/data/lang.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/test/rexml/data/lang0.xml b/test/rexml/data/lang0.xml deleted file mode 100644 index 283b4e0f08..0000000000 --- a/test/rexml/data/lang0.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Ruby - - - Yukihiro Matsumoto - - - - - Python - - - Guido van Rossum - - - diff --git a/test/rexml/data/message.xml b/test/rexml/data/message.xml deleted file mode 100644 index 3b81df2a86..0000000000 --- a/test/rexml/data/message.xml +++ /dev/null @@ -1,27 +0,0 @@ - - -
- lookupformservice - 9 - stammdaten - new -
- - - - - iteminfo - ELE - - - parentinfo - Pruefgebiete - - - id - 1 - - - - -
diff --git a/test/rexml/data/moreover.xml b/test/rexml/data/moreover.xml deleted file mode 100644 index 38d4c4f81c..0000000000 --- a/test/rexml/data/moreover.xml +++ /dev/null @@ -1,244 +0,0 @@ - - -
- http://c.moreover.com/click/here.pl?x13563273 - e-Commerce Operators Present Version 1.0 of the XML Standard - StockAccess - text - moreover... - - http://www.stockaccess.com/index.html - Dec 24 2000 6:28AM - - -
-
- http://c.moreover.com/click/here.pl?x13560995 - W3C Publishes XML Protocol Requirements Document - Xml - text - moreover... - - http://www.xml.com/ - Dec 24 2000 12:22AM - - -
-
- http://c.moreover.com/click/here.pl?x13553521 - Prowler: Open Source XML-Based Content Management Framework - Xml - text - moreover... - - http://www.xml.com/ - Dec 23 2000 2:05PM - - -
-
- http://c.moreover.com/click/here.pl?x13549013 - The Middleware Company Debuts Public Training Courses in Ejb, J2ee And Xml - Java Industry Connection - text - moreover... - - http://industry.java.sun.com/javanews/more/hotnews/ - Dec 23 2000 12:15PM - - -
-
- http://c.moreover.com/click/here.pl?x13544467 - Revised Working Draft for the W3C XML Information Set - Xml - text - moreover... - - http://www.xml.com/ - Dec 23 2000 5:50AM - - -
-
- http://c.moreover.com/click/here.pl?x13534836 - XML: Its The Great Peacemaker - ZDNet - text - moreover... - - http://www.zdnet.com/intweek/ - Dec 22 2000 9:05PM - - -
-
- http://c.moreover.com/click/here.pl?x13533485 - Project eL - The XML Leningrad Codex Markup Project - Xml - text - moreover... - - http://www.xml.com/ - Dec 22 2000 8:34PM - - -
-
- http://c.moreover.com/click/here.pl?x13533488 - XML Linking Language (XLink) and XML Base Specifications Issued as W3C Proposed Recommenda - Xml - text - moreover... - - http://www.xml.com/ - Dec 22 2000 8:34PM - - -
-
- http://c.moreover.com/click/here.pl?x13533492 - W3C Releases XHTML Basic Specification as a W3C Recommendation - Xml - text - moreover... - - http://www.xml.com/ - Dec 22 2000 8:34PM - - -
-
- http://c.moreover.com/click/here.pl?x13521827 - Java, Xml And Oracle9i(TM) Make A Great Team - Java Industry Connection - text - moreover... - - http://industry.java.sun.com/javanews/more/hotnews/ - Dec 22 2000 3:21PM - - -
-
- http://c.moreover.com/click/here.pl?x13511233 - Competing initiatives to vie for security standard - ZDNet - text - moreover... - - http://www.zdnet.com/eweek/filters/news/ - Dec 22 2000 10:54AM - - -
-
- http://c.moreover.com/click/here.pl?x13492397 - Oracle Provides Developers with Great Xml Reading This Holiday Season - Java Industry Connection - text - moreover... - - http://industry.java.sun.com/javanews/more/hotnews/ - Dec 21 2000 8:08PM - - -
-
- http://c.moreover.com/click/here.pl?x13491292 - XML as the great peacemaker - Extensible Markup Language Accomplished The Seemingly Impossible This Year: It B - Hospitality Net - text - moreover... - - http://www.hospitalitynet.org/news/list.htm?c=2000 - Dec 21 2000 7:45PM - - -
-
- http://c.moreover.com/click/here.pl?x13484758 - XML as the great peacemaker - CNET - text - moreover... - - http://news.cnet.com/news/0-1003.html?tag=st.ne.1002.dir.1003 - Dec 21 2000 4:41PM - - -
-
- http://c.moreover.com/click/here.pl?x13480896 - COOP Switzerland Selects Mercator as Integration Platform - Stockhouse Canada - text - moreover... - - http://www.stockhouse.ca/news/ - Dec 21 2000 1:55PM - - -
-
- http://c.moreover.com/click/here.pl?x13471023 - Competing XML Specs Move Toward a Union - Internet World - text - moreover... - - http://www.internetworld.com/ - Dec 21 2000 11:14AM - - -
-
- http://c.moreover.com/click/here.pl?x13452280 - Next-generation XHTML stripped down for handhelds - CNET - text - moreover... - - http://news.cnet.com/news/0-1005.html?tag=st.ne.1002.dir.1005 - Dec 20 2000 9:11PM - - -
-
- http://c.moreover.com/click/here.pl?x13451789 - Xml Powers Oracle9i(TM) Dynamic Services - Java Industry Connection - text - moreover... - - http://industry.java.sun.com/javanews/more/hotnews/ - Dec 20 2000 9:05PM - - -
-
- http://c.moreover.com/click/here.pl?x13442097 - XML DOM reference guide - ASPWire - text - moreover... - - http://aspwire.com/ - Dec 20 2000 6:26PM - - -
-
- http://c.moreover.com/click/here.pl?x13424117 - Repeat/Xqsite And Bowstreet Team to Deliver Integrated Xml Solutions - Java Industry Connection - text - moreover... - - http://industry.java.sun.com/javanews/more/hotnews/ - Dec 20 2000 9:04AM - - -
-
- diff --git a/test/rexml/data/much_ado.xml b/test/rexml/data/much_ado.xml deleted file mode 100644 index f008fadbb0..0000000000 --- a/test/rexml/data/much_ado.xml +++ /dev/null @@ -1,6850 +0,0 @@ - - -Much Ado about Nothing - - -

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

-

SGML markup by Jon Bosak, 1992-1994.

-

XML version by Jon Bosak, 1996-1998.

-

This work may be freely copied and distributed worldwide.

-
- - - -Dramatis Personae - -DON PEDRO, prince of Arragon. -DON JOHN, his bastard brother. -CLAUDIO, a young lord of Florence. -BENEDICK, a young lord of Padua. -LEONATO, governor of Messina. -ANTONIO, his brother. -BALTHASAR, attendant on Don Pedro. - - -CONRADE -BORACHIO -followers of Don John. - - -FRIAR FRANCIS -DOGBERRY, a constable. -VERGES, a headborough. -A Sexton. -A Boy. -HERO, daughter to Leonato. -BEATRICE, niece to Leonato. - - -MARGARET -URSULA -gentlewomen attending on Hero. - - -Messengers, Watch, Attendants, &c. - - -SCENE Messina. - -MUCH ADO ABOUT NOTHING - -ACT I - -SCENE I. Before LEONATO'S house. -Enter LEONATO, HERO, and BEATRICE, with a -Messenger - - -LEONATO -I learn in this letter that Don Peter of Arragon -comes this night to Messina. - - - -Messenger -He is very near by this: he was not three leagues off -when I left him. - - - -LEONATO -How many gentlemen have you lost in this action? - - - -Messenger -But few of any sort, and none of name. - - - -LEONATO -A victory is twice itself when the achiever brings -home full numbers. I find here that Don Peter hath -bestowed much honour on a young Florentine called Claudio. - - - -Messenger -Much deserved on his part and equally remembered by -Don Pedro: he hath borne himself beyond the -promise of his age, doing, in the figure of a lamb, -the feats of a lion: he hath indeed better -bettered expectation than you must expect of me to -tell you how. - - - -LEONATO -He hath an uncle here in Messina will be very much -glad of it. - - - -Messenger -I have already delivered him letters, and there -appears much joy in him; even so much that joy could -not show itself modest enough without a badge of -bitterness. - - - -LEONATO -Did he break out into tears? - - - -Messenger -In great measure. - - - -LEONATO -A kind overflow of kindness: there are no faces -truer than those that are so washed. How much -better is it to weep at joy than to joy at weeping! - - - -BEATRICE -I pray you, is Signior Mountanto returned from the -wars or no? - - - -Messenger -I know none of that name, lady: there was none such -in the army of any sort. - - - -LEONATO -What is he that you ask for, niece? - - - -HERO -My cousin means Signior Benedick of Padua. - - - -Messenger -O, he's returned; and as pleasant as ever he was. - - - -BEATRICE -He set up his bills here in Messina and challenged -Cupid at the flight; and my uncle's fool, reading -the challenge, subscribed for Cupid, and challenged -him at the bird-bolt. I pray you, how many hath he -killed and eaten in these wars? But how many hath -he killed? for indeed I promised to eat all of his killing. - - - -LEONATO -Faith, niece, you tax Signior Benedick too much; -but he'll be meet with you, I doubt it not. - - - -Messenger -He hath done good service, lady, in these wars. - - - -BEATRICE -You had musty victual, and he hath holp to eat it: -he is a very valiant trencherman; he hath an -excellent stomach. - - - -Messenger -And a good soldier too, lady. - - - -BEATRICE -And a good soldier to a lady: but what is he to a lord? - - - -Messenger -A lord to a lord, a man to a man; stuffed with all -honourable virtues. - - - -BEATRICE -It is so, indeed; he is no less than a stuffed man: -but for the stuffing,--well, we are all mortal. - - - -LEONATO -You must not, sir, mistake my niece. There is a -kind of merry war betwixt Signior Benedick and her: -they never meet but there's a skirmish of wit -between them. - - - -BEATRICE -Alas! he gets nothing by that. In our last -conflict four of his five wits went halting off, and -now is the whole man governed with one: so that if -he have wit enough to keep himself warm, let him -bear it for a difference between himself and his -horse; for it is all the wealth that he hath left, -to be known a reasonable creature. Who is his -companion now? He hath every month a new sworn brother. - - - -Messenger -Is't possible? - - - -BEATRICE -Very easily possible: he wears his faith but as -the fashion of his hat; it ever changes with the -next block. - - - -Messenger -I see, lady, the gentleman is not in your books. - - - -BEATRICE -No; an he were, I would burn my study. But, I pray -you, who is his companion? Is there no young -squarer now that will make a voyage with him to the devil? - - - -Messenger -He is most in the company of the right noble Claudio. - - - -BEATRICE -O Lord, he will hang upon him like a disease: he -is sooner caught than the pestilence, and the taker -runs presently mad. God help the noble Claudio! if -he have caught the Benedick, it will cost him a -thousand pound ere a' be cured. - - - -Messenger -I will hold friends with you, lady. - - - -BEATRICE -Do, good friend. - - - -LEONATO -You will never run mad, niece. - - - -BEATRICE -No, not till a hot January. - - - -Messenger -Don Pedro is approached. - - - -Enter DON PEDRO, DON JOHN, CLAUDIO, BENEDICK, -and BALTHASAR - - -DON PEDRO -Good Signior Leonato, you are come to meet your -trouble: the fashion of the world is to avoid -cost, and you encounter it. - - - -LEONATO -Never came trouble to my house in the likeness of -your grace: for trouble being gone, comfort should -remain; but when you depart from me, sorrow abides -and happiness takes his leave. - - - -DON PEDRO -You embrace your charge too willingly. I think this -is your daughter. - - - -LEONATO -Her mother hath many times told me so. - - - -BENEDICK -Were you in doubt, sir, that you asked her? - - - -LEONATO -Signior Benedick, no; for then were you a child. - - - -DON PEDRO -You have it full, Benedick: we may guess by this -what you are, being a man. Truly, the lady fathers -herself. Be happy, lady; for you are like an -honourable father. - - - -BENEDICK -If Signior Leonato be her father, she would not -have his head on her shoulders for all Messina, as -like him as she is. - - - -BEATRICE -I wonder that you will still be talking, Signior -Benedick: nobody marks you. - - - -BENEDICK -What, my dear Lady Disdain! are you yet living? - - - -BEATRICE -Is it possible disdain should die while she hath -such meet food to feed it as Signior Benedick? -Courtesy itself must convert to disdain, if you come -in her presence. - - - -BENEDICK -Then is courtesy a turncoat. But it is certain I -am loved of all ladies, only you excepted: and I -would I could find in my heart that I had not a hard -heart; for, truly, I love none. - - - -BEATRICE -A dear happiness to women: they would else have -been troubled with a pernicious suitor. I thank God -and my cold blood, I am of your humour for that: I -had rather hear my dog bark at a crow than a man -swear he loves me. - - - -BENEDICK -God keep your ladyship still in that mind! so some -gentleman or other shall 'scape a predestinate -scratched face. - - - -BEATRICE -Scratching could not make it worse, an 'twere such -a face as yours were. - - - -BENEDICK -Well, you are a rare parrot-teacher. - - - -BEATRICE -A bird of my tongue is better than a beast of yours. - - - -BENEDICK -I would my horse had the speed of your tongue, and -so good a continuer. But keep your way, i' God's -name; I have done. - - - -BEATRICE -You always end with a jade's trick: I know you of old. - - - -DON PEDRO -That is the sum of all, Leonato. Signior Claudio -and Signior Benedick, my dear friend Leonato hath -invited you all. I tell him we shall stay here at -the least a month; and he heartily prays some -occasion may detain us longer. I dare swear he is no -hypocrite, but prays from his heart. - - - -LEONATO -If you swear, my lord, you shall not be forsworn. -To DON JOHN -Let me bid you welcome, my lord: being reconciled to -the prince your brother, I owe you all duty. - - - -DON JOHN -I thank you: I am not of many words, but I thank -you. - - - -LEONATO -Please it your grace lead on? - - - -DON PEDRO -Your hand, Leonato; we will go together. - - - -Exeunt all except BENEDICK and CLAUDIO - - -CLAUDIO -Benedick, didst thou note the daughter of Signior Leonato? - - - -BENEDICK -I noted her not; but I looked on her. - - - -CLAUDIO -Is she not a modest young lady? - - - -BENEDICK -Do you question me, as an honest man should do, for -my simple true judgment; or would you have me speak -after my custom, as being a professed tyrant to their sex? - - - -CLAUDIO -No; I pray thee speak in sober judgment. - - - -BENEDICK -Why, i' faith, methinks she's too low for a high -praise, too brown for a fair praise and too little -for a great praise: only this commendation I can -afford her, that were she other than she is, she -were unhandsome; and being no other but as she is, I -do not like her. - - - -CLAUDIO -Thou thinkest I am in sport: I pray thee tell me -truly how thou likest her. - - - -BENEDICK -Would you buy her, that you inquire after her? - - - -CLAUDIO -Can the world buy such a jewel? - - - -BENEDICK -Yea, and a case to put it into. But speak you this -with a sad brow? or do you play the flouting Jack, -to tell us Cupid is a good hare-finder and Vulcan a -rare carpenter? Come, in what key shall a man take -you, to go in the song? - - - -CLAUDIO -In mine eye she is the sweetest lady that ever I -looked on. - - - -BENEDICK -I can see yet without spectacles and I see no such -matter: there's her cousin, an she were not -possessed with a fury, exceeds her as much in beauty -as the first of May doth the last of December. But I -hope you have no intent to turn husband, have you? - - - -CLAUDIO -I would scarce trust myself, though I had sworn the -contrary, if Hero would be my wife. - - - -BENEDICK -Is't come to this? In faith, hath not the world -one man but he will wear his cap with suspicion? -Shall I never see a bachelor of three-score again? -Go to, i' faith; an thou wilt needs thrust thy neck -into a yoke, wear the print of it and sigh away -Sundays. Look Don Pedro is returned to seek you. - - - -Re-enter DON PEDRO - - -DON PEDRO -What secret hath held you here, that you followed -not to Leonato's? - - - -BENEDICK -I would your grace would constrain me to tell. - - - -DON PEDRO -I charge thee on thy allegiance. - - - -BENEDICK -You hear, Count Claudio: I can be secret as a dumb -man; I would have you think so; but, on my -allegiance, mark you this, on my allegiance. He is -in love. With who? now that is your grace's part. -Mark how short his answer is;--With Hero, Leonato's -short daughter. - - - -CLAUDIO -If this were so, so were it uttered. - - - -BENEDICK -Like the old tale, my lord: 'it is not so, nor -'twas not so, but, indeed, God forbid it should be -so.' - - - -CLAUDIO -If my passion change not shortly, God forbid it -should be otherwise. - - - -DON PEDRO -Amen, if you love her; for the lady is very well worthy. - - - -CLAUDIO -You speak this to fetch me in, my lord. - - - -DON PEDRO -By my troth, I speak my thought. - - - -CLAUDIO -And, in faith, my lord, I spoke mine. - - - -BENEDICK -And, by my two faiths and troths, my lord, I spoke mine. - - - -CLAUDIO -That I love her, I feel. - - - -DON PEDRO -That she is worthy, I know. - - - -BENEDICK -That I neither feel how she should be loved nor -know how she should be worthy, is the opinion that -fire cannot melt out of me: I will die in it at the stake. - - - -DON PEDRO -Thou wast ever an obstinate heretic in the despite -of beauty. - - - -CLAUDIO -And never could maintain his part but in the force -of his will. - - - -BENEDICK -That a woman conceived me, I thank her; that she -brought me up, I likewise give her most humble -thanks: but that I will have a recheat winded in my -forehead, or hang my bugle in an invisible baldrick, -all women shall pardon me. Because I will not do -them the wrong to mistrust any, I will do myself the -right to trust none; and the fine is, for the which -I may go the finer, I will live a bachelor. - - - -DON PEDRO -I shall see thee, ere I die, look pale with love. - - - -BENEDICK -With anger, with sickness, or with hunger, my lord, -not with love: prove that ever I lose more blood -with love than I will get again with drinking, pick -out mine eyes with a ballad-maker's pen and hang me -up at the door of a brothel-house for the sign of -blind Cupid. - - - -DON PEDRO -Well, if ever thou dost fall from this faith, thou -wilt prove a notable argument. - - - -BENEDICK -If I do, hang me in a bottle like a cat and shoot -at me; and he that hits me, let him be clapped on -the shoulder, and called Adam. - - - -DON PEDRO -Well, as time shall try: 'In time the savage bull -doth bear the yoke.' - - - -BENEDICK -The savage bull may; but if ever the sensible -Benedick bear it, pluck off the bull's horns and set -them in my forehead: and let me be vilely painted, -and in such great letters as they write 'Here is -good horse to hire,' let them signify under my sign -'Here you may see Benedick the married man.' - - - -CLAUDIO -If this should ever happen, thou wouldst be horn-mad. - - - -DON PEDRO -Nay, if Cupid have not spent all his quiver in -Venice, thou wilt quake for this shortly. - - - -BENEDICK -I look for an earthquake too, then. - - - -DON PEDRO -Well, you temporize with the hours. In the -meantime, good Signior Benedick, repair to -Leonato's: commend me to him and tell him I will -not fail him at supper; for indeed he hath made -great preparation. - - - -BENEDICK -I have almost matter enough in me for such an -embassage; and so I commit you-- - - - -CLAUDIO -To the tuition of God: From my house, if I had it,-- - - - -DON PEDRO -The sixth of July: Your loving friend, Benedick. - - - -BENEDICK -Nay, mock not, mock not. The body of your -discourse is sometime guarded with fragments, and -the guards are but slightly basted on neither: ere -you flout old ends any further, examine your -conscience: and so I leave you. - - - -Exit - - -CLAUDIO -My liege, your highness now may do me good. - - - -DON PEDRO -My love is thine to teach: teach it but how, -And thou shalt see how apt it is to learn -Any hard lesson that may do thee good. - - - -CLAUDIO -Hath Leonato any son, my lord? - - - -DON PEDRO -No child but Hero; she's his only heir. -Dost thou affect her, Claudio? - - - -CLAUDIO -O, my lord, -When you went onward on this ended action, -I look'd upon her with a soldier's eye, -That liked, but had a rougher task in hand -Than to drive liking to the name of love: -But now I am return'd and that war-thoughts -Have left their places vacant, in their rooms -Come thronging soft and delicate desires, -All prompting me how fair young Hero is, -Saying, I liked her ere I went to wars. - - - -DON PEDRO -Thou wilt be like a lover presently -And tire the hearer with a book of words. -If thou dost love fair Hero, cherish it, -And I will break with her and with her father, -And thou shalt have her. Was't not to this end -That thou began'st to twist so fine a story? - - - -CLAUDIO -How sweetly you do minister to love, -That know love's grief by his complexion! -But lest my liking might too sudden seem, -I would have salved it with a longer treatise. - - - -DON PEDRO -What need the bridge much broader than the flood? -The fairest grant is the necessity. -Look, what will serve is fit: 'tis once, thou lovest, -And I will fit thee with the remedy. -I know we shall have revelling to-night: -I will assume thy part in some disguise -And tell fair Hero I am Claudio, -And in her bosom I'll unclasp my heart -And take her hearing prisoner with the force -And strong encounter of my amorous tale: -Then after to her father will I break; -And the conclusion is, she shall be thine. -In practise let us put it presently. - - - -Exeunt - - -SCENE II. A room in LEONATO's house. -Enter LEONATO and ANTONIO, meeting - - -LEONATO -How now, brother! Where is my cousin, your son? -hath he provided this music? - - - -ANTONIO -He is very busy about it. But, brother, I can tell -you strange news that you yet dreamt not of. - - - -LEONATO -Are they good? - - - -ANTONIO -As the event stamps them: but they have a good -cover; they show well outward. The prince and Count -Claudio, walking in a thick-pleached alley in mine -orchard, were thus much overheard by a man of mine: -the prince discovered to Claudio that he loved my -niece your daughter and meant to acknowledge it -this night in a dance: and if he found her -accordant, he meant to take the present time by the -top and instantly break with you of it. - - - -LEONATO -Hath the fellow any wit that told you this? - - - -ANTONIO -A good sharp fellow: I will send for him; and -question him yourself. - - - -LEONATO -No, no; we will hold it as a dream till it appear -itself: but I will acquaint my daughter withal, -that she may be the better prepared for an answer, -if peradventure this be true. Go you and tell her of it. -Enter Attendants -Cousins, you know what you have to do. O, I cry you -mercy, friend; go you with me, and I will use your -skill. Good cousin, have a care this busy time. - - - -Exeunt - - -SCENE III. The same. -Enter DON JOHN and CONRADE - - -CONRADE -What the good-year, my lord! why are you thus out -of measure sad? - - - -DON JOHN -There is no measure in the occasion that breeds; -therefore the sadness is without limit. - - - -CONRADE -You should hear reason. - - - -DON JOHN -And when I have heard it, what blessing brings it? - - - -CONRADE -If not a present remedy, at least a patient -sufferance. - - - -DON JOHN -I wonder that thou, being, as thou sayest thou art, -born under Saturn, goest about to apply a moral -medicine to a mortifying mischief. I cannot hide -what I am: I must be sad when I have cause and smile -at no man's jests, eat when I have stomach and wait -for no man's leisure, sleep when I am drowsy and -tend on no man's business, laugh when I am merry and -claw no man in his humour. - - - -CONRADE -Yea, but you must not make the full show of this -till you may do it without controlment. You have of -late stood out against your brother, and he hath -ta'en you newly into his grace; where it is -impossible you should take true root but by the -fair weather that you make yourself: it is needful -that you frame the season for your own harvest. - - - -DON JOHN -I had rather be a canker in a hedge than a rose in -his grace, and it better fits my blood to be -disdained of all than to fashion a carriage to rob -love from any: in this, though I cannot be said to -be a flattering honest man, it must not be denied -but I am a plain-dealing villain. I am trusted with -a muzzle and enfranchised with a clog; therefore I -have decreed not to sing in my cage. If I had my -mouth, I would bite; if I had my liberty, I would do -my liking: in the meantime let me be that I am and -seek not to alter me. - - - -CONRADE -Can you make no use of your discontent? - - - -DON JOHN -I make all use of it, for I use it only. -Who comes here? -Enter BORACHIO -What news, Borachio? - - - -BORACHIO -I came yonder from a great supper: the prince your -brother is royally entertained by Leonato: and I -can give you intelligence of an intended marriage. - - - -DON JOHN -Will it serve for any model to build mischief on? -What is he for a fool that betroths himself to -unquietness? - - - -BORACHIO -Marry, it is your brother's right hand. - - - -DON JOHN -Who? the most exquisite Claudio? - - - -BORACHIO -Even he. - - - -DON JOHN -A proper squire! And who, and who? which way looks -he? - - - -BORACHIO -Marry, on Hero, the daughter and heir of Leonato. - - - -DON JOHN -A very forward March-chick! How came you to this? - - - -BORACHIO -Being entertained for a perfumer, as I was smoking a -musty room, comes me the prince and Claudio, hand -in hand in sad conference: I whipt me behind the -arras; and there heard it agreed upon that the -prince should woo Hero for himself, and having -obtained her, give her to Count Claudio. - - - -DON JOHN -Come, come, let us thither: this may prove food to -my displeasure. That young start-up hath all the -glory of my overthrow: if I can cross him any way, I -bless myself every way. You are both sure, and will assist me? - - - -CONRADE -To the death, my lord. - - - -DON JOHN -Let us to the great supper: their cheer is the -greater that I am subdued. Would the cook were of -my mind! Shall we go prove what's to be done? - - - -BORACHIO -We'll wait upon your lordship. - - - -Exeunt - - - - -ACT II - -SCENE I. A hall in LEONATO'S house. -Enter LEONATO, ANTONIO, HERO, BEATRICE, and others - - -LEONATO -Was not Count John here at supper? - - - -ANTONIO -I saw him not. - - - -BEATRICE -How tartly that gentleman looks! I never can see -him but I am heart-burned an hour after. - - - -HERO -He is of a very melancholy disposition. - - - -BEATRICE -He were an excellent man that were made just in the -midway between him and Benedick: the one is too -like an image and says nothing, and the other too -like my lady's eldest son, evermore tattling. - - - -LEONATO -Then half Signior Benedick's tongue in Count John's -mouth, and half Count John's melancholy in Signior -Benedick's face,-- - - - -BEATRICE -With a good leg and a good foot, uncle, and money -enough in his purse, such a man would win any woman -in the world, if a' could get her good-will. - - - -LEONATO -By my troth, niece, thou wilt never get thee a -husband, if thou be so shrewd of thy tongue. - - - -ANTONIO -In faith, she's too curst. - - - -BEATRICE -Too curst is more than curst: I shall lessen God's -sending that way; for it is said, 'God sends a curst -cow short horns;' but to a cow too curst he sends none. - - - -LEONATO -So, by being too curst, God will send you no horns. - - - -BEATRICE -Just, if he send me no husband; for the which -blessing I am at him upon my knees every morning and -evening. Lord, I could not endure a husband with a -beard on his face: I had rather lie in the woollen. - - - -LEONATO -You may light on a husband that hath no beard. - - - -BEATRICE -What should I do with him? dress him in my apparel -and make him my waiting-gentlewoman? He that hath a -beard is more than a youth, and he that hath no -beard is less than a man: and he that is more than -a youth is not for me, and he that is less than a -man, I am not for him: therefore, I will even take -sixpence in earnest of the bear-ward, and lead his -apes into hell. - - - -LEONATO -Well, then, go you into hell? - - - -BEATRICE -No, but to the gate; and there will the devil meet -me, like an old cuckold, with horns on his head, and -say 'Get you to heaven, Beatrice, get you to -heaven; here's no place for you maids:' so deliver -I up my apes, and away to Saint Peter for the -heavens; he shows me where the bachelors sit, and -there live we as merry as the day is long. - - - -ANTONIO -To HERO Well, niece, I trust you will be ruled -by your father. - - - -BEATRICE -Yes, faith; it is my cousin's duty to make curtsy -and say 'Father, as it please you.' But yet for all -that, cousin, let him be a handsome fellow, or else -make another curtsy and say 'Father, as it please -me.' - - - -LEONATO -Well, niece, I hope to see you one day fitted with a husband. - - - -BEATRICE -Not till God make men of some other metal than -earth. Would it not grieve a woman to be -overmastered with a pierce of valiant dust? to make -an account of her life to a clod of wayward marl? -No, uncle, I'll none: Adam's sons are my brethren; -and, truly, I hold it a sin to match in my kindred. - - - -LEONATO -Daughter, remember what I told you: if the prince -do solicit you in that kind, you know your answer. - - - -BEATRICE -The fault will be in the music, cousin, if you be -not wooed in good time: if the prince be too -important, tell him there is measure in every thing -and so dance out the answer. For, hear me, Hero: -wooing, wedding, and repenting, is as a Scotch jig, -a measure, and a cinque pace: the first suit is hot -and hasty, like a Scotch jig, and full as -fantastical; the wedding, mannerly-modest, as a -measure, full of state and ancientry; and then comes -repentance and, with his bad legs, falls into the -cinque pace faster and faster, till he sink into his grave. - - - -LEONATO -Cousin, you apprehend passing shrewdly. - - - -BEATRICE -I have a good eye, uncle; I can see a church by daylight. - - - -LEONATO -The revellers are entering, brother: make good room. - - -All put on their masks -Enter DON PEDRO, CLAUDIO, BENEDICK, BALTHASAR, -DON JOHN, BORACHIO, MARGARET, URSULA and others, masked - - -DON PEDRO -Lady, will you walk about with your friend? - - - -HERO -So you walk softly and look sweetly and say nothing, -I am yours for the walk; and especially when I walk away. - - - -DON PEDRO -With me in your company? - - - -HERO -I may say so, when I please. - - - -DON PEDRO -And when please you to say so? - - - -HERO -When I like your favour; for God defend the lute -should be like the case! - - - -DON PEDRO -My visor is Philemon's roof; within the house is Jove. - - - -HERO -Why, then, your visor should be thatched. - - - -DON PEDRO -Speak low, if you speak love. - - - -Drawing her aside - - -BALTHASAR -Well, I would you did like me. - - - -MARGARET -So would not I, for your own sake; for I have many -ill-qualities. - - - -BALTHASAR -Which is one? - - - -MARGARET -I say my prayers aloud. - - - -BALTHASAR -I love you the better: the hearers may cry, Amen. - - - -MARGARET -God match me with a good dancer! - - - -BALTHASAR -Amen. - - - -MARGARET -And God keep him out of my sight when the dance is -done! Answer, clerk. - - - -BALTHASAR -No more words: the clerk is answered. - - - -URSULA -I know you well enough; you are Signior Antonio. - - - -ANTONIO -At a word, I am not. - - - -URSULA -I know you by the waggling of your head. - - - -ANTONIO -To tell you true, I counterfeit him. - - - -URSULA -You could never do him so ill-well, unless you were -the very man. Here's his dry hand up and down: you -are he, you are he. - - - -ANTONIO -At a word, I am not. - - - -URSULA -Come, come, do you think I do not know you by your -excellent wit? can virtue hide itself? Go to, -mum, you are he: graces will appear, and there's an -end. - - - -BEATRICE -Will you not tell me who told you so? - - - -BENEDICK -No, you shall pardon me. - - - -BEATRICE -Nor will you not tell me who you are? - - - -BENEDICK -Not now. - - - -BEATRICE -That I was disdainful, and that I had my good wit -out of the 'Hundred Merry Tales:'--well this was -Signior Benedick that said so. - - - -BENEDICK -What's he? - - - -BEATRICE -I am sure you know him well enough. - - - -BENEDICK -Not I, believe me. - - - -BEATRICE -Did he never make you laugh? - - - -BENEDICK -I pray you, what is he? - - - -BEATRICE -Why, he is the prince's jester: a very dull fool; -only his gift is in devising impossible slanders: -none but libertines delight in him; and the -commendation is not in his wit, but in his villany; -for he both pleases men and angers them, and then -they laugh at him and beat him. I am sure he is in -the fleet: I would he had boarded me. - - - -BENEDICK -When I know the gentleman, I'll tell him what you say. - - - -BEATRICE -Do, do: he'll but break a comparison or two on me; -which, peradventure not marked or not laughed at, -strikes him into melancholy; and then there's a -partridge wing saved, for the fool will eat no -supper that night. -Music -We must follow the leaders. - - - -BENEDICK -In every good thing. - - - -BEATRICE -Nay, if they lead to any ill, I will leave them at -the next turning. - - - -Dance. Then exeunt all except DON JOHN, BORACHIO, -and CLAUDIO - - -DON JOHN -Sure my brother is amorous on Hero and hath -withdrawn her father to break with him about it. -The ladies follow her and but one visor remains. - - - -BORACHIO -And that is Claudio: I know him by his bearing. - - - -DON JOHN -Are not you Signior Benedick? - - - -CLAUDIO -You know me well; I am he. - - - -DON JOHN -Signior, you are very near my brother in his love: -he is enamoured on Hero; I pray you, dissuade him -from her: she is no equal for his birth: you may -do the part of an honest man in it. - - - -CLAUDIO -How know you he loves her? - - - -DON JOHN -I heard him swear his affection. - - - -BORACHIO -So did I too; and he swore he would marry her to-night. - - - -DON JOHN -Come, let us to the banquet. - - - -Exeunt DON JOHN and BORACHIO - - -CLAUDIO -Thus answer I in the name of Benedick, -But hear these ill news with the ears of Claudio. -'Tis certain so; the prince wooes for himself. -Friendship is constant in all other things -Save in the office and affairs of love: -Therefore, all hearts in love use their own tongues; -Let every eye negotiate for itself -And trust no agent; for beauty is a witch -Against whose charms faith melteth into blood. -This is an accident of hourly proof, -Which I mistrusted not. Farewell, therefore, Hero! - - - -Re-enter BENEDICK - - -BENEDICK -Count Claudio? - - - -CLAUDIO -Yea, the same. - - - -BENEDICK -Come, will you go with me? - - - -CLAUDIO -Whither? - - - -BENEDICK -Even to the next willow, about your own business, -county. What fashion will you wear the garland of? -about your neck, like an usurer's chain? or under -your arm, like a lieutenant's scarf? You must wear -it one way, for the prince hath got your Hero. - - - -CLAUDIO -I wish him joy of her. - - - -BENEDICK -Why, that's spoken like an honest drovier: so they -sell bullocks. But did you think the prince would -have served you thus? - - - -CLAUDIO -I pray you, leave me. - - - -BENEDICK -Ho! now you strike like the blind man: 'twas the -boy that stole your meat, and you'll beat the post. - - - -CLAUDIO -If it will not be, I'll leave you. - - - -Exit - - -BENEDICK -Alas, poor hurt fowl! now will he creep into sedges. -But that my Lady Beatrice should know me, and not -know me! The prince's fool! Ha? It may be I go -under that title because I am merry. Yea, but so I -am apt to do myself wrong; I am not so reputed: it -is the base, though bitter, disposition of Beatrice -that puts the world into her person and so gives me -out. Well, I'll be revenged as I may. - - - -Re-enter DON PEDRO - - -DON PEDRO -Now, signior, where's the count? did you see him? - - - -BENEDICK -Troth, my lord, I have played the part of Lady Fame. -I found him here as melancholy as a lodge in a -warren: I told him, and I think I told him true, -that your grace had got the good will of this young -lady; and I offered him my company to a willow-tree, -either to make him a garland, as being forsaken, or -to bind him up a rod, as being worthy to be whipped. - - - -DON PEDRO -To be whipped! What's his fault? - - - -BENEDICK -The flat transgression of a schoolboy, who, being -overjoyed with finding a birds' nest, shows it his -companion, and he steals it. - - - -DON PEDRO -Wilt thou make a trust a transgression? The -transgression is in the stealer. - - - -BENEDICK -Yet it had not been amiss the rod had been made, -and the garland too; for the garland he might have -worn himself, and the rod he might have bestowed on -you, who, as I take it, have stolen his birds' nest. - - - -DON PEDRO -I will but teach them to sing, and restore them to -the owner. - - - -BENEDICK -If their singing answer your saying, by my faith, -you say honestly. - - - -DON PEDRO -The Lady Beatrice hath a quarrel to you: the -gentleman that danced with her told her she is much -wronged by you. - - - -BENEDICK -O, she misused me past the endurance of a block! -an oak but with one green leaf on it would have -answered her; my very visor began to assume life and -scold with her. She told me, not thinking I had been -myself, that I was the prince's jester, that I was -duller than a great thaw; huddling jest upon jest -with such impossible conveyance upon me that I stood -like a man at a mark, with a whole army shooting at -me. She speaks poniards, and every word stabs: -if her breath were as terrible as her terminations, -there were no living near her; she would infect to -the north star. I would not marry her, though she -were endowed with all that Adam bad left him before -he transgressed: she would have made Hercules have -turned spit, yea, and have cleft his club to make -the fire too. Come, talk not of her: you shall find -her the infernal Ate in good apparel. I would to God -some scholar would conjure her; for certainly, while -she is here, a man may live as quiet in hell as in a -sanctuary; and people sin upon purpose, because they -would go thither; so, indeed, all disquiet, horror -and perturbation follows her. - - - -DON PEDRO -Look, here she comes. - - - -Enter CLAUDIO, BEATRICE, HERO, and LEONATO - - -BENEDICK -Will your grace command me any service to the -world's end? I will go on the slightest errand now -to the Antipodes that you can devise to send me on; -I will fetch you a tooth-picker now from the -furthest inch of Asia, bring you the length of -Prester John's foot, fetch you a hair off the great -Cham's beard, do you any embassage to the Pigmies, -rather than hold three words' conference with this -harpy. You have no employment for me? - - - -DON PEDRO -None, but to desire your good company. - - - -BENEDICK -O God, sir, here's a dish I love not: I cannot -endure my Lady Tongue. - - - -Exit - - -DON PEDRO -Come, lady, come; you have lost the heart of -Signior Benedick. - - - -BEATRICE -Indeed, my lord, he lent it me awhile; and I gave -him use for it, a double heart for his single one: -marry, once before he won it of me with false dice, -therefore your grace may well say I have lost it. - - - -DON PEDRO -You have put him down, lady, you have put him down. - - - -BEATRICE -So I would not he should do me, my lord, lest I -should prove the mother of fools. I have brought -Count Claudio, whom you sent me to seek. - - - -DON PEDRO -Why, how now, count! wherefore are you sad? - - - -CLAUDIO -Not sad, my lord. - - - -DON PEDRO -How then? sick? - - - -CLAUDIO -Neither, my lord. - - - -BEATRICE -The count is neither sad, nor sick, nor merry, nor -well; but civil count, civil as an orange, and -something of that jealous complexion. - - - -DON PEDRO -I' faith, lady, I think your blazon to be true; -though, I'll be sworn, if he be so, his conceit is -false. Here, Claudio, I have wooed in thy name, and -fair Hero is won: I have broke with her father, -and his good will obtained: name the day of -marriage, and God give thee joy! - - - -LEONATO -Count, take of me my daughter, and with her my -fortunes: his grace hath made the match, and an -grace say Amen to it. - - - -BEATRICE -Speak, count, 'tis your cue. - - - -CLAUDIO -Silence is the perfectest herald of joy: I were -but little happy, if I could say how much. Lady, as -you are mine, I am yours: I give away myself for -you and dote upon the exchange. - - - -BEATRICE -Speak, cousin; or, if you cannot, stop his mouth -with a kiss, and let not him speak neither. - - - -DON PEDRO -In faith, lady, you have a merry heart. - - - -BEATRICE -Yea, my lord; I thank it, poor fool, it keeps on -the windy side of care. My cousin tells him in his -ear that he is in her heart. - - - -CLAUDIO -And so she doth, cousin. - - - -BEATRICE -Good Lord, for alliance! Thus goes every one to the -world but I, and I am sunburnt; I may sit in a -corner and cry heigh-ho for a husband! - - - -DON PEDRO -Lady Beatrice, I will get you one. - - - -BEATRICE -I would rather have one of your father's getting. -Hath your grace ne'er a brother like you? Your -father got excellent husbands, if a maid could come by them. - - - -DON PEDRO -Will you have me, lady? - - - -BEATRICE -No, my lord, unless I might have another for -working-days: your grace is too costly to wear -every day. But, I beseech your grace, pardon me: I -was born to speak all mirth and no matter. - - - -DON PEDRO -Your silence most offends me, and to be merry best -becomes you; for, out of question, you were born in -a merry hour. - - - -BEATRICE -No, sure, my lord, my mother cried; but then there -was a star danced, and under that was I born. -Cousins, God give you joy! - - - -LEONATO -Niece, will you look to those things I told you of? - - - -BEATRICE -I cry you mercy, uncle. By your grace's pardon. - - - -Exit - - -DON PEDRO -By my troth, a pleasant-spirited lady. - - - -LEONATO -There's little of the melancholy element in her, my -lord: she is never sad but when she sleeps, and -not ever sad then; for I have heard my daughter say, -she hath often dreamed of unhappiness and waked -herself with laughing. - - - -DON PEDRO -She cannot endure to hear tell of a husband. - - - -LEONATO -O, by no means: she mocks all her wooers out of suit. - - - -DON PEDRO -She were an excellent wife for Benedict. - - - -LEONATO -O Lord, my lord, if they were but a week married, -they would talk themselves mad. - - - -DON PEDRO -County Claudio, when mean you to go to church? - - - -CLAUDIO -To-morrow, my lord: time goes on crutches till love -have all his rites. - - - -LEONATO -Not till Monday, my dear son, which is hence a just -seven-night; and a time too brief, too, to have all -things answer my mind. - - - -DON PEDRO -Come, you shake the head at so long a breathing: -but, I warrant thee, Claudio, the time shall not go -dully by us. I will in the interim undertake one of -Hercules' labours; which is, to bring Signior -Benedick and the Lady Beatrice into a mountain of -affection the one with the other. I would fain have -it a match, and I doubt not but to fashion it, if -you three will but minister such assistance as I -shall give you direction. - - - -LEONATO -My lord, I am for you, though it cost me ten -nights' watchings. - - - -CLAUDIO -And I, my lord. - - - -DON PEDRO -And you too, gentle Hero? - - - -HERO -I will do any modest office, my lord, to help my -cousin to a good husband. - - - -DON PEDRO -And Benedick is not the unhopefullest husband that -I know. Thus far can I praise him; he is of a noble -strain, of approved valour and confirmed honesty. I -will teach you how to humour your cousin, that she -shall fall in love with Benedick; and I, with your -two helps, will so practise on Benedick that, in -despite of his quick wit and his queasy stomach, he -shall fall in love with Beatrice. If we can do this, -Cupid is no longer an archer: his glory shall be -ours, for we are the only love-gods. Go in with me, -and I will tell you my drift. - - - -Exeunt - - -SCENE II. The same. -Enter DON JOHN and BORACHIO - - -DON JOHN -It is so; the Count Claudio shall marry the -daughter of Leonato. - - - -BORACHIO -Yea, my lord; but I can cross it. - - - -DON JOHN -Any bar, any cross, any impediment will be -medicinable to me: I am sick in displeasure to him, -and whatsoever comes athwart his affection ranges -evenly with mine. How canst thou cross this marriage? - - - -BORACHIO -Not honestly, my lord; but so covertly that no -dishonesty shall appear in me. - - - -DON JOHN -Show me briefly how. - - - -BORACHIO -I think I told your lordship a year since, how much -I am in the favour of Margaret, the waiting -gentlewoman to Hero. - - - -DON JOHN -I remember. - - - -BORACHIO -I can, at any unseasonable instant of the night, -appoint her to look out at her lady's chamber window. - - - -DON JOHN -What life is in that, to be the death of this marriage? - - - -BORACHIO -The poison of that lies in you to temper. Go you to -the prince your brother; spare not to tell him that -he hath wronged his honour in marrying the renowned -Claudio--whose estimation do you mightily hold -up--to a contaminated stale, such a one as Hero. - - - -DON JOHN -What proof shall I make of that? - - - -BORACHIO -Proof enough to misuse the prince, to vex Claudio, -to undo Hero and kill Leonato. Look you for any -other issue? - - - -DON JOHN -Only to despite them, I will endeavour any thing. - - - -BORACHIO -Go, then; find me a meet hour to draw Don Pedro and -the Count Claudio alone: tell them that you know -that Hero loves me; intend a kind of zeal both to the -prince and Claudio, as,--in love of your brother's -honour, who hath made this match, and his friend's -reputation, who is thus like to be cozened with the -semblance of a maid,--that you have discovered -thus. They will scarcely believe this without trial: -offer them instances; which shall bear no less -likelihood than to see me at her chamber-window, -hear me call Margaret Hero, hear Margaret term me -Claudio; and bring them to see this the very night -before the intended wedding,--for in the meantime I -will so fashion the matter that Hero shall be -absent,--and there shall appear such seeming truth -of Hero's disloyalty that jealousy shall be called -assurance and all the preparation overthrown. - - - -DON JOHN -Grow this to what adverse issue it can, I will put -it in practise. Be cunning in the working this, and -thy fee is a thousand ducats. - - - -BORACHIO -Be you constant in the accusation, and my cunning -shall not shame me. - - - -DON JOHN -I will presently go learn their day of marriage. - - - -Exeunt - - -SCENE III. LEONATO'S orchard. -Enter BENEDICK - - -BENEDICK -Boy! - - - -Enter Boy - - -Boy -Signior? - - - -BENEDICK -In my chamber-window lies a book: bring it hither -to me in the orchard. - - - -Boy -I am here already, sir. - - - -BENEDICK -I know that; but I would have thee hence, and here again. -Exit Boy -I do much wonder that one man, seeing how much -another man is a fool when he dedicates his -behaviors to love, will, after he hath laughed at -such shallow follies in others, become the argument -of his own scorn by failing in love: and such a man -is Claudio. I have known when there was no music -with him but the drum and the fife; and now had he -rather hear the tabour and the pipe: I have known -when he would have walked ten mile a-foot to see a -good armour; and now will he lie ten nights awake, -carving the fashion of a new doublet. He was wont to -speak plain and to the purpose, like an honest man -and a soldier; and now is he turned orthography; his -words are a very fantastical banquet, just so many -strange dishes. May I be so converted and see with -these eyes? I cannot tell; I think not: I will not -be sworn, but love may transform me to an oyster; but -I'll take my oath on it, till he have made an oyster -of me, he shall never make me such a fool. One woman -is fair, yet I am well; another is wise, yet I am -well; another virtuous, yet I am well; but till all -graces be in one woman, one woman shall not come in -my grace. Rich she shall be, that's certain; wise, -or I'll none; virtuous, or I'll never cheapen her; -fair, or I'll never look on her; mild, or come not -near me; noble, or not I for an angel; of good -discourse, an excellent musician, and her hair shall -be of what colour it please God. Ha! the prince and -Monsieur Love! I will hide me in the arbour. - - -Withdraws -Enter DON PEDRO, CLAUDIO, and LEONATO - - -DON PEDRO -Come, shall we hear this music? - - - -CLAUDIO -Yea, my good lord. How still the evening is, -As hush'd on purpose to grace harmony! - - - -DON PEDRO -See you where Benedick hath hid himself? - - - -CLAUDIO -O, very well, my lord: the music ended, -We'll fit the kid-fox with a pennyworth. - - - -Enter BALTHASAR with Music - - -DON PEDRO -Come, Balthasar, we'll hear that song again. - - - -BALTHASAR -O, good my lord, tax not so bad a voice -To slander music any more than once. - - - -DON PEDRO -It is the witness still of excellency -To put a strange face on his own perfection. -I pray thee, sing, and let me woo no more. - - - -BALTHASAR -Because you talk of wooing, I will sing; -Since many a wooer doth commence his suit -To her he thinks not worthy, yet he wooes, -Yet will he swear he loves. - - - -DON PEDRO -Now, pray thee, come; -Or, if thou wilt hold longer argument, -Do it in notes. - - - -BALTHASAR -Note this before my notes; -There's not a note of mine that's worth the noting. - - - -DON PEDRO -Why, these are very crotchets that he speaks; -Note, notes, forsooth, and nothing. - - - -Air - - -BENEDICK -Now, divine air! now is his soul ravished! Is it -not strange that sheeps' guts should hale souls out -of men's bodies? Well, a horn for my money, when -all's done. - - - -The Song - - -BALTHASAR -Sigh no more, ladies, sigh no more, -Men were deceivers ever, -One foot in sea and one on shore, -To one thing constant never: -Then sigh not so, but let them go, -And be you blithe and bonny, -Converting all your sounds of woe -Into Hey nonny, nonny. -Sing no more ditties, sing no moe, -Of dumps so dull and heavy; -The fraud of men was ever so, -Since summer first was leafy: -Then sigh not so, &c. - - - -DON PEDRO -By my troth, a good song. - - - -BALTHASAR -And an ill singer, my lord. - - - -DON PEDRO -Ha, no, no, faith; thou singest well enough for a shift. - - - -BENEDICK -An he had been a dog that should have howled thus, -they would have hanged him: and I pray God his bad -voice bode no mischief. I had as lief have heard the -night-raven, come what plague could have come after -it. - - - -DON PEDRO -Yea, marry, dost thou hear, Balthasar? I pray thee, -get us some excellent music; for to-morrow night we -would have it at the Lady Hero's chamber-window. - - - -BALTHASAR -The best I can, my lord. - - - -DON PEDRO -Do so: farewell. -Exit BALTHASAR -Come hither, Leonato. What was it you told me of -to-day, that your niece Beatrice was in love with -Signior Benedick? - - - -CLAUDIO -O, ay: stalk on. stalk on; the fowl sits. I did -never think that lady would have loved any man. - - - -LEONATO -No, nor I neither; but most wonderful that she -should so dote on Signior Benedick, whom she hath in -all outward behaviors seemed ever to abhor. - - - -BENEDICK -Is't possible? Sits the wind in that corner? - - - -LEONATO -By my troth, my lord, I cannot tell what to think -of it but that she loves him with an enraged -affection: it is past the infinite of thought. - - - -DON PEDRO -May be she doth but counterfeit. - - - -CLAUDIO -Faith, like enough. - - - -LEONATO -O God, counterfeit! There was never counterfeit of -passion came so near the life of passion as she -discovers it. - - - -DON PEDRO -Why, what effects of passion shows she? - - - -CLAUDIO -Bait the hook well; this fish will bite. - - - -LEONATO -What effects, my lord? She will sit you, you heard -my daughter tell you how. - - - -CLAUDIO -She did, indeed. - - - -DON PEDRO -How, how, pray you? You amaze me: I would have I -thought her spirit had been invincible against all -assaults of affection. - - - -LEONATO -I would have sworn it had, my lord; especially -against Benedick. - - - -BENEDICK -I should think this a gull, but that the -white-bearded fellow speaks it: knavery cannot, -sure, hide himself in such reverence. - - - -CLAUDIO -He hath ta'en the infection: hold it up. - - - -DON PEDRO -Hath she made her affection known to Benedick? - - - -LEONATO -No; and swears she never will: that's her torment. - - - -CLAUDIO -'Tis true, indeed; so your daughter says: 'Shall -I,' says she, 'that have so oft encountered him -with scorn, write to him that I love him?' - - - -LEONATO -This says she now when she is beginning to write to -him; for she'll be up twenty times a night, and -there will she sit in her smock till she have writ a -sheet of paper: my daughter tells us all. - - - -CLAUDIO -Now you talk of a sheet of paper, I remember a -pretty jest your daughter told us of. - - - -LEONATO -O, when she had writ it and was reading it over, she -found Benedick and Beatrice between the sheet? - - - -CLAUDIO -That. - - - -LEONATO -O, she tore the letter into a thousand halfpence; -railed at herself, that she should be so immodest -to write to one that she knew would flout her; 'I -measure him,' says she, 'by my own spirit; for I -should flout him, if he writ to me; yea, though I -love him, I should.' - - - -CLAUDIO -Then down upon her knees she falls, weeps, sobs, -beats her heart, tears her hair, prays, curses; 'O -sweet Benedick! God give me patience!' - - - -LEONATO -She doth indeed; my daughter says so: and the -ecstasy hath so much overborne her that my daughter -is sometime afeared she will do a desperate outrage -to herself: it is very true. - - - -DON PEDRO -It were good that Benedick knew of it by some -other, if she will not discover it. - - - -CLAUDIO -To what end? He would make but a sport of it and -torment the poor lady worse. - - - -DON PEDRO -An he should, it were an alms to hang him. She's an -excellent sweet lady; and, out of all suspicion, -she is virtuous. - - - -CLAUDIO -And she is exceeding wise. - - - -DON PEDRO -In every thing but in loving Benedick. - - - -LEONATO -O, my lord, wisdom and blood combating in so tender -a body, we have ten proofs to one that blood hath -the victory. I am sorry for her, as I have just -cause, being her uncle and her guardian. - - - -DON PEDRO -I would she had bestowed this dotage on me: I would -have daffed all other respects and made her half -myself. I pray you, tell Benedick of it, and hear -what a' will say. - - - -LEONATO -Were it good, think you? - - - -CLAUDIO -Hero thinks surely she will die; for she says she -will die, if he love her not, and she will die, ere -she make her love known, and she will die, if he woo -her, rather than she will bate one breath of her -accustomed crossness. - - - -DON PEDRO -She doth well: if she should make tender of her -love, 'tis very possible he'll scorn it; for the -man, as you know all, hath a contemptible spirit. - - - -CLAUDIO -He is a very proper man. - - - -DON PEDRO -He hath indeed a good outward happiness. - - - -CLAUDIO -Before God! and, in my mind, very wise. - - - -DON PEDRO -He doth indeed show some sparks that are like wit. - - - -CLAUDIO -And I take him to be valiant. - - - -DON PEDRO -As Hector, I assure you: and in the managing of -quarrels you may say he is wise; for either he -avoids them with great discretion, or undertakes -them with a most Christian-like fear. - - - -LEONATO -If he do fear God, a' must necessarily keep peace: -if he break the peace, he ought to enter into a -quarrel with fear and trembling. - - - -DON PEDRO -And so will he do; for the man doth fear God, -howsoever it seems not in him by some large jests -he will make. Well I am sorry for your niece. Shall -we go seek Benedick, and tell him of her love? - - - -CLAUDIO -Never tell him, my lord: let her wear it out with -good counsel. - - - -LEONATO -Nay, that's impossible: she may wear her heart out first. - - - -DON PEDRO -Well, we will hear further of it by your daughter: -let it cool the while. I love Benedick well; and I -could wish he would modestly examine himself, to see -how much he is unworthy so good a lady. - - - -LEONATO -My lord, will you walk? dinner is ready. - - - -CLAUDIO -If he do not dote on her upon this, I will never -trust my expectation. - - - -DON PEDRO -Let there be the same net spread for her; and that -must your daughter and her gentlewomen carry. The -sport will be, when they hold one an opinion of -another's dotage, and no such matter: that's the -scene that I would see, which will be merely a -dumb-show. Let us send her to call him in to dinner. - - - -Exeunt DON PEDRO, CLAUDIO, and LEONATO - - -BENEDICK -Coming forward This can be no trick: the -conference was sadly borne. They have the truth of -this from Hero. They seem to pity the lady: it -seems her affections have their full bent. Love me! -why, it must be requited. I hear how I am censured: -they say I will bear myself proudly, if I perceive -the love come from her; they say too that she will -rather die than give any sign of affection. I did -never think to marry: I must not seem proud: happy -are they that hear their detractions and can put -them to mending. They say the lady is fair; 'tis a -truth, I can bear them witness; and virtuous; 'tis -so, I cannot reprove it; and wise, but for loving -me; by my troth, it is no addition to her wit, nor -no great argument of her folly, for I will be -horribly in love with her. I may chance have some -odd quirks and remnants of wit broken on me, -because I have railed so long against marriage: but -doth not the appetite alter? a man loves the meat -in his youth that he cannot endure in his age. -Shall quips and sentences and these paper bullets of -the brain awe a man from the career of his humour? -No, the world must be peopled. When I said I would -die a bachelor, I did not think I should live till I -were married. Here comes Beatrice. By this day! -she's a fair lady: I do spy some marks of love in -her. - - - -Enter BEATRICE - - -BEATRICE -Against my will I am sent to bid you come in to dinner. - - - -BENEDICK -Fair Beatrice, I thank you for your pains. - - - -BEATRICE -I took no more pains for those thanks than you take -pains to thank me: if it had been painful, I would -not have come. - - - -BENEDICK -You take pleasure then in the message? - - - -BEATRICE -Yea, just so much as you may take upon a knife's -point and choke a daw withal. You have no stomach, -signior: fare you well. - - - -Exit - - -BENEDICK -Ha! 'Against my will I am sent to bid you come in -to dinner;' there's a double meaning in that 'I took -no more pains for those thanks than you took pains -to thank me.' that's as much as to say, Any pains -that I take for you is as easy as thanks. If I do -not take pity of her, I am a villain; if I do not -love her, I am a Jew. I will go get her picture. - - - -Exit - - - - -ACT III - -SCENE I. LEONATO'S garden. -Enter HERO, MARGARET, and URSULA - - -HERO -Good Margaret, run thee to the parlor; -There shalt thou find my cousin Beatrice -Proposing with the prince and Claudio: -Whisper her ear and tell her, I and Ursula -Walk in the orchard and our whole discourse -Is all of her; say that thou overheard'st us; -And bid her steal into the pleached bower, -Where honeysuckles, ripen'd by the sun, -Forbid the sun to enter, like favourites, -Made proud by princes, that advance their pride -Against that power that bred it: there will she hide her, -To listen our purpose. This is thy office; -Bear thee well in it and leave us alone. - - - -MARGARET -I'll make her come, I warrant you, presently. - - - -Exit - - -HERO -Now, Ursula, when Beatrice doth come, -As we do trace this alley up and down, -Our talk must only be of Benedick. -When I do name him, let it be thy part -To praise him more than ever man did merit: -My talk to thee must be how Benedick -Is sick in love with Beatrice. Of this matter -Is little Cupid's crafty arrow made, -That only wounds by hearsay. -Enter BEATRICE, behind -Now begin; -For look where Beatrice, like a lapwing, runs -Close by the ground, to hear our conference. - - - -URSULA -The pleasant'st angling is to see the fish -Cut with her golden oars the silver stream, -And greedily devour the treacherous bait: -So angle we for Beatrice; who even now -Is couched in the woodbine coverture. -Fear you not my part of the dialogue. - - - -HERO -Then go we near her, that her ear lose nothing -Of the false sweet bait that we lay for it. -Approaching the bower -No, truly, Ursula, she is too disdainful; -I know her spirits are as coy and wild -As haggerds of the rock. - - - -URSULA -But are you sure -That Benedick loves Beatrice so entirely? - - - -HERO -So says the prince and my new-trothed lord. - - - -URSULA -And did they bid you tell her of it, madam? - - - -HERO -They did entreat me to acquaint her of it; -But I persuaded them, if they loved Benedick, -To wish him wrestle with affection, -And never to let Beatrice know of it. - - - -URSULA -Why did you so? Doth not the gentleman -Deserve as full as fortunate a bed -As ever Beatrice shall couch upon? - - - -HERO -O god of love! I know he doth deserve -As much as may be yielded to a man: -But Nature never framed a woman's heart -Of prouder stuff than that of Beatrice; -Disdain and scorn ride sparkling in her eyes, -Misprising what they look on, and her wit -Values itself so highly that to her -All matter else seems weak: she cannot love, -Nor take no shape nor project of affection, -She is so self-endeared. - - - -URSULA -Sure, I think so; -And therefore certainly it were not good -She knew his love, lest she make sport at it. - - - -HERO -Why, you speak truth. I never yet saw man, -How wise, how noble, young, how rarely featured, -But she would spell him backward: if fair-faced, -She would swear the gentleman should be her sister; -If black, why, Nature, drawing of an antique, -Made a foul blot; if tall, a lance ill-headed; -If low, an agate very vilely cut; -If speaking, why, a vane blown with all winds; -If silent, why, a block moved with none. -So turns she every man the wrong side out -And never gives to truth and virtue that -Which simpleness and merit purchaseth. - - - -URSULA -Sure, sure, such carping is not commendable. - - - -HERO -No, not to be so odd and from all fashions -As Beatrice is, cannot be commendable: -But who dare tell her so? If I should speak, -She would mock me into air; O, she would laugh me -Out of myself, press me to death with wit. -Therefore let Benedick, like cover'd fire, -Consume away in sighs, waste inwardly: -It were a better death than die with mocks, -Which is as bad as die with tickling. - - - -URSULA -Yet tell her of it: hear what she will say. - - - -HERO -No; rather I will go to Benedick -And counsel him to fight against his passion. -And, truly, I'll devise some honest slanders -To stain my cousin with: one doth not know -How much an ill word may empoison liking. - - - -URSULA -O, do not do your cousin such a wrong. -She cannot be so much without true judgment-- -Having so swift and excellent a wit -As she is prized to have--as to refuse -So rare a gentleman as Signior Benedick. - - - -HERO -He is the only man of Italy. -Always excepted my dear Claudio. - - - -URSULA -I pray you, be not angry with me, madam, -Speaking my fancy: Signior Benedick, -For shape, for bearing, argument and valour, -Goes foremost in report through Italy. - - - -HERO -Indeed, he hath an excellent good name. - - - -URSULA -His excellence did earn it, ere he had it. -When are you married, madam? - - - -HERO -Why, every day, to-morrow. Come, go in: -I'll show thee some attires, and have thy counsel -Which is the best to furnish me to-morrow. - - - -URSULA -She's limed, I warrant you: we have caught her, madam. - - - -HERO -If it proves so, then loving goes by haps: -Some Cupid kills with arrows, some with traps. - - - -Exeunt HERO and URSULA - - -BEATRICE -Coming forward -What fire is in mine ears? Can this be true? -Stand I condemn'd for pride and scorn so much? -Contempt, farewell! and maiden pride, adieu! -No glory lives behind the back of such. -And, Benedick, love on; I will requite thee, -Taming my wild heart to thy loving hand: -If thou dost love, my kindness shall incite thee -To bind our loves up in a holy band; -For others say thou dost deserve, and I -Believe it better than reportingly. - - - -Exit - - -SCENE II. A room in LEONATO'S house -Enter DON PEDRO, CLAUDIO, BENEDICK, and LEONATO - - -DON PEDRO -I do but stay till your marriage be consummate, and -then go I toward Arragon. - - - -CLAUDIO -I'll bring you thither, my lord, if you'll -vouchsafe me. - - - -DON PEDRO -Nay, that would be as great a soil in the new gloss -of your marriage as to show a child his new coat -and forbid him to wear it. I will only be bold -with Benedick for his company; for, from the crown -of his head to the sole of his foot, he is all -mirth: he hath twice or thrice cut Cupid's -bow-string and the little hangman dare not shoot at -him; he hath a heart as sound as a bell and his -tongue is the clapper, for what his heart thinks his -tongue speaks. - - - -BENEDICK -Gallants, I am not as I have been. - - - -LEONATO -So say I methinks you are sadder. - - - -CLAUDIO -I hope he be in love. - - - -DON PEDRO -Hang him, truant! there's no true drop of blood in -him, to be truly touched with love: if he be sad, -he wants money. - - - -BENEDICK -I have the toothache. - - - -DON PEDRO -Draw it. - - - -BENEDICK -Hang it! - - - -CLAUDIO -You must hang it first, and draw it afterwards. - - - -DON PEDRO -What! sigh for the toothache? - - - -LEONATO -Where is but a humour or a worm. - - - -BENEDICK -Well, every one can master a grief but he that has -it. - - - -CLAUDIO -Yet say I, he is in love. - - - -DON PEDRO -There is no appearance of fancy in him, unless it be -a fancy that he hath to strange disguises; as, to be -a Dutchman today, a Frenchman to-morrow, or in the -shape of two countries at once, as, a German from -the waist downward, all slops, and a Spaniard from -the hip upward, no doublet. Unless he have a fancy -to this foolery, as it appears he hath, he is no -fool for fancy, as you would have it appear he is. - - - -CLAUDIO -If he be not in love with some woman, there is no -believing old signs: a' brushes his hat o' -mornings; what should that bode? - - - -DON PEDRO -Hath any man seen him at the barber's? - - - -CLAUDIO -No, but the barber's man hath been seen with him, -and the old ornament of his cheek hath already -stuffed tennis-balls. - - - -LEONATO -Indeed, he looks younger than he did, by the loss of a beard. - - - -DON PEDRO -Nay, a' rubs himself with civet: can you smell him -out by that? - - - -CLAUDIO -That's as much as to say, the sweet youth's in love. - - - -DON PEDRO -The greatest note of it is his melancholy. - - - -CLAUDIO -And when was he wont to wash his face? - - - -DON PEDRO -Yea, or to paint himself? for the which, I hear -what they say of him. - - - -CLAUDIO -Nay, but his jesting spirit; which is now crept into -a lute-string and now governed by stops. - - - -DON PEDRO -Indeed, that tells a heavy tale for him: conclude, -conclude he is in love. - - - -CLAUDIO -Nay, but I know who loves him. - - - -DON PEDRO -That would I know too: I warrant, one that knows him not. - - - -CLAUDIO -Yes, and his ill conditions; and, in despite of -all, dies for him. - - - -DON PEDRO -She shall be buried with her face upwards. - - - -BENEDICK -Yet is this no charm for the toothache. Old -signior, walk aside with me: I have studied eight -or nine wise words to speak to you, which these -hobby-horses must not hear. - - - -Exeunt BENEDICK and LEONATO - - -DON PEDRO -For my life, to break with him about Beatrice. - - - -CLAUDIO -'Tis even so. Hero and Margaret have by this -played their parts with Beatrice; and then the two -bears will not bite one another when they meet. - - - -Enter DON JOHN - - -DON JOHN -My lord and brother, God save you! - - - -DON PEDRO -Good den, brother. - - - -DON JOHN -If your leisure served, I would speak with you. - - - -DON PEDRO -In private? - - - -DON JOHN -If it please you: yet Count Claudio may hear; for -what I would speak of concerns him. - - - -DON PEDRO -What's the matter? - - - -DON JOHN -To CLAUDIO Means your lordship to be married -to-morrow? - - - -DON PEDRO -You know he does. - - - -DON JOHN -I know not that, when he knows what I know. - - - -CLAUDIO -If there be any impediment, I pray you discover it. - - - -DON JOHN -You may think I love you not: let that appear -hereafter, and aim better at me by that I now will -manifest. For my brother, I think he holds you -well, and in dearness of heart hath holp to effect -your ensuing marriage;--surely suit ill spent and -labour ill bestowed. - - - -DON PEDRO -Why, what's the matter? - - - -DON JOHN -I came hither to tell you; and, circumstances -shortened, for she has been too long a talking of, -the lady is disloyal. - - - -CLAUDIO -Who, Hero? - - - -DON PEDRO -Even she; Leonato's Hero, your Hero, every man's Hero: - - - -CLAUDIO -Disloyal? - - - -DON JOHN -The word is too good to paint out her wickedness; I -could say she were worse: think you of a worse -title, and I will fit her to it. Wonder not till -further warrant: go but with me to-night, you shall -see her chamber-window entered, even the night -before her wedding-day: if you love her then, -to-morrow wed her; but it would better fit your honour -to change your mind. - - - -CLAUDIO -May this be so? - - - -DON PEDRO -I will not think it. - - - -DON JOHN -If you dare not trust that you see, confess not -that you know: if you will follow me, I will show -you enough; and when you have seen more and heard -more, proceed accordingly. - - - -CLAUDIO -If I see any thing to-night why I should not marry -her to-morrow in the congregation, where I should -wed, there will I shame her. - - - -DON PEDRO -And, as I wooed for thee to obtain her, I will join -with thee to disgrace her. - - - -DON JOHN -I will disparage her no farther till you are my -witnesses: bear it coldly but till midnight, and -let the issue show itself. - - - -DON PEDRO -O day untowardly turned! - - - -CLAUDIO -O mischief strangely thwarting! - - - -DON JOHN -O plague right well prevented! so will you say when -you have seen the sequel. - - - -Exeunt - - -SCENE III. A street. -Enter DOGBERRY and VERGES with the Watch - - -DOGBERRY -Are you good men and true? - - - -VERGES -Yea, or else it were pity but they should suffer -salvation, body and soul. - - - -DOGBERRY -Nay, that were a punishment too good for them, if -they should have any allegiance in them, being -chosen for the prince's watch. - - - -VERGES -Well, give them their charge, neighbour Dogberry. - - - -DOGBERRY -First, who think you the most desertless man to be -constable? - - - -First Watchman -Hugh Otecake, sir, or George Seacole; for they can -write and read. - - - -DOGBERRY -Come hither, neighbour Seacole. God hath blessed -you with a good name: to be a well-favoured man is -the gift of fortune; but to write and read comes by nature. - - - -Second Watchman -Both which, master constable,-- - - - -DOGBERRY -You have: I knew it would be your answer. Well, -for your favour, sir, why, give God thanks, and make -no boast of it; and for your writing and reading, -let that appear when there is no need of such -vanity. You are thought here to be the most -senseless and fit man for the constable of the -watch; therefore bear you the lantern. This is your -charge: you shall comprehend all vagrom men; you are -to bid any man stand, in the prince's name. - - - -Second Watchman -How if a' will not stand? - - - -DOGBERRY -Why, then, take no note of him, but let him go; and -presently call the rest of the watch together and -thank God you are rid of a knave. - - - -VERGES -If he will not stand when he is bidden, he is none -of the prince's subjects. - - - -DOGBERRY -True, and they are to meddle with none but the -prince's subjects. You shall also make no noise in -the streets; for, for the watch to babble and to -talk is most tolerable and not to be endured. - - - -Watchman -We will rather sleep than talk: we know what -belongs to a watch. - - - -DOGBERRY -Why, you speak like an ancient and most quiet -watchman; for I cannot see how sleeping should -offend: only, have a care that your bills be not -stolen. Well, you are to call at all the -ale-houses, and bid those that are drunk get them to bed. - - - -Watchman -How if they will not? - - - -DOGBERRY -Why, then, let them alone till they are sober: if -they make you not then the better answer, you may -say they are not the men you took them for. - - - -Watchman -Well, sir. - - - -DOGBERRY -If you meet a thief, you may suspect him, by virtue -of your office, to be no true man; and, for such -kind of men, the less you meddle or make with them, -why the more is for your honesty. - - - -Watchman -If we know him to be a thief, shall we not lay -hands on him? - - - -DOGBERRY -Truly, by your office, you may; but I think they -that touch pitch will be defiled: the most peaceable -way for you, if you do take a thief, is to let him -show himself what he is and steal out of your company. - - - -VERGES -You have been always called a merciful man, partner. - - - -DOGBERRY -Truly, I would not hang a dog by my will, much more -a man who hath any honesty in him. - - - -VERGES -If you hear a child cry in the night, you must call -to the nurse and bid her still it. - - - -Watchman -How if the nurse be asleep and will not hear us? - - - -DOGBERRY -Why, then, depart in peace, and let the child wake -her with crying; for the ewe that will not hear her -lamb when it baes will never answer a calf when he bleats. - - - -VERGES -'Tis very true. - - - -DOGBERRY -This is the end of the charge:--you, constable, are -to present the prince's own person: if you meet the -prince in the night, you may stay him. - - - -VERGES -Nay, by'r our lady, that I think a' cannot. - - - -DOGBERRY -Five shillings to one on't, with any man that knows -the statutes, he may stay him: marry, not without -the prince be willing; for, indeed, the watch ought -to offend no man; and it is an offence to stay a -man against his will. - - - -VERGES -By'r lady, I think it be so. - - - -DOGBERRY -Ha, ha, ha! Well, masters, good night: an there be -any matter of weight chances, call up me: keep your -fellows' counsels and your own; and good night. -Come, neighbour. - - - -Watchman -Well, masters, we hear our charge: let us go sit here -upon the church-bench till two, and then all to bed. - - - -DOGBERRY -One word more, honest neighbours. I pray you watch -about Signior Leonato's door; for the wedding being -there to-morrow, there is a great coil to-night. -Adieu: be vigitant, I beseech you. - - -Exeunt DOGBERRY and VERGES -Enter BORACHIO and CONRADE - - -BORACHIO -What Conrade! - - - -Watchman -Aside Peace! stir not. - - - -BORACHIO -Conrade, I say! - - - -CONRADE -Here, man; I am at thy elbow. - - - -BORACHIO -Mass, and my elbow itched; I thought there would a -scab follow. - - - -CONRADE -I will owe thee an answer for that: and now forward -with thy tale. - - - -BORACHIO -Stand thee close, then, under this pent-house, for -it drizzles rain; and I will, like a true drunkard, -utter all to thee. - - - -Watchman -Aside Some treason, masters: yet stand close. - - - -BORACHIO -Therefore know I have earned of Don John a thousand ducats. - - - -CONRADE -Is it possible that any villany should be so dear? - - - -BORACHIO -Thou shouldst rather ask if it were possible any -villany should be so rich; for when rich villains -have need of poor ones, poor ones may make what -price they will. - - - -CONRADE -I wonder at it. - - - -BORACHIO -That shows thou art unconfirmed. Thou knowest that -the fashion of a doublet, or a hat, or a cloak, is -nothing to a man. - - - -CONRADE -Yes, it is apparel. - - - -BORACHIO -I mean, the fashion. - - - -CONRADE -Yes, the fashion is the fashion. - - - -BORACHIO -Tush! I may as well say the fool's the fool. But -seest thou not what a deformed thief this fashion -is? - - - -Watchman -Aside I know that Deformed; a' has been a vile -thief this seven year; a' goes up and down like a -gentleman: I remember his name. - - - -BORACHIO -Didst thou not hear somebody? - - - -CONRADE -No; 'twas the vane on the house. - - - -BORACHIO -Seest thou not, I say, what a deformed thief this -fashion is? how giddily a' turns about all the hot -bloods between fourteen and five-and-thirty? -sometimes fashioning them like Pharaoh's soldiers -in the reeky painting, sometime like god Bel's -priests in the old church-window, sometime like the -shaven Hercules in the smirched worm-eaten tapestry, -where his codpiece seems as massy as his club? - - - -CONRADE -All this I see; and I see that the fashion wears -out more apparel than the man. But art not thou -thyself giddy with the fashion too, that thou hast -shifted out of thy tale into telling me of the fashion? - - - -BORACHIO -Not so, neither: but know that I have to-night -wooed Margaret, the Lady Hero's gentlewoman, by the -name of Hero: she leans me out at her mistress' -chamber-window, bids me a thousand times good -night,--I tell this tale vilely:--I should first -tell thee how the prince, Claudio and my master, -planted and placed and possessed by my master Don -John, saw afar off in the orchard this amiable encounter. - - - -CONRADE -And thought they Margaret was Hero? - - - -BORACHIO -Two of them did, the prince and Claudio; but the -devil my master knew she was Margaret; and partly -by his oaths, which first possessed them, partly by -the dark night, which did deceive them, but chiefly -by my villany, which did confirm any slander that -Don John had made, away went Claudio enraged; swore -he would meet her, as he was appointed, next morning -at the temple, and there, before the whole -congregation, shame her with what he saw o'er night -and send her home again without a husband. - - - -First Watchman -We charge you, in the prince's name, stand! - - - -Second Watchman -Call up the right master constable. We have here -recovered the most dangerous piece of lechery that -ever was known in the commonwealth. - - - -First Watchman -And one Deformed is one of them: I know him; a' -wears a lock. - - - -CONRADE -Masters, masters,-- - - - -Second Watchman -You'll be made bring Deformed forth, I warrant you. - - - -CONRADE -Masters,-- - - - -First Watchman -Never speak: we charge you let us obey you to go with us. - - - -BORACHIO -We are like to prove a goodly commodity, being taken -up of these men's bills. - - - -CONRADE -A commodity in question, I warrant you. Come, we'll obey you. - - - -Exeunt - - -SCENE IV. HERO's apartment. -Enter HERO, MARGARET, and URSULA - - -HERO -Good Ursula, wake my cousin Beatrice, and desire -her to rise. - - - -URSULA -I will, lady. - - - -HERO -And bid her come hither. - - - -URSULA -Well. - - - -Exit - - -MARGARET -Troth, I think your other rabato were better. - - - -HERO -No, pray thee, good Meg, I'll wear this. - - - -MARGARET -By my troth, 's not so good; and I warrant your -cousin will say so. - - - -HERO -My cousin's a fool, and thou art another: I'll wear -none but this. - - - -MARGARET -I like the new tire within excellently, if the hair -were a thought browner; and your gown's a most rare -fashion, i' faith. I saw the Duchess of Milan's -gown that they praise so. - - - -HERO -O, that exceeds, they say. - - - -MARGARET -By my troth, 's but a night-gown in respect of -yours: cloth o' gold, and cuts, and laced with -silver, set with pearls, down sleeves, side sleeves, -and skirts, round underborne with a bluish tinsel: -but for a fine, quaint, graceful and excellent -fashion, yours is worth ten on 't. - - - -HERO -God give me joy to wear it! for my heart is -exceeding heavy. - - - -MARGARET -'Twill be heavier soon by the weight of a man. - - - -HERO -Fie upon thee! art not ashamed? - - - -MARGARET -Of what, lady? of speaking honourably? Is not -marriage honourable in a beggar? Is not your lord -honourable without marriage? I think you would have -me say, 'saving your reverence, a husband:' and bad -thinking do not wrest true speaking, I'll offend -nobody: is there any harm in 'the heavier for a -husband'? None, I think, and it be the right husband -and the right wife; otherwise 'tis light, and not -heavy: ask my Lady Beatrice else; here she comes. - - - -Enter BEATRICE - - -HERO -Good morrow, coz. - - - -BEATRICE -Good morrow, sweet Hero. - - - -HERO -Why how now? do you speak in the sick tune? - - - -BEATRICE -I am out of all other tune, methinks. - - - -MARGARET -Clap's into 'Light o' love;' that goes without a -burden: do you sing it, and I'll dance it. - - - -BEATRICE -Ye light o' love, with your heels! then, if your -husband have stables enough, you'll see he shall -lack no barns. - - - -MARGARET -O illegitimate construction! I scorn that with my heels. - - - -BEATRICE -'Tis almost five o'clock, cousin; tis time you were -ready. By my troth, I am exceeding ill: heigh-ho! - - - -MARGARET -For a hawk, a horse, or a husband? - - - -BEATRICE -For the letter that begins them all, H. - - - -MARGARET -Well, and you be not turned Turk, there's no more -sailing by the star. - - - -BEATRICE -What means the fool, trow? - - - -MARGARET -Nothing I; but God send every one their heart's desire! - - - -HERO -These gloves the count sent me; they are an -excellent perfume. - - - -BEATRICE -I am stuffed, cousin; I cannot smell. - - - -MARGARET -A maid, and stuffed! there's goodly catching of cold. - - - -BEATRICE -O, God help me! God help me! how long have you -professed apprehension? - - - -MARGARET -Even since you left it. Doth not my wit become me rarely? - - - -BEATRICE -It is not seen enough, you should wear it in your -cap. By my troth, I am sick. - - - -MARGARET -Get you some of this distilled Carduus Benedictus, -and lay it to your heart: it is the only thing for a qualm. - - - -HERO -There thou prickest her with a thistle. - - - -BEATRICE -Benedictus! why Benedictus? you have some moral in -this Benedictus. - - - -MARGARET -Moral! no, by my troth, I have no moral meaning; I -meant, plain holy-thistle. You may think perchance -that I think you are in love: nay, by'r lady, I am -not such a fool to think what I list, nor I list -not to think what I can, nor indeed I cannot think, -if I would think my heart out of thinking, that you -are in love or that you will be in love or that you -can be in love. Yet Benedick was such another, and -now is he become a man: he swore he would never -marry, and yet now, in despite of his heart, he eats -his meat without grudging: and how you may be -converted I know not, but methinks you look with -your eyes as other women do. - - - -BEATRICE -What pace is this that thy tongue keeps? - - - -MARGARET -Not a false gallop. - - - -Re-enter URSULA - - -URSULA -Madam, withdraw: the prince, the count, Signior -Benedick, Don John, and all the gallants of the -town, are come to fetch you to church. - - - -HERO -Help to dress me, good coz, good Meg, good Ursula. - - - -Exeunt - - -SCENE V. Another room in LEONATO'S house. -Enter LEONATO, with DOGBERRY and VERGES - - -LEONATO -What would you with me, honest neighbour? - - - -DOGBERRY -Marry, sir, I would have some confidence with you -that decerns you nearly. - - - -LEONATO -Brief, I pray you; for you see it is a busy time with me. - - - -DOGBERRY -Marry, this it is, sir. - - - -VERGES -Yes, in truth it is, sir. - - - -LEONATO -What is it, my good friends? - - - -DOGBERRY -Goodman Verges, sir, speaks a little off the -matter: an old man, sir, and his wits are not so -blunt as, God help, I would desire they were; but, -in faith, honest as the skin between his brows. - - - -VERGES -Yes, I thank God I am as honest as any man living -that is an old man and no honester than I. - - - -DOGBERRY -Comparisons are odorous: palabras, neighbour Verges. - - - -LEONATO -Neighbours, you are tedious. - - - -DOGBERRY -It pleases your worship to say so, but we are the -poor duke's officers; but truly, for mine own part, -if I were as tedious as a king, I could find it in -my heart to bestow it all of your worship. - - - -LEONATO -All thy tediousness on me, ah? - - - -DOGBERRY -Yea, an 'twere a thousand pound more than 'tis; for -I hear as good exclamation on your worship as of any -man in the city; and though I be but a poor man, I -am glad to hear it. - - - -VERGES -And so am I. - - - -LEONATO -I would fain know what you have to say. - - - -VERGES -Marry, sir, our watch to-night, excepting your -worship's presence, ha' ta'en a couple of as arrant -knaves as any in Messina. - - - -DOGBERRY -A good old man, sir; he will be talking: as they -say, when the age is in, the wit is out: God help -us! it is a world to see. Well said, i' faith, -neighbour Verges: well, God's a good man; an two men -ride of a horse, one must ride behind. An honest -soul, i' faith, sir; by my troth he is, as ever -broke bread; but God is to be worshipped; all men -are not alike; alas, good neighbour! - - - -LEONATO -Indeed, neighbour, he comes too short of you. - - - -DOGBERRY -Gifts that God gives. - - - -LEONATO -I must leave you. - - - -DOGBERRY -One word, sir: our watch, sir, have indeed -comprehended two aspicious persons, and we would -have them this morning examined before your worship. - - - -LEONATO -Take their examination yourself and bring it me: I -am now in great haste, as it may appear unto you. - - - -DOGBERRY -It shall be suffigance. - - - -LEONATO -Drink some wine ere you go: fare you well. - - - -Enter a Messenger - - -Messenger -My lord, they stay for you to give your daughter to -her husband. - - - -LEONATO -I'll wait upon them: I am ready. - - - -Exeunt LEONATO and Messenger - - -DOGBERRY -Go, good partner, go, get you to Francis Seacole; -bid him bring his pen and inkhorn to the gaol: we -are now to examination these men. - - - -VERGES -And we must do it wisely. - - - -DOGBERRY -We will spare for no wit, I warrant you; here's -that shall drive some of them to a non-come: only -get the learned writer to set down our -excommunication and meet me at the gaol. - - - -Exeunt - - - - -ACT IV - -SCENE I. A church. -Enter DON PEDRO, DON JOHN, LEONATO, FRIAR FRANCIS, -CLAUDIO, BENEDICK, HERO, BEATRICE, and Attendants - - -LEONATO -Come, Friar Francis, be brief; only to the plain -form of marriage, and you shall recount their -particular duties afterwards. - - - -FRIAR FRANCIS -You come hither, my lord, to marry this lady. - - - -CLAUDIO -No. - - - -LEONATO -To be married to her: friar, you come to marry her. - - - -FRIAR FRANCIS -Lady, you come hither to be married to this count. - - - -HERO -I do. - - - -FRIAR FRANCIS -If either of you know any inward impediment why you -should not be conjoined, charge you, on your souls, -to utter it. - - - -CLAUDIO -Know you any, Hero? - - - -HERO -None, my lord. - - - -FRIAR FRANCIS -Know you any, count? - - - -LEONATO -I dare make his answer, none. - - - -CLAUDIO -O, what men dare do! what men may do! what men daily -do, not knowing what they do! - - - -BENEDICK -How now! interjections? Why, then, some be of -laughing, as, ah, ha, he! - - - -CLAUDIO -Stand thee by, friar. Father, by your leave: -Will you with free and unconstrained soul -Give me this maid, your daughter? - - - -LEONATO -As freely, son, as God did give her me. - - - -CLAUDIO -And what have I to give you back, whose worth -May counterpoise this rich and precious gift? - - - -DON PEDRO -Nothing, unless you render her again. - - - -CLAUDIO -Sweet prince, you learn me noble thankfulness. -There, Leonato, take her back again: -Give not this rotten orange to your friend; -She's but the sign and semblance of her honour. -Behold how like a maid she blushes here! -O, what authority and show of truth -Can cunning sin cover itself withal! -Comes not that blood as modest evidence -To witness simple virtue? Would you not swear, -All you that see her, that she were a maid, -By these exterior shows? But she is none: -She knows the heat of a luxurious bed; -Her blush is guiltiness, not modesty. - - - -LEONATO -What do you mean, my lord? - - - -CLAUDIO -Not to be married, -Not to knit my soul to an approved wanton. - - - -LEONATO -Dear my lord, if you, in your own proof, -Have vanquish'd the resistance of her youth, -And made defeat of her virginity,-- - - - -CLAUDIO -I know what you would say: if I have known her, -You will say she did embrace me as a husband, -And so extenuate the 'forehand sin: -No, Leonato, -I never tempted her with word too large; -But, as a brother to his sister, show'd -Bashful sincerity and comely love. - - - -HERO -And seem'd I ever otherwise to you? - - - -CLAUDIO -Out on thee! Seeming! I will write against it: -You seem to me as Dian in her orb, -As chaste as is the bud ere it be blown; -But you are more intemperate in your blood -Than Venus, or those pamper'd animals -That rage in savage sensuality. - - - -HERO -Is my lord well, that he doth speak so wide? - - - -LEONATO -Sweet prince, why speak not you? - - - -DON PEDRO -What should I speak? -I stand dishonour'd, that have gone about -To link my dear friend to a common stale. - - - -LEONATO -Are these things spoken, or do I but dream? - - - -DON JOHN -Sir, they are spoken, and these things are true. - - - -BENEDICK -This looks not like a nuptial. - - - -HERO -True! O God! - - - -CLAUDIO -Leonato, stand I here? -Is this the prince? is this the prince's brother? -Is this face Hero's? are our eyes our own? - - - -LEONATO -All this is so: but what of this, my lord? - - - -CLAUDIO -Let me but move one question to your daughter; -And, by that fatherly and kindly power -That you have in her, bid her answer truly. - - - -LEONATO -I charge thee do so, as thou art my child. - - - -HERO -O, God defend me! how am I beset! -What kind of catechising call you this? - - - -CLAUDIO -To make you answer truly to your name. - - - -HERO -Is it not Hero? Who can blot that name -With any just reproach? - - - -CLAUDIO -Marry, that can Hero; -Hero itself can blot out Hero's virtue. -What man was he talk'd with you yesternight -Out at your window betwixt twelve and one? -Now, if you are a maid, answer to this. - - - -HERO -I talk'd with no man at that hour, my lord. - - - -DON PEDRO -Why, then are you no maiden. Leonato, -I am sorry you must hear: upon mine honour, -Myself, my brother and this grieved count -Did see her, hear her, at that hour last night -Talk with a ruffian at her chamber-window -Who hath indeed, most like a liberal villain, -Confess'd the vile encounters they have had -A thousand times in secret. - - - -DON JOHN -Fie, fie! they are not to be named, my lord, -Not to be spoke of; -There is not chastity enough in language -Without offence to utter them. Thus, pretty lady, -I am sorry for thy much misgovernment. - - - -CLAUDIO -O Hero, what a Hero hadst thou been, -If half thy outward graces had been placed -About thy thoughts and counsels of thy heart! -But fare thee well, most foul, most fair! farewell, -Thou pure impiety and impious purity! -For thee I'll lock up all the gates of love, -And on my eyelids shall conjecture hang, -To turn all beauty into thoughts of harm, -And never shall it more be gracious. - - - -LEONATO -Hath no man's dagger here a point for me? - - - -HERO swoons - - -BEATRICE -Why, how now, cousin! wherefore sink you down? - - - -DON JOHN -Come, let us go. These things, come thus to light, -Smother her spirits up. - - - -Exeunt DON PEDRO, DON JOHN, and CLAUDIO - - -BENEDICK -How doth the lady? - - - -BEATRICE -Dead, I think. Help, uncle! -Hero! why, Hero! Uncle! Signior Benedick! Friar! - - - -LEONATO -O Fate! take not away thy heavy hand. -Death is the fairest cover for her shame -That may be wish'd for. - - - -BEATRICE -How now, cousin Hero! - - - -FRIAR FRANCIS -Have comfort, lady. - - - -LEONATO -Dost thou look up? - - - -FRIAR FRANCIS -Yea, wherefore should she not? - - - -LEONATO -Wherefore! Why, doth not every earthly thing -Cry shame upon her? Could she here deny -The story that is printed in her blood? -Do not live, Hero; do not ope thine eyes: -For, did I think thou wouldst not quickly die, -Thought I thy spirits were stronger than thy shames, -Myself would, on the rearward of reproaches, -Strike at thy life. Grieved I, I had but one? -Chid I for that at frugal nature's frame? -O, one too much by thee! Why had I one? -Why ever wast thou lovely in my eyes? -Why had I not with charitable hand -Took up a beggar's issue at my gates, -Who smirch'd thus and mired with infamy, -I might have said 'No part of it is mine; -This shame derives itself from unknown loins'? -But mine and mine I loved and mine I praised -And mine that I was proud on, mine so much -That I myself was to myself not mine, -Valuing of her,--why, she, O, she is fallen -Into a pit of ink, that the wide sea -Hath drops too few to wash her clean again -And salt too little which may season give -To her foul-tainted flesh! - - - -BENEDICK -Sir, sir, be patient. -For my part, I am so attired in wonder, -I know not what to say. - - - -BEATRICE -O, on my soul, my cousin is belied! - - - -BENEDICK -Lady, were you her bedfellow last night? - - - -BEATRICE -No, truly not; although, until last night, -I have this twelvemonth been her bedfellow. - - - -LEONATO -Confirm'd, confirm'd! O, that is stronger made -Which was before barr'd up with ribs of iron! -Would the two princes lie, and Claudio lie, -Who loved her so, that, speaking of her foulness, -Wash'd it with tears? Hence from her! let her die. - - - -FRIAR FRANCIS -Hear me a little; for I have only been -Silent so long and given way unto -This course of fortune -By noting of the lady. I have mark'd -A thousand blushing apparitions -To start into her face, a thousand innocent shames -In angel whiteness beat away those blushes; -And in her eye there hath appear'd a fire, -To burn the errors that these princes hold -Against her maiden truth. Call me a fool; -Trust not my reading nor my observations, -Which with experimental seal doth warrant -The tenor of my book; trust not my age, -My reverence, calling, nor divinity, -If this sweet lady lie not guiltless here -Under some biting error. - - - -LEONATO -Friar, it cannot be. -Thou seest that all the grace that she hath left -Is that she will not add to her damnation -A sin of perjury; she not denies it: -Why seek'st thou then to cover with excuse -That which appears in proper nakedness? - - - -FRIAR FRANCIS -Lady, what man is he you are accused of? - - - -HERO -They know that do accuse me; I know none: -If I know more of any man alive -Than that which maiden modesty doth warrant, -Let all my sins lack mercy! O my father, -Prove you that any man with me conversed -At hours unmeet, or that I yesternight -Maintain'd the change of words with any creature, -Refuse me, hate me, torture me to death! - - - -FRIAR FRANCIS -There is some strange misprision in the princes. - - - -BENEDICK -Two of them have the very bent of honour; -And if their wisdoms be misled in this, -The practise of it lives in John the bastard, -Whose spirits toil in frame of villanies. - - - -LEONATO -I know not. If they speak but truth of her, -These hands shall tear her; if they wrong her honour, -The proudest of them shall well hear of it. -Time hath not yet so dried this blood of mine, -Nor age so eat up my invention, -Nor fortune made such havoc of my means, -Nor my bad life reft me so much of friends, -But they shall find, awaked in such a kind, -Both strength of limb and policy of mind, -Ability in means and choice of friends, -To quit me of them throughly. - - - -FRIAR FRANCIS -Pause awhile, -And let my counsel sway you in this case. -Your daughter here the princes left for dead: -Let her awhile be secretly kept in, -And publish it that she is dead indeed; -Maintain a mourning ostentation -And on your family's old monument -Hang mournful epitaphs and do all rites -That appertain unto a burial. - - - -LEONATO -What shall become of this? what will this do? - - - -FRIAR FRANCIS -Marry, this well carried shall on her behalf -Change slander to remorse; that is some good: -But not for that dream I on this strange course, -But on this travail look for greater birth. -She dying, as it must so be maintain'd, -Upon the instant that she was accused, -Shall be lamented, pitied and excused -Of every hearer: for it so falls out -That what we have we prize not to the worth -Whiles we enjoy it, but being lack'd and lost, -Why, then we rack the value, then we find -The virtue that possession would not show us -Whiles it was ours. So will it fare with Claudio: -When he shall hear she died upon his words, -The idea of her life shall sweetly creep -Into his study of imagination, -And every lovely organ of her life -Shall come apparell'd in more precious habit, -More moving-delicate and full of life, -Into the eye and prospect of his soul, -Than when she lived indeed; then shall he mourn, -If ever love had interest in his liver, -And wish he had not so accused her, -No, though he thought his accusation true. -Let this be so, and doubt not but success -Will fashion the event in better shape -Than I can lay it down in likelihood. -But if all aim but this be levell'd false, -The supposition of the lady's death -Will quench the wonder of her infamy: -And if it sort not well, you may conceal her, -As best befits her wounded reputation, -In some reclusive and religious life, -Out of all eyes, tongues, minds and injuries. - - - -BENEDICK -Signior Leonato, let the friar advise you: -And though you know my inwardness and love -Is very much unto the prince and Claudio, -Yet, by mine honour, I will deal in this -As secretly and justly as your soul -Should with your body. - - - -LEONATO -Being that I flow in grief, -The smallest twine may lead me. - - - -FRIAR FRANCIS -'Tis well consented: presently away; -For to strange sores strangely they strain the cure. -Come, lady, die to live: this wedding-day -Perhaps is but prolong'd: have patience and endure. - - - -Exeunt all but BENEDICK and BEATRICE - - -BENEDICK -Lady Beatrice, have you wept all this while? - - - -BEATRICE -Yea, and I will weep a while longer. - - - -BENEDICK -I will not desire that. - - - -BEATRICE -You have no reason; I do it freely. - - - -BENEDICK -Surely I do believe your fair cousin is wronged. - - - -BEATRICE -Ah, how much might the man deserve of me that would right her! - - - -BENEDICK -Is there any way to show such friendship? - - - -BEATRICE -A very even way, but no such friend. - - - -BENEDICK -May a man do it? - - - -BEATRICE -It is a man's office, but not yours. - - - -BENEDICK -I do love nothing in the world so well as you: is -not that strange? - - - -BEATRICE -As strange as the thing I know not. It were as -possible for me to say I loved nothing so well as -you: but believe me not; and yet I lie not; I -confess nothing, nor I deny nothing. I am sorry for my cousin. - - - -BENEDICK -By my sword, Beatrice, thou lovest me. - - - -BEATRICE -Do not swear, and eat it. - - - -BENEDICK -I will swear by it that you love me; and I will make -him eat it that says I love not you. - - - -BEATRICE -Will you not eat your word? - - - -BENEDICK -With no sauce that can be devised to it. I protest -I love thee. - - - -BEATRICE -Why, then, God forgive me! - - - -BENEDICK -What offence, sweet Beatrice? - - - -BEATRICE -You have stayed me in a happy hour: I was about to -protest I loved you. - - - -BENEDICK -And do it with all thy heart. - - - -BEATRICE -I love you with so much of my heart that none is -left to protest. - - - -BENEDICK -Come, bid me do any thing for thee. - - - -BEATRICE -Kill Claudio. - - - -BENEDICK -Ha! not for the wide world. - - - -BEATRICE -You kill me to deny it. Farewell. - - - -BENEDICK -Tarry, sweet Beatrice. - - - -BEATRICE -I am gone, though I am here: there is no love in -you: nay, I pray you, let me go. - - - -BENEDICK -Beatrice,-- - - - -BEATRICE -In faith, I will go. - - - -BENEDICK -We'll be friends first. - - - -BEATRICE -You dare easier be friends with me than fight with mine enemy. - - - -BENEDICK -Is Claudio thine enemy? - - - -BEATRICE -Is he not approved in the height a villain, that -hath slandered, scorned, dishonoured my kinswoman? O -that I were a man! What, bear her in hand until they -come to take hands; and then, with public -accusation, uncovered slander, unmitigated rancour, ---O God, that I were a man! I would eat his heart -in the market-place. - - - -BENEDICK -Hear me, Beatrice,-- - - - -BEATRICE -Talk with a man out at a window! A proper saying! - - - -BENEDICK -Nay, but, Beatrice,-- - - - -BEATRICE -Sweet Hero! She is wronged, she is slandered, she is undone. - - - -BENEDICK -Beat-- - - - -BEATRICE -Princes and counties! Surely, a princely testimony, -a goodly count, Count Comfect; a sweet gallant, -surely! O that I were a man for his sake! or that I -had any friend would be a man for my sake! But -manhood is melted into courtesies, valour into -compliment, and men are only turned into tongue, and -trim ones too: he is now as valiant as Hercules -that only tells a lie and swears it. I cannot be a -man with wishing, therefore I will die a woman with grieving. - - - -BENEDICK -Tarry, good Beatrice. By this hand, I love thee. - - - -BEATRICE -Use it for my love some other way than swearing by it. - - - -BENEDICK -Think you in your soul the Count Claudio hath wronged Hero? - - - -BEATRICE -Yea, as sure as I have a thought or a soul. - - - -BENEDICK -Enough, I am engaged; I will challenge him. I will -kiss your hand, and so I leave you. By this hand, -Claudio shall render me a dear account. As you -hear of me, so think of me. Go, comfort your -cousin: I must say she is dead: and so, farewell. - - - -Exeunt - - -SCENE II. A prison. -Enter DOGBERRY, VERGES, and Sexton, in gowns; and -the Watch, with CONRADE and BORACHIO - - -DOGBERRY -Is our whole dissembly appeared? - - - -VERGES -O, a stool and a cushion for the sexton. - - - -Sexton -Which be the malefactors? - - - -DOGBERRY -Marry, that am I and my partner. - - - -VERGES -Nay, that's certain; we have the exhibition to examine. - - - -Sexton -But which are the offenders that are to be -examined? let them come before master constable. - - - -DOGBERRY -Yea, marry, let them come before me. What is your -name, friend? - - - -BORACHIO -Borachio. - - - -DOGBERRY -Pray, write down, Borachio. Yours, sirrah? - - - -CONRADE -I am a gentleman, sir, and my name is Conrade. - - - -DOGBERRY -Write down, master gentleman Conrade. Masters, do -you serve God? - - - -CONRADE -BORACHIO -Yea, sir, we hope. - - - -DOGBERRY -Write down, that they hope they serve God: and -write God first; for God defend but God should go -before such villains! Masters, it is proved already -that you are little better than false knaves; and it -will go near to be thought so shortly. How answer -you for yourselves? - - - -CONRADE -Marry, sir, we say we are none. - - - -DOGBERRY -A marvellous witty fellow, I assure you: but I -will go about with him. Come you hither, sirrah; a -word in your ear: sir, I say to you, it is thought -you are false knaves. - - - -BORACHIO -Sir, I say to you we are none. - - - -DOGBERRY -Well, stand aside. 'Fore God, they are both in a -tale. Have you writ down, that they are none? - - - -Sexton -Master constable, you go not the way to examine: -you must call forth the watch that are their accusers. - - - -DOGBERRY -Yea, marry, that's the eftest way. Let the watch -come forth. Masters, I charge you, in the prince's -name, accuse these men. - - - -First Watchman -This man said, sir, that Don John, the prince's -brother, was a villain. - - - -DOGBERRY -Write down Prince John a villain. Why, this is flat -perjury, to call a prince's brother villain. - - - -BORACHIO -Master constable,-- - - - -DOGBERRY -Pray thee, fellow, peace: I do not like thy look, -I promise thee. - - - -Sexton -What heard you him say else? - - - -Second Watchman -Marry, that he had received a thousand ducats of -Don John for accusing the Lady Hero wrongfully. - - - -DOGBERRY -Flat burglary as ever was committed. - - - -VERGES -Yea, by mass, that it is. - - - -Sexton -What else, fellow? - - - -First Watchman -And that Count Claudio did mean, upon his words, to -disgrace Hero before the whole assembly. and not marry her. - - - -DOGBERRY -O villain! thou wilt be condemned into everlasting -redemption for this. - - - -Sexton -What else? - - - -Watchman -This is all. - - - -Sexton -And this is more, masters, than you can deny. -Prince John is this morning secretly stolen away; -Hero was in this manner accused, in this very manner -refused, and upon the grief of this suddenly died. -Master constable, let these men be bound, and -brought to Leonato's: I will go before and show -him their examination. - - - -Exit - - -DOGBERRY -Come, let them be opinioned. - - - -VERGES -Let them be in the hands-- - - - -CONRADE -Off, coxcomb! - - - -DOGBERRY -God's my life, where's the sexton? let him write -down the prince's officer coxcomb. Come, bind them. -Thou naughty varlet! - - - -CONRADE -Away! you are an ass, you are an ass. - - - -DOGBERRY -Dost thou not suspect my place? dost thou not -suspect my years? O that he were here to write me -down an ass! But, masters, remember that I am an -ass; though it be not written down, yet forget not -that I am an ass. No, thou villain, thou art full of -piety, as shall be proved upon thee by good witness. -I am a wise fellow, and, which is more, an officer, -and, which is more, a householder, and, which is -more, as pretty a piece of flesh as any is in -Messina, and one that knows the law, go to; and a -rich fellow enough, go to; and a fellow that hath -had losses, and one that hath two gowns and every -thing handsome about him. Bring him away. O that -I had been writ down an ass! - - - -Exeunt - - - - -ACT V - -SCENE I. Before LEONATO'S house. -Enter LEONATO and ANTONIO - - -ANTONIO -If you go on thus, you will kill yourself: -And 'tis not wisdom thus to second grief -Against yourself. - - - -LEONATO -I pray thee, cease thy counsel, -Which falls into mine ears as profitless -As water in a sieve: give not me counsel; -Nor let no comforter delight mine ear -But such a one whose wrongs do suit with mine. -Bring me a father that so loved his child, -Whose joy of her is overwhelm'd like mine, -And bid him speak of patience; -Measure his woe the length and breadth of mine -And let it answer every strain for strain, -As thus for thus and such a grief for such, -In every lineament, branch, shape, and form: -If such a one will smile and stroke his beard, -Bid sorrow wag, cry 'hem!' when he should groan, -Patch grief with proverbs, make misfortune drunk -With candle-wasters; bring him yet to me, -And I of him will gather patience. -But there is no such man: for, brother, men -Can counsel and speak comfort to that grief -Which they themselves not feel; but, tasting it, -Their counsel turns to passion, which before -Would give preceptial medicine to rage, -Fetter strong madness in a silken thread, -Charm ache with air and agony with words: -No, no; 'tis all men's office to speak patience -To those that wring under the load of sorrow, -But no man's virtue nor sufficiency -To be so moral when he shall endure -The like himself. Therefore give me no counsel: -My griefs cry louder than advertisement. - - - -ANTONIO -Therein do men from children nothing differ. - - - -LEONATO -I pray thee, peace. I will be flesh and blood; -For there was never yet philosopher -That could endure the toothache patiently, -However they have writ the style of gods -And made a push at chance and sufferance. - - - -ANTONIO -Yet bend not all the harm upon yourself; -Make those that do offend you suffer too. - - - -LEONATO -There thou speak'st reason: nay, I will do so. -My soul doth tell me Hero is belied; -And that shall Claudio know; so shall the prince -And all of them that thus dishonour her. - - - -ANTONIO -Here comes the prince and Claudio hastily. - - - -Enter DON PEDRO and CLAUDIO - - -DON PEDRO -Good den, good den. - - - -CLAUDIO -Good day to both of you. - - - -LEONATO -Hear you. my lords,-- - - - -DON PEDRO -We have some haste, Leonato. - - - -LEONATO -Some haste, my lord! well, fare you well, my lord: -Are you so hasty now? well, all is one. - - - -DON PEDRO -Nay, do not quarrel with us, good old man. - - - -ANTONIO -If he could right himself with quarreling, -Some of us would lie low. - - - -CLAUDIO -Who wrongs him? - - - -LEONATO -Marry, thou dost wrong me; thou dissembler, thou:-- -Nay, never lay thy hand upon thy sword; -I fear thee not. - - - -CLAUDIO -Marry, beshrew my hand, -If it should give your age such cause of fear: -In faith, my hand meant nothing to my sword. - - - -LEONATO -Tush, tush, man; never fleer and jest at me: -I speak not like a dotard nor a fool, -As under privilege of age to brag -What I have done being young, or what would do -Were I not old. Know, Claudio, to thy head, -Thou hast so wrong'd mine innocent child and me -That I am forced to lay my reverence by -And, with grey hairs and bruise of many days, -Do challenge thee to trial of a man. -I say thou hast belied mine innocent child; -Thy slander hath gone through and through her heart, -And she lies buried with her ancestors; -O, in a tomb where never scandal slept, -Save this of hers, framed by thy villany! - - - -CLAUDIO -My villany? - - - -LEONATO -Thine, Claudio; thine, I say. - - - -DON PEDRO -You say not right, old man. - - - -LEONATO -My lord, my lord, -I'll prove it on his body, if he dare, -Despite his nice fence and his active practise, -His May of youth and bloom of lustihood. - - - -CLAUDIO -Away! I will not have to do with you. - - - -LEONATO -Canst thou so daff me? Thou hast kill'd my child: -If thou kill'st me, boy, thou shalt kill a man. - - - -ANTONIO -He shall kill two of us, and men indeed: -But that's no matter; let him kill one first; -Win me and wear me; let him answer me. -Come, follow me, boy; come, sir boy, come, follow me: -Sir boy, I'll whip you from your foining fence; -Nay, as I am a gentleman, I will. - - - -LEONATO -Brother,-- - - - -ANTONIO -Content yourself. God knows I loved my niece; -And she is dead, slander'd to death by villains, -That dare as well answer a man indeed -As I dare take a serpent by the tongue: -Boys, apes, braggarts, Jacks, milksops! - - - -LEONATO -Brother Antony,-- - - - -ANTONIO -Hold you content. What, man! I know them, yea, -And what they weigh, even to the utmost scruple,-- -Scrambling, out-facing, fashion-monging boys, -That lie and cog and flout, deprave and slander, -Go anticly, show outward hideousness, -And speak off half a dozen dangerous words, -How they might hurt their enemies, if they durst; -And this is all. - - - -LEONATO -But, brother Antony,-- - - - -ANTONIO -Come, 'tis no matter: -Do not you meddle; let me deal in this. - - - -DON PEDRO -Gentlemen both, we will not wake your patience. -My heart is sorry for your daughter's death: -But, on my honour, she was charged with nothing -But what was true and very full of proof. - - - -LEONATO -My lord, my lord,-- - - - -DON PEDRO -I will not hear you. - - - -LEONATO -No? Come, brother; away! I will be heard. - - - -ANTONIO -And shall, or some of us will smart for it. - - - -Exeunt LEONATO and ANTONIO - - -DON PEDRO -See, see; here comes the man we went to seek. - - - -Enter BENEDICK - - -CLAUDIO -Now, signior, what news? - - - -BENEDICK -Good day, my lord. - - - -DON PEDRO -Welcome, signior: you are almost come to part -almost a fray. - - - -CLAUDIO -We had like to have had our two noses snapped off -with two old men without teeth. - - - -DON PEDRO -Leonato and his brother. What thinkest thou? Had -we fought, I doubt we should have been too young for them. - - - -BENEDICK -In a false quarrel there is no true valour. I came -to seek you both. - - - -CLAUDIO -We have been up and down to seek thee; for we are -high-proof melancholy and would fain have it beaten -away. Wilt thou use thy wit? - - - -BENEDICK -It is in my scabbard: shall I draw it? - - - -DON PEDRO -Dost thou wear thy wit by thy side? - - - -CLAUDIO -Never any did so, though very many have been beside -their wit. I will bid thee draw, as we do the -minstrels; draw, to pleasure us. - - - -DON PEDRO -As I am an honest man, he looks pale. Art thou -sick, or angry? - - - -CLAUDIO -What, courage, man! What though care killed a cat, -thou hast mettle enough in thee to kill care. - - - -BENEDICK -Sir, I shall meet your wit in the career, and you -charge it against me. I pray you choose another subject. - - - -CLAUDIO -Nay, then, give him another staff: this last was -broke cross. - - - -DON PEDRO -By this light, he changes more and more: I think -he be angry indeed. - - - -CLAUDIO -If he be, he knows how to turn his girdle. - - - -BENEDICK -Shall I speak a word in your ear? - - - -CLAUDIO -God bless me from a challenge! - - - -BENEDICK -Aside to CLAUDIO You are a villain; I jest not: -I will make it good how you dare, with what you -dare, and when you dare. Do me right, or I will -protest your cowardice. You have killed a sweet -lady, and her death shall fall heavy on you. Let me -hear from you. - - - -CLAUDIO -Well, I will meet you, so I may have good cheer. - - - -DON PEDRO -What, a feast, a feast? - - - -CLAUDIO -I' faith, I thank him; he hath bid me to a calf's -head and a capon; the which if I do not carve most -curiously, say my knife's naught. Shall I not find -a woodcock too? - - - -BENEDICK -Sir, your wit ambles well; it goes easily. - - - -DON PEDRO -I'll tell thee how Beatrice praised thy wit the -other day. I said, thou hadst a fine wit: 'True,' -said she, 'a fine little one.' 'No,' said I, 'a -great wit:' 'Right,' says she, 'a great gross one.' -'Nay,' said I, 'a good wit:' 'Just,' said she, 'it -hurts nobody.' 'Nay,' said I, 'the gentleman -is wise:' 'Certain,' said she, 'a wise gentleman.' -'Nay,' said I, 'he hath the tongues:' 'That I -believe,' said she, 'for he swore a thing to me on -Monday night, which he forswore on Tuesday morning; -there's a double tongue; there's two tongues.' Thus -did she, an hour together, transshape thy particular -virtues: yet at last she concluded with a sigh, thou -wast the properest man in Italy. - - - -CLAUDIO -For the which she wept heartily and said she cared -not. - - - -DON PEDRO -Yea, that she did: but yet, for all that, an if she -did not hate him deadly, she would love him dearly: -the old man's daughter told us all. - - - -CLAUDIO -All, all; and, moreover, God saw him when he was -hid in the garden. - - - -DON PEDRO -But when shall we set the savage bull's horns on -the sensible Benedick's head? - - - -CLAUDIO -Yea, and text underneath, 'Here dwells Benedick the -married man'? - - - -BENEDICK -Fare you well, boy: you know my mind. I will leave -you now to your gossip-like humour: you break jests -as braggarts do their blades, which God be thanked, -hurt not. My lord, for your many courtesies I thank -you: I must discontinue your company: your brother -the bastard is fled from Messina: you have among -you killed a sweet and innocent lady. For my Lord -Lackbeard there, he and I shall meet: and, till -then, peace be with him. - - - -Exit - - -DON PEDRO -He is in earnest. - - - -CLAUDIO -In most profound earnest; and, I'll warrant you, for -the love of Beatrice. - - - -DON PEDRO -And hath challenged thee. - - - -CLAUDIO -Most sincerely. - - - -DON PEDRO -What a pretty thing man is when he goes in his -doublet and hose and leaves off his wit! - - - -CLAUDIO -He is then a giant to an ape; but then is an ape a -doctor to such a man. - - - -DON PEDRO -But, soft you, let me be: pluck up, my heart, and -be sad. Did he not say, my brother was fled? - - - -Enter DOGBERRY, VERGES, and the Watch, with CONRADE -and BORACHIO - - -DOGBERRY -Come you, sir: if justice cannot tame you, she -shall ne'er weigh more reasons in her balance: nay, -an you be a cursing hypocrite once, you must be looked to. - - - -DON PEDRO -How now? two of my brother's men bound! Borachio -one! - - - -CLAUDIO -Hearken after their offence, my lord. - - - -DON PEDRO -Officers, what offence have these men done? - - - -DOGBERRY -Marry, sir, they have committed false report; -moreover, they have spoken untruths; secondarily, -they are slanders; sixth and lastly, they have -belied a lady; thirdly, they have verified unjust -things; and, to conclude, they are lying knaves. - - - -DON PEDRO -First, I ask thee what they have done; thirdly, I -ask thee what's their offence; sixth and lastly, why -they are committed; and, to conclude, what you lay -to their charge. - - - -CLAUDIO -Rightly reasoned, and in his own division: and, by -my troth, there's one meaning well suited. - - - -DON PEDRO -Who have you offended, masters, that you are thus -bound to your answer? this learned constable is -too cunning to be understood: what's your offence? - - - -BORACHIO -Sweet prince, let me go no farther to mine answer: -do you hear me, and let this count kill me. I have -deceived even your very eyes: what your wisdoms -could not discover, these shallow fools have brought -to light: who in the night overheard me confessing -to this man how Don John your brother incensed me -to slander the Lady Hero, how you were brought into -the orchard and saw me court Margaret in Hero's -garments, how you disgraced her, when you should -marry her: my villany they have upon record; which -I had rather seal with my death than repeat over -to my shame. The lady is dead upon mine and my -master's false accusation; and, briefly, I desire -nothing but the reward of a villain. - - - -DON PEDRO -Runs not this speech like iron through your blood? - - - -CLAUDIO -I have drunk poison whiles he utter'd it. - - - -DON PEDRO -But did my brother set thee on to this? - - - -BORACHIO -Yea, and paid me richly for the practise of it. - - - -DON PEDRO -He is composed and framed of treachery: -And fled he is upon this villany. - - - -CLAUDIO -Sweet Hero! now thy image doth appear -In the rare semblance that I loved it first. - - - -DOGBERRY -Come, bring away the plaintiffs: by this time our -sexton hath reformed Signior Leonato of the matter: -and, masters, do not forget to specify, when time -and place shall serve, that I am an ass. - - - -VERGES -Here, here comes master Signior Leonato, and the -Sexton too. - - - -Re-enter LEONATO and ANTONIO, with the Sexton - - -LEONATO -Which is the villain? let me see his eyes, -That, when I note another man like him, -I may avoid him: which of these is he? - - - -BORACHIO -If you would know your wronger, look on me. - - - -LEONATO -Art thou the slave that with thy breath hast kill'd -Mine innocent child? - - - -BORACHIO -Yea, even I alone. - - - -LEONATO -No, not so, villain; thou beliest thyself: -Here stand a pair of honourable men; -A third is fled, that had a hand in it. -I thank you, princes, for my daughter's death: -Record it with your high and worthy deeds: -'Twas bravely done, if you bethink you of it. - - - -CLAUDIO -I know not how to pray your patience; -Yet I must speak. Choose your revenge yourself; -Impose me to what penance your invention -Can lay upon my sin: yet sinn'd I not -But in mistaking. - - - -DON PEDRO -By my soul, nor I: -And yet, to satisfy this good old man, -I would bend under any heavy weight -That he'll enjoin me to. - - - -LEONATO -I cannot bid you bid my daughter live; -That were impossible: but, I pray you both, -Possess the people in Messina here -How innocent she died; and if your love -Can labour ought in sad invention, -Hang her an epitaph upon her tomb -And sing it to her bones, sing it to-night: -To-morrow morning come you to my house, -And since you could not be my son-in-law, -Be yet my nephew: my brother hath a daughter, -Almost the copy of my child that's dead, -And she alone is heir to both of us: -Give her the right you should have given her cousin, -And so dies my revenge. - - - -CLAUDIO -O noble sir, -Your over-kindness doth wring tears from me! -I do embrace your offer; and dispose -For henceforth of poor Claudio. - - - -LEONATO -To-morrow then I will expect your coming; -To-night I take my leave. This naughty man -Shall face to face be brought to Margaret, -Who I believe was pack'd in all this wrong, -Hired to it by your brother. - - - -BORACHIO -No, by my soul, she was not, -Nor knew not what she did when she spoke to me, -But always hath been just and virtuous -In any thing that I do know by her. - - - -DOGBERRY -Moreover, sir, which indeed is not under white and -black, this plaintiff here, the offender, did call -me ass: I beseech you, let it be remembered in his -punishment. And also, the watch heard them talk of -one Deformed: they say be wears a key in his ear and -a lock hanging by it, and borrows money in God's -name, the which he hath used so long and never paid -that now men grow hard-hearted and will lend nothing -for God's sake: pray you, examine him upon that point. - - - -LEONATO -I thank thee for thy care and honest pains. - - - -DOGBERRY -Your worship speaks like a most thankful and -reverend youth; and I praise God for you. - - - -LEONATO -There's for thy pains. - - - -DOGBERRY -God save the foundation! - - - -LEONATO -Go, I discharge thee of thy prisoner, and I thank thee. - - - -DOGBERRY -I leave an arrant knave with your worship; which I -beseech your worship to correct yourself, for the -example of others. God keep your worship! I wish -your worship well; God restore you to health! I -humbly give you leave to depart; and if a merry -meeting may be wished, God prohibit it! Come, neighbour. - - - -Exeunt DOGBERRY and VERGES - - -LEONATO -Until to-morrow morning, lords, farewell. - - - -ANTONIO -Farewell, my lords: we look for you to-morrow. - - - -DON PEDRO -We will not fail. - - - -CLAUDIO -To-night I'll mourn with Hero. - - - -LEONATO -To the Watch Bring you these fellows on. We'll -talk with Margaret, -How her acquaintance grew with this lewd fellow. - - - -Exeunt, severally - - -SCENE II. LEONATO'S garden. -Enter BENEDICK and MARGARET, meeting - - -BENEDICK -Pray thee, sweet Mistress Margaret, deserve well at -my hands by helping me to the speech of Beatrice. - - - -MARGARET -Will you then write me a sonnet in praise of my beauty? - - - -BENEDICK -In so high a style, Margaret, that no man living -shall come over it; for, in most comely truth, thou -deservest it. - - - -MARGARET -To have no man come over me! why, shall I always -keep below stairs? - - - -BENEDICK -Thy wit is as quick as the greyhound's mouth; it catches. - - - -MARGARET -And yours as blunt as the fencer's foils, which hit, -but hurt not. - - - -BENEDICK -A most manly wit, Margaret; it will not hurt a -woman: and so, I pray thee, call Beatrice: I give -thee the bucklers. - - - -MARGARET -Give us the swords; we have bucklers of our own. - - - -BENEDICK -If you use them, Margaret, you must put in the -pikes with a vice; and they are dangerous weapons for maids. - - - -MARGARET -Well, I will call Beatrice to you, who I think hath legs. - - - -BENEDICK -And therefore will come. -Exit MARGARET -Sings -The god of love, -That sits above, -And knows me, and knows me, -How pitiful I deserve,-- -I mean in singing; but in loving, Leander the good -swimmer, Troilus the first employer of panders, and -a whole bookful of these quondam carpet-mangers, -whose names yet run smoothly in the even road of a -blank verse, why, they were never so truly turned -over and over as my poor self in love. Marry, I -cannot show it in rhyme; I have tried: I can find -out no rhyme to 'lady' but 'baby,' an innocent -rhyme; for 'scorn,' 'horn,' a hard rhyme; for, -'school,' 'fool,' a babbling rhyme; very ominous -endings: no, I was not born under a rhyming planet, -nor I cannot woo in festival terms. -Enter BEATRICE -Sweet Beatrice, wouldst thou come when I called thee? - - - -BEATRICE -Yea, signior, and depart when you bid me. - - - -BENEDICK -O, stay but till then! - - - -BEATRICE -'Then' is spoken; fare you well now: and yet, ere -I go, let me go with that I came; which is, with -knowing what hath passed between you and Claudio. - - - -BENEDICK -Only foul words; and thereupon I will kiss thee. - - - -BEATRICE -Foul words is but foul wind, and foul wind is but -foul breath, and foul breath is noisome; therefore I -will depart unkissed. - - - -BENEDICK -Thou hast frighted the word out of his right sense, -so forcible is thy wit. But I must tell thee -plainly, Claudio undergoes my challenge; and either -I must shortly hear from him, or I will subscribe -him a coward. And, I pray thee now, tell me for -which of my bad parts didst thou first fall in love with me? - - - -BEATRICE -For them all together; which maintained so politic -a state of evil that they will not admit any good -part to intermingle with them. But for which of my -good parts did you first suffer love for me? - - - -BENEDICK -Suffer love! a good epithet! I do suffer love -indeed, for I love thee against my will. - - - -BEATRICE -In spite of your heart, I think; alas, poor heart! -If you spite it for my sake, I will spite it for -yours; for I will never love that which my friend hates. - - - -BENEDICK -Thou and I are too wise to woo peaceably. - - - -BEATRICE -It appears not in this confession: there's not one -wise man among twenty that will praise himself. - - - -BENEDICK -An old, an old instance, Beatrice, that lived in -the lime of good neighbours. If a man do not erect -in this age his own tomb ere he dies, he shall live -no longer in monument than the bell rings and the -widow weeps. - - - -BEATRICE -And how long is that, think you? - - - -BENEDICK -Question: why, an hour in clamour and a quarter in -rheum: therefore is it most expedient for the -wise, if Don Worm, his conscience, find no -impediment to the contrary, to be the trumpet of his -own virtues, as I am to myself. So much for -praising myself, who, I myself will bear witness, is -praiseworthy: and now tell me, how doth your cousin? - - - -BEATRICE -Very ill. - - - -BENEDICK -And how do you? - - - -BEATRICE -Very ill too. - - - -BENEDICK -Serve God, love me and mend. There will I leave -you too, for here comes one in haste. - - - -Enter URSULA - - -URSULA -Madam, you must come to your uncle. Yonder's old -coil at home: it is proved my Lady Hero hath been -falsely accused, the prince and Claudio mightily -abused; and Don John is the author of all, who is -fed and gone. Will you come presently? - - - -BEATRICE -Will you go hear this news, signior? - - - -BENEDICK -I will live in thy heart, die in thy lap, and be -buried in thy eyes; and moreover I will go with -thee to thy uncle's. - - - -Exeunt - - -SCENE III. A church. -Enter DON PEDRO, CLAUDIO, and three or four -with tapers - - -CLAUDIO -Is this the monument of Leonato? - - - -Lord -It is, my lord. - - - -CLAUDIO -Reading out of a scroll -Done to death by slanderous tongues -Was the Hero that here lies: -Death, in guerdon of her wrongs, -Gives her fame which never dies. -So the life that died with shame -Lives in death with glorious fame. -Hang thou there upon the tomb, -Praising her when I am dumb. -Now, music, sound, and sing your solemn hymn. -SONG. -Pardon, goddess of the night, -Those that slew thy virgin knight; -For the which, with songs of woe, -Round about her tomb they go. -Midnight, assist our moan; -Help us to sigh and groan, -Heavily, heavily: -Graves, yawn and yield your dead, -Till death be uttered, -Heavily, heavily. - - - -CLAUDIO -Now, unto thy bones good night! -Yearly will I do this rite. - - - -DON PEDRO -Good morrow, masters; put your torches out: -The wolves have prey'd; and look, the gentle day, -Before the wheels of Phoebus, round about -Dapples the drowsy east with spots of grey. -Thanks to you all, and leave us: fare you well. - - - -CLAUDIO -Good morrow, masters: each his several way. - - - -DON PEDRO -Come, let us hence, and put on other weeds; -And then to Leonato's we will go. - - - -CLAUDIO -And Hymen now with luckier issue speed's -Than this for whom we render'd up this woe. - - - -Exeunt - - -SCENE IV. A room in LEONATO'S house. -Enter LEONATO, ANTONIO, BENEDICK, BEATRICE, -MARGARET, URSULA, FRIAR FRANCIS, and HERO - - -FRIAR FRANCIS -Did I not tell you she was innocent? - - - -LEONATO -So are the prince and Claudio, who accused her -Upon the error that you heard debated: -But Margaret was in some fault for this, -Although against her will, as it appears -In the true course of all the question. - - - -ANTONIO -Well, I am glad that all things sort so well. - - - -BENEDICK -And so am I, being else by faith enforced -To call young Claudio to a reckoning for it. - - - -LEONATO -Well, daughter, and you gentle-women all, -Withdraw into a chamber by yourselves, -And when I send for you, come hither mask'd. -Exeunt Ladies -The prince and Claudio promised by this hour -To visit me. You know your office, brother: -You must be father to your brother's daughter -And give her to young Claudio. - - - -ANTONIO -Which I will do with confirm'd countenance. - - - -BENEDICK -Friar, I must entreat your pains, I think. - - - -FRIAR FRANCIS -To do what, signior? - - - -BENEDICK -To bind me, or undo me; one of them. -Signior Leonato, truth it is, good signior, -Your niece regards me with an eye of favour. - - - -LEONATO -That eye my daughter lent her: 'tis most true. - - - -BENEDICK -And I do with an eye of love requite her. - - - -LEONATO -The sight whereof I think you had from me, -From Claudio and the prince: but what's your will? - - - -BENEDICK -Your answer, sir, is enigmatical: -But, for my will, my will is your good will -May stand with ours, this day to be conjoin'd -In the state of honourable marriage: -In which, good friar, I shall desire your help. - - - -LEONATO -My heart is with your liking. - - - -FRIAR FRANCIS -And my help. -Here comes the prince and Claudio. - - - -Enter DON PEDRO and CLAUDIO, and two or -three others - - -DON PEDRO -Good morrow to this fair assembly. - - - -LEONATO -Good morrow, prince; good morrow, Claudio: -We here attend you. Are you yet determined -To-day to marry with my brother's daughter? - - - -CLAUDIO -I'll hold my mind, were she an Ethiope. - - - -LEONATO -Call her forth, brother; here's the friar ready. - - - -Exit ANTONIO - - -DON PEDRO -Good morrow, Benedick. Why, what's the matter, -That you have such a February face, -So full of frost, of storm and cloudiness? - - - -CLAUDIO -I think he thinks upon the savage bull. -Tush, fear not, man; we'll tip thy horns with gold -And all Europa shall rejoice at thee, -As once Europa did at lusty Jove, -When he would play the noble beast in love. - - - -BENEDICK -Bull Jove, sir, had an amiable low; -And some such strange bull leap'd your father's cow, -And got a calf in that same noble feat -Much like to you, for you have just his bleat. - - - -CLAUDIO -For this I owe you: here comes other reckonings. -Re-enter ANTONIO, with the Ladies masked -Which is the lady I must seize upon? - - - -ANTONIO -This same is she, and I do give you her. - - - -CLAUDIO -Why, then she's mine. Sweet, let me see your face. - - - -LEONATO -No, that you shall not, till you take her hand -Before this friar and swear to marry her. - - - -CLAUDIO -Give me your hand: before this holy friar, -I am your husband, if you like of me. - - - -HERO -And when I lived, I was your other wife: -Unmasking -And when you loved, you were my other husband. - - - -CLAUDIO -Another Hero! - - - -HERO -Nothing certainer: -One Hero died defiled, but I do live, -And surely as I live, I am a maid. - - - -DON PEDRO -The former Hero! Hero that is dead! - - - -LEONATO -She died, my lord, but whiles her slander lived. - - - -FRIAR FRANCIS -All this amazement can I qualify: -When after that the holy rites are ended, -I'll tell you largely of fair Hero's death: -Meantime let wonder seem familiar, -And to the chapel let us presently. - - - -BENEDICK -Soft and fair, friar. Which is Beatrice? - - - -BEATRICE -Unmasking I answer to that name. What is your will? - - - -BENEDICK -Do not you love me? - - - -BEATRICE -Why, no; no more than reason. - - - -BENEDICK -Why, then your uncle and the prince and Claudio -Have been deceived; they swore you did. - - - -BEATRICE -Do not you love me? - - - -BENEDICK -Troth, no; no more than reason. - - - -BEATRICE -Why, then my cousin Margaret and Ursula -Are much deceived; for they did swear you did. - - - -BENEDICK -They swore that you were almost sick for me. - - - -BEATRICE -They swore that you were well-nigh dead for me. - - - -BENEDICK -'Tis no such matter. Then you do not love me? - - - -BEATRICE -No, truly, but in friendly recompense. - - - -LEONATO -Come, cousin, I am sure you love the gentleman. - - - -CLAUDIO -And I'll be sworn upon't that he loves her; -For here's a paper written in his hand, -A halting sonnet of his own pure brain, -Fashion'd to Beatrice. - - - -HERO -And here's another -Writ in my cousin's hand, stolen from her pocket, -Containing her affection unto Benedick. - - - -BENEDICK -A miracle! here's our own hands against our hearts. -Come, I will have thee; but, by this light, I take -thee for pity. - - - -BEATRICE -I would not deny you; but, by this good day, I yield -upon great persuasion; and partly to save your life, -for I was told you were in a consumption. - - - -BENEDICK -Peace! I will stop your mouth. - - - -Kissing her - - -DON PEDRO -How dost thou, Benedick, the married man? - - - -BENEDICK -I'll tell thee what, prince; a college of -wit-crackers cannot flout me out of my humour. Dost -thou think I care for a satire or an epigram? No: -if a man will be beaten with brains, a' shall wear -nothing handsome about him. In brief, since I do -purpose to marry, I will think nothing to any -purpose that the world can say against it; and -therefore never flout at me for what I have said -against it; for man is a giddy thing, and this is my -conclusion. For thy part, Claudio, I did think to -have beaten thee, but in that thou art like to be my -kinsman, live unbruised and love my cousin. - - - -CLAUDIO -I had well hoped thou wouldst have denied Beatrice, -that I might have cudgelled thee out of thy single -life, to make thee a double-dealer; which, out of -question, thou wilt be, if my cousin do not look -exceedingly narrowly to thee. - - - -BENEDICK -Come, come, we are friends: let's have a dance ere -we are married, that we may lighten our own hearts -and our wives' heels. - - - -LEONATO -We'll have dancing afterward. - - - -BENEDICK -First, of my word; therefore play, music. Prince, -thou art sad; get thee a wife, get thee a wife: -there is no staff more reverend than one tipped with horn. - - - -Enter a Messenger - - -Messenger -My lord, your brother John is ta'en in flight, -And brought with armed men back to Messina. - - - -BENEDICK -Think not on him till to-morrow: -I'll devise thee brave punishments for him. -Strike up, pipers. - - -Dance -Exeunt - - -
diff --git a/test/rexml/data/namespaces.xml b/test/rexml/data/namespaces.xml deleted file mode 100644 index e8e4df8364..0000000000 --- a/test/rexml/data/namespaces.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Hello - - - - Hey - - - - Hey2 - - - - Hey3 - - diff --git a/test/rexml/data/nitf.xml b/test/rexml/data/nitf.xml deleted file mode 100644 index 269d99e211..0000000000 --- a/test/rexml/data/nitf.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - Use of Napster Quadruples - - By PETER SVENSSON - AP Business Writer - - The Associated Press - - NEW YORK - - - - -

Despite the uncertain legality of the Napster online music-sharing service, the number of people -using it more than quadrupled in just five months, Media Metrix said Monday.

-

That made Napster the fastest-growing software application ever recorded by the Internet research -company.

-

From 1.1 million home users in the United States in February, the first month Media Metrix -tracked the application, Napster use rocketed to 4.9 million users in July.

-

That represents 6 percent of U.S. home PC users who have modems, said Media Metrix, which pays -people to install monitoring software on their computers.

-

It estimates total usage from a panel of about 50,000 people in the United States.

-

Napster was also used at work by 887,000 people in July, Media Metrix said.

-

Napster Inc. has been sued by the recording industry for allegedly enabling copyright -infringement. The federal government weighed in on the case Friday, saying the service is not protected -under a key copyright law, as the San Mateo, Calif., company claims.

-

Bruce Ryon, head of Media Metrix's New Media Group, said Napster was used by "the full spectrum of PC users, not just the youth with time on their hands and a passion for music."

-

The Napster program allows users to copy digital music files from the hard drives of other -users over the Internet.

-

Napster Inc. said last week that 28 million people had downloaded its program. It does not reveal -its own figures for how many people actually use the software.

-

Because the program connects to the company's computers over the Internet every time -it is run, Napster Inc. can track usage exactly.

-

__

-

On the Net:

-

-http://www.napster.com

-

-http://www.mediametrix.com

-
-
- -
diff --git a/test/rexml/data/numbers.xml b/test/rexml/data/numbers.xml deleted file mode 100644 index a1791cd638..0000000000 --- a/test/rexml/data/numbers.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - 3 - 24 - 55 - 11 - 2 - -3 - - - - - - - - diff --git a/test/rexml/data/ofbiz-issues-full-177.xml b/test/rexml/data/ofbiz-issues-full-177.xml deleted file mode 100644 index bfff771d12..0000000000 --- a/test/rexml/data/ofbiz-issues-full-177.xml +++ /dev/null @@ -1,13971 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - 1 - RESOLVED - P3 - FIXED - Documentation - CVS - All - issues@ofbiz - 20030820210924 - website - ajzeneski - not determined - DEFECT - 2003-08-13 22:35:10 - issues@ofbiz - - - - All - Website missing - - - ajzeneski - 2003-08-13 22:35:10 - Website is missing from CVS. - - - ajzeneski - 2003-08-19 12:09:17 - Website starting to move - - - ajzeneski - 2003-08-19 12:11:57 - Changed milestone - - - ajzeneski - 2003-08-20 21:09:24 - Website has been imported into CVS - - - ajzeneski - 2003-08-19 12:09:17 - issue_status - Status - NEW - STARTED - - - ajzeneski - 2003-08-19 12:09:17 - version - Version - unspecified - CVS - - - ajzeneski - 2003-08-19 12:11:57 - target_milestone - Target Milestone - milestone 1 - not determined - - - ajzeneski - 2003-08-20 21:09:24 - issue_status - Status - STARTED - RESOLVED - - - ajzeneski - 2003-08-20 21:09:24 - resolution - Resolution - - FIXED - - - - 2 - RESOLVED - P3 - FIXED - Components - CVS - All - jonesde - 20030824004146 - Product - ajzeneski - not determined - DEFECT - 2003-08-23 14:25:20 - issues@ofbiz - - - - All - Missing FTL - - - ajzeneski - 2003-08-23 14:25:20 - Missing FTL file: - -Error: File not found: /feature/EditFeatureCategoryFeatures.ftl - - - jonesde - 2003-08-24 00:41:46 - Converted JSP to FTL, made some small corrections. - - - jonesde - 2003-08-24 00:41:46 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2003-08-24 00:41:46 - resolution - Resolution - - FIXED - - - - 3 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20030828103031 - Product - ajzeneski - not determined - DEFECT - 2003-08-23 14:27:14 - issues@ofbiz - - - - All - Edit Promo Bug - - - ajzeneski - 2003-08-23 14:27:14 - When editing a promo rule; the drop down for the current condition contains only -the existing condition (many times). - - - jonesde - 2003-08-28 10:30:31 - #list directive had a type. Fix in CVS. - - - jonesde - 2003-08-28 10:30:31 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2003-08-28 10:30:31 - resolution - Resolution - - FIXED - - - - 4 - VERIFIED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20030828103057 - Product - ajzeneski - not determined - DEFECT - 2003-08-23 14:30:52 - issues@ofbiz - - - - All - Price Rule Bug - - - ajzeneski - 2003-08-23 14:30:52 - When editing a price rule; changing the is "sale price" flag sets properly, -however always displays "no" as the selected choice. - - - jonesde - 2003-08-28 10:20:59 - Fixed conditional on the no button, now appears correctly. - - - jonesde - 2003-08-28 10:30:57 - Done - - - jonesde - 2003-08-28 10:20:59 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2003-08-28 10:20:59 - resolution - Resolution - - FIXED - - - jonesde - 2003-08-28 10:30:57 - issue_status - Status - RESOLVED - VERIFIED - - - - 5 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20030823144138 - Party - ajzeneski - not determined - DEFECT - 2003-08-23 14:41:38 - issues@ofbiz - - - - All - Relationship missing button - - - ajzeneski - 2003-08-23 14:41:38 - View/Edit party relationships page first is still JSP and second is missing the -links to communication event(s). - - - - 6 - CLOSED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20030918144334 - Entity - robdawson - not determined - DEFECT - 2003-09-04 02:09:57 - jonesde - - - - All - Entity Engine ConnectionFactory and DBCPConnectionFactory issues with Oracle - - - robdawson - 2003-09-04 02:09:57 - When using the Inline JDBC Functionality of the Entity Engine to access an Oracle -database the Entity Engine gives SQL no suitable driver exceptions. - -The fix for this involves changing: - loader.loadClass(driverClassName); -to - Class clazz = loader.loadClass(driverClassName); - clazz.newInstance(); -in both the ConnectionFactory and DBCPConnectionFactory classes. - -There will also need to be the appropriate exception handling. - -Please contact me if this requires any clarification. - - - ajzeneski - 2003-09-04 22:15:06 - The message you are getting means that the JDBC drivers for Oracle cannot be -found on the classpath. Contact the users mailing list if you need further help -with this issue. - - - ajzeneski - 2003-09-04 22:17:28 - Sorry; DBCP support is currently outdated and not used due to the fact that -there is no transaction support. It is recommended you use the JOTM/XAPool -connections. This issue will be addressed during a refactor of this class in the -coming months. - - - jonesde - 2003-09-18 14:43:34 - -This issue has been resolved with code changes similar to those recommended. - -HOWEVER: There is one caveat with this: I would NOT recommend running using -either of these blocks of code. Without a transaction aware connection pool -performance will be severely affected or operations may be performed outside of -transactions. So, I wouldn't use straight JDBC or DBCP right now. Hopefully in -the future DBCP will support XADataSources, then it may be an option. - -Later, --David Jones - - - - ajzeneski - 2003-09-04 22:15:06 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2003-09-04 22:15:06 - resolution - Resolution - - INVALID - - - jonesde - 2003-09-18 14:43:34 - issue_status - Status - RESOLVED - CLOSED - - - jonesde - 2003-09-18 14:43:34 - qa_contact - QA Contact - issues@ofbiz - jonesde - - - - 7 - NEW - P4 - - Components - CVS - All - issues@ofbiz - 20040304194045 - WebTools - fzhu_genshare - not determined - DEFECT - 2003-09-21 07:35:08 - issues@ofbiz - - http://localhost:8080/webtools/control/view/ModelGroupWriter?savetofile=true - - All - "Save Entity Group XML to File" error - - - 8 - jonesde - 2003-11-04 01:04:02 - - - fzhu_genshare - 2003-09-21 07:35:08 - If click "Save Entity Group XML to File" on the webtools, the new page opens and -the following error message appears: - -org.apache.jasper.JasperException: Unable to compile class for JSP - -An error occurred at line: -1 in the jsp file: null - -Generated servlet error: -[javac] Since fork is true, ignoring compiler setting. -[javac] Compiling 1 source file -[javac] Since fork is true, ignoring compiler setting. -[javac] C:\DOCUME~1\ADMINI~1\LOCALS~1 -\Temp\Jetty_0_0_0_0_8080__webtools\entity\ModelGroupWriter_jsp.java:72: -cannot resolve symbol -[javac] symbol : variable entityGroupResourceHandler -[javac] location: class org.ofbiz.entity.model.ModelGroupReader -[javac] ResourceHandler resourceHandler = -modelGroupReader.entityGroupResourceHandler; -[javac] ^ -[javac] 1 error - - - jonesde - 2003-11-04 01:04:02 - *** Issue 8 has been marked as a duplicate of this issue. *** - - - jonesde - 2004-03-04 19:40:45 - lower priority - - - jonesde - 2004-03-04 19:40:45 - priority - Priority - P3 - P4 - - - - 8 - RESOLVED - P3 - DUPLICATE - Components - CVS - All - issues@ofbiz - 20031104010402 - WebTools - fzhu_genshare - not determined - DEFECT - 2003-09-21 07:40:53 - issues@ofbiz - - http://localhost:8080/webtools/control/view/ModelGroupWriter - - All - "Generate Entity Group XML" error - - - 7 - jonesde - 2003-11-04 01:04:02 - - - fzhu_genshare - 2003-09-21 07:40:53 - If clicked "Generate Entity Group XML" on webtools, an error message occurs: - -org.apache.jasper.JasperException: Unable to compile class for JSP - -An error occurred at line: -1 in the jsp file: null - -Generated servlet error: -[javac] Since fork is true, ignoring compiler setting. -[javac] Compiling 1 source file -[javac] Since fork is true, ignoring compiler setting. -[javac] C:\DOCUME~1\ADMINI~1\LOCALS~1 -\Temp\Jetty_0_0_0_0_8080__webtools\entity\ModelGroupWriter_jsp.java:72: -cannot resolve symbol -[javac] symbol : variable entityGroupResourceHandler -[javac] location: class org.ofbiz.entity.model.ModelGroupReader -[javac] ResourceHandler resourceHandler = -modelGroupReader.entityGroupResourceHandler; -[javac] ^ -[javac] 1 error - -It seems the class ResourceHandler is missing. The same error result in several -links of webtools concerning entity engine xml export broken. - - - jonesde - 2003-11-04 01:04:02 - This issue is a duplicate of #7, they may be different links but they hit the same -request and code. - -*** This issue has been marked as a duplicate of 7 *** - - - jonesde - 2003-11-04 01:04:02 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2003-11-04 01:04:02 - resolution - Resolution - - DUPLICATE - - - - 9 - RESOLVED - P3 - WONTFIX - Components - CVS - All - issues@ofbiz - 20040223211140 - Entity - byersa - not determined - DEFECT - 2003-10-28 09:27:31 - issues@ofbiz - - - - All - GenericEntity.getBytes fails with HSQLDB - - - byersa - 2003-10-28 09:27:31 - getBytes internally casts to ByteWrapper which causes a ClassCastException. -Casting directly to byte[] seems to work. - -Don't know if it fails with other dbs. - - - jonesde - 2004-02-23 21:11:40 - This does not appear to be something that can be fixed in OFBiz, it appears to be a bug in HSQLDB, and -only in certain versions. Trying it with an earlier version it worked, but various other things didn't. We -may just have to be patient until HSQLDB has another stable release. - - - jonesde - 2004-02-23 21:11:40 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-02-23 21:11:40 - resolution - Resolution - - WONTFIX - - - - 10 - RESOLVED - P5 - FIXED - Components - CVS - All - ajzeneski - 20040630193003 - Service - byersa - not determined - ENHANCEMENT - 2003-10-31 08:53:59 - issues@ofbiz - - - - All - missing or incorrect service parameter message - - - byersa - 2003-10-31 08:53:59 - If possible, I think it would be very helpful to developers if the message that -informs on invalid service parameter conditions would clearly indicate whether -it is in the IN or OUT mode that the problem is occurring. - - - ajzeneski - 2004-03-08 12:17:42 - changed to enhancement - - - ajzeneski - 2004-03-08 17:49:18 - reassigned - - - ajzeneski - 2004-06-30 19:30:03 - The ServiceValidationException has been updated to support missing and extra fields as well as -knowing which "mode" (IN/OUT) the error occured in. - - - ajzeneski - 2004-03-08 12:17:42 - issue_type - Issue Type - DEFECT - ENHANCEMENT - - - ajzeneski - 2004-03-08 12:17:42 - priority - Priority - P3 - P5 - - - ajzeneski - 2004-03-08 17:49:17 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-06-30 19:30:03 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 19:30:03 - resolution - Resolution - - FIXED - - - - 11 - RESOLVED - P2 - INVALID - Components - CVS - PC - jonesde - 20031104002629 - Content - cyf - not determined - DEFECT - 2003-11-03 22:26:18 - issues@ofbiz - - - - Windows 2000 - "response.sendRedirect" in jsp could not take effect - - - cyf - 2003-11-03 22:26:18 - I have write a test.jsp code(like): -..... -hello world! -<%response.sendRedirect("control/main");%> -.... - -define : -in controller.xml: -<request-map uri="test" edit="true"> - <response name="success" type="view" value="test"/> - <response name="error" type="view" value="error"/> -</request-map> -..... -<view-map name="test" type="region"/> - -in region also configued - -when I test the page : -it's appear "hello world!",but didn't redirect. - -When I use this code as jsp page in normal web app,redirect can take effect. - -I think this is a bug of in region process. - - - jonesde - 2003-11-04 00:26:29 - -If I understand your complaint correctly it is because the way you organized -things the response output stream is committed before the sendRedirect is -called. There is absolutely nothing that can be done about this. - -If you want to send a redirect you should do so in an event or a non-region view -(and non-jpublish for that matter). Those composite view tools are meant for -generating views and involve templates that may cause the response to be -committed before you wrapped view is even called. - -BTW, this may be more appropriate as a question on the users list, not as a defect -bug report. - -Later, --David Jones - - - jonesde - 2003-11-04 00:26:29 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2003-11-04 00:26:29 - resolution - Resolution - - INVALID - - - - 12 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040223213513 - Entity - quake_wang - not determined - DEFECT - 2003-11-04 01:39:16 - issues@ofbiz - - - - All - entity cache is not synchronized with DB - - - quake_wang - 2003-11-04 01:39:16 - Quake, - -It might make sense to have an issue created on the ofbiz.dev.java.net -site that covers this problem, since it may take some time to resolve. -Could you create one there? It could just include text from messages -send back and forth in this email thread. - -Thanks, --David - -On Nov 3, 2003, at 6:57 PM, Quake_Wang wrote: - -> The immutable flag can solve some cache synchronize issues, it will -> help for debugging. But, please consider this scenario: -> -> Service A: -> OK, now base on policy: "NEVER read from the cache if you are planning -> on updating", we directly read from DB, -> order = findByPK ("Order", 10000); -> order.set("status", "DEF"); -> order.store(); -> -> -> Service B: -> order = findByPKCache("Order", 10000); -> just query, do not change any fields, entity engine will put the order -> 10000 with "DEF" status in cache, after some other operations (not on -> the order generic value) throw exception, rolled back service A and B, -> then PKCache is not synchronized with DB too, the immutable flag can -> not help any...... -> -> You wrote a service using cache for better performance, and someone -> may assembly your service in same transaction (group service, ECA -> service), the synchronizing may broken, it's really hard to find such -> problem. -> -> Any ideas? -> -> Quake -> -> -----Original Message----- -> From: David Jones [mailto:jonesde@ofbiz.org] -> Sent: Monday, November 03, 2003 11:05 PM -> To: dev@ofbiz.dev.java.net -> Subject: Re: [OFBiz] Dev - Important - [Bug] PKCache is not -> synchronized -> with DB -> -> -> -> Because of the possibility that this is happening and causing -> previously unexplained problems, I decided to go ahead and implement -> the immutable feature on the GenericEntity. This is now in CVS, but may -> cause problems with current code (and will most likely in many cases). -> Do disable this just comment out the line near the beginning of the set -> method in GenericEntity.java. It is around line 248 in the current -> revision of the file. -> -> I fixed a few places that had this problem, including createCustomer in -> ecommerce and the userLogin service. Creating a new customer and going -> through the checkout process works fine now, but variations on the way -> I did it may break. -> -> If we have too many problems with this, I'm okay with disabling it -> temporarily, but it would be nice to go this direction in the future. -> It will help resolve the possibility that strange things happen because -> things are being changed in the cache when they shouldn't be and the -> cache is out of sync with the database, ie is dirty. -> -> Feel free to report bugs along these lines, or better yet send -> patches... -> -> Later, -> -David -> -> -> On Nov 3, 2003, at 5:24 AM, David Jones wrote: -> ->> ->> Quake, ->> ->> Yes, I know this is a problem, although I had forgotten about it since ->> it hasn't come up for a long time. ->> ->> Our official answer on this, related to the use of the cache in ->> general is: NEVER read from the cache if you are planning on updating ->> something. It's tempting to change the GenericValue object to have an ->> unchangeable flag that is set for all versions that go into the ->> cache.... ->> ->> I agree with you, there doesn't seem to be an easy way to ->> automatically clear the cache on a rollback. In most cases the ->> rollback doesn't even go through the Entity Engine, it is done in ->> external code. So, the Entity Engine never gets a notification of the ->> rollback, and if it did it would have to remember every operation that ->> happened during that transaction so it could clear those dirty cache ->> entries. ->> ->> Thus the policy: never use the cache to read when you are planning on ->> writing to the database. And yeah, maybe I should throw some code in ->> there to enforce this... Any thoughts from anyone on that? ->> ->> Later, ->> -David ->> ->> ->> ->> On Nov 3, 2003, at 4:45 AM, Quake_Wang wrote: ->> ->>> Found a bug in the PKCache, below is the scenario ->>> ->>> Service A: ->>> 1. find an order with the order No. 10000, dummy code: ->>> order = findByPKCache("Order", 10000); ->>> assume we get an order with the status "ABC"; ->>> ->>> 2. set the order status to "DEF" and store, dummy code: ->>> order.set("status", "DEF"); ->>> order.store(); ->>> ->>> Service B: ->>> 1. find order 10000 again, dummy code: ->>> order = findByPKCache("Order", 10000); ->>> If the service A and B are in the same transaction (ex, group service ->>> or ECA service), entity engine will get the order with "DEF" status ->>> and put it in the PK cache. ->>> ->>> 2. some other operations, throw exception ->>> Service A and B are rolled back, as the result, the PKCache is not ->>> synchronized with DB: ->>> DB: order 10000, status "ABC" ->>> PKCache: order 10000, status "DEF" ->>> ->>> I spent some time to trace this bug, but can not find an easy way to ->>> fix it, just simply change the findByPKCache to findByPK in service ->>> B. ->>> I'm sending out this email in hopes of helping who may encounter the ->>> same problem and receiving a better fix method. ->>> ->>> Regards ->>> Quake ->>> ->>> --------------------------------------------------------------------- ->>> To unsubscribe, e-mail: dev-unsubscribe@ofbiz.dev.java.net ->>> For additional commands, e-mail: dev-help@ofbiz.dev.java.net ->> ->> ->> --------------------------------------------------------------------- ->> To unsubscribe, e-mail: dev-unsubscribe@ofbiz.dev.java.net ->> For additional commands, e-mail: dev-help@ofbiz.dev.java.net -> -> -> --------------------------------------------------------------------- -> To unsubscribe, e-mail: dev-unsubscribe@ofbiz.dev.java.net -> For additional commands, e-mail: dev-help@ofbiz.dev.java.net -> -> -> --------------------------------------------------------------------- -> To unsubscribe, e-mail: dev-unsubscribe@ofbiz.dev.java.net -> For additional commands, e-mail: dev-help@ofbiz.dev.java.net - - ---------------------------------------------------------------------- -To unsubscribe, e-mail: dev-unsubscribe@ofbiz.dev.java.net -For additional commands, e-mail: dev-help@ofbiz.dev.java.net - - - jonesde - 2004-02-23 21:35:13 - -Just a note on this. To fix it there need to be ThreadLocal caches that are maintained by a class that -implements the Synchronization interface for transactions. The idea would be that cache reads look in -the ThreadLocal cache first, then in the global cache, cache writes put everything in the ThreadLocal -cache and when the transaction is committed all ThreadLocal cache entries go into the global cache. --David - - - - 13 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20031112065558 - Entity - byersa - not determined - DEFECT - 2003-11-12 06:15:27 - issues@ofbiz - - - - All - setNonPKFields - - - byersa - 2003-11-12 06:15:27 - I had a situation in which I used setNonPKFields to populate an entity that had -createdData and lastModifiedDate from parameters thinking that it would be a -sort of parameter map. My intention was to then add the individual fields to a -service input, but it turns out that instead of converting the date string to -DateTime format, it kept them as strings and the service complained. I guess the -GenericValue only converts datatypes during the persistence phase? If that is -the case, it would be useful if it converted up loading. - - - jonesde - 2003-11-12 06:55:58 - This is really not the responsibility of the GenericValue object (or really the -GenericEntity object). This is difficult to handle as a defect report and should -be sent to the dev mailing for discussion of the best way to go about what you -are trying to do. The email message should perhaps include more detail about the -overall goal you are trying to accomplish. Note that the GenericEntity, at the -moment, does not enforce types going in, but may be changed to do that and throw -an exception if the type is wrong. -David - - - jonesde - 2003-11-12 06:55:58 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2003-11-12 06:55:58 - resolution - Resolution - - INVALID - - - - 14 - NEW - P3 - - Components - CVS - Macintosh - issues@ofbiz - 20040107162053 - Order - jonesde - not determined - DEFECT - 2004-01-07 16:20:53 - issues@ofbiz - - - - All - Order Summary pages don't show free shipping promo - - - jonesde - 2004-01-07 16:20:53 - Here is a description from Si Chen who reported the problem: - -One thing that I noticed that is anomalous, though, is that the order review -pages still show an estimate for shipping charges, even though the customer -should get free shipping. It seems that the checkout review pages are using -org.ofbiz.order.shoppingcart.shipping.ShippingEvents.getShipEstimate, while on -actual checkout it is using -org.ofbiz.order.order.OrderReadHelper.getShippingTotal. - -The former is not taking into account shipping adjustments. - - - - 15 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040210064750 - Order - nowpulse - not determined - PATCH - 2004-02-10 01:36:16 - issues@ofbiz - - - - All - Order Stats showing incorrect YTD info - - - nowpulse - 2004-02-10 01:36:16 - The YTD info is incorrect since the Java month starts at 0 instead of 1. - -ofbiz/components/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh -On Line 71 the 1 should be replaced with a 0 - -cal.set(Calendar.MONTH, 0); - -thank you, -sterling - - - jonesde - 2004-02-10 06:47:50 - Fixed as recommended. - - - jonesde - 2004-02-10 06:47:50 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-02-10 06:47:50 - resolution - Resolution - - FIXED - - - - 16 - NEW - P4 - - Components - CVS - All - jonesde - 20040527233859 - Product - jonesde - not determined - FEATURE - 2004-02-24 02:56:29 - issues@ofbiz - - - - All - Limit Categories Shown in Drop Downs - - - jonesde - 2004-02-24 02:56:29 - Add "show in drop-down" option ProductCategory, filter by it in all combo style category drop downs, -and change existing category drop-downs to be combo-boxes, include those on the EditProduct, -EditProductCategories, EditCategory, EditCategoryProducts, EditPromoRules pages. - - - jonesde - 2004-05-27 23:38:59 - Some progress has been made on this, but something still needs to be done with the form tool, etc to -limit the drop downs. - - - ajzeneski - 2004-03-18 11:59:21 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-05-27 23:38:59 - priority - Priority - P1 - P4 - - - - 17 - RESOLVED - P1 - FIXED - Components - CVS - All - jonesde - 20040318120731 - Product - jonesde - not determined - FEATURE - 2004-02-24 02:58:45 - issues@ofbiz - - - - All - Filter Promotion Products to exclude discontinued - - - jonesde - 2004-02-24 02:58:45 - Add code to the ProductPromoWorker to (perhaps optionally) filter products included by the -salesDiscontinuationDate, and of course make sure the category member from/thru dates are being -honored. - - - jonesde - 2004-02-25 21:00:44 - Now implemented. - - - jonesde - 2004-02-25 21:00:44 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-02-25 21:00:44 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:07:31 - version - Version - Pre3.0.0 - CVS - - - - 18 - RESOLVED - P1 - FIXED - Components - CVS - All - jonesde - 20040318120740 - Product - jonesde - not determined - DEFECT - 2004-02-24 03:01:49 - issues@ofbiz - - - - All - Back ordered, or insufficient quantities not handled right - - - jonesde - 2004-02-24 03:01:49 - It appears that when a product is back-ordered, or reserved in excess of the AvailableToPromise the -calculations and setting of values are messed up. - -Here is a report on this from Bryce Ewing on Feb 5th, 2004: - -================================================= -I have found something that appears to be a bug (but I am not totally sure), I will explain this in two -cases below: - -case 1: buy 1 item of product1 with no inventory - - inventory item created with 0 on hand, and -1 available to promise - - order item inventory res created with quantity of 1 and quantity not available of 1 - -case 2: buy 2 items of product2 with 1 item in inventory - - inventory item updated with 1 on hand, and -1 available to promise - - order item inventory res created with quantity of 2 and quantity not available of 0 - -For case 1 the system is doing exactly what I would expect, but in case 2 I would have expected that -the order item inventory res record would have had a quantity not available of 1 rather than 0. - -Am I mistaken in this expectation, or is this infact a bug? -================================================= - -Here is a comment on some apparently related findings by Jacopo Cappellato: - -================================================= -I'm studying the simple method InventoryServices.reserveProductInventory -that implements the inventory reservation of on order/order item, and I've -got a question about this issue. -What is the meaning of the quantityNotAvailable field in -OrderItemInventoryRes entity? Where and how is it used (or intended to be -used for)? I've noticed that this quantity is considered in the pick list -reports... - -Probably the quantityNotAvailable field should contain the quantity reserved -that caused inventory item's atp to be less than zero: if so, why in the -reserveProductInventory method the quantityNotAvailable is set only in line -498 and not also after line 458? And in which way, once set, could this -quantity return to zero? -================================================= - - - jonesde - 2004-02-24 18:35:45 - After a patch from Bryce Ewing it appears to be fixed. - - - jonesde - 2004-02-24 18:35:45 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-02-24 18:35:45 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:07:40 - version - Version - Pre3.0.0 - CVS - - - - 19 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120748 - Product - jacopo - not determined - PATCH - 2004-02-24 06:44:51 - issues@ofbiz - - - - All - Patch for bug in the Inventory Receive function - - - jacopo - 2004-02-24 06:44:51 - In Facility manager, when you receive a purchase order delivered with more than -one shipments and you select to receive only one shipment the proposed -quantities are the quantities of the original purchase order and not the -quantities of the shipment. -In my patches I tried to change the minimum amount of code and the -result is that the code is not well written... obviously feel free to change -my code. -PS: I submitted this patches to the dev list in january 2004. -PPS: the two patches are in Unified Output Format - - -Index: ofbiz/components/product/webapp/facility/inventory/receiveInventory.ftl -=================================================================== -RCS -file: /cvs/ofbiz/components/product/webapp/facility/inventory/receiveInventory.f -tl,v -retrieving revision 1.5 -diff -u -r1.5 receiveInventory.ftl ---- ofbiz/components/product/webapp/facility/inventory/receiveInventory.ftl - 17 Dec 2003 22:46:36 -0000 1.5 -+++ ofbiz/components/product/webapp/facility/inventory/receiveInventory.ftl - 14 Jan 2004 11:05:06 -0000 -@@ -312,6 +312,9 @@ - </tr> - <#list purchaseOrderItems as orderItem> - <#assign defaultQuantity = orderItem.quantity - receivedQuantities -[orderItem.orderItemSeqId]?double> -+ <#if shipment?has_content> -+ <#assign defaultQuantity = shippedQuantities -[orderItem.orderItemSeqId]?double - receivedQuantities -[orderItem.orderItemSeqId]?double> -+ </#if> - <#if 0 < defaultQuantity> - <#assign orderItemType = orderItem.getRelatedOne("OrderItemType")> - <input type="hidden" name="orderId_o_${rowCount}" -value="${orderItem.orderId}"> - - - - - - - -Index: ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh -=================================================================== -RCS file: /cvs/ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh,v -retrieving revision 1.4 -diff -u -r1.4 receiveInventory.bsh ---- ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh 25 Aug 2003 15:28:00 -0000 - 1.4 -+++ ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh 14 Jan 2004 11:08:14 -0000 -@@ -69,6 +69,7 @@ - shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap -("shipmentId", shipmentId)); - } - -+shippedQuantities = new HashMap(); - purchaseOrderItems = null; - if (purchaseOrder != null) { - if (product != null) { -@@ -80,14 +81,18 @@ - exprs = new ArrayList(); - while (issueIter.hasNext()) { - issuance = issueIter.next(); -- exprs.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, -issuance.getString("orderItemSeqId"))); -+ exprs.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, -issuance.getString("orderItemSeqId"))); -+ double issuanceQty = issuance.getDouble("quantity").doubleValue(); -+ if (shippedQuantities.containsKey(issuance.getString -("orderItemSeqId"))) { -+ issuanceQty += ((Double)shippedQuantities.get -(issuance.getString("orderItemSeqId"))).doubleValue(); -+ } -+ shippedQuantities.put(issuance.getString("orderItemSeqId"), -issuanceQty); - } - purchaseOrderItems = EntityUtil.filterByOr(orderItems, exprs); - } else { - purchaseOrderItems = purchaseOrder.getRelated("OrderItem"); - } - } -- - receivedQuantities = new HashMap(); - if (purchaseOrderItems != null && purchaseOrderItems.size() > 0) { - context.put("firstOrderItem", EntityUtil.getFirst(purchaseOrderItems)); -@@ -100,7 +105,13 @@ - if (receipts != null && receipts.size() > 0) { - recIter = receipts.iterator(); - while (recIter.hasNext()) { -- rec = recIter.next(); -+ rec = recIter.next(); -+ if (shipment != null) { -+ if (rec.getString("shipmentId") == null || -+ !rec.getString("shipmentId").equals(shipment.getString -("shipmentId"))) { -+ continue; -+ } -+ } - accepted = rec.getDouble("quantityAccepted"); - rejected = rec.getDouble("quantityRejected"); - if (accepted != null) -@@ -140,6 +151,7 @@ - context.put("product", product); - context.put("shipments", shipments); - context.put("shipment", shipment); -+context.put("shippedQuantities", shippedQuantities); - context.put("purchaseOrderItems", purchaseOrderItems); - context.put("receivedQuantities", receivedQuantities); - context.put("rejectReasons", rejectReasons); - - - jacopo - 2004-02-24 06:55:45 - Created an attachment (id=1) -Patch files in UOF for receiveInventory,bsh and receiveInventory.ftl - - - - jonesde - 2004-03-01 06:35:22 - The changes are in CVS. Thanks Jacopo! - - - text/plain - 1 - 2004-02-24 06:55:45 - Patch files in UOF for receiveInventory,bsh and receiveInventory.ftl - 1 - receiveInventory.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/1/receiveInventory.patch - - - jacopo - 2004-02-24 06:55:45 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=1) -Patch files in UOF for receiveInventory,bsh and receiveInventory.ftl - - - - jonesde - 2004-03-01 06:35:22 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 06:35:22 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:07:48 - version - Version - Pre3.0.0 - CVS - - - - 20 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120758 - Party - jacopo - not determined - PATCH - 2004-02-24 07:36:49 - issues@ofbiz - - - - All - List All Visits link in the Party Profile page returns an error with 0 visits - - - jacopo - 2004-02-24 07:36:50 - List All Visits link in the Party Profile page returns an error with 0 visits -(see attached patch file) due to wrong bsh code. - - - jacopo - 2004-02-24 07:38:20 - Created an attachment (id=2) -Patch for bug in uof - - - - jonesde - 2004-03-01 06:39:57 - The changes are in CVS. Thanks Jacopo! - - - text/plain - 2 - 2004-02-24 07:38:20 - Patch for bug in uof - 1 - showvisits.bsh.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/2/showvisits.bsh.patch - - - jacopo - 2004-02-24 07:38:20 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=2) -Patch for bug in uof - - - - jonesde - 2004-03-01 06:39:57 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 06:39:57 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:07:58 - version - Version - Pre3.0.0 - CVS - - - - 21 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120807 - Party - jacopo - not determined - PATCH - 2004-02-24 07:40:56 - issues@ofbiz - - - - All - findparty page returns JavaScript errors when clicking on the LookupParty link and when the lookup fields are hidden - - - jacopo - 2004-02-24 07:40:56 - findparty page returns JavaScript errors when clicking on the LookupParty link -and when the lookup fields are hidden. The attached patch should fix the -problem. - - - jacopo - 2004-02-24 07:41:29 - Created an attachment (id=3) -Patch for bug in uof - - - - jonesde - 2004-03-01 06:44:01 - Your changes are in CVS. Thanks Jacopo! - - - text/plain - 3 - 2004-02-24 07:41:29 - Patch for bug in uof - 1 - findparty.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/3/findparty.ftl.patch - - - jacopo - 2004-02-24 07:41:29 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=3) -Patch for bug in uof - - - - jonesde - 2004-03-01 06:44:01 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 06:44:01 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:08:07 - version - Version - Pre3.0.0 - CVS - - - - 22 - NEW - P3 - - Components - CVS - All - ajzeneski - 20040318115951 - Order - jacopo - not determined - DEFECT - 2004-02-24 08:52:07 - issues@ofbiz - - - - All - Errors in order entry when "Payment Already Received" type is selected. - - - jacopo - 2004-02-24 08:52:08 - In Order Entry: -when you finalize an order and, in the "Order Entry Payment -Settings" page, you select the "Payment Already Received" type, in the -following page you get JavaScript errors when you click over -the links (stating that the object "document.billsetupform" doesn't exist); -and so you cannot submit the order. - - - jonesde - 2004-02-26 07:08:20 - -This has been an issue for a while now. It's good to have it in the tracking system since it may not get -fixed right away. Andy is more aware of what is happening there than I am, so he may have more -feedback on it. -David - - - jonesde - 2004-02-26 07:08:20 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - jonesde - 2004-02-26 07:08:20 - priority - Priority - P2 - P3 - - - ajzeneski - 2004-03-18 11:59:51 - version - Version - Pre3.0.0 - CVS - - - - 23 - NEW - P4 - - Components - CVS - All - ajzeneski - 20040318120006 - Product - jacopo - not determined - DEFECT - 2004-02-24 08:56:40 - issues@ofbiz - - - - All - Inventory receive ignores the inventory item id field. - - - jacopo - 2004-02-24 08:56:40 - In Facility Manager -> Inventory receive: -it always creates a new inventory item even if the "inventory item id" optional -field is filled with an existing inventory item id. - - - ajzeneski - 2004-03-08 17:38:11 - reassigned - - - ajzeneski - 2004-03-08 17:38:11 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-03-18 12:00:06 - version - Version - Pre3.0.0 - CVS - - - - 24 - NEW - P4 - - Components - CVS - All - ajzeneski - 20040318120024 - Product - jacopo - not determined - DEFECT - 2004-02-24 09:01:59 - issues@ofbiz - - - - All - Receive return: it always creates serialized inventory items. - - - jacopo - 2004-02-24 09:01:59 - In Facility Manager -->Receive return - -it always creates a serialized inventory item (even if 'non-serialized' is -selected) and so the received quantities are lost (if more than one). - - - ajzeneski - 2004-03-08 17:38:55 - reassigned - - - ajzeneski - 2004-03-08 17:38:55 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-03-18 12:00:24 - version - Version - Pre3.0.0 - CVS - - - - 25 - RESOLVED - P2 - INVALID - Components - CVS - All - ajzeneski - 20040318120814 - Accounting - jonesde - not determined - DEFECT - 2004-02-25 14:58:53 - issues@ofbiz - - - - All - Permission Checks missing in various part of Accounting Manager - - - jonesde - 2004-02-25 14:58:53 - Various pages in the Accounting Manager have no view permission checking, including the billing -account, invoice, etc pages. - - - jaz - 2004-02-25 15:36:03 - I'm not involved in this project. - - - jonesde - 2004-02-25 16:13:54 - -Fixed assigned to mistake. - - - ajzeneski - 2004-03-08 10:48:28 - All components have a default VIEW permission based on the component configuration. Each page no -longer needs to have the added code as long as require auth is set in the controller.xml file. The -checkLogin event will make sure the user has the default permission for the specific component. -Additional permissions are only necessary when not using the default permission. - - - jaz - 2004-02-25 15:36:03 - assigned_to - Assigned To - jaz - jonesde - - - jonesde - 2004-02-25 16:13:54 - assigned_to - Assigned To - jonesde - ajzeneski - - - ajzeneski - 2004-03-08 10:48:28 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-03-08 10:48:28 - resolution - Resolution - - INVALID - - - ajzeneski - 2004-03-18 12:08:14 - version - Version - Pre3.0.0 - CVS - - - - 26 - RESOLVED - P3 - FIXED - Components - CVS - All - ajzeneski - 20040308115822 - Order - jonesde - not determined - DEFECT - 2004-02-25 21:11:36 - issues@ofbiz - - - - All - Billing Account Errors - - - jonesde - 2004-02-25 21:11:36 - This issue was reported by Si Chen, Olivier Heintz, and some others. - -The following is some text from an email fro Si Chen on Jan 26, 2004; the attached patch is also from -this email. - -======================================= -Hello. After some work we have tracked down the problem with using -billingAccount in the order manager and were able to fix it. The -problem is stated in the order manager's billsettings.ftl, it was -passing in "EXT_BILLACT|10000" for the checkoutPaymentId instead of -separate checkoutPaymentId and billingAccountId. Olivier had suggested -a good patch earlier which parses this form of checkoutPaymentId in the -CheckOutEvents.java. We took a different approach and used code from -ecommerce to pass both checkoutPaymentId and billingAccountId. We also -fixed CheckOutEvents.java to get the billingAccountId from the request -and associate it with the cart. Both are shown in the attached patch. - -One last problem: in ecommerce, in checkoutpayment.ftl, gift cards, -credit cards, and billing accounts are all using "amount_<account_id>" -as the name of the input fields. As a result, when the -toggleBillingAccount javascript function tries to toggle the billing -account selected for entering the amount to pay, it gets confused and -cannot do this. As a result, when you use the multi-page rather than -express checkout in ecommerce, it does not work properly. I'll be happy -to elaborate on this if you need me to. -======================================= - - - jonesde - 2004-02-25 21:14:01 - Created an attachment (id=4) -Patch to fix BillingAccount issues - - - - ajzeneski - 2004-03-08 11:58:22 - Applied patch; fixed JS in ecommerce - - - text/plain - 4 - 2004-02-25 21:14:01 - Patch to fix BillingAccount issues - 1 - BillingAccountError.patch - 3 - jonesde - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/4/BillingAccountError.patch - - - jonesde - 2004-02-25 21:14:01 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=4) -Patch to fix BillingAccount issues - - - - ajzeneski - 2004-03-08 11:58:22 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-03-08 11:58:22 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-08 11:58:22 - version - Version - Pre3.0.0 - CVS - - - - 27 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120822 - WorkEffort - jacopo - not determined - PATCH - 2004-02-26 03:20:00 - issues@ofbiz - - - - All - Patch for missing pagedef file for popup template that causes lookup error (due to i18n changes) - - - jacopo - 2004-02-26 03:20:00 - The lookup link in New Event -> Parties page is broken. -The popup template doesn't run the envsetup script that loads the localized -labels. - -PATCH: add a file named "popup.xml" to the template folder containing the -following lines: - -<?xml version="1.0" encoding="UTF-8"?> -<page> - <template-action name="/includes/envsetup.bsh"/> -</page> - - - jonesde - 2004-03-01 07:16:55 - -I have added the popup.xml file to CVS. Thanks for sending it over Jacopo. - - - jonesde - 2004-03-01 07:16:55 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 07:16:55 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:08:22 - version - Version - Pre3.0.0 - CVS - - - - 28 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040806161040 - WorkEffort - jacopo - not determined - PATCH - 2004-02-26 03:32:11 - issues@ofbiz - - - - All - Added lookup link for parties in month view - - - jacopo - 2004-02-26 03:32:11 - Added lookup link for parties in month view. -All the stuff was already in place... I just added the link. -However I think this is a very useful enhancement. - - - jacopo - 2004-02-26 03:32:44 - Created an attachment (id=5) -Patch in UOF - - - - jonesde - 2004-03-03 08:10:20 - Changed issue type as per email from Jacopo. - - - jonesde - 2004-08-06 16:10:40 - Thanks Jacopo, this is now in CVS. - - - text/plain - 5 - 2004-02-26 03:32:44 - Patch in UOF - 1 - month.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/5/month.ftl.patch - - - jacopo - 2004-02-26 03:32:44 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=5) -Patch in UOF - - - - jonesde - 2004-03-03 08:10:20 - issue_type - Issue Type - ENHANCEMENT - PATCH - - - ajzeneski - 2004-03-18 12:00:44 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-08-06 16:10:40 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-08-06 16:10:40 - resolution - Resolution - - FIXED - - - - 29 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120831 - WorkEffort - jacopo - not determined - PATCH - 2004-02-26 03:56:48 - issues@ofbiz - - - - All - When creating a new event from calendar, start and end date were not filled properly in the form - - - jacopo - 2004-02-26 03:56:48 - When creating a new event from calendar, start and end date were not filled -properly in the event form. -The two patches (one for the event.ftl file and one for the event.bsh file) -will solve this problem. - - - jacopo - 2004-02-26 03:59:24 - Created an attachment (id=6) -Patch for event.bsh in UOF - - - - jacopo - 2004-02-26 03:59:58 - Created an attachment (id=7) -Patch for event.ftl file in UOF - - - - jonesde - 2004-03-01 07:28:02 - Your changes are in CVS, thanks Jacopo! - - - text/plain - 6 - 2004-02-26 03:59:24 - Patch for event.bsh in UOF - 1 - event.bsh.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/6/event.bsh.patch - - - text/plain - 7 - 2004-02-26 03:59:58 - Patch for event.ftl file in UOF - 1 - event.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/7/event.ftl.patch - - - jacopo - 2004-02-26 03:59:24 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=6) -Patch for event.bsh in UOF - - - - jacopo - 2004-02-26 03:59:58 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=7) -Patch for event.ftl file in UOF - - - - jonesde - 2004-03-01 07:28:02 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 07:28:02 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:08:31 - version - Version - Pre3.0.0 - CVS - - - - 30 - NEW - P5 - - Components - CVS - All - ajzeneski - 20040308175050 - Order - jackhung - not determined - DEFECT - 2004-02-26 04:17:49 - issues@ofbiz - - - - All - Fail to approval order - - - jackhung - 2004-02-26 04:17:49 - 19285437[ ControlServlet.java:133:DEBUG] [[[updateactivityassign] Servlet -Starting, doing setup- total:0.0,since last(Begin):0.0]] -19285438[ ControlServlet.java:182:DEBUG] [[[updateactivityassign] Setup -done, doing Event(s) and View(s)- total:0.0,since last([updateactivityas...):0.0]] -19285440[ RequestHandler.java:200:INFO ] [Processing Request]: -updateactivityassign -19285744[ WfProcessMgrImpl.java:106:INFO ] [WfProcessMgr.init] : Create -process manager (org.ofbiz.order[20030730144901] / ProcessOrder[20030730144901]) -19285890[ BshUtil.java:75 :ERROR] BSH Evaluation error. -Sourced file: <Inline eval of: approvalCode.equals("0"); > : Attempt to resolve -method: equals() on undefined variable or class name: approvalCode : at Line: 1 -: in file: <Inline eval of: approvalCode.equals("0"); > : approvalCode .equals ( -"0" ) - - at bsh.UtilEvalError.toEvalError(UtilEvalError.java:82) - at bsh.UtilEvalError.toEvalError(UtilEvalError.java:87) - at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:79) - at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:69) - at bsh.Interpreter.evalParsedScript(Interpreter.java:1104) - at bsh.Interpreter.eval(Interpreter.java:590) - at bsh.Interpreter.eval(Interpreter.java:616) - at bsh.Interpreter.eval(Interpreter.java:606) - at org.ofbiz.base.util.BshUtil.eval(BshUtil.java:64) - at -org.ofbiz.workflow.impl.WfExecutionObjectImpl.evalBshCondition(WfExecutionObjectImpl.java:718) - at -org.ofbiz.workflow.impl.WfProcessImpl.getTransFrom(WfProcessImpl.java:477) - at org.ofbiz.workflow.impl.WfProcessImpl.queueNext(WfProcessImpl.java:298) - at -org.ofbiz.workflow.impl.WfProcessImpl.activityComplete(WfProcessImpl.java:286) - at org.ofbiz.workflow.impl.WfActivityImpl.complete(WfActivityImpl.java:408) - at -org.ofbiz.workflow.impl.WfAssignmentImpl.complete(WfAssignmentImpl.java:175) - at -org.ofbiz.workflow.client.WorkflowClient.complete(WorkflowClient.java:266) - at -org.ofbiz.workflow.client.WorkflowServices.completeAssignment(WorkflowServices.java:418) - - - ajzeneski - 2004-03-08 12:08:46 - I cannot duplicate this problem; please provide more information or we will have to close this has no -longer an issue. - - - ajzeneski - 2004-03-08 17:50:50 - reassigned - - - ajzeneski - 2004-03-08 12:08:46 - issue_status - Status - NEW - STARTED - - - ajzeneski - 2004-03-08 12:08:46 - op_sys - OS/Version - Linux - All - - - ajzeneski - 2004-03-08 12:08:46 - rep_platform - Platform - PC - All - - - ajzeneski - 2004-03-08 12:08:46 - short_desc - Summary - Fail to approval order - Fail to approval order - - - ajzeneski - 2004-03-08 17:50:50 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-03-08 17:50:50 - issue_status - Status - STARTED - NEW - - - ajzeneski - 2004-03-08 17:50:50 - priority - Priority - P2 - P5 - - - - 31 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040318120101 - WorkEffort - jacopo - not determined - DEFECT - 2004-02-26 05:39:36 - issues@ofbiz - - - - All - Error message when you try to create new contact information under an event - - - jacopo - 2004-02-26 05:39:36 - An error message is returned when you try to create new contact information -under an event: Cannot locate service by name (createWorkEffortContactMech) - -This is the complete message: - -ERROR: Could not complete the Create an email address for WorkEffort process -[problem invoking the [createWorkEffortContactMech] service with the map named -[context] containing [{locale=en_US, infoString=foo@bar.com, userLogin= -[GenericEntity:UserLogin][partyId,admin(java.lang.String)][disabledDateTime,null -()][passwordHint,null()][createdTxStamp,null()][successiveFailedLogins,null()] -[enabled,Y(java.lang.String)][userLoginId,admin(java.lang.String)] -[currentPassword,ofbiz(java.lang.String)][lastUpdatedTxStamp,null()] -[lastUpdatedStamp,null()][createdStamp,null()], workEffortId=10030, -contactMechTypeId=EMAIL_ADDRESS}]: Cannot locate service by name -(createWorkEffortContactMech)] - - - ajzeneski - 2004-03-18 12:01:01 - version - Version - Pre3.0.0 - CVS - - - - 32 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040409054533 - WorkEffort - jacopo - not determined - DEFECT - 2004-02-26 05:50:01 - issues@ofbiz - - - - All - Errors that prevent adding a new phase to a project. - - - jacopo - 2004-02-26 05:50:01 - It's impossible to add a new phase to a project. Even if you fill all the -fields of the new phase form when you press the 'create' button you get an -error in the system log (however no error messages are shown in the html page). - -This is the complete error message: - -1160388[ ServiceDispatcher.java:309:ERROR] Service Error [createPhase]: ERROR: -Could not complete the Create Project Phase process [problem creating the newEnt -ity value: while inserting: [GenericEntity:WorkEffortAssoc][createdTxStamp,2004- -02-26 14:44:26.096(java.sql.Timestamp)][workEffortIdTo,10034(java.lang.String)][ -workEffortIdFrom,10031(java.lang.String)][workEffortAssocTypeId,WORK_EFF_BREAKDO -WN(java.lang.String)][lastUpdatedTxStamp,2004-02-26 14:44:26.096(java.sql.Timest -amp)][createdStamp,2004-02-26 14:44:26.106(java.sql.Timestamp)][lastUpdatedStamp -,2004-02-26 14:44:26.106(java.sql.Timestamp)] (SQL Exception while executing the - following:INSERT INTO WORK_EFFORT_ASSOC (WORK_EFFORT_ID_FROM, WORK_EFFORT_ID_TO -, WORK_EFFORT_ASSOC_TYPE_ID, SEQUENCE_NUM, FROM_DATE, THRU_DATE, LAST_UPDATED_ST -AMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, - ?, ?, ?, ?, ?, ?) ([-5005] (at 124): Missing non-NULL value))] - - - jacopo - 2004-04-09 05:45:33 - David Jones has fixed this problem in date 2004-04-08 (see the -thread "createphase ERROR in OFBiz 3.0 and OFBiz CVS versions" in the dev-list). - - - - ajzeneski - 2004-03-18 12:01:18 - version - Version - Pre3.0.0 - CVS - - - jacopo - 2004-04-09 05:45:33 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-04-09 05:45:33 - resolution - Resolution - - FIXED - - - - 33 - RESOLVED - P4 - FIXED - Components - CVS - All - issues@ofbiz - 20050209023142 - WorkEffort - jacopo - not determined - DEFECT - 2004-02-26 06:00:26 - issues@ofbiz - - - - All - When you create a new request and you don't fill correctly all the fields no error messages are shown - - - jacopo - 2004-02-26 06:00:26 - When you create a new request and you don't fill correctly all the fields no -error messages are shown. - - - jacopo - 2005-02-09 02:31:42 - Fixed after the refactoring to screen widget. - - - ajzeneski - 2004-03-18 12:01:30 - version - Version - Pre3.0.0 - CVS - - - jacopo - 2005-02-09 02:31:42 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2005-02-09 02:31:42 - resolution - Resolution - - FIXED - - - - 34 - RESOLVED - P5 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120838 - Order - jacopo - not determined - PATCH - 2004-02-26 06:11:14 - issues@ofbiz - - - - All - Little JavaScript in "find returns" when lookup fields are hidden - - - jacopo - 2004-02-26 06:11:14 - Little JavaScript in "find returns" when lookup fields are hidden - -Patch for findReturns.ftl is attached. - - - jacopo - 2004-02-26 06:11:49 - Created an attachment (id=8) -Patch for findReturn.ftl in UOF - - - - jonesde - 2004-03-01 11:18:49 - Your changes are in CVS. Thanks for sending that over. - - - text/plain - 8 - 2004-02-26 06:11:49 - Patch for findReturn.ftl in UOF - 1 - findReturn.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/8/findReturn.ftl.patch - - - jacopo - 2004-02-26 06:11:49 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=8) -Patch for findReturn.ftl in UOF - - - - jonesde - 2004-03-01 11:18:49 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 11:18:49 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:08:38 - version - Version - Pre3.0.0 - CVS - - - - 35 - RESOLVED - P1 - FIXED - Components - CVS - All - ajzeneski - 20040308103928 - E-Commerce - razorb - not determined - DEFECT - 2004-02-26 06:18:48 - issues@ofbiz - - http://localhost:8080/ecommerce/control/product/~category_id=100/~product_id=GZ-1006 - - All - Single variant combo doesn't select properly - - - razorb - 2004-02-26 06:18:48 - Using the drop down menu to select a variantion i.e. LGPL does not set the -selection on the menu. Using the swatch/images does correctly set the menu -selection and allows adding to the basket. - -I suspect a little JS error somewhere for single variant items. - - - jonesde - 2004-02-26 06:52:49 - -I just reproduced this against the latest code base, appears to still be an issue with single feature type -virtual products. - - - ajzeneski - 2004-03-08 09:54:51 - Updated since this is a CVS bug and updated status - - - ajzeneski - 2004-03-08 10:39:28 - fixed JS bugs in productdetail - - - jonesde - 2004-02-26 06:52:48 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - jonesde - 2004-02-26 06:52:48 - priority - Priority - P3 - P1 - - - ajzeneski - 2004-03-08 09:54:51 - issue_status - Status - NEW - STARTED - - - ajzeneski - 2004-03-08 09:54:51 - version - Version - Pre3.0.0 - CVS - - - ajzeneski - 2004-03-08 10:39:28 - issue_status - Status - STARTED - RESOLVED - - - ajzeneski - 2004-03-08 10:39:28 - resolution - Resolution - - FIXED - - - - 36 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120846 - Product - jacopo - not determined - PATCH - 2004-02-26 23:17:51 - issues@ofbiz - - - - All - Facility Manager: in 'inventory receive' the type of order is not checked and it's possible to receive a sales order if you enter its id in the 'purchase order id' field - - - jacopo - 2004-02-26 23:17:51 - Facility Manager: in 'inventory receive' the type of order is not checked and -it's possible to receive a sales order if you enter its id in the 'purchase -order id' field. - -This is the patch in UOF for the receiveInventory.bsh file (pay attention that -some days ago I've submitted a patch for the same file against the same CVS -release): - -Index: ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh -=================================================================== -RCS file: /cvs/ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh,v -retrieving revision 1.4 -diff -u -r1.4 receiveInventory.bsh ---- ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh 25 Aug 2003 15:28:00 -0000 - 1.4 -+++ ofbiz/components/product/webapp/facility/WEB- -INF/actions/inventory/receiveInventory.bsh 27 Feb 2004 07:17:08 -0000 -@@ -43,6 +43,9 @@ - purchaseOrder = null; - if (purchaseOrderId != null && purchaseOrderId.length() > 0) { - purchaseOrder = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap -("orderId", purchaseOrderId)); -+ if (purchaseOrder != null && !"PURCHASE_ORDER".equals -(purchaseOrder.getString("orderTypeId"))) { -+ purchaseOrder = null; -+ } - } - - product = null; - - - jonesde - 2004-02-28 11:58:13 - The patch is in CVS. - - - jonesde - 2004-02-28 11:58:13 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-02-28 11:58:13 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:08:46 - version - Version - Pre3.0.0 - CVS - - - - 37 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120856 - Product - jacopo - not determined - DEFECT - 2004-02-27 02:05:25 - issues@ofbiz - - - - All - Facility Manager: error message when trying to confirm stock moves needed. - - - jacopo - 2004-02-27 02:05:25 - In the Facility Manager, int the PickList -> Stock Moves page, if I try to -confirm the "stock moves needed" proposed by the system I get the following -error: - -Error calling event: org.ofbiz.content.webapp.event.EventHandlerException: No -rows to process - -And the movements are not performed. - - - jonesde - 2004-03-01 17:22:23 - This is caused by some code that was added to display warning messages that wiped out the rowCount -variable. The warning message loop now uses a variable names messageCount. - - - jonesde - 2004-03-01 17:22:23 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 17:22:23 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:08:56 - version - Version - Pre3.0.0 - CVS - - - - 38 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120905 - Product - jacopo - not determined - PATCH - 2004-02-27 02:23:36 - issues@ofbiz - - - - All - Facility Manager: in Edit shipment -> items tab, a wrong link to EditProduct page caused a controller error. - - - jacopo - 2004-02-27 02:23:36 - Facility Manager: in Edit shipment -> items tab, a wrong link to EditProduct -page caused a controller error. - -Patch for EditShipmentItems.ftl file is attached. - - - jacopo - 2004-02-27 02:24:16 - Created an attachment (id=9) -Patch for EditShipmentItems.ftl in UOF - - - - jonesde - 2004-03-01 07:38:50 - Your changes are in CVS. Thanks for the patch Jacopo. - - - text/plain - 9 - 2004-02-27 02:24:16 - Patch for EditShipmentItems.ftl in UOF - 1 - EditShipmentItems.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/9/EditShipmentItems.ftl.patch - - - jacopo - 2004-02-27 02:24:16 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=9) -Patch for EditShipmentItems.ftl in UOF - - - - jonesde - 2004-03-01 07:38:50 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 07:38:50 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:09:05 - version - Version - Pre3.0.0 - CVS - - - - 39 - NEW - P2 - - Components - CVS - All - issues@ofbiz - 20040318120141 - Order - jacopo - not determined - DEFECT - 2004-02-27 04:05:34 - issues@ofbiz - - - - All - SapDB problem when displaying order task list assigned to user role - - - jacopo - 2004-02-27 04:05:34 - SapDB problem when displaying order task list assigned to user role: -if more than one order is assigned to user role, in "Order List" page the -orders are shown 5 times! -If only one order is assigned to the user role, the order is shown well (1 -time). - -See picture attached. - - - jacopo - 2004-02-27 04:07:00 - Created an attachment (id=10) -Bug example showing two orders waiting approval duplicated 5 times. - - - - image/gif - 10 - 2004-02-27 04:07:00 - Bug example showing two orders waiting approval duplicated 5 times. - - order_list_bug.GIF - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/10/order_list_bug.GIF - - - jacopo - 2004-02-27 04:07:00 - attachments.thedata - Attachment Data - - Created an attachment (id=10) -Bug example showing two orders waiting approval duplicated 5 times. - - - - ajzeneski - 2004-03-18 12:01:41 - version - Version - Pre3.0.0 - CVS - - - - 40 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20050209023003 - WorkEffort - jacopo - not determined - DEFECT - 2004-02-27 07:27:15 - issues@ofbiz - - - - All - Party lookup with empty fields returns only one person repeated many times (= number of persons). - - - jacopo - 2004-02-27 07:27:15 - If, in Party lookup, you perform a lookup with empty fields (all records), -returns only one person repeated many times (= number of persons). -I suspect that the problem is in the "lookupParty" simple method in common -component. - - - jacopo - 2005-02-09 02:30:03 - Fixed changing the way the lookup is implemented (see Jira issue OFBIZ-114). - - - ajzeneski - 2004-03-18 12:01:50 - version - Version - Pre3.0.0 - CVS - - - jacopo - 2005-02-09 02:30:03 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2005-02-09 02:30:03 - resolution - Resolution - - FIXED - - - - 41 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120912 - Product - jacopo - not determined - PATCH - 2004-02-27 08:53:04 - issues@ofbiz - - - - All - Facility Manager: in Edit shipment -> items tab, a wrong link to EditProduct caused a controller error (same as issue #38) - - - jacopo - 2004-02-27 08:53:04 - Facility Manager: in View shipment tab, a wrong link to EditProduct -page caused a controller error (same as issue #38). - -Patch for ViewShipmentItemInfo.ftl file is attached. - - - jacopo - 2004-02-27 08:53:50 - Created an attachment (id=11) -Patch for file ViewShipmentItemInfo.ftl in UOF - - - - jonesde - 2004-03-01 07:41:15 - Your changes are now in CVS. Thanks for sending those over Jacopo. - - - text/plain - 11 - 2004-02-27 08:53:50 - Patch for file ViewShipmentItemInfo.ftl in UOF - 1 - ViewShipmentItemInfo.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/11/ViewShipmentItemInfo.ftl.patch - - - jacopo - 2004-02-27 08:53:50 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=11) -Patch for file ViewShipmentItemInfo.ftl in UOF - - - - jonesde - 2004-03-01 07:41:15 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 07:41:15 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:09:12 - version - Version - Pre3.0.0 - CVS - - - - 42 - RESOLVED - P4 - WONTFIX - Components - CVS - All - ajzeneski - 20040630193328 - Product - jacopo - not determined - DEFECT - 2004-02-28 22:34:42 - issues@ofbiz - - - - All - In shipment, the following error message appears: "Applet Package Weight Reader notinited" - - - jacopo - 2004-02-28 22:34:42 - In shipment, the following error message appears: "Applet Package Weight Reader -notinited". -I think the problem is caused by the fact that the class ShipmentScaleApplet is -not built in the ant task. -Was this done intentionally? (I think this applet tries to connect to a scale -device connected to a serial port and so probably this could cause some -problems...). - - - ajzeneski - 2004-03-08 17:39:52 - reassigned; I will comment out the applet code until this is finished - - - ajzeneski - 2004-06-30 19:33:28 - The applet is going to be replaced with a think client shipment station UI - - - ajzeneski - 2004-03-08 17:39:52 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-03-18 12:01:59 - version - Version - Pre3.0.0 - CVS - - - ajzeneski - 2004-06-30 19:33:28 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 19:33:28 - resolution - Resolution - - WONTFIX - - - - 43 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040318120921 - E-Commerce - jacopo - not determined - PATCH - 2004-02-28 22:46:49 - issues@ofbiz - - - - All - In "Create Return", select-all checkbox doesn't work due to wrong form name. - - - jacopo - 2004-02-28 22:46:49 - In "Create Return", select-all checkbox doesn't work due to wrong form name. - -Patch attached for requestreturn.ftl in Unified Output Format. - - - jacopo - 2004-02-28 22:47:40 - Created an attachment (id=12) -Patch attached for requestreturn.ftl in UOF. - - - - jonesde - 2004-03-01 07:48:30 - Your changes are in CVS. Thanks for fixing that. - - - text/plain - 12 - 2004-02-28 22:47:39 - Patch attached for requestreturn.ftl in UOF. - 1 - requestreturn.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/12/requestreturn.ftl.patch - - - jacopo - 2004-02-28 22:47:40 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=12) -Patch attached for requestreturn.ftl in UOF. - - - - jonesde - 2004-03-01 07:48:30 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-01 07:48:30 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-18 12:09:21 - version - Version - Pre3.0.0 - CVS - - - - 44 - NEW - P4 - - Components - CVS - All - issues@ofbiz - 20040229030013 - Product - jacopo - not determined - ENHANCEMENT - 2004-02-29 03:00:13 - issues@ofbiz - - - - All - Packages: ShipmentPackage's weight automatically updated when ShipmentPackageContent entries are added/deleted (weight taken from the Product entity). - - - jacopo - 2004-02-29 03:00:13 - Packages: ShipmentPackage's weight automatically updated when -ShipmentPackageContent entries are added/deleted (weight taken from the Product -entity). - - - - 45 - RESOLVED - P1 - FIXED - Components - CVS - All - issues@ofbiz - 20040301155709 - Order - jacopo - not determined - DEFECT - 2004-02-29 06:17:33 - issues@ofbiz - - - - All - In orderview page, if you select the "QuickShip order link" you get a controller error. - - - jacopo - 2004-02-29 06:17:33 - In orderview page (/ordermgr/control/orderview), if you select the "QuickShip -order link" you get a controller error: - -org.ofbiz.content.webapp.control.RequestHandlerException: Unknown request -[quickShipOrderMultiFacility]; this request does not exist or cannot be called -directly. - - - jonesde - 2004-03-01 12:11:07 - I'll get on this... - - - jonesde - 2004-03-01 15:57:09 - Changed the default behavior for this; also added request-map and service defs for the quick ship from -multi facilites. - - - jonesde - 2004-03-01 12:11:07 - issue_status - Status - NEW - STARTED - - - jonesde - 2004-03-01 15:57:09 - issue_status - Status - STARTED - RESOLVED - - - jonesde - 2004-03-01 15:57:09 - resolution - Resolution - - FIXED - - - - 46 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040806152631 - Product - jacopo - not determined - PATCH - 2004-03-02 05:13:01 - issues@ofbiz - - - - All - Patch for multiple inventory facility reservation - - - jacopo - 2004-03-02 05:13:01 - Patch for multiple inventory facility reservation: -the intent of this is to perform reservation only if all items are available in -one facility: that, I think, is the declared behaviour, and what is checked -with the isInventoryAvailable method. - - - jacopo - 2004-03-02 05:13:49 - Created an attachment (id=13) -Patch for ProductStoreWorker.java in UOF - - - - jonesde - 2004-08-06 15:26:31 - Thanks Jacopo, your patch is now in CVS. - - - text/plain - 13 - 2004-03-02 05:13:49 - Patch for ProductStoreWorker.java in UOF - 1 - ProductStoreWorker.java.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/13/ProductStoreWorker.java.patch - - - jacopo - 2004-03-02 05:13:49 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=13) -Patch for ProductStoreWorker.java in UOF - - - - ajzeneski - 2004-03-18 12:02:10 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-08-06 15:26:31 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-08-06 15:26:31 - resolution - Resolution - - FIXED - - - - 47 - RESOLVED - P3 - FIXED - Components - CVS - All - ajzeneski - 20040323221326 - Product - jacopo - not determined - PATCH - 2004-03-02 06:06:51 - issues@ofbiz - - - - All - Facility -> Shipment: patch for JavaScript error introduced during i18n process. - - - jacopo - 2004-03-02 06:06:51 - Facility -> Shipment: patch for JavaScript error introduced during i18n process. - - - jacopo - 2004-03-02 06:07:51 - Created an attachment (id=14) -Patch for AddItemsFromOrder.ftl file in UOF - - - - ajzeneski - 2004-03-08 17:42:45 - reassigned - - - jacopo - 2004-03-23 22:13:26 - This bug has been fixed by the code for the new feature regarding shipment -plans. - - - text/plain - 14 - 2004-03-02 06:07:51 - Patch for AddItemsFromOrder.ftl file in UOF - 1 - AddItemsFromOrder.ftl.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/14/AddItemsFromOrder.ftl.patch - - - jacopo - 2004-03-02 06:07:51 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=14) -Patch for AddItemsFromOrder.ftl file in UOF - - - - ajzeneski - 2004-03-08 17:42:45 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-03-18 12:02:18 - version - Version - Pre3.0.0 - CVS - - - jacopo - 2004-03-23 22:13:26 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-03-23 22:13:26 - resolution - Resolution - - FIXED - - - - 48 - NEW - P2 - - Components - CVS - All - issues@ofbiz - 20040318120228 - Product - jacopo - not determined - DEFECT - 2004-03-02 06:28:37 - issues@ofbiz - - - - All - Facility -> Shipment -> Items: delete shipment item link returns a constraint violation error. - - - jacopo - 2004-03-02 06:28:37 - Facility -> Shipment -> Items: delete shipment item link returns a constraint -violation error: - -The following errors occurred: -ERROR: Could not complete the Delete ShipmentItem process [problem removing the -lookedUpValue value: Exception while deleting the following entity: -[GenericEntity:ShipmentItem][shipmentId,10010(java.lang.String)] -[shipmentItemSeqId,00001(java.lang.String)] (SQL Exception while executing the -following:DELETE FROM SHIPMENT_ITEM WHERE SHIPMENT_ID=? AND -SHIPMENT_ITEM_SEQ_ID=? (Integrity constraint violation ITEM_ISS_SHITM table: -ITEM_ISSUANCE in statement [DELETE FROM SHIPMENT_ITEM WHERE SHIPMENT_ID=? AND -SHIPMENT_ITEM_SEQ_ID=?]))] - -In my opinion, the delete shipment item link should perform something like this -(instead of barely trying to remove the ShipmentItem entry): it should remove -the item issuances, recreate the reservations and then remove the shipment item. - - - ajzeneski - 2004-03-18 12:02:28 - version - Version - Pre3.0.0 - CVS - - - - 49 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040528001027 - Product - jacopo - not determined - PATCH - 2004-03-03 03:11:18 - issues@ofbiz - - - - All - Facility -> Receive PO: at now it's possible to receive multiple times the same shipment items. This is a partial patch for this problem. - - - jacopo - 2004-03-03 03:11:18 - Facility -> Receive PO: at now it's possible to receive multiple times the same -shipment items. This is a partial patch for this problem. With the attached -patch the shipment already delivered (or cancelled) are not shown (and so the -user cannot receive them again). -In order to completely fix this issue the best solution is, in my opinion, to -automatically update the shipment status to "delivered" when the user receives -an item: this could be done modifying the service -group "receiveInventoryProduct" by adding to it the "updateShipment" service -(to update the shipment status). However I'm going to add this comments to a -new "DEFECT" issue. - - - jacopo - 2004-03-03 03:12:11 - Created an attachment (id=15) -Patch for file receiveInventory.bsh in UOF. - - - - jonesde - 2004-05-28 00:10:27 - This is now in CVS, thanks for sending it over Jacopo. - - - text/plain - 15 - 2004-03-03 03:12:11 - Patch for file receiveInventory.bsh in UOF. - 1 - receiveInventory.bsh.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/15/receiveInventory.bsh.patch - - - jacopo - 2004-03-03 03:12:11 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=15) -Patch for file receiveInventory.bsh in UOF. - - - - ajzeneski - 2004-03-18 12:02:37 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-05-28 00:10:27 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-28 00:10:27 - resolution - Resolution - - FIXED - - - - 50 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040528000924 - Product - jacopo - not determined - DEFECT - 2004-03-03 03:15:23 - issues@ofbiz - - - - All - Facility -> Receive PO: at now it's possible to receive multiple times the same shipment items. - - - jacopo - 2004-03-03 03:15:24 - Facility -> Receive PO: at now it's possible to receive multiple times the same -shipment items. -This problem was partially fixed by the patch attached to issue #49. -With that patch the shipment already delivered (or cancelled) are not shown -(and so the user cannot receive them again). -In order to completely fix this issue the best solution is, in my opinion, to -automatically update the shipment status to "delivered" when the user receives -an item: this could be done modifying the service -group "receiveInventoryProduct" by adding to it the "updateShipment" service -(to update the shipment status). However I'm going to add this comments to a -new "DEFECT" issue. - - - jonesde - 2004-05-28 00:09:24 - The patch is in, now just need to update the shipment status as mentioned in the description. - - - ajzeneski - 2004-03-18 12:02:49 - version - Version - Pre3.0.0 - CVS - - - - 51 - RESOLVED - P3 - REMIND - Base - CVS - All - issues@ofbiz - 20040811004716 - Startup - jacopo - not determined - DEFECT - 2004-03-03 06:37:30 - issues@ofbiz - - - - All - Several SapDB error messages are generated at startup when entities are created. - - - jacopo - 2004-03-03 06:37:30 - Several SapDB error messages are generated at startup when entities are created. -The messages appear during the indices' generation phase, not for all entities -(maybe 5-10%); here is an example: - -147042[ DatabaseUtil.java:319:ERROR] Could not create foreign key indices -for entity "EftAccount": SQL Exception while executing the following: -CREATE INDEX EFTACCT_PMETH ON EFT_ACCOUNT (PAYMENT_METHOD_ID) -Error was: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-7055] (at 44): -Column(s) already indexed:EFTACCT_PMETH -SQL Exception while executing the following: -CREATE INDEX EFTACCT_PADDR ON EFT_ACCOUNT (CONTACT_MECH_ID) -Error was: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-7055] (at 44): -Column(s) already indexed:EFTACCT_PADDR - - - jacopo - 2004-08-11 00:47:16 - I've created a new issue (OFBIZ-1) for this in Jira; in it you will find a lot -of details. - - - - ajzeneski - 2004-03-18 12:03:00 - version - Version - Pre3.0.0 - CVS - - - jacopo - 2004-08-11 00:47:16 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-08-11 00:47:16 - resolution - Resolution - - REMIND - - - - 52 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040308121509 - Order - jacopo - not determined - DEFECT - 2004-03-04 03:14:08 - issues@ofbiz - - - - All - Billing accounts selectable by users during order entry are not correctly filtered out. - - - jacopo - 2004-03-04 03:14:08 - Billing accounts selectable by users as payment methods during order entry are -not correctly filtered out: removed billing accounts are also shown (i.e. -billing accounts with thru date < now). - - - ajzeneski - 2004-03-08 12:15:09 - Billing accounts are now filtered by date so expired accounts no longer show on order manager order -entry and the ecommerce checkout pages - - - ajzeneski - 2004-03-08 12:15:09 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-03-08 12:15:09 - resolution - Resolution - - FIXED - - - ajzeneski - 2004-03-08 12:15:09 - version - Version - Pre3.0.0 - CVS - - - - 53 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040528010450 - Product - jacopo - not determined - DEFECT - 2004-03-05 06:01:05 - issues@ofbiz - - - - All - In Shipment: it's possible to issue 0 quantities from AddItemsFormOrder page. - - - jacopo - 2004-03-05 06:01:05 - In Shipment: it's possible to issue 0 quantities from AddItemsFormOrder page -(an ItemIssuance record is created with 0 quantity). -I think this should be avoided by submitting only quantities > 0. - - - jonesde - 2004-05-28 01:04:50 - Now checks to see if quantity is empty or 0 when issuing OIIRs to the shipment. - - - ajzeneski - 2004-03-18 12:03:13 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-05-28 01:04:50 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-28 01:04:50 - resolution - Resolution - - FIXED - - - - 54 - RESOLVED - P1 - FIXED - Components - CVS - All - issues@ofbiz - 20040630124239 - Product - jacopo - not determined - DEFECT - 2004-03-05 06:20:02 - issues@ofbiz - - - - All - In Shipment: if you enter a non numeric value (such as null quantity) in the issue field the program returns a bad error. - - - jacopo - 2004-03-05 06:20:02 - In Shipment: if you enter a non numeric value (such as null quantity) in the -issue field the program returns a bad error. -See also issue#53. -I'm running SapDB and after this error I need to restart OFBiz because in every -page I receive SQL errors like the following: - -Target exception: org.ofbiz.entity.GenericDataSourceException: SQL Exception -occurred on commit (Cannot commit a transactional connection: See JDBC 2.0 -Optional Package Specification section 7.1 (p25)) -BSF info: ..\ofbiz\components\content\webapp\content\WEB- -INF\actions\includes\envsetup.bsh at line: 0 column: 0) - - - ajzeneski - 2004-06-30 12:42:39 - Applied patch which fixes a bug in the service multi event handler - - - ajzeneski - 2004-03-18 12:03:23 - version - Version - Pre3.0.0 - CVS - - - ajzeneski - 2004-06-30 12:42:39 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 12:42:39 - resolution - Resolution - - FIXED - - - - 55 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040323221851 - Product - jacopo - not determined - DEFECT - 2004-03-05 06:25:34 - issues@ofbiz - - - - All - In shipment, it's possible to issue to shipment items with negative reservations (atp < 0); as a consequence of this, also the inventory items' quantity on hand can be negative. - - - jacopo - 2004-03-05 06:25:34 - I've noticed that, in shipment, it's possible to issue to shipment items with -negative reservations (atp < 0); as a consequence of this, also the inventory -items' quantity on hand can be negative. -In my opinion, in this situation at least a warning message should be -provided. - - - jacopo - 2004-03-23 22:18:51 - In "Order Items" page a new column has been added that tells users if they are -issuing negative reservations and the default issuance value is also -decremented by this quantity. -However is still possible to override this value and force an issuance for a -negative reservation. - - - - - ajzeneski - 2004-03-18 12:03:32 - version - Version - Pre3.0.0 - CVS - - - jacopo - 2004-03-23 22:18:51 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-03-23 22:18:51 - resolution - Resolution - - FIXED - - - - 56 - RESOLVED - P3 - WONTFIX - Components - CVS - PC - issues@ofbiz - 20040308173638 - Party - vivalinux - not determined - PATCH - 2004-03-08 14:07:32 - issues@ofbiz - - http://<ofbiz_root_url>/partymgr/control/findparty - - All - Selecting "Show All Records" displays all names as "(Not selected)" - - - vivalinux - 2004-03-08 14:07:32 - The findparty.bsh constructs a dynamic view tailored to the search fields -submited by the lookupparty form. Since selecting all does not give a hint about -which fields the client is interested in, the findparty.bsh fails to include any -of the name (firstName, lastName, groupName) fields. - -The can be corrected with the patch that follows or handling the select all -records as yet another case. I think, I'll side with simplicity, and sacrify -efficiency .... - -Hope this helps. - - -Index: components/party/webapp/partymgr/WEB-INF/actions/party/findparty.bsh -=================================================================== -RCS file: -/cvs/ofbiz/components/party/webapp/partymgr/WEB-INF/actions/party/findparty.bsh,v -retrieving revision 1.13 -diff -u -r1.13 findparty.bsh ---- components/party/webapp/partymgr/WEB-INF/actions/party/findparty.bsh 27 Jan -2004 19:44:36 -0000 1.13 -+++ components/party/webapp/partymgr/WEB-INF/actions/party/findparty.bsh 8 Mar -2004 22:06:24 -0000 -@@ -100,8 +100,15 @@ - - // default view settings - dynamicView.addMemberEntity("PT", "Party"); -+ dynamicView.addMemberEntity("PG", "PartyGroup"); -+ dynamicView.addMemberEntity("PP", "Person"); - dynamicView.addAlias("PT", "partyId"); - dynamicView.addAlias("PT", "partyTypeId"); -+ dynamicView.addAlias("PG", "groupName"); -+ dynamicView.addAlias("PP", "firstName"); -+ dynamicView.addAlias("PP", "lastName"); -+ dynamicView.addViewLink("PT","PG",true,UtilMisc.toList(new -ModelKeyMap("partyId", "partyId"))); -+ dynamicView.addViewLink("PT","PP",true,UtilMisc.toList(new -ModelKeyMap("partyId", "partyId"))); - dynamicView.addRelation("one-nofk", "", "PartyType", -ModelKeyMap.makeKeyMapList("partyTypeId")); - dynamicView.addRelation("many", "", "UserLogin", -ModelKeyMap.makeKeyMapList("partyId")); - -@@ -143,11 +150,6 @@ - if (groupName != null && groupName.length() > 0) { - paramList = paramList + "&groupName=" + groupName; - -- // modify the dynamic view -- dynamicView.addMemberEntity("PG", "PartyGroup"); -- dynamicView.addAlias("PG", "groupName"); -- dynamicView.addViewLink("PT", "PG", Boolean.FALSE, -ModelKeyMap.makeKeyMapList("partyId")); -- - // add the expr - andExprs.add(new EntityExpr("groupName", true, EntityOperator.LIKE, -"%"+groupName+"%", true)); - } -@@ -160,14 +162,6 @@ - firstName = request.getParameter("firstName"); - lastName = request.getParameter("lastName"); - -- // modify the dynamic view -- if ((firstName != null && firstName.length() > 0) || (lastName != null && -lastName.length() > 0)) { -- dynamicView.addMemberEntity("PE", "Person"); -- dynamicView.addAlias("PE", "firstName"); -- dynamicView.addAlias("PE", "lastName"); -- dynamicView.addViewLink("PT", "PE", Boolean.FALSE, -ModelKeyMap.makeKeyMapList("partyId")); -- } -- - // filter on firstName - if (firstName != null && firstName.length() > 0) { - paramList = paramList + "&firstName=" + firstName; -@@ -319,6 +313,12 @@ - List orderBy = new ArrayList(); - fieldsToSelect.add("partyId"); - fieldsToSelect.add("partyTypeId"); -+ fieldsToSelect.add("firstName"); -+ fieldsToSelect.add("lastName"); -+ fieldsToSelect.add("groupName"); -+ orderBy.add("-partyTypeId"); -+ orderBy.add("lastName"); -+ orderBy.add("groupName"); - - // UserLogin - if (userLoginId != null && userLoginId.length() > 0) { -@@ -327,14 +327,11 @@ - - // Person - if ((firstName != null && firstName.length() > 0) || (lastName != null -&& lastName.length() > 0)) { -- fieldsToSelect.add("firstName"); -- fieldsToSelect.add("lastName"); - orderBy.add("lastName"); - orderBy.add("firstName"); - } - // PartyGroup - if (groupName != null && groupName.length() > 0) { -- fieldsToSelect.add("groupName"); - orderBy.add("groupName"); - } - // RoleType -Index: components/party/webapp/partymgr/party/findparty.ftl -=================================================================== -RCS file: /cvs/ofbiz/components/party/webapp/partymgr/party/findparty.ftl,v -retrieving revision 1.10 -diff -u -r1.10 findparty.ftl ---- components/party/webapp/partymgr/party/findparty.ftl 1 Mar 2004 14:43:27 --0000 1.10 -+++ components/party/webapp/partymgr/party/findparty.ftl 8 Mar 2004 22:06:24 -0000 -@@ -212,13 +212,12 @@ - </table> - <input type="image" src="/images/spacer.gif" -onClick="javascript:document.lookupparty.submit();"> - </form> --<#if requestParameters.hideFields?default("N") != "Y"> - <script language="JavaScript"> - <!--// - document.lookupparty.partyId.focus(); - //--> - </script> --</#if> -+ - <#if partyList?exists> - <br> - <table border=0 width='100%' cellspacing='0' cellpadding='0' -class='boxoutside'> -@@ -292,21 +291,13 @@ - </td> - <td> - <div class="tabletext"> -- <#if partyRow.containsKey("lastName")> - <#if partyRow.lastName?has_content> - ${partyRow.lastName}<#if -partyRow.firstName?has_content>, ${partyRow.firstName}</#if> -- <#else> -- (No Name Found) -- </#if> -- <#elseif partyRow.containsKey("groupName")> -- <#if partyRow.groupName?has_content> -+ <#elseif partyRow.groupName?has_content> - ${partyRow.groupName} - <#else> -- (No Name Found) -+ (Not Selected) - </#if> -- <#else> -- (Not Selected) -- </#if> - </td> - <#if extInfo?default("") == "P"> - <td><div -class="tabletext">${partyRow.postalCode?if_exists}</div></td> - - - ajzeneski - 2004-03-08 17:36:38 - This page has been changed from using the left joins in the dynamic view. Using left joins performs too -poorly for actual use. This patch has been rejected; a new task will be opened for fixing the problem of -the name not being displayed. - - - ajzeneski - 2004-03-08 17:36:38 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-03-08 17:36:38 - resolution - Resolution - - WONTFIX - - - - 57 - NEW - P4 - - Components - CVS - All - ajzeneski - 20040308174641 - Party - ajzeneski - not determined - DEFECT - 2004-03-08 17:36:18 - issues@ofbiz - - - - All - Find Party - Show all does not show name - - - ajzeneski - 2004-03-08 17:36:18 - The name is not displayed when selecting show all in the party manager. - - - ajzeneski - 2004-03-08 17:46:41 - reassigned - - - ajzeneski - 2004-03-08 17:46:41 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - - 58 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040308185722 - Content - vivalinux - not determined - ENHANCEMENT - 2004-03-08 18:57:22 - issues@ofbiz - - - - All - Inherited hidden fields overide child fields when they have use-when - - - vivalinux - 2004-03-08 18:57:22 - In working with inherited forms I noticed that hidden fields are hard -to override if the overriding field has a use-when attribute: - - Since the HtmlFormRenderer gives precedence to hidden fields, and new -fields with "use-when" are only placed in front of existing fields -but not merged with, the resulting behavior is that hidden fields of -parent forms always get rendered even when the use-when condition is -true. This causes the hidden field to take precedence over the user -input when the form is submitted. - - Here is a posible solution: - -Index: components/content/src/org/ofbiz/content/widget/form/ModelForm.java -=================================================================== -RCS file: -/usr/local/cvsrepos/newriverbiz/components/content/src/org/ofbiz/content/widget/form/ModelForm.java,v -retrieving revision 1.1.1.4 -diff -u -r1.1.1.4 ModelForm.java ---- components/content/src/org/ofbiz/content/widget/form/ModelForm.java -2004/01/08 14:19:55 1.1.1.4 -+++ components/content/src/org/ofbiz/content/widget/form/ModelForm.java -2004/01/29 20:23:20 -@@ -277,15 +277,25 @@ - public ModelFormField addUpdateField(ModelFormField modelFormField) { - if (!modelFormField.isUseWhenEmpty()) { - // is a conditional field, add to the List but don't worry about -the Map -- //for adding to list, see if there is another field with that name -in the list and if so, put it before that one -+ //for adding to list, see if there is another field with that name -+ //in the list and if so, put it before that one - boolean inserted = false; - for (int i = 0; i < this.fieldList.size(); i++) { - ModelFormField curField = (ModelFormField) this.fieldList.get(i); -+ // BUG FIX: parent hidden fields are left and rendered even when they -+ // are overriden with fields that have a use-when - if (curField.getName() != null && -curField.getName().equals(modelFormField.getName())) { -- this.fieldList.add(i, modelFormField); -- inserted = true; -- break; -+ if ((curField.getFieldInfo().getFieldType() != -ModelFormField.FieldInfo.HIDDEN) && -+ (curField.getFieldInfo().getFieldType() != ModelFormField.FieldInfo.IGNORED)) { -+ this.fieldList.add(i, modelFormField); -+ inserted = true; -+ break; -+ } else { -+ curField.mergeOverrideModelFormField(modelFormField); -+ break; -+ } - } -+ //End of BUG fix - } - if (!inserted) { - this.fieldList.add(modelFormField); - - - - 59 - NEW - P1 - - Components - CVS - All - issues@ofbiz - 20040318120354 - Workflow - mbennani - not determined - DEFECT - 2004-03-09 06:47:17 - issues@ofbiz - - - - All - Serious Problem in Sub-flow Implementation: in-Memory Requester Used!! - - - mbennani - 2004-03-09 06:47:17 - I am running ofbiz almost v.3 :-) (image from late 2003 from cvs). -(subflow implementation did not change since 1.2 anyways, I believe) - -Quick Description: ------------------- -Subflows are using the in-memory requester object which -does not persist over server re-starts. This is serious one guys. - -More Description (Scenario): ---------------------------- -I have a main process with 3 steps(step1,step2-subflow,step3). A subflow -process being the second step. This second step calls another process that I -call sub. sub has 2 simple steps (substep1,substep2). - -Now, in normal time (i.e no server restart), it all works fine and my main -process runs fine, calls the subflow, subflow runs, the call returns and my -step3 of the main process runs successfully and main completes fine. - -The problem arises when say I run step 1 of main process, subflow gets -initiated, substep1 is executed, and before substep2 is executed, I stop the -server (faking a server problem..., connection lost...whatever). -When I restart the server, the subflow resumes at substep2 which executes fine, -and eventually completes the subflow process. But, step-subflow activity in the -workeffort table still shows WF_RUNNING. Therefore, my main process is hanging -there and will never move along. The waitForResult() is not executed anymore -after server restart. -This is happening in WfActivitySubFlowImplementation on runService. - -Even More Details, code wise, if you want to look at it: -------------------------------------------------------- -In a normal scenario (no server stopped), the runService of -WfActivitySubFlowImplementation eventually calls the runSync in WorkflowEngine -and then waitForResult. I put a system out message in the waiter class and I -can see my message being displayed in the console forever ("waiting..."), until -the subflow process finishes. And that's ok, that's what we want. When the -subflow process finishes, the call is returned back to the runService in -WfActivitySubFlowImplementation() and the setComplete is called, which changes -the status of my step2-subflow activity in the main process to WF_COMPLETED to -advance the main process. It also calls setResults() to propagate the results -from the subflow up to the main process. - -BUT, now if I stop my server during that wait, and restart it the call never -reachs the setComplete nor the setResults, making therefore my main process -unusable anymore. - - - ajzeneski - 2004-03-18 12:03:54 - op_sys - OS/Version - Windows 2000 - All - - - ajzeneski - 2004-03-18 12:03:54 - version - Version - Pre3.0.0 - CVS - - - - 60 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040707152609 - Entity - doogie - not determined - ENHANCEMENT - 2004-03-09 07:09:04 - issues@ofbiz - - - - All - Replace simplistic caching with complex reverse dependency resolver - - - doogie - 2004-03-09 07:09:04 - This patch removes all simple caching from GenericDelegator, and replaces -it with a stand-alone class, that handles all entity cache management. It -uses new features in the entity model, that keeps track of view entities -that are referenced by regular entities. As entities are updated, all -cached lists of views or condition caches are cleared. - -With this patch applied, view entities can be cached, without worry that -they will become stale. Which then allows very complex views to be -created, that emulate complex code patterns, while still allowing for -caching. This can speed up code tremendously. - -Additionally, since cache clearing now works, it almost always makes more -sense to use the cache variation of the methods. - - - doogie - 2004-03-09 07:14:24 - Created an attachment (id=16) -The patch - - - - doogie - 2004-04-29 15:44:46 - This patch is on hold, until some other patches are committed. Some of them -need to have bugs filed, which I am working on. Plus, this patch needs to be -updated to the latest code base(not a big task, done locally). - - - doogie - 2004-07-07 15:26:09 - This is now in cvs. - - - text/plain - 16 - 2004-03-09 07:14:24 - The patch - 1 - EntityCache.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/16/EntityCache.patch - - - doogie - 2004-03-09 07:14:24 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=16) -The patch - - - - doogie - 2004-04-29 15:44:46 - issue_status - Status - NEW - STARTED - - - doogie - 2004-04-29 16:16:01 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-07-07 15:26:09 - issue_status - Status - STARTED - RESOLVED - - - doogie - 2004-07-07 15:26:09 - resolution - Resolution - - FIXED - - - - 61 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422222023 - Product - doogie - not determined - FEATURE - 2004-03-09 07:18:26 - issues@ofbiz - - - - All - Allow for easier extension of this class. - - - doogie - 2004-03-09 07:18:26 - This patch makes a protected writeValues() method, which allows sub-classes -to redirect the output to other places, as needed. - - - doogie - 2004-03-09 07:18:49 - Created an attachment (id=17) -The patch - - - - doogie - 2004-04-22 22:20:23 - Applied the patch. - - - text/plain - 17 - 2004-03-09 07:18:49 - The patch - 1 - EntitySaxReader-extension.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/17/EntitySaxReader-extension.patch - - - doogie - 2004-03-09 07:18:49 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=17) -The patch - - - - doogie - 2004-04-22 22:20:23 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:20:23 - resolution - Resolution - - FIXED - - - - 62 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422223418 - Entity - doogie - not determined - FEATURE - 2004-03-09 07:34:07 - issues@ofbiz - - - - All - Allow for UPPER() and LOWER() sorting - - - doogie - 2004-03-09 07:34:07 - See $summary. - - - doogie - 2004-03-09 07:34:26 - Created an attachment (id=18) -The patch. - - - - doogie - 2004-04-22 22:34:18 - Applied patch. - - - text/plain - 18 - 2004-03-09 07:34:26 - The patch. - 1 - EntityUtil-UPPER_LOWER.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/18/EntityUtil-UPPER_LOWER.patch - - - doogie - 2004-03-09 07:34:26 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=18) -The patch. - - - - doogie - 2004-04-22 22:34:18 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:34:18 - resolution - Resolution - - FIXED - - - - 63 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040429160209 - Entity - doogie - not determined - FEATURE - 2004-03-09 07:36:19 - issues@ofbiz - - - - All - Add support for turning off schemas completely - - - doogie - 2004-03-09 07:36:19 - See $summary. - - - doogie - 2004-03-09 07:36:42 - Created an attachment (id=19) -The patch - - - - doogie - 2004-04-29 16:02:09 - Applied this patch. - - - text/plain - 19 - 2004-03-09 07:36:42 - The patch - 1 - use-schemas.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/19/use-schemas.patch - - - doogie - 2004-03-09 07:36:42 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=19) -The patch - - - - doogie - 2004-04-29 16:02:09 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-29 16:02:09 - resolution - Resolution - - FIXED - - - - 64 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422222810 - Entity - doogie - not determined - FEATURE - 2004-03-09 07:43:55 - issues@ofbiz - - - - All - Make the code look like the rest of the file. - - - doogie - 2004-03-09 07:43:55 - See $summary. - - - doogie - 2004-03-09 07:44:21 - Created an attachment (id=20) -The patch - - - - doogie - 2004-04-22 22:28:10 - Applied patch. - - - text/plain - 20 - 2004-03-09 07:44:21 - The patch - 1 - SqlJdbcUtil-Cast.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/20/SqlJdbcUtil-Cast.patch - - - doogie - 2004-03-09 07:44:21 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=20) -The patch - - - - doogie - 2004-04-22 22:28:10 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:28:10 - resolution - Resolution - - FIXED - - - - 65 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040429163146 - Entity - doogie - not determined - ENHANCEMENT - 2004-03-09 07:46:14 - issues@ofbiz - - - - All - Add java.util.Date support. - - - doogie - 2004-03-09 07:46:14 - See $summary. - - - doogie - 2004-03-09 07:46:39 - Created an attachment (id=21) -The patch - - - - doogie - 2004-04-29 16:31:46 - Applied the patch. - - - text/plain - 21 - 2004-03-09 07:46:39 - The patch - 1 - SqlJdbcUtil-Java_Util_Date.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/21/SqlJdbcUtil-Java_Util_Date.patch - - - doogie - 2004-03-09 07:46:39 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=21) -The patch - - - - doogie - 2004-04-29 16:16:03 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 16:31:45 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-29 16:31:45 - resolution - Resolution - - FIXED - - - - 66 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422221943 - Entity - doogie - not determined - FEATURE - 2004-03-09 07:47:46 - issues@ofbiz - - - - All - Use UtilValidate.isNotEmpty. - - - doogie - 2004-03-09 07:47:46 - See $summary. - - - doogie - 2004-03-09 07:48:06 - Created an attachment (id=22) -The patch - - - - doogie - 2004-04-22 22:19:43 - Applied patch, which uses UtilValidate.isNotEmpty in SqlJdbcUtil. - - - text/plain - 22 - 2004-03-09 07:48:06 - The patch - 1 - SqlJdbcUtil-UtilValidate.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/22/SqlJdbcUtil-UtilValidate.patch - - - doogie - 2004-03-09 07:48:06 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=22) -The patch - - - - doogie - 2004-04-22 22:19:43 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:19:43 - resolution - Resolution - - FIXED - - - - 67 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040429161604 - Entity - doogie - not determined - ENHANCEMENT - 2004-03-09 07:49:20 - issues@ofbiz - - - - All - Add support for <constraint> on relations and views. - - - doogie - 2004-03-09 07:49:20 - When defining a view or relation, you can now constrain the returned -values to those that match an EntityCondition. This is really helpful -for complex views. - - - doogie - 2004-03-09 07:49:42 - Created an attachment (id=23) -The patch - - - - text/plain - 23 - 2004-03-09 07:49:42 - The patch - 1 - model-constraint.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/23/model-constraint.patch - - - doogie - 2004-03-09 07:49:42 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=23) -The patch - - - - doogie - 2004-04-29 16:16:04 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - - 68 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040423074926 - Entity - doogie - not determined - FEATURE - 2004-03-09 07:51:20 - issues@ofbiz - - - - All - Use a NumberFormat for casting number objects to strings. - - - doogie - 2004-03-09 07:51:20 - See $summary. - - - doogie - 2004-03-09 07:51:40 - Created an attachment (id=24) -The patch - - - - doogie - 2004-04-23 07:49:26 - Applied patch. - - - text/plain - 24 - 2004-03-09 07:51:40 - The patch - 1 - GenericEntity-NumberFormat.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/24/GenericEntity-NumberFormat.patch - - - doogie - 2004-03-09 07:51:40 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=24) -The patch - - - - doogie - 2004-04-23 07:49:26 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-23 07:49:26 - resolution - Resolution - - FIXED - - - - 69 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040423075223 - Entity - doogie - not determined - FEATURE - 2004-03-09 07:52:20 - issues@ofbiz - - - - All - Add addToXmlElement method - - - doogie - 2004-03-09 07:52:20 - See $summary. - - - doogie - 2004-03-09 07:52:42 - Created an attachment (id=25) -The patch - - - - doogie - 2004-04-23 07:52:23 - Applied patch. - - - text/plain - 25 - 2004-03-09 07:52:42 - The patch - 1 - GenericEntity-addToXmlElement.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/25/GenericEntity-addToXmlElement.patch - - - doogie - 2004-03-09 07:52:42 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=25) -The patch - - - - doogie - 2004-04-23 07:52:23 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-23 07:52:23 - resolution - Resolution - - FIXED - - - - 70 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422221512 - Entity - doogie - not determined - DEFECT - 2004-03-09 07:54:40 - issues@ofbiz - - - - All - Fix modelEntity dereferencing - - - doogie - 2004-03-09 07:54:40 - When GenericEntities have been deserialized, modelEntity will be null. -getModelEntity() should be called, to repopulate it. - - - doogie - 2004-03-09 07:54:57 - Created an attachment (id=26) -The patch - - - - doogie - 2004-04-22 22:15:12 - Applied patch, plus fixed it in a few other areas. - - - text/plain - 26 - 2004-03-09 07:54:57 - The patch - 1 - GenericEntity-getModelEntity.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/26/GenericEntity-getModelEntity.patch - - - doogie - 2004-03-09 07:54:57 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=26) -The patch - - - - doogie - 2004-04-22 22:15:12 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:15:12 - resolution - Resolution - - FIXED - - - - 71 - NEW - P4 - - Components - CVS - All - issues@ofbiz - 20040501214447 - Content - doogie - not determined - ENHANCEMENT - 2004-03-09 07:56:46 - issues@ofbiz - - - - All - Factor out the code - - - doogie - 2004-03-09 07:56:46 - See $summary. - - - doogie - 2004-03-09 07:57:40 - Created an attachment (id=27) -The patch. - - - - doogie - 2004-04-29 19:57:51 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:06:43 - Not adding this patch, breaks the Server Stats Since Start page in WebTools, and not totally sure the -cleanup is worth it yet. - - - doogie - 2004-05-01 21:44:47 - I'll fix that page then, and submit a revised patch. - - - text/plain - 27 - 2004-03-09 07:57:40 - The patch. - 1 - ServerHitBin-factor.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/27/ServerHitBin-factor.patch - - - doogie - 2004-03-09 07:57:40 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=27) -The patch. - - - - doogie - 2004-04-29 16:16:02 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 19:57:51 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:07:05 - priority - Priority - P2 - P4 - - - - 72 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422223139 - Entity - doogie - not determined - FEATURE - 2004-03-09 08:04:05 - issues@ofbiz - - - - All - Add a matches(condition) helper method. - - - doogie - 2004-03-09 08:04:05 - See $summary. - - - doogie - 2004-03-09 08:04:31 - Created an attachment (id=28) -The patch - - - - doogie - 2004-04-22 22:31:39 - Applied patch. - - - text/plain - 28 - 2004-03-09 08:04:31 - The patch - 1 - GenericEntity-matches-condition.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/28/GenericEntity-matches-condition.patch - - - doogie - 2004-03-09 08:04:31 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=28) -The patch - - - - doogie - 2004-04-22 22:31:39 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:31:39 - resolution - Resolution - - FIXED - - - - 73 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422221835 - Entity - doogie - not determined - DEFECT - 2004-03-09 08:05:30 - issues@ofbiz - - - - All - Fix deserializing of these objects. - - - doogie - 2004-03-09 08:05:30 - See $summary. - - - doogie - 2004-03-09 08:05:51 - Created an attachment (id=29) -The patch. - - - - doogie - 2004-04-22 22:18:35 - Applied patch, which set delegatorName to "default" when it is null. - - - text/plain - 29 - 2004-03-09 08:05:50 - The patch. - 1 - GenericDelegator-fix-serialization.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/29/GenericDelegator-fix-serialization.patch - - - doogie - 2004-03-09 08:05:51 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=29) -The patch. - - - - doogie - 2004-04-22 22:18:35 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:18:35 - resolution - Resolution - - FIXED - - - - 74 - NEW - P2 - - Components - CVS - All - issues@ofbiz - 20040429200642 - Order - doogie - not determined - ENHANCEMENT - 2004-03-09 08:08:00 - issues@ofbiz - - - - All - Fix all fetchers of shopping cart to use a static method - - - doogie - 2004-03-09 08:08:00 - This patch fixes all code that fetches the ShoppingCart from the session, -to use a static method instead. It also adds the beginning of named -ShoppingCart support. - - - doogie - 2004-03-09 08:08:22 - Created an attachment (id=30) -The patch. - - - - doogie - 2004-04-29 19:57:51 - Changing priority, so that someone else can see the ones I want applied next. - - - doogie - 2004-04-29 20:05:04 - This patch depends on EntityCache, which isn't ready for inclussion yet, -reducing priority. - - - doogie - 2004-04-29 20:06:42 - Oops, modified wrong issue. - - - text/plain - 30 - 2004-03-09 08:08:22 - The patch. - 1 - ShoppingCart-getShoppingCart.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/30/ShoppingCart-getShoppingCart.patch - - - doogie - 2004-03-09 08:08:22 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=30) -The patch. - - - - doogie - 2004-04-29 16:16:03 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 19:57:51 - priority - Priority - P3 - P2 - - - doogie - 2004-04-29 20:05:04 - priority - Priority - P2 - P3 - - - doogie - 2004-04-29 20:06:41 - priority - Priority - P3 - P2 - - - - 75 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429171641 - Base - doogie - not determined - ENHANCEMENT - 2004-03-09 08:09:21 - issues@ofbiz - - - - All - Allow code to detect whether a cacheline has expired. - - - doogie - 2004-03-09 08:09:21 - See $summary. - - - doogie - 2004-03-09 08:09:41 - Created an attachment (id=31) -The patch - - - - doogie - 2004-04-29 16:57:47 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:16:41 - Now in CVS, thanks Adam. - - - text/plain - 31 - 2004-03-09 08:09:41 - The patch - 1 - UtilCache-hasExpired.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/31/UtilCache-hasExpired.patch - - - doogie - 2004-03-09 08:09:41 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=31) -The patch - - - - doogie - 2004-04-29 16:16:04 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 16:57:47 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:16:41 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:16:41 - resolution - Resolution - - FIXED - - - - 76 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429171643 - Base - doogie - not determined - ENHANCEMENT - 2004-03-09 08:10:31 - issues@ofbiz - - - - All - Allow code to get the values stored in the cache. - - - doogie - 2004-03-09 08:10:31 - See $summary. - - - doogie - 2004-03-09 08:10:58 - Created an attachment (id=32) -The patch - - - - doogie - 2004-04-29 16:57:47 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:16:43 - Now in CVS, thanks Adam. - - - text/plain - 32 - 2004-03-09 08:10:58 - The patch - 1 - UtilCache-getCacheLineValues.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/32/UtilCache-getCacheLineValues.patch - - - doogie - 2004-03-09 08:10:58 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=32) -The patch - - - - doogie - 2004-04-29 16:16:05 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 16:57:47 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:16:43 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:16:43 - resolution - Resolution - - FIXED - - - - 77 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429171648 - Base - doogie - not determined - ENHANCEMENT - 2004-03-09 08:11:52 - issues@ofbiz - - - - All - Allow registering of listeners for the various events on caches. - - - doogie - 2004-03-09 08:11:52 - See $summary. - - - doogie - 2004-03-09 08:12:13 - Created an attachment (id=33) -The patch - - - - doogie - 2004-04-29 16:57:48 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:16:48 - Now in CVS, thanks Adam. - - - text/plain - 33 - 2004-03-09 08:12:12 - The patch - 1 - UtilCache-listeners.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/33/UtilCache-listeners.patch - - - doogie - 2004-03-09 08:12:13 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=33) -The patch - - - - doogie - 2004-04-29 16:16:05 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 16:57:48 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:16:48 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:16:48 - resolution - Resolution - - FIXED - - - - 78 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040423080723 - Entity - doogie - not determined - FEATURE - 2004-03-09 08:19:59 - issues@ofbiz - - - - All - Some additional methods to manipulate the embedded cache. - - - doogie - 2004-03-09 08:19:59 - See $summary. - - - doogie - 2004-03-09 08:20:20 - Created an attachment (id=34) -The patch - - - - doogie - 2004-04-23 08:07:23 - Add some more methods to GenericValue to manipulate the cache. - - - text/plain - 34 - 2004-03-09 08:20:20 - The patch - 1 - GenericValue-EmbeddedCache.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/34/GenericValue-EmbeddedCache.patch - - - doogie - 2004-03-09 08:20:20 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=34) -The patch - - - - doogie - 2004-04-23 08:07:23 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-23 08:07:23 - resolution - Resolution - - FIXED - - - - 79 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040429200727 - Product - doogie - not determined - ENHANCEMENT - 2004-03-09 08:21:27 - issues@ofbiz - - - - All - methods to fetch the list of available catalogs. - - - doogie - 2004-03-09 08:21:27 - See $summary. - - - doogie - 2004-03-09 08:21:46 - Created an attachment (id=35) -The patch - - - - doogie - 2004-04-29 19:57:52 - Changing priority, so that someone else can see the ones I want applied next. - - - doogie - 2004-04-29 20:07:27 - This patch depends on EntityCache, which isn't ready for inclussion yet, -reducing priority. - - - text/plain - 35 - 2004-03-09 08:21:46 - The patch - 1 - CatalogWorker-getCatalogsAvailable.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/35/CatalogWorker-getCatalogsAvailable.patch - - - doogie - 2004-03-09 08:21:46 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=35) -The patch - - - - doogie - 2004-04-29 16:16:05 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 19:57:52 - priority - Priority - P3 - P2 - - - doogie - 2004-04-29 20:07:27 - priority - Priority - P2 - P3 - - - - 80 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040422222535 - Entity - doogie - not determined - DEFECT - 2004-03-09 08:22:53 - issues@ofbiz - - - - All - Create a separate makeIndexName helper method. - - - doogie - 2004-03-09 08:22:53 - This patch also truncates the index name, based on the clipping value. - - - doogie - 2004-03-09 08:23:14 - Created an attachment (id=36) -The patch - - - - doogie - 2004-04-22 22:25:35 - Applied patch. - - - text/plain - 36 - 2004-03-09 08:23:14 - The patch - 1 - DatabaseUtil-makeIndexName.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/36/DatabaseUtil-makeIndexName.patch - - - doogie - 2004-03-09 08:23:14 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=36) -The patch - - - - doogie - 2004-04-22 22:25:35 - issue_status - Status - NEW - RESOLVED - - - doogie - 2004-04-22 22:25:35 - resolution - Resolution - - FIXED - - - - 81 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429172408 - Base - doogie - not determined - ENHANCEMENT - 2004-03-09 08:23:52 - issues@ofbiz - - - - All - Add support for writing elements. - - - doogie - 2004-03-09 08:23:52 - See $summary. - - - doogie - 2004-03-09 08:24:13 - Created an attachment (id=37) -The patch - - - - doogie - 2004-04-29 16:57:47 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:24:08 - Now in CVS, thanks Adam. - - - text/plain - 37 - 2004-03-09 08:24:12 - The patch - 1 - UtilXml-writeElement.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/37/UtilXml-writeElement.patch - - - doogie - 2004-03-09 08:24:13 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=37) -The patch - - - - doogie - 2004-04-29 16:16:03 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 16:57:47 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:24:08 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:24:08 - resolution - Resolution - - FIXED - - - - 82 - NEW - P2 - - Components - CVS - All - issues@ofbiz - 20040429195752 - Party - doogie - not determined - ENHANCEMENT - 2004-03-09 08:25:06 - issues@ofbiz - - - - All - Services/etc for manipulating PartyAttributes. - - - doogie - 2004-03-09 08:25:06 - See $summary. - - - doogie - 2004-03-09 08:25:27 - Created an attachment (id=38) -The patch - - - - doogie - 2004-04-29 19:57:52 - Changing priority, so that someone else can see the ones I want applied next. - - - text/plain - 38 - 2004-03-09 08:25:27 - The patch - 1 - PartyAttributes.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/38/PartyAttributes.patch - - - doogie - 2004-03-09 08:25:27 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=38) -The patch - - - - doogie - 2004-04-29 16:16:04 - issue_type - Issue Type - FEATURE - ENHANCEMENT - - - doogie - 2004-04-29 19:57:52 - priority - Priority - P3 - P2 - - - - 83 - NEW - P5 - - Components - CVS - All - issues@ofbiz - 20040309095844 - Content - jacopo - not determined - DEFECT - 2004-03-09 09:58:44 - issues@ofbiz - - - - All - Problems displaying the Euro symbol in order confirmation by email with MS Outlook - - - jacopo - 2004-03-09 09:58:44 - Problems displaying the Euro symbol in order confirmation by email with MS -Outlook: instead of the beautyful Euro symbol you see a '?'. -Ok, maybe I should create an issue to the Microsoft issue tracker... however -I've reported this for two reasons: -1) other users reported this some time ago in the mailing lists -2) maybe, in general, for the currency symbols in ftl templates we should use -the html entity references (i.e. &euro; for the Euro symbol): this will solve -all the display problems with virtually any client software. - - - - 84 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040309101202 - Product - jacopo - not determined - ENHANCEMENT - 2004-03-09 10:12:02 - issues@ofbiz - - - - All - In shipment, it's possible to issue to shipment items with negative reservations (atp < 0); as a consequence of this, also the inventory items' quantity on hand can be negative. - - - jacopo - 2004-03-09 10:12:02 - In shipment, it's possible to issue to shipment items with negative -reservations (atp < 0); as a consequence of this, also the inventory items' -quantity on hand can be negative. -In fact, when the issuance is performed, the (negative) reservation is deleted -and a new issuance is created and the inventory's qoh is decremented. -In my opinion, in this situation a warning message should be provided. -Also, David Jones has suggested to create a report of all negative QOH -InventoryItems and add a link for each one to get a physical inventory variance -started. - - - - 85 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040730212116 - Party - jonesde - not determined - ENHANCEMENT - 2004-03-11 08:14:35 - issues@ofbiz - - - - All - The showvisits page in the Party Manager is very slow when there are many visits - - - jonesde - 2004-03-11 08:14:35 - The showvisits page is not coded to efficiently display a subset of the visits when there are many active. -When there are tens of thousands the current code doesn't work very efficiently. - - - ajzeneski - 2004-07-30 21:21:16 - The code for visit display utilized the entity list iterator and pulls a subset for each page. The query -fields are indexed (as of now) so depending on the JDBC driver being used this should be quite efficient. -If you experience further problems, send more information to the DEV list. - - - ajzeneski - 2004-03-18 12:04:04 - version - Version - Pre3.0.0 - CVS - - - ajzeneski - 2004-07-30 21:21:16 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 21:21:16 - resolution - Resolution - - INVALID - - - - 86 - NEW - P4 - - Components - CVS - All - issues@ofbiz - 20040312164734 - Content - jonesde - not determined - PATCH - 2004-03-12 16:45:26 - issues@ofbiz - - - - All - Error Message (esp Map) Improvements from Quake Wang - - - jonesde - 2004-03-12 16:45:26 - A description from an email from Quake: - -================================ -David, - The attachment is my patch. The main changes are: - -1. Now the event and the service invoke will use the same message fields in SimpleMethod. -2. Add the errorMessageMap and successMessageMap for the message handling - - I only change the envsetup.bsh and errormsg.ftl in the ecommerce component, please use the -ecommerce to review the backward compatiblity. - -Regards -Quake -============================= - - - jonesde - 2004-03-12 16:47:34 - Created an attachment (id=39) -Error Message patch from Quake Wang - - - - text/plain - 39 - 2004-03-12 16:47:34 - Error Message patch from Quake Wang - 1 - quake.errormessages.patch - 3 - jonesde - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/39/quake.errormessages.patch - - - jonesde - 2004-03-12 16:47:34 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=39) -Error Message patch from Quake Wang - - - - - 87 - NEW - P3 - - Base - CVS - All - issues@ofbiz - 20040312165745 - Base - doogie - not determined - DEFECT - 2004-03-12 16:56:52 - issues@ofbiz - - - - All - bsf.jar in base is old - - - doogie - 2004-03-12 16:56:52 - bsf is no longer part of IBM. Instead, it has moved to jakarta. - -Attached patch changes imports, etc. It can't change the bsf.jar in -base/lib/scripting/, however. - - - doogie - 2004-03-12 16:57:45 - Created an attachment (id=40) -The patch. - - - - text/plain - 40 - 2004-03-12 16:57:45 - The patch. - 1 - IBM-Jakarta-BSF.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/40/IBM-Jakarta-BSF.patch - - - doogie - 2004-03-12 16:57:45 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=40) -The patch. - - - - - 88 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040312165737 - Order - jonesde - not determined - DEFECT - 2004-03-12 16:57:37 - issues@ofbiz - - - - All - Promotion/other adjustments not as expected when cancelling order items - - - jonesde - 2004-03-12 16:57:37 - When order items are cancelled some order level adjustments are not changed, like order level -promotion adjustments. Because of this order totals can easily become negative. The question is what -to do about it? - -Andy wrote this at one point in an email: - -============================ -I was aware of this; the only order level adjustments which are currently re-calculated are shipping and -tax, order level promotions are not done at this time so we will need to add this in. In order to do this -promotion evaluation will need to be able to be done without a shopping cart. -============================ - -I'm not sure I totally agree with this, I think short of that it would still be good to at least pro-rate these -order adjustments like we do with tax and shipping. - -Or would it be better on any order change to just cancel the order and create a new one with full re- -calculations, including promotions, tax, shipping, etc, etc? If that is done should we apply promotions, -etc as if it was the original order date, or using today's date? (could be a big difference based on -promotions that come and go over time) - - - - 89 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040312171315 - Product - jonesde - not determined - PATCH - 2004-03-12 17:10:18 - issues@ofbiz - - - - All - In product detail show variant prices (from Brian Johnson) - - - jonesde - 2004-03-12 17:10:18 - Here is a description from an email from Brian Johnson: - -=================================== -I've changed productdetail to better handle variants with different prices. When you first bring-up the -page it says "make selections", then when you select the features from the drop-downs it'll show the -price for the product with those features. --- -Brian Johnson -=================================== - - - jonesde - 2004-03-12 17:13:15 - Created an attachment (id=41) -Show prices for variants along with drop down, patch from Brian Johnson - - - - text/plain - 41 - 2004-03-12 17:13:15 - Show prices for variants along with drop down, patch from Brian Johnson - 1 - productdetail-variantprices.patch - 3 - jonesde - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/41/productdetail-variantprices.patch - - - jonesde - 2004-03-12 17:11:11 - issue_type - Issue Type - DEFECT - PATCH - - - jonesde - 2004-03-12 17:13:15 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=41) -Show prices for variants along with drop down, patch from Brian Johnson - - - - - 90 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040312172159 - E-Commerce - jonesde - not determined - FEATURE - 2004-03-12 17:21:59 - issues@ofbiz - - - - All - Web/order/etc marketing reports like Core Metrics - - - jonesde - 2004-03-12 17:21:59 - The feature here is to create a standard set of reports commonly used to keep tabs on a web content -and/or ecommerce site. These reports would be similar to what a company like Core Metrics offers. - -Would include reports for a given time period such as for things like hits, visits/sessions, orders, -tracking codes, percent of customers that order, orders per customer, pages/products/etc viewed, -searches done, referring sites & search strings, etc, etc, etc. - - - - 91 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040315011245 - Product - jacopo - not determined - DEFECT - 2004-03-15 01:12:45 - issues@ofbiz - - - - All - Shipment: potential problem when issuing negative reservations (quantityNotAvailable could be lost) - - - jacopo - 2004-03-15 01:12:45 - This is a potential problem when you issue negative reservation to a shipment. -Here is the scenario: - -1) inventory item 9000 for product WG-1111 with atp/qoh = 10/10 -2) two orders are received for WG-1111: the first for 8 items, the second -for 5 items -3) two reservations are made: the first for 8 items and the second for 5 -items but with quantityNotAvailable = 3 -4) the inventory item 9000 is now: atp/qoh = -3/10 -5) only the second order is issued to shipment: the reservation record is -deleted and the qoh is decremented -6) the inventory item 9000 is now: atp/qoh = -3/5 but the reservation for -the first order (for quantity = 8) has quantityNotAvailable = 0 (ERROR: it -should be 3) - -A possible patch: if we issue a negative reservation we should try to assign -the quantityNotAvailable to another reservation in the same inventory item. - -In order to do this, David Jones has proposed to do a re-reservation whenever a -reservation is issued to a shipment, considering that (like in this scenario) -shipments may occur in a different order than reservations. - -In fact, when new inventory is received a re-reservation is already done for -all OIIR that are associated to inventory items (of the same product) that have -negative ATP. -In a similar way, when we issue a OIIR, we could do a re-reservation for all -the OIIR associated to the inventory item. - - - - 92 - RESOLVED - P3 - FIXED - Components - CVS - All - jonesde - 20040416115022 - E-Commerce - holivier - not determined - PATCH - 2004-03-16 06:35:41 - issues@ofbiz - - - - All - Simple Update for localization - - - holivier - 2004-03-16 06:35:41 - In the ecommerce component -2 UiLabels change (the # is now in the label) -and some french UiLabel correction - - - holivier - 2004-03-16 06:38:00 - Created an attachment (id=42) -the Ecommerce UiLabel patch - - - - jonesde - 2004-04-16 11:50:22 - Patch is in CVS. Thanks for doing these Olivier. - - - text/plain - 42 - 2004-03-16 06:38:00 - the Ecommerce UiLabel patch - 1 - EcommerceUiLabel.update.patch - 165 - holivier - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/42/EcommerceUiLabel.update.patch - - - holivier - 2004-03-16 06:38:00 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=42) -the Ecommerce UiLabel patch - - - - ajzeneski - 2004-03-18 12:04:15 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-04-16 11:50:22 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-16 11:50:22 - resolution - Resolution - - FIXED - - - - 93 - RESOLVED - P3 - FIXED - Components - CVS - All - jonesde - 20040416115029 - Order - holivier - not determined - PATCH - 2004-03-16 08:00:55 - issues@ofbiz - - - - All - Simple Update for localization - - - holivier - 2004-03-16 08:00:55 - Order component, some french UiLabels correction - - - holivier - 2004-03-16 08:02:07 - Created an attachment (id=43) -The OrderUilabel properties patch file - - - - jonesde - 2004-04-16 11:50:29 - Patch is in CVS. Thanks for doing these Olivier. - - - text/plain - 43 - 2004-03-16 08:02:07 - The OrderUilabel properties patch file - 1 - OrderUilabelCorrection.patch - 165 - holivier - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/43/OrderUilabelCorrection.patch - - - holivier - 2004-03-16 08:02:07 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=43) -The OrderUilabel properties patch file - - - - ajzeneski - 2004-03-18 12:04:26 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-04-16 11:50:29 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-16 11:50:29 - resolution - Resolution - - FIXED - - - - 94 - RESOLVED - P3 - FIXED - Components - CVS - All - jonesde - 20040416115037 - Party - holivier - not determined - PATCH - 2004-03-16 09:28:27 - issues@ofbiz - - - - All - Simple Update for localization - - - holivier - 2004-03-16 09:28:27 - simple french correction & translation in the Party and workeffort components - - - holivier - 2004-03-16 09:29:26 - Created an attachment (id=44) -the PartyUiLabel correction patch file - - - - holivier - 2004-03-16 09:30:03 - Created an attachment (id=45) -the workeffortUilabel correction patch file - - - - jonesde - 2004-04-16 11:50:37 - Patch is in CVS. Thanks for doing these Olivier. - - - text/plain - 44 - 2004-03-16 09:29:26 - the PartyUiLabel correction patch file - 1 - PartyUiLabelCorrection040316.patch - 165 - holivier - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/44/PartyUiLabelCorrection040316.patch - - - text/plain - 45 - 2004-03-16 09:30:03 - the workeffortUilabel correction patch file - 1 - WorkeffortUiLabelCorrection040316.patch - 165 - holivier - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/45/WorkeffortUiLabelCorrection040316.patch - - - holivier - 2004-03-16 09:29:26 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=44) -the PartyUiLabel correction patch file - - - - holivier - 2004-03-16 09:30:03 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=45) -the workeffortUilabel correction patch file - - - - ajzeneski - 2004-03-18 12:04:35 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-04-16 11:50:37 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-16 11:50:37 - resolution - Resolution - - FIXED - - - - 95 - RESOLVED - P3 - FIXED - Components - CVS - All - jonesde - 20040416115047 - Product - holivier - not determined - PATCH - 2004-03-16 09:32:59 - issues@ofbiz - - - - All - Simple Update for localization - - - holivier - 2004-03-16 09:32:59 - Product components internationalization and the UiLabel files associated - - - holivier - 2004-03-16 09:36:08 - Created an attachment (id=46) -the patch file for produt bsh, xml, ftl and properties - - - - jonesde - 2004-04-16 11:50:47 - Patch is in CVS. Thanks for doing these Olivier. - - - text/plain - 46 - 2004-03-16 09:36:08 - the patch file for produt bsh, xml, ftl and properties - 1 - ProductUiLabelMigration040316.patch - 165 - holivier - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/46/ProductUiLabelMigration040316.patch - - - holivier - 2004-03-16 09:36:08 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=46) -the patch file for produt bsh, xml, ftl and properties - - - - ajzeneski - 2004-03-18 12:04:46 - version - Version - Pre3.0.0 - CVS - - - jonesde - 2004-04-16 11:50:47 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-16 11:50:47 - resolution - Resolution - - FIXED - - - - 96 - RESOLVED - P3 - FIXED - Components - CVS - All - jonesde - 20040730204543 - Security Extensions - holivier - not determined - PATCH - 2004-03-16 13:30:49 - issues@ofbiz - - - - All - Typo error correction in emailPassword (bcc in place of cc) - - - holivier - 2004-03-16 13:30:49 - just a simple typo correction.In the emailPassword method when reading and -populated the service fields they was an error. - serviceContext.put("sendBcc", productStoreEmail.get("ccAddress")); -I have change cc to bcc - - - holivier - 2004-03-16 13:31:26 - Created an attachment (id=47) -the patch file - - - - ajzeneski - 2004-07-30 20:45:43 - this has already been fixed in cvs. - - - text/plain - 47 - 2004-03-16 13:31:26 - the patch file - 1 - EmailPassword040316.patch - 165 - holivier - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/47/EmailPassword040316.patch - - - holivier - 2004-03-16 13:31:26 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=47) -the patch file - - - - ajzeneski - 2004-03-18 12:04:54 - version - Version - Pre3.0.0 - CVS - - - ajzeneski - 2004-07-30 20:45:43 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 20:45:43 - resolution - Resolution - - FIXED - - - - 97 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040527234819 - Accounting - jacopo - not determined - DEFECT - 2004-03-18 06:59:56 - issues@ofbiz - - - - All - Error when creating an invoice with billing account payment type. - - - jacopo - 2004-03-18 06:59:56 - The following error is generated when you try to create an invoice for an order -with payment type == billing account: - ----------------------------------------- -803495[ InvoiceServices.java:583:ERROR] Problems storing invoice items -org.ofbiz.entity.GenericEntityException: Exception occurred in storeAll (while i -nserting: [GenericEntity:InvoiceContactMech][createdTxStamp,2004-03-18 15:29:46. -156(java.sql.Timestamp)][invoiceId,10010(java.lang.String)][contactMechPurposeTy -peId,BILLING_LOCATION(java.lang.String)][lastUpdatedTxStamp,2004-03-18 15:29:46. -156(java.sql.Timestamp)][contactMechId,null()][createdStamp,2004-03-18 15:29:46. -977(java.sql.Timestamp)][lastUpdatedStamp,2004-03-18 15:29:46.977(java.sql.Times -tamp)] (SQL Exception while executing the following:INSERT INTO INVOICE_CONTACT_ -MECH (INVOICE_ID, CONTACT_MECH_PURPOSE_TYPE_ID, CONTACT_MECH_ID, LAST_UPDATED_ST -AMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, - ?, ?, ?) ([-5005] (at 83): Missing non-NULL value))) ----------------------------------------- - -I think I've tracked down the source of this problem: -the field contactMechId for the billing account entry in BillingAccount entity -is empty. - - - jacopo - 2004-05-26 10:12:53 - The error happens when no Billing Contact Mechanism is specified in the billing -account. -In order to fix this issue the input field "Billing Contact Mech" in the -EditBillingAccount page should be marked as mandatory. - - - - jonesde - 2004-05-27 23:48:19 - Fixed by changing the code to not try to create that record when the BillingAccount.contactMechId is -empty. - - - jonesde - 2004-05-27 23:48:18 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-27 23:48:18 - resolution - Resolution - - FIXED - - - - 98 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040322173551 - Product - jacopo - not determined - FEATURE - 2004-03-19 07:41:21 - issues@ofbiz - - - - All - New Shipment Plan feature for the shipment process. - - - jacopo - 2004-03-19 07:41:21 - New Shipment Plan feature for the shipment process. - -In order to support some of the tasks in the manufacturing industry there was -the need of some simple shipment planning functionality: we need to assign a -group of customer order items to a scheduled shipment (but without actually -picking and issuing the items from warehouse). - -The patches in the attached zip file add this functionality to the shipment ui. -This is the list of changes: - -NEW FILES (new page, within the shipment ui, for ShipmentPlan management) - -product/webapp/facility/shipment/EditShipmentPlan.ftl -product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh -product/webapp/facility/WEB-INF/pagedefs/shipment/EditShipmentPlan.xml - -PATCHES -product/webapp/facility/shipment/ShipmentTabBar.ftl (added new link to -EditShipmentPlan page) - -product/webapp/facility/shipment/ShipmentForms.xml (some new forms for the -EditShipmentPlan page) - -product/webapp/facility/WEB-INF/controller.xml (controller definitions for the -EditShipmentPlan page) - -product/webapp/facility/shipment/AddItemsFromOrder.ftl (added some info, also -fixed issues #47 and #55) -product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh (added -code to get reservations also from shipment plan) - -product/servicedef/services_shipment.xml (definitions for two new services to -add/delete entries in the Shipment Plan) -product/scripts/org/ofbiz/shipment/shipment/ShipmentSerices.xml (implementation -of the two new services) - -product/entitydef/entitygroup.xml (declaration of the new entity ShipmentPlan) -product/entitydef/entitymodel_shipment.xml (definition of the new entity -ShipmentPlan) - -product/config/ProductUiLabels.properties (some new labels) -product/config/ProductUiLabels_fr.properties (some new labels in ENGLISH) - - - jacopo - 2004-03-19 07:42:41 - Created an attachment (id=48) -The patches and new files - - - - jonesde - 2004-03-22 17:35:51 - This patch is now in place. Thanks for sending it in Jacopo. BTW, for future patches a consolidated -patch file is nice. - - - application/x-compressed - 48 - 2004-03-19 07:42:41 - The patches and new files - - ShipmentPlan.zip - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/48/ShipmentPlan.zip - - - jacopo - 2004-03-19 07:42:41 - attachments.thedata - Attachment Data - - Created an attachment (id=48) -The patches and new files - - - - jonesde - 2004-03-22 17:35:51 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-03-22 17:35:51 - resolution - Resolution - - FIXED - - - - 99 - RESOLVED - P4 - FIXED - Components - CVS - All - issues@ofbiz - 20040806160304 - Product - jacopo - not determined - PATCH - 2004-03-28 01:13:10 - issues@ofbiz - - - - All - New html report that shows inventory availability by product - - - jacopo - 2004-03-28 01:13:10 - This is a new html report (patches are in the attached zip file) for the -Facility Manager Application that shows info about stock levels and -reservations from a product point of view (instead of inventory item). -The action code is very simple (the bsh action calls a service to -compute atp and qoh per product); the report is formatted by the form widget -stuff. -It is not internationalized. -In my local setup I've added a link to it from the Inventory Item page but fell -free to modify it and put it where you want. - - - jacopo - 2004-03-28 01:14:46 - Created an attachment (id=49) -Files and patches for the new report. - - - - jonesde - 2004-08-06 16:03:04 - Okay, this is in CVS, and I added a link to it from the facility inventory items page. Thanks for sending -this over. - - - application/x-compressed - 49 - 2004-03-28 01:14:46 - Files and patches for the new report. - - inventory_report.zip - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/49/inventory_report.zip - - - jacopo - 2004-03-28 01:14:46 - attachments.thedata - Attachment Data - - Created an attachment (id=49) -Files and patches for the new report. - - - - jonesde - 2004-08-06 16:03:04 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-08-06 16:03:04 - resolution - Resolution - - FIXED - - - - 100 - RESOLVED - P3 - FIXED - Components - REL 3.0.0 - All - issues@ofbiz - 20040403232241 - E-Commerce - dlouzado - not determined - DEFECT - 2004-03-28 13:50:10 - issues@ofbiz - - - - All - crash on Shipping Information page - - - dlouzado - 2004-03-28 13:50:10 - I was logged as "admin" user and buying something on the test store on ofbiz -instance running on a standalone machine (no connection with the internet). - -I was filling the shipping information and when I clicked 'continue' the -following exception was thrown: - - -"org.ofbiz.base.util.GeneralException: JPublish execution error (BeanShell -script error: Sourced file: -C:\jtools\ofbiz\components\ecommerce\webapp\ecommerce\WEB-INF\actions\order\optionsettings.bsh -: Error in method invocation: Attempt to pass void argument (position 0) to -method: getContactMechByType : at Line: 65 : in file: -C:\jtools\ofbiz\components\ecommerce\webapp\ecommerce\WEB-INF\actions\order\optionsettings.bsh -: ContactHelper .getContactMechByType ( party , "EMAIL_ADDRESS" , false ) -BSF info: -C:\jtools\ofbiz\components\ecommerce\webapp\ecommerce\WEB-INF\actions\order\optionsettings.bsh -at line: 0 column: 0)" - - - jonesde - 2004-04-03 23:22:41 - Fixed so that "party" would exist where it is referenced there. - - - jonesde - 2004-04-03 23:22:41 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-03 23:22:41 - resolution - Resolution - - FIXED - - - - 101 - RESOLVED - P5 - FIXED - Components - CVS - All - ajzeneski - 20040730152858 - Content - eckardjf - not determined - DEFECT - 2004-04-02 09:44:46 - issues@ofbiz - - - - All - https Website Settings Ignored - - - eckardjf - 2004-04-02 09:44:46 - org.ofbiz.content.webapp.control.RequestHandler.doRequest() checks to see if a request should be -secure, but is not - and will redirect to a secure url if necessary. However, when rewriting the url to -make it secure, it does not check the website settings for the enableHttps, httpsHost and httpsPort. It -uses the global defaults from url.properties instead, which means the website settings have no effect. - - - ajzeneski - 2004-07-30 15:28:58 - this has now been corrected in CVS. - - - ajzeneski - 2004-06-30 19:43:50 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-07-30 15:28:58 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 15:28:58 - resolution - Resolution - - FIXED - - - - 102 - NEW - P4 - - Components - REL 3.0.0 - All - issues@ofbiz - 20040403233556 - Entity Extensions - jonesde - not determined - ENHANCEMENT - 2004-04-03 23:35:56 - issues@ofbiz - - - - All - Easy way to disabling Entity Sync oriented information - - - jonesde - 2004-04-03 23:35:56 - Need an easy way to disable the saving of Entity Sync oriented information such as the entity remove -information. May not want to disable the auto tx and individual timestamps because they are used in -other code that takes advantage of the fact that they are always present (though we still need to get rid -of the last updated and created timestamps that were added to various entities). - - - - 103 - RESOLVED - P1 - FIXED - Components - CVS - All - ajzeneski - 20040405070601 - Accounting - bryce_nz - not determined - DEFECT - 2004-04-05 00:05:28 - issues@ofbiz - - - - All - Nasty little error in PaymentGatewayServices - - - bryce_nz - 2004-04-05 00:05:28 - In PaymentGatewayServices.refundPayment there is a section of code for creating -the payment for the refund, then at line 1255 there is the following: - - Map result = ServiceUtil.returnSuccess(); - result.put("paymentId", "10000"); - return result; - -Obviously the payment id being returned shouldn't be hardcoded in, should read: - - Map result = ServiceUtil.returnSuccess(); - result.put("paymentId", paymentId); - return result; - - - ajzeneski - 2004-04-05 07:06:01 - This has been corrected in CVS, thank you. - - - ajzeneski - 2004-04-05 07:05:36 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-04-05 07:06:01 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 07:06:01 - resolution - Resolution - - FIXED - - - - 104 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405134511 - Workflow - elfring - not determined - FEATURE - 2004-04-05 13:22:20 - issues@ofbiz - - - - All - Job Definition - - - elfring - 2004-04-05 13:22:20 - This request might fit to the section "Service Engine Tools" on the page -"http://ofbiz.org/feature-list.html". - -Would you like to support the JDF -standard? -http://en.wikipedia.org/wiki/Job_Definition_Format - - - ajzeneski - 2004-04-05 13:45:11 - Not sure what this is supposed to be requesting. This issue contains no specific feature request. - - - ajzeneski - 2004-04-05 13:45:11 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 13:45:11 - resolution - Resolution - - INVALID - - - - 105 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405134741 - Service - elfring - not determined - FEATURE - 2004-04-05 13:28:41 - issues@ofbiz - - - - All - Support for dynamic Service Configuration - - - elfring - 2004-04-05 13:28:41 - Would you like to use a service configurator for your server? -- -http://www.cs.wustl.edu/~schmidt/ACE-papers.html -- -http://java.sun.com/j2se/1.5.0/docs/guide/jmx/tutorial/tutorialTOC.html - -Can this -request solved with JMX? -http://en.wikipedia.org/wiki/Java_Management_eXtensions - - - ajzeneski - 2004-04-05 13:47:41 - This issue contains no specific feature request. Not sure what you are requesting, so there is no way to -determine if JMX will solve the problem. - - - ajzeneski - 2004-04-05 13:47:41 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 13:47:41 - resolution - Resolution - - INVALID - - - - 106 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405134845 - WebTools - elfring - not determined - FEATURE - 2004-04-05 13:42:12 - issues@ofbiz - - - - All - Portlet Interface - - - elfring - 2004-04-05 13:42:12 - Would you like to integrate components with web portals? - -- -http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-portlet2.html -- -http://www.javaworld.net/javaworld/jw-11-2003/jw-1114-jsfredux.html -- -http://en.wikipedia.org/wiki/Portlet - - - ajzeneski - 2004-04-05 13:48:45 - Sure we would love to integrate with web portals, however this issue contains no specific feature -request. - - - ajzeneski - 2004-04-05 13:48:45 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 13:48:45 - resolution - Resolution - - INVALID - - - - 107 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405135106 - WebTools - elfring - not determined - FEATURE - 2004-04-05 13:47:12 - issues@ofbiz - - - - All - Vector graphics and XForms - - - elfring - 2004-04-05 13:47:12 - Will the application support .svgz or .x3dz files that contain XForms? - -- -http://en.wikipedia.org/wiki/Scalable_Vector_Graphics -- -http://en.wikipedia.org/wiki/X3D -- http://en.wikipedia.org/wiki/XForms -- -http://xml.apache.org/batik/ - -See also the request "XForms" in the discussion forum by -Britton LaRoche from "August 28, 2003 12:38:36 AM -GMT". -https://ofbiz.dev.java.net/servlets/ProjectForumMessageView?forumID=282&messageID=1065 - - - ajzeneski - 2004-04-05 13:51:06 - This issue contains no specific feature request. No information was provided regarding how support for -these file types is desired and where the desired functionality is needed. - - - ajzeneski - 2004-04-05 13:51:06 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 13:51:06 - resolution - Resolution - - INVALID - - - - 108 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405140048 - Rules - elfring - not determined - FEATURE - 2004-04-05 13:51:31 - issues@ofbiz - - - - All - Integration with Knowledge Representation - - - elfring - 2004-04-05 13:51:31 - What is the current state of your support for this technology? -- -http://en.wikipedia.org/wiki/Knowledge_representation -- -http://en.wikipedia.org/wiki/Expert_system - - - ajzeneski - 2004-04-05 14:00:48 - This issue is not a valid feature request, questions of this sort should be discussed on the mailing lists. -In addition, do expect readers to follow links and read articles to get your point across it is highly -unlikely that people will spent the time to research something for you. Your best bet is to read the -articles and post a question asking something specific, then your chances of getting an intelligent -response is greater. - - - ajzeneski - 2004-04-05 14:00:48 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 14:00:48 - resolution - Resolution - - INVALID - - - - 109 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405140138 - Service - elfring - not determined - FEATURE - 2004-04-05 13:52:57 - issues@ofbiz - - - - All - Open Services Gateway - - - elfring - 2004-04-05 13:52:57 - Would you like to cooperate with these service APIs so that your software can be used over these -interfaces? -http://www.osgi.org/about/faqs.asp -http://en.wikipedia.org/wiki/OSGi - - - ajzeneski - 2004-04-05 14:01:37 - This issue contains no specific feature request. - - - ajzeneski - 2004-04-05 14:01:37 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 14:01:37 - resolution - Resolution - - INVALID - - - - 110 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405140228 - Entity - elfring - not determined - FEATURE - 2004-04-05 13:56:20 - issues@ofbiz - - - - All - Content Storage API - - - elfring - 2004-04-05 13:56:20 - Would you like to support the programming interface "Content -Repository"? -http://jcp.org/en/jsr/detail?id=170 - -This topic can be perhaps combined -with requests for CVS and Subversion integration. - - - ajzeneski - 2004-04-05 14:02:28 - This issue contains no specific feature request; please see issue #108 for more suggestions. - - - ajzeneski - 2004-04-05 14:02:28 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 14:02:28 - resolution - Resolution - - INVALID - - - - 111 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405140305 - Workflow - elfring - not determined - ENHANCEMENT - 2004-04-05 14:02:16 - issues@ofbiz - - - - All - Workflow Management - - - elfring - 2004-04-05 14:02:17 - How do you think about workflow modelling patterns? -Which of them are supported by your -software? (Is cooperation with other standards like BPML besides WfMC XPDL -possible?) -http://tmitwww.tm.tue.nl/research/patterns/ - - - ajzeneski - 2004-04-05 14:03:05 - see issue #108 - - - ajzeneski - 2004-04-05 14:03:05 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 14:03:05 - resolution - Resolution - - INVALID - - - - 112 - RESOLVED - P3 - INVALID - Components - CVS - All - issues@ofbiz - 20040405141257 - Entity Extensions - elfring - not determined - ENHANCEMENT - 2004-04-05 14:07:40 - issues@ofbiz - - - - All - relationships and object mapping - - - elfring - 2004-04-05 14:07:40 - I've got the impression from the discussion about the topic "entity-engine: thoughts on extends -(IS A) pattern and relationships" that there might be something useful from other information -sources. - -1. CORBA: Relationship Service -Specification -http://www.omg.org/technology/documents/formal/relationship_service.htm - -2. -ObJectRelationalBridge -http://db.apache.org/ojb/ - -3. alternative open source -implementation for JDO -http://speedo.objectweb.org/ - -4. Citations from -CiteSeer -http://citeseer.ist.psu.edu/cis?q=object+and+relational+and+mapping+and+database - -5. -a detailed Wiki -http://en.wikipedia.org/wiki/Object_database - -Would you like to reuse -anything from those implementations and experiences? - -How does your use of the Java Open -Transaction Manager (http://jotm.objectweb.org/) fit into this picture? - - - ajzeneski - 2004-04-05 14:12:57 - No specific enhancement requested. - - - ajzeneski - 2004-04-05 14:12:57 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-04-05 14:12:57 - resolution - Resolution - - INVALID - - - - 113 - RESOLVED - P3 - WORKSFORME - Components - CVS - All - issues@ofbiz - 20040406101817 - WebTools - ajzeneski - not determined - DEFECT - 2004-04-06 07:00:29 - issues@ofbiz - - - - All - EditEntity.jsp displays wrong field length - - - ajzeneski - 2004-04-06 07:00:29 - Reported by prozelit@yahoo.com: - -On EditEntity.jsp, there is a fields table. It is -supposed to display the length of each field, but it -looks like it displays the length of the field name -instead. It seems to me there is a bug at line 347. - - - jonesde - 2004-04-06 10:18:17 - -This is the expected behavior. The length in parenthesis there is meant to show you the length of the -column name so that you can tell if it is within the required length of the database, we generally -recommend (and always use) equal or less than 30 characters. - - - jonesde - 2004-04-06 10:18:17 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-06 10:18:17 - resolution - Resolution - - WORKSFORME - - - - 114 - NEW - P3 - - Components - CVS - PC - issues@ofbiz - 20040406100126 - WorkEffort - vivalinux - not determined - PATCH - 2004-04-06 10:01:26 - issues@ofbiz - - http://<ofbiz_URL>/workeffort/control/month?start=1083297600000 - - All - Daylight savings and the calendar - - - vivalinux - 2004-04-06 10:01:26 - On the months when daylight savings takes place, or stops taking place -(April/September in the US), the way the start of the period is computed in the -WorkEffortServices.getWorkEffortsByPeriod yields one extra hour after dayligh -savings kicks in. -The reason for this is that the absolute time is interpreted differently once -daylight savings is in place. -So I suggest using the attached patch which relies on UtilDateTime.getDayStart -to get the period start/end. - - - - 115 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040730150719 - Product - lykins - not determined - FEATURE - 2004-04-06 13:56:51 - issues@ofbiz - - - - All - Product to Order Lookup Link - - - lykins - 2004-04-06 13:56:51 - Something that should bring great benefit is the ability to link the product to -the orders from the product maintenance screen. It would be very beneficial to -know what purchase order the product came from. I noticed that there are links -to almost all other relations besides this. - -Thanks, -Patrick - - - ajzeneski - 2004-07-30 15:07:19 - good idea; now in CVS - - - ajzeneski - 2004-07-30 15:07:19 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 15:07:19 - resolution - Resolution - - FIXED - - - - 116 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040417174533 - Product - jacopo - not determined - PATCH - 2004-04-17 00:19:59 - issues@ofbiz - - - - All - Implementation of getProductVariant service. - - - jacopo - 2004-04-17 00:19:59 - Implementation of getProductVariant service. - - - jacopo - 2004-04-17 00:20:48 - Created an attachment (id=50) -Patch for the java implementation - - - - jacopo - 2004-04-17 00:21:21 - Created an attachment (id=51) -Patch for the service definition. - - - - jonesde - 2004-04-17 17:45:33 - It's in. Thanks Jacopo. - - - text/plain - 50 - 2004-04-17 00:20:48 - Patch for the java implementation - 1 - ProductServices.java.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/50/ProductServices.java.patch - - - text/plain - 51 - 2004-04-17 00:21:21 - Patch for the service definition. - 1 - services.xml.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/51/services.xml.patch - - - jacopo - 2004-04-17 00:20:48 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=50) -Patch for the java implementation - - - - jacopo - 2004-04-17 00:21:21 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=51) -Patch for the service definition. - - - - jonesde - 2004-04-17 17:45:33 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-17 17:45:33 - resolution - Resolution - - FIXED - - - - 117 - RESOLVED - P1 - FIXED - Components - CVS - All - issues@ofbiz - 20040422201817 - Accounting - colt_nz - not determined - DEFECT - 2004-04-20 14:45:56 - issues@ofbiz - - - - All - editPayment has wrongly named fields - - - colt_nz - 2004-04-20 14:45:56 - /accounting/webapp/accounting/payment/editPayment.ftl - -Input fields partyIdTo and partyIdFrom are round the wrong way. ie switch 'em. - - - jonesde - 2004-04-22 20:18:17 - -Thanks for reporting this, the fix is in CVS. Looks like it was perhaps an issue with the i18n... - - - jonesde - 2004-04-22 20:18:17 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-22 20:18:17 - resolution - Resolution - - FIXED - - - - 118 - RESOLVED - P4 - FIXED - Components - CVS - All - issues@ofbiz - 20040819001212 - Product - jonesde - not determined - FEATURE - 2004-04-23 21:32:35 - issues@ofbiz - - - - All - Make QuickAddVariants Easier to Use - - - jonesde - 2004-04-23 21:32:35 - Make QuickAddVariants Easier to Use: - -1. Change to multi-form -2. Allow enter pattern to use to pre-populate the various IDs - - - jacopo - 2004-08-19 00:12:11 - Some time ago I did this and you put all the stuff in CVS, so now it's done. - - - jacopo - 2004-08-19 00:12:10 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-08-19 00:12:10 - resolution - Resolution - - FIXED - - - - 119 - RESOLVED - P2 - FIXED - Components - CVS - All - jacopo - 20040717041328 - Manufacturing - jacopo - not determined - ENHANCEMENT - 2004-04-24 00:15:36 - issues@ofbiz - - - - All - Refactoring of the BOMEvent class that manages all the related to bill of materials editing. - - - jacopo - 2004-04-24 00:15:36 - Refactoring of the BOMEvent class that manages all the related to bill of -materials editing. - -Three new (simple) services should be created (create, update, delete). -An sECA rule should be added to the create and update services to update the -low level code. - - - jacopo - 2004-07-17 04:13:28 - Ok, the BOMEvent class has gone away; I have implemented some simple services -to add/update/remove/copy boms (performing all the needed checks for loops and -updating the product's llc). - - - - jacopo - 2004-07-17 04:13:28 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-07-17 04:13:28 - resolution - Resolution - - FIXED - - - - 120 - NEW - P3 - - Components - CVS - All - jacopo - 20040424001903 - Manufacturing - jacopo - not determined - ENHANCEMENT - 2004-04-24 00:19:03 - issues@ofbiz - - - - All - searchDuplicateAncenstor service should resolve also virtual to variant products to search for loops. - - - jacopo - 2004-04-24 00:19:03 - searchDuplicateAncenstor service should resolve also virtual to variant -products to search for loops. - - - - 121 - RESOLVED - P3 - FIXED - Components - CVS - All - jacopo - 20040717041557 - Manufacturing - jacopo - not determined - ENHANCEMENT - 2004-04-24 00:24:11 - issues@ofbiz - - - - All - Refactoring of the Bill of Material editor's ui: migration to the forms widget. - - - jacopo - 2004-04-24 00:24:11 - Refactoring of the Bill of Material editor's ui: migration to the forms widget. - -This will also include: -- i18n and l10n issues -- management of all the relavant fields that are missing -- lookup fields -- fields validation - - - jacopo - 2004-07-17 04:15:57 - I have not used the form widget (maybe in the future, together with some more -clean ups) here, but most of these points has been fixed. - - - jacopo - 2004-07-17 04:15:57 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-07-17 04:15:57 - resolution - Resolution - - FIXED - - - - 122 - NEW - P3 - - Components - CVS - All - jacopo - 20040424002537 - Manufacturing - jacopo - not determined - ENHANCEMENT - 2004-04-24 00:25:37 - issues@ofbiz - - - - All - updateLowLevelCode service - it should also update the low level code for variant products - - - jacopo - 2004-04-24 00:25:37 - updateLowLevelCode service - it should also update the low level code for -variant products - - - - 123 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501062848 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:05:20 - issues@ofbiz - - - - All - Add methods to check against classes, instead of only objects. - - - doogie - 2004-04-29 16:05:20 - This patch adds new versions of interfaceOf, isOrSubOf, and instanceOf, that -check against a class, instead of an Object. - - - doogie - 2004-04-29 16:06:57 - Created an attachment (id=52) -The patch. - - - - doogie - 2004-04-29 19:57:52 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:28:48 - This is now in CVS, thanks Adam! - - - text/plain - 52 - 2004-04-29 16:06:57 - The patch. - 1 - ObjectType-check-against-class.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/52/ObjectType-check-against-class.patch - - - doogie - 2004-04-29 16:06:57 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=52) -The patch. - - - - doogie - 2004-04-29 16:15:14 - issue_type - Issue Type - DEFECT - ENHANCEMENT - - - doogie - 2004-04-29 19:57:52 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:28:48 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 06:28:48 - resolution - Resolution - - FIXED - - - - 124 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501062855 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:08:48 - issues@ofbiz - - - - All - Handle is-* operators when value1 is null - - - doogie - 2004-04-29 16:08:48 - See $summary. - - - doogie - 2004-04-29 16:09:11 - Created an attachment (id=53) -The patch - - - - doogie - 2004-04-29 19:57:53 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:28:55 - This is now in CVS, thanks Adam! - - - text/plain - 53 - 2004-04-29 16:09:11 - The patch - 1 - ObjectType-is-compare-value1-null.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/53/ObjectType-is-compare-value1-null.patch - - - doogie - 2004-04-29 16:09:11 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=53) -The patch - - - - doogie - 2004-04-29 16:15:14 - issue_type - Issue Type - DEFECT - ENHANCEMENT - - - doogie - 2004-04-29 19:57:53 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:28:55 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 06:28:55 - resolution - Resolution - - FIXED - - - - 125 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501062903 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:10:04 - issues@ofbiz - - - - All - Convert classnames to full names. - - - doogie - 2004-04-29 16:10:04 - See $summary. - - - doogie - 2004-04-29 16:10:21 - Created an attachment (id=54) -The patch. - - - - doogie - 2004-04-29 19:57:48 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:29:03 - This is now in CVS, thanks Adam! - - - text/plain - 54 - 2004-04-29 16:10:21 - The patch. - 1 - ObjectType-convert-classname-to-full.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/54/ObjectType-convert-classname-to-full.patch - - - doogie - 2004-04-29 16:10:21 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=54) -The patch. - - - - doogie - 2004-04-29 16:15:13 - issue_type - Issue Type - DEFECT - ENHANCEMENT - - - doogie - 2004-04-29 19:57:48 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:29:03 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 06:29:03 - resolution - Resolution - - FIXED - - - - 126 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501062243 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:13:25 - issues@ofbiz - - - - All - Add some helper methods for objects implementing their own equals, compareTo, and hashCode - - - doogie - 2004-04-29 16:13:25 - Name: UtilObject.patch -Prune: 1 -Description: Add some helper methods for objects implementing their own equals, -compareTo, and hashCode. -DiffStat: - base/src/base/org/ofbiz/base/util/UtilObject.java | 35 ++++++++++++++++++++++ - 1 files changed, 35 insertions(+) - - - doogie - 2004-04-29 16:13:45 - Created an attachment (id=55) -The patch. - - - - doogie - 2004-04-29 19:57:49 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:22:43 - This is now in CVS, thanks Adam! - - - text/plain - 55 - 2004-04-29 16:13:45 - The patch. - 1 - UtilObject.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/55/UtilObject.patch - - - doogie - 2004-04-29 16:13:45 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=55) -The patch. - - - - doogie - 2004-04-29 16:15:13 - issue_type - Issue Type - DEFECT - ENHANCEMENT - - - doogie - 2004-04-29 19:57:49 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:22:43 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 06:22:43 - resolution - Resolution - - FIXED - - - - 127 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501055554 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:18:14 - issues@ofbiz - - - - All - Simplify the top-level build.xml - - - doogie - 2004-04-29 16:18:14 - Name: simpler-build.xml.patch -Prune: 1 -Description: Simplifies the top-level build.xml - This patch makes use of ant 1.6 features, to automate calling of sub - build.xmls. It also adds a 'test' target; note, however, that the - listed sub build.xmls don't actually have that test target yet. -DiffStat: - build.xml | 494 ++++---------------------------------------------------------- - 1 files changed, 32 insertions(+), 462 deletions(-) - - - doogie - 2004-04-29 16:18:43 - Created an attachment (id=56) -The patch. - - - - doogie - 2004-04-29 19:57:50 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 05:55:54 - This is now in, thanks Adam! - - - text/plain - 56 - 2004-04-29 16:18:43 - The patch. - 1 - simpler-build.xml.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/56/simpler-build.xml.patch - - - doogie - 2004-04-29 16:18:43 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=56) -The patch. - - - - doogie - 2004-04-29 16:19:44 - issue_type - Issue Type - DEFECT - ENHANCEMENT - - - doogie - 2004-04-29 19:57:50 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 05:55:54 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 05:55:54 - resolution - Resolution - - FIXED - - - - 128 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501051820 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:20:39 - issues@ofbiz - - - - All - Add support for formatting time intervals with human words - - - doogie - 2004-04-29 16:20:39 - Name: UtilDateTime-time-interval.patch -Prune: 1 -Description: Add support for formatting time intervals with human words -DiffStat: - base/config/DateTimeLabels.properties | 10 ++ - base/src/base/org/ofbiz/base/util/UtilDateTime.java | 90 ++++++++++++++++++++ - 2 files changed, 100 insertions(+) - - - doogie - 2004-04-29 16:20:57 - Created an attachment (id=57) -The patch. - - - - doogie - 2004-04-29 19:57:51 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 05:18:20 - These are now in CVS, thanks Adam! - - - text/plain - 57 - 2004-04-29 16:20:57 - The patch. - 1 - UtilDateTime-time-interval.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/57/UtilDateTime-time-interval.patch - - - doogie - 2004-04-29 16:20:58 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=57) -The patch. - - - - doogie - 2004-04-29 19:57:51 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 05:18:20 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 05:18:20 - resolution - Resolution - - FIXED - - - - 129 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429172414 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:22:10 - issues@ofbiz - - - - All - Add more childElementList and firstChildElement variants. - - - doogie - 2004-04-29 16:22:10 - Name: UtilXml-childElementList-firstChildElement.patch -Prune: 1 -Depends: UtilXml-writeElement.patch -Description: Add more childElementList and firstChildElement variants. -DiffStat: - base/src/base/org/ofbiz/base/component/ComponentLoaderConfig.java - | 2 - base/src/base/org/ofbiz/base/util/UtilXml.java - | 80 ++++++++++ - components/content/src/org/ofbiz/content/widget/form/ModelFormField.java - | 4 - components/entity/src/org/ofbiz/entity/model/ModelViewEntity.java - | 2 - components/minilang/src/org/ofbiz/minilang/SimpleMethod.java - | 2 - components/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java - | 2 - components/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java - | 2 - components/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java - | 2 - components/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java -| 2 - components/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java - | 2 - components/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java - | 4 - components/minilang/src/org/ofbiz/minilang/method/otherops/Log.java - | 2 - components/minilang/src/org/ofbiz/minilang/operation/MakeInString.java - | 2 - components/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java - | 2 - 14 files changed, 95 insertions(+), 15 deletions(-) - - - doogie - 2004-04-29 16:22:50 - Created an attachment (id=58) -The patch. - - - - doogie - 2004-04-29 16:57:47 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:24:14 - Now in CVS, thanks Adam. - - - text/plain - 58 - 2004-04-29 16:22:50 - The patch. - 1 - UtilXml-childElementList-firstChildElement.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/58/UtilXml-childElementList-firstChildElement.patch - - - doogie - 2004-04-29 16:22:50 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=58) -The patch. - - - - doogie - 2004-04-29 16:57:47 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:24:14 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:24:14 - resolution - Resolution - - FIXED - - - - 130 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429174623 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:24:36 - issues@ofbiz - - - - All - put now returns the previous value of the object, if it exists - - - doogie - 2004-04-29 16:24:36 - Name: UtilCache-put-returns-object.patch -Prune: 1 -Depends: UtilCache-listeners.patch -Description: put now returns the previous value of the object, if it exists -DiffStat: - base/src/base/org/ofbiz/base/util/UtilCache.java | 16 ++++++++++------ - 1 files changed, 10 insertions(+), 6 deletions(-) - - - doogie - 2004-04-29 16:24:58 - Created an attachment (id=59) -The patch. - - - - doogie - 2004-04-29 16:57:48 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:46:23 - Now in CVS, thanks Adam. - - - text/plain - 59 - 2004-04-29 16:24:58 - The patch. - 1 - UtilCache-put-returns-object.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/59/UtilCache-put-returns-object.patch - - - doogie - 2004-04-29 16:24:58 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=59) -The patch. - - - - doogie - 2004-04-29 16:57:48 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:46:23 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:46:23 - resolution - Resolution - - FIXED - - - - 131 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040429174619 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 16:55:31 - issues@ofbiz - - - - All - Add getCacheLineKeys method. - - - doogie - 2004-04-29 16:55:31 - Name: UtilCache-getCacheLineKeys.patch -Prune: 1 -Depends: UtilCache-put-returns-object.patch -Description: Add getCacheLineKeys method. -DiffStat: - base/src/base/org/ofbiz/base/util/UtilCache.java | 4 ++++ - 1 files changed, 4 insertions(+) - - - doogie - 2004-04-29 16:55:56 - Created an attachment (id=60) -The patch. - - - - doogie - 2004-04-29 16:57:48 - Changing priority to P2, as I need these applied before I can commit my entity -cache work. - - - jonesde - 2004-04-29 17:46:19 - Now in CVS, thanks Adam. - - - text/plain - 60 - 2004-04-29 16:55:56 - The patch. - 1 - UtilCache-getCacheLineKeys.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/60/UtilCache-getCacheLineKeys.patch - - - doogie - 2004-04-29 16:55:56 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=60) -The patch. - - - - doogie - 2004-04-29 16:57:48 - priority - Priority - P3 - P2 - - - jonesde - 2004-04-29 17:46:19 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-04-29 17:46:19 - resolution - Resolution - - FIXED - - - - 132 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501051751 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 19:39:13 - issues@ofbiz - - - - All - Add entrySet(), which functions like Map.entrySet(). - - - doogie - 2004-04-29 19:39:13 - Name: UtilCache-entrySet.patch -Prune: 1 -Description: Add entrySet(), which functions like Map.entrySet(). -DiffStat: - base/src/base/org/ofbiz/base/util/UtilCache.java | 4 ++++ - 1 files changed, 4 insertions(+) - - - doogie - 2004-04-29 19:41:28 - Created an attachment (id=61) -The patch. - - - - doogie - 2004-04-29 19:57:53 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 05:17:51 - These are now in CVS, thanks Adam! - - - text/plain - 61 - 2004-04-29 19:41:27 - The patch. - 1 - UtilCache-entrySet.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/61/UtilCache-entrySet.patch - - - doogie - 2004-04-29 19:41:28 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=61) -The patch. - - - - doogie - 2004-04-29 19:57:53 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 05:17:51 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 05:17:51 - resolution - Resolution - - FIXED - - - - 133 - RESOLVED - P1 - FIXED - Base - CVS - All - issues@ofbiz - 20040501042628 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 19:42:19 - issues@ofbiz - - - - All - Add a new constructor. - - - doogie - 2004-04-29 19:42:19 - Name: UtilCache-new-constructor.patch -Prune: 1 -Depends: UtilCache-entrySet.patch -Description: Add a new constructor. -DiffStat: - base/src/base/org/ofbiz/base/util/UtilCache.java | 13 +++++++++++++ - 1 files changed, 13 insertions(+) - - - doogie - 2004-04-29 19:42:45 - Created an attachment (id=62) -The patch. - - - - doogie - 2004-04-29 19:57:48 - Changing priority, so that someone else can see the ones I want applied next. - - - doogie - 2004-04-30 10:42:15 - Changing these issuses, as they are needed by EntityCache.patch. - - - jonesde - 2004-05-01 04:26:28 - These are now in CVS, thanks Adam! - - - text/plain - 62 - 2004-04-29 19:42:45 - The patch. - 1 - UtilCache-new-constructor.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/62/UtilCache-new-constructor.patch - - - doogie - 2004-04-29 19:42:45 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=62) -The patch. - - - - doogie - 2004-04-29 19:57:48 - priority - Priority - P3 - P2 - - - doogie - 2004-04-30 10:42:15 - priority - Priority - P2 - P1 - - - jonesde - 2004-05-01 04:26:28 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 04:26:28 - resolution - Resolution - - FIXED - - - - 134 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501062248 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 19:43:49 - issues@ofbiz - - - - All - Change utilCacheTable to a WeakHashMap. - - - doogie - 2004-04-29 19:43:49 - Name: UtilCache-WeakHashMap.patch -Prune: 1 -Depends: UtilCache-new-constructor.patch -Description: Change utilCacheTable to a WeakHashMap. -DiffStat: - base/src/base/org/ofbiz/base/util/UtilCache.java | 3 ++- - 1 files changed, 2 insertions(+), 1 deletion(-) - - - doogie - 2004-04-29 19:44:39 - Created an attachment (id=63) -The patch. - - - - doogie - 2004-04-29 19:57:49 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:22:48 - This is now in CVS, thanks Adam! - - - text/plain - 63 - 2004-04-29 19:44:39 - The patch. - 1 - UtilCache-WeakHashMap.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/63/UtilCache-WeakHashMap.patch - - - doogie - 2004-04-29 19:44:39 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=63) -The patch. - - - - doogie - 2004-04-29 19:57:49 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:22:48 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 06:22:48 - resolution - Resolution - - FIXED - - - - 135 - RESOLVED - P1 - FIXED - Base - CVS - All - issues@ofbiz - 20040501042633 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 19:45:22 - issues@ofbiz - - - - All - Methods that clear a cache by name or pattern. - - - doogie - 2004-04-29 19:45:22 - Name: UtilCache-clearCache-helpers.patch -Prune: 1 -Depends: UtilCache-WeakHashMap.patch -Description: Methods that clear a cache by name or pattern. -DiffStat: - base/src/base/org/ofbiz/base/util/UtilCache.java | 22 ++++++++++++++++++++++ - 1 files changed, 22 insertions(+) - - - doogie - 2004-04-29 19:45:43 - Created an attachment (id=64) -The patch. - - - - doogie - 2004-04-29 19:57:49 - Changing priority, so that someone else can see the ones I want applied next. - - - doogie - 2004-04-30 10:42:16 - Changing these issuses, as they are needed by EntityCache.patch. - - - jonesde - 2004-05-01 04:26:33 - These are now in CVS, thanks Adam! - - - text/plain - 64 - 2004-04-29 19:45:43 - The patch. - 1 - UtilCache-clearCache-helpers.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/64/UtilCache-clearCache-helpers.patch - - - doogie - 2004-04-29 19:45:43 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=64) -The patch. - - - - doogie - 2004-04-29 19:57:49 - priority - Priority - P3 - P2 - - - doogie - 2004-04-30 10:42:16 - priority - Priority - P2 - P1 - - - jonesde - 2004-05-01 04:26:33 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 04:26:33 - resolution - Resolution - - FIXED - - - - 136 - RESOLVED - P2 - FIXED - Base - CVS - All - issues@ofbiz - 20040501064335 - Base - doogie - not determined - ENHANCEMENT - 2004-04-29 19:46:54 - issues@ofbiz - - - - All - Place the loaded document object in a UtilCache instance. - - - doogie - 2004-04-29 19:46:54 - Name: ResourceLoader-document-in-cache.patch -Prune: 1 -Depends: UtilCache-clearCache-helpers.patch -Description: Place the loaded document object in a UtilCache instance. -DiffStat: - base/src/base/org/ofbiz/base/config/ResourceLoader.java | 11 ++++------- - 1 files changed, 4 insertions(+), 7 deletions(-) - - - doogie - 2004-04-29 19:47:17 - Created an attachment (id=65) -The patch. - - - - doogie - 2004-04-29 19:57:50 - Changing priority, so that someone else can see the ones I want applied next. - - - jonesde - 2004-05-01 06:43:35 - This is now in CVS, thanks Adam! - - - text/plain - 65 - 2004-04-29 19:47:17 - The patch. - 1 - ResourceLoader-document-in-cache.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/65/ResourceLoader-document-in-cache.patch - - - doogie - 2004-04-29 19:47:17 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=65) -The patch. - - - - doogie - 2004-04-29 19:57:50 - priority - Priority - P3 - P2 - - - jonesde - 2004-05-01 06:43:35 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-01 06:43:35 - resolution - Resolution - - FIXED - - - - 137 - RESOLVED - P3 - FIXED - Components - CVS - All - ajzeneski - 20040527233355 - Accounting - sichen - not determined - DEFECT - 2004-05-03 14:48:41 - issues@ofbiz - - - - All - createInvoiceForOrder not get correct fields for terms - - - 141 - jacopo - 2004-05-26 10:48:21 - - - sichen - 2004-05-03 14:48:41 - InvoiceServices.createInvoiceForOrder is not getting correct fields for terms. -It is not automatically generating a key for InvoiceTerm entity and is also -looking for "termType" from BillingAccount when the field is actually "termTypeId." - - - sichen - 2004-05-03 14:50:09 - Created an attachment (id=66) -Patch fixes defect and allows invoices to be created correctly - - - - jacopo - 2004-05-04 00:50:17 - See also issue #97 - - - jacopo - 2004-05-26 10:48:20 - *** Issue 141 has been marked as a duplicate of this issue. *** - - - jonesde - 2004-05-27 23:33:55 - It's now in CVS, thanks to both Si Chen and Jacopo Cappellato for reporting/fixing this. - - - text/plain - 66 - 2004-05-03 14:50:09 - Patch fixes defect and allows invoices to be created correctly - 1 - InvoiceServices.java.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/66/InvoiceServices.java.patch - - - sichen - 2004-05-03 14:50:09 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=66) -Patch fixes defect and allows invoices to be created correctly - - - - jonesde - 2004-05-03 23:03:12 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - jonesde - 2004-05-27 23:33:55 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-05-27 23:33:55 - resolution - Resolution - - FIXED - - - - 138 - RESOLVED - P3 - WORKSFORME - Components - CVS - All - issues@ofbiz - 20040713022331 - Manufacturing - sichen - not determined - DEFECT - 2004-05-04 17:45:50 - issues@ofbiz - - - - Windows XP - Null delegator in FindProductRun - - - sichen - 2004-05-04 17:45:50 - I am getting a -4269781[ VisitHandler.java:130:ERROR] Could not find delegator with -delegatorName [null] in session, not creating Visit entity - -Is this a Windows problem or a bug? - -Thanks, - -Si Chen - - - sichen - 2004-05-04 17:46:33 - Created an attachment (id=67) -error log from running FindProductRun in Manufacturing - - - - jacopo - 2004-07-13 02:23:31 - I couldn't recreate this error. -However, from the log it seems something related to the Visit stuff. - - - text/plain - 67 - 2004-05-04 17:46:33 - error log from running FindProductRun in Manufacturing - - findproductrun.log - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/67/findproductrun.log - - - sichen - 2004-05-04 17:46:33 - attachments.thedata - Attachment Data - - Created an attachment (id=67) -error log from running FindProductRun in Manufacturing - - - - jacopo - 2004-07-13 02:23:31 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-07-13 02:23:31 - resolution - Resolution - - WORKSFORME - - - - 139 - NEW - P3 - - Components - CVS - All - david - 20040509064322 - E-Commerce - arukala - not determined - FEATURE - 2004-05-09 06:43:22 - issues@ofbiz - - - - All - Reading UiLable Properties in Email templates - - - arukala - 2004-05-09 06:43:22 - Hallo David, - -We are looking for your suggestions. on how should i call the UiLabel -Properties in eCommerce Email Templates. we are eager to see this feature in -email Confirmation after placing an order for customers?. suggest us how to? - - - - 140 - RESOLVED - P3 - FIXED - Components - CVS - All - jacopo - 20040518040000 - Manufacturing - jacopo - not determined - ENHANCEMENT - 2004-05-11 08:26:52 - issues@ofbiz - - - - All - Remove all the checks against the isVariant field. - - - jacopo - 2004-05-11 08:26:52 - Remove all the checks against the isVariant field: the best way to see if a -product is variant is to check the ProductAssoc entity. - - - jacopo - 2004-05-18 04:00:00 - Committed with the last changes a few days ago. - - - jacopo - 2004-05-18 04:00:00 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-05-18 04:00:00 - resolution - Resolution - - FIXED - - - - 141 - RESOLVED - P3 - DUPLICATE - Components - CVS - All - issues@ofbiz - 20040526104821 - Accounting - jacopo - not determined - PATCH - 2004-05-26 09:01:42 - issues@ofbiz - - - - All - Patch for bug in invoice creation when terms are specified for a billing account. - - - 137 - jacopo - 2004-05-26 10:48:21 - - - jacopo - 2004-05-26 09:01:42 - Patch for bug in invoice creation when terms are specified for billing account: -A wrong field name was used. -Also a non-null field was not set. - - - jacopo - 2004-05-26 09:02:49 - Created an attachment (id=68) -The patch file in UOF - - - - jacopo - 2004-05-26 10:48:21 - Ok, Si Chen had already fixed this!!! - -*** This issue has been marked as a duplicate of 137 *** - - - text/plain - 68 - 2004-05-26 09:02:49 - The patch file in UOF - 1 - InvoiceServices.java.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/68/InvoiceServices.java.patch - - - jacopo - 2004-05-26 09:02:49 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=68) -The patch file in UOF - - - - jacopo - 2004-05-26 10:48:21 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-05-26 10:48:21 - resolution - Resolution - - DUPLICATE - - - - 142 - RESOLVED - P3 - FIXED - Components - CVS - PC - ajzeneski - 20040630194530 - Party - jackhung - not determined - DEFECT - 2004-06-15 03:33:20 - issues@ofbiz - - - - Linux - Party Profile [New Communication] throws exception - - - jackhung - 2004-06-15 03:33:20 - Error: The application script threw an exception: Sourced file: -/mnt/hda6/jackwork/ofbiz3/workspace/ofbiz/components/party/webapp/partymgr/WEB-INF/actions/communication/editCommunication.bsh -: null : at Line: 47 : in file: -/mnt/hda6/jackwork/ofbiz3/workspace/ofbiz/components/party/webapp/partymgr/WEB-INF/actions/communication/editCommunication.bsh -: party .getRelatedOne ( "Person" ) Target exception: -java.lang.NullPointerException: Null Pointer in Method Invocation BSF info: -/mnt/hda6/jackwork/ofbiz3/workspace/ofbiz/components/party/webapp/partymgr/WEB-INF/actions/communication/editCommunication.bsh -at line: 0 column: 0 - - -URL: https://jhpc:18443/partymgr/control/viewCommunicationEvent?partyIdFrom=ltdadmin - -partyId = request.getParameter("party_id"); -... -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); -context.put("party", party); -context.put("lookupPerson", party.getRelatedOne("Person")); <--- - - - ajzeneski - 2004-06-30 19:45:30 - This has been fixed in CVS - - - jonesde - 2004-06-15 03:39:27 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-06-30 19:45:30 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 19:45:30 - resolution - Resolution - - FIXED - - - - 143 - NEW - P3 - - Components - CVS - All - ajzeneski - 20040630194322 - Order - sichen - not determined - FEATURE - 2004-06-17 10:51:48 - issues@ofbiz - - - - All - Allows orders to have shipBeforeDate and shipAfterDate - - - sichen - 2004-06-17 10:51:48 - Changed ShoppingCart.java and CheckoutHelper.java to allow ship before and -after dates to be set using the OrderShipmentPreference entity. -OrderServices.java is modified as well to allow these dates to go on the order -confirmation email. - - - sichen - 2004-06-17 10:53:16 - Created an attachment (id=69) -Patches ShoppingCart.java, CheckoutHelper.java, OrderServices.java, - - - - text/plain - 69 - 2004-06-17 10:53:16 - Patches ShoppingCart.java, CheckoutHelper.java, OrderServices.java, - 1 - order_dating_patch.txt - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/69/order_dating_patch.txt - - - sichen - 2004-06-17 10:53:16 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=69) -Patches ShoppingCart.java, CheckoutHelper.java, OrderServices.java, - - - - ajzeneski - 2004-06-30 19:43:22 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - ajzeneski - 2004-06-30 19:43:22 - short_desc - Summary - Allows orders to have shipBeforeDate and shipAfterDate - Allows orders to have shipBeforeDate and shipAfterDate - - - - 144 - RESOLVED - P3 - WORKSFORME - Base - CVS - PC - issues@ofbiz - 20040630194017 - Base - jackhung - not determined - DEFECT - 2004-06-18 02:57:10 - issues@ofbiz - - - - Linux - https connection broke Mozilla 1.3 and 1.4 - - - jackhung - 2004-06-18 02:57:10 - I'm getting a strange problem lately (2 days). I'm at the ecommerce's main page -and try to [Login] (url -https://www.myhost.net:8443/ecommerce/control/checkLogin/main). The -certification stuff comes up and I accepted it. On one of my system using -Mozilla 1.3, the browser popup a dialog saying: - "www.myhost.net has received an incorrect or unexpected message. Error Code: --12229" -For all subsequent attempt, the browser popup a dialog saying: - "The Document contains no data" -It appears that the browser is not sending any request to the server on -subsequent attempt. - -On another system using Mozilla 1.4, i did not get the "unexpected message", but -still got the "no data" one. - -I have an Crozilla 1.3a browser around (from the Mozilla SVG project). I tried -it and it works!! - -As a matter of fact, i'm having the same problem with any of the secure -components (webtools, partymgr, ...) - - - ajzeneski - 2004-06-30 19:40:17 - I cannot duplicate this issue with FireFox. It could be a bug in that version of mozilla. Is this still an -issue w/ the 1.5-1.7? - - - ajzeneski - 2004-06-30 19:40:17 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 19:40:17 - resolution - Resolution - - WORKSFORME - - - - 145 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040619093839 - Party - sichen - not determined - PATCH - 2004-06-18 09:57:41 - issues@ofbiz - - - - All - Fixes duplicated PartyContactMechPurposes when using updatePartyContactMech - - - sichen - 2004-06-18 09:57:41 - Fixes duplicated PartyContactMechPurposes when using updatePartyContactMech to -move a party's contact information from an old contactMechId to a -newContactMechId by checking to make sure the PartyContactMechPurpose does not -already exist. - - - sichen - 2004-06-18 09:58:34 - Created an attachment (id=70) -Patches PartyContactMechServices.xml - - - - jonesde - 2004-06-19 09:38:39 - It's in CVS now. Thanks Si. - - - text/plain - 70 - 2004-06-18 09:58:34 - Patches PartyContactMechServices.xml - 1 - PartyContactMechServices.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/70/PartyContactMechServices.patch - - - sichen - 2004-06-18 09:58:34 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=70) -Patches PartyContactMechServices.xml - - - - jonesde - 2004-06-19 09:38:39 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-06-19 09:38:39 - resolution - Resolution - - FIXED - - - - 146 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040622094557 - Party - sichen - not determined - PATCH - 2004-06-21 17:56:29 - issues@ofbiz - - - - All - Passes partyId into updatePostalAddress from updatepartyPostalAddress - - - sichen - 2004-06-21 17:56:29 - Passes partyId into updatePostalAddress from updatePartyPostalAddress, to -preserve it for updateCreditCard later. - - - sichen - 2004-06-21 17:57:02 - Created an attachment (id=71) -Passes partyId from updatePartyPostalAddress to updatePostalAddress - - - - jonesde - 2004-06-22 09:45:57 - It's in. Thanks Si Chen. - - - text/plain - 71 - 2004-06-21 17:57:02 - Passes partyId from updatePartyPostalAddress to updatePostalAddress - 1 - PartyContactMechServices.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/71/PartyContactMechServices.patch - - - sichen - 2004-06-21 17:57:02 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=71) -Passes partyId from updatePartyPostalAddress to updatePostalAddress - - - - jonesde - 2004-06-22 09:45:57 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-06-22 09:45:57 - resolution - Resolution - - FIXED - - - - 147 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040623161518 - Product - sichen - not determined - ENHANCEMENT - 2004-06-22 15:58:48 - issues@ofbiz - - - - All - Minor additions to calculateProductPrice - - - sichen - 2004-06-22 15:58:48 - Implements a "Percent of Default Price" price action for price rules and checks -both default and list prices when there is a "Promotional Price Override" price -action. - - - sichen - 2004-06-22 15:59:22 - Created an attachment (id=72) -minor additions to calculateProductPrice - - - - jonesde - 2004-06-23 16:15:18 - Okay, this patch is in. Thanks for working on this and sending it over Si. - - - text/plain - 72 - 2004-06-22 15:59:22 - minor additions to calculateProductPrice - 1 - calculateProductPrice.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/72/calculateProductPrice.patch - - - sichen - 2004-06-22 15:59:22 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=72) -minor additions to calculateProductPrice - - - - jonesde - 2004-06-23 16:15:18 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-06-23 16:15:18 - resolution - Resolution - - FIXED - - - - 148 - RESOLVED - P2 - WORKSFORME - Components - CVS - All - ajzeneski - 20040730233418 - Accounting - jacopo - not determined - DEFECT - 2004-06-23 05:42:27 - issues@ofbiz - - - - All - Duplicate invoices for the same order under some cicumstances. - - - jacopo - 2004-06-23 05:42:27 - With "Offline Payments", from the order detail page it is possible to -receive payments: when the payments cover the order's grand total an invoice -is generated; also when the shipment to which the order is issued changes -its status to PACKED an invoice is created: this can cause the creation -of two different invoices for the same order. - - - ajzeneski - 2004-07-30 21:11:52 - I cannot duplicate this problem; I attempted an offline order, received the payment - no invoice was -created; issued a quick ship a single invoice was created. Please provide more details. - - - jacopo - 2004-07-30 23:34:18 - I cannot believe... I have tried again and the problem is gone away. -However I'm totally sure (99%) that this was an issue... - - - - jonesde - 2004-06-23 16:16:30 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - jacopo - 2004-07-30 23:34:18 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-07-30 23:34:18 - resolution - Resolution - - WORKSFORME - - - - 149 - RESOLVED - P3 - FIXED - Components - CVS - All - ajzeneski - 20040818085225 - Order - jacopo - not determined - PATCH - 2004-06-26 01:51:16 - issues@ofbiz - - - - All - Patch for bug that happens when you try to cancel an order item. - - - jacopo - 2004-06-26 01:51:16 - In revision 1.30 of the services.xml file for the order component, the require- -new-transaction="true" was added to the resetGrandTotal service: this causes -problems when you cancel an order item because the resetGrandTotal is one of -the services that are triggered and it seems to hang up the process waiting for -a transaction (at least this happens with SAP-DB). - -The attached patch removes the require-new-transaction="true" parameter and -this solves the problem; however I don't know if this could cause other -problems in different parts of the system. - - - jacopo - 2004-06-26 01:51:58 - Created an attachment (id=73) -Patch in UOF - - - - jacopo - 2004-08-18 08:52:25 - The patch has been applied. - - - text/plain - 73 - 2004-06-26 01:51:58 - Patch in UOF - 1 - services.xml.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/73/services.xml.patch - - - jacopo - 2004-06-26 01:51:58 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=73) -Patch in UOF - - - - jacopo - 2004-08-18 08:52:25 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-08-18 08:52:25 - resolution - Resolution - - FIXED - - - - 150 - RESOLVED - P3 - FIXED - Components - CVS - All - ajzeneski - 20040630190556 - Order - jacopo - not determined - PATCH - 2004-06-26 01:56:29 - issues@ofbiz - - - - All - When you receive a purchase order the order lines are declared completed (also multiple times) even if it's not true. - - - jacopo - 2004-06-26 01:56:29 - The attached patch fixes two bugs that caused the problem. - - - jacopo - 2004-06-26 01:56:53 - Created an attachment (id=74) -Tha patch in UOF - - - - ajzeneski - 2004-06-30 19:05:56 - patch applied to CVS - - - text/plain - 74 - 2004-06-26 01:56:53 - Tha patch in UOF - 1 - OrderSimpleMethods.xml.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/74/OrderSimpleMethods.xml.patch - - - jacopo - 2004-06-26 01:56:53 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=74) -Tha patch in UOF - - - - ajzeneski - 2004-06-30 19:05:56 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 19:05:56 - resolution - Resolution - - FIXED - - - - 151 - RESOLVED - P3 - FIXED - Components - CVS - All - ajzeneski - 20040630224402 - Order - jacopo - not determined - PATCH - 2004-06-26 02:01:14 - issues@ofbiz - - - - All - In order entry, if no party is selected, during the checkout process some errors are generated: this patch fix the problem by disabling the checkout link if the party is missing. - - - jacopo - 2004-06-26 02:01:14 - In order entry, if no party is selected, during the checkout process some -errors are generated: this patch fix the problem by disabling the checkout link -if the party is missing. - - - jacopo - 2004-06-26 02:01:41 - Created an attachment (id=75) -Patch in UOF - - - - ajzeneski - 2004-06-30 19:19:39 - I cannot duplicate this issue; is it still a problem? - - - jacopo - 2004-06-30 22:44:02 - Hmmm, now it seems to work for me, too. -I'm wondering if something is changed during the last 10 days... I was quite -sure about this problem. -By the way, I'm going to declare resolved this issue, thanks. - - - - text/plain - 75 - 2004-06-26 02:01:41 - Patch in UOF - 1 - noparty.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/75/noparty.patch - - - jacopo - 2004-06-26 02:01:41 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=75) -Patch in UOF - - - - jacopo - 2004-06-30 22:44:02 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-06-30 22:44:02 - resolution - Resolution - - FIXED - - - - 152 - RESOLVED - P4 - LATER - Components - CVS - All - ajzeneski - 20040630192805 - Order - jacopo - not determined - PATCH - 2004-06-26 02:13:57 - issues@ofbiz - - - - All - Shipping location is missing in purchase orders: this causes problems when you try to cancel an order item. - - - jacopo - 2004-06-26 02:13:57 - In purchase order the shipping location address is not set and this causes -problems when you try to cancel order items (the shipping location is used is -some service that are triggered in this situation, such as the calcTax service -etc...). -In my opinion the best solution is to add a shipping location address to the -purchase order. -The address could be that of the facility that will receive the po. - -I have also attached a patch (not a good one, so probably you shouldn't apply -it) that fix this problem by allowing, during order entry, to select one of the -addresses of the facility that is linked to the productStore for which the -purchase order is taken: so in the checkinits page the store selection should -be enabled for purchase orders too. - - - jacopo - 2004-06-26 02:14:21 - Created an attachment (id=76) -Patch in UOF - - - - ajzeneski - 2004-06-30 19:28:05 - Sounds like there are more issues here. First off most likely tax should not be calculated for purchase -orders; nor should the same shipping charges which apply to sales orders should not apply to purchase -orders. - -I will see what I can do when working on some additional PO enhancements. - - - text/plain - 76 - 2004-06-26 02:14:20 - Patch in UOF - 1 - shipping_address.patch - 194 - jacopo - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/76/shipping_address.patch - - - jacopo - 2004-06-26 02:14:22 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=76) -Patch in UOF - - - - ajzeneski - 2004-06-30 19:28:05 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-06-30 19:28:05 - resolution - Resolution - - LATER - - - - 153 - NEW - P5 - - Components - CVS - All - ajzeneski - 20040707011403 - Service - eckardjf - not determined - DEFECT - 2004-07-05 12:19:00 - issues@ofbiz - - - - All - purgeOldJobs service leaves artifacts - - - eckardjf - 2004-07-05 12:19:00 - The purgeOldJobs service will remove qualifying JobSandbox entities, but will not remove the related -RuntimeData, RecurrenceInfo and RecurrenceRule entities (even if they are not referenced by an -existing WorkEffort). - - - jonesde - 2004-07-07 01:14:03 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - - 154 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040707150844 - Content - doogie - not determined - DEFECT - 2004-07-06 12:49:26 - issues@ofbiz - - - - All - Unknown import - - - doogie - 2004-07-06 12:49:26 - Region.java imports com.sun.rsasign.r. When compiling with jikes, this class is -not available. Removing the import, and the class compiles fine, so it's -obviously not needed. - - - doogie - 2004-07-06 12:49:58 - Created an attachment (id=77) -Remove the bad import - - - - jonesde - 2004-07-07 15:08:44 - This import has now been removed, not even sure why it was there in the first place... Thanks Adam. - - - text/plain - 77 - 2004-07-06 12:49:58 - Remove the bad import - 1 - Region.java.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/77/Region.java.patch - - - doogie - 2004-07-06 12:49:58 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=77) -Remove the bad import - - - - jonesde - 2004-07-07 15:08:44 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 15:08:44 - resolution - Resolution - - FIXED - - - - 155 - RESOLVED - P3 - FIXED - Base - CVS - All - issues@ofbiz - 20040707011249 - Base - doogie - not determined - DEFECT - 2004-07-06 14:27:26 - issues@ofbiz - - - - All - UtilCache does not allow for null keys - - - doogie - 2004-07-06 14:27:26 - UtilCache doesn't allow null keys to be stored. This is sub-optimal, and -actually causes problems with my enhanced entity cache code. Attached patch fixes. - - - doogie - 2004-07-06 14:28:17 - Created an attachment (id=78) -Allow for null keys - - - - jonesde - 2004-07-07 01:12:49 - This is now in CVS, thanks Adam! - - - text/plain - 78 - 2004-07-06 14:28:17 - Allow for null keys - 1 - UtilCache-null-key.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/78/UtilCache-null-key.patch - - - doogie - 2004-07-06 14:28:17 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=78) -Allow for null keys - - - - jonesde - 2004-07-07 01:12:49 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 01:12:49 - resolution - Resolution - - FIXED - - - - 156 - RESOLVED - P3 - FIXED - Base - CVS - All - issues@ofbiz - 20040707011312 - Base - doogie - not determined - ENHANCEMENT - 2004-07-06 14:30:09 - issues@ofbiz - - - - All - Allow specifying the expire time on put in UtilCache - - - doogie - 2004-07-06 14:30:09 - Add a new put method, that takes an expireTime parameter. - - - doogie - 2004-07-06 14:30:31 - Created an attachment (id=79) -The patch. - - - - jonesde - 2004-07-07 01:13:12 - This is now in CVS, thanks Adam! - - - text/plain - 79 - 2004-07-06 14:30:31 - The patch. - 1 - UtilCache-put-takes-expireTime.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/79/UtilCache-put-takes-expireTime.patch - - - doogie - 2004-07-06 14:30:31 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=79) -The patch. - - - - jonesde - 2004-07-07 01:13:12 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 01:13:12 - resolution - Resolution - - FIXED - - - - 157 - RESOLVED - P3 - FIXED - Base - CVS - All - issues@ofbiz - 20040707011225 - Base - doogie - not determined - ENHANCEMENT - 2004-07-06 14:35:33 - issues@ofbiz - - - - All - In UtilCache, allow for a list of property bases to be specified - - - doogie - 2004-07-06 14:35:33 - When a UtilCache instance is created, it currently will only look for a single -matching property value, by name. This patch allows for a list of base property -names to be specified, and the first one found will be used. - -I make use of this in my entity cache code. For instance: -== -Cache.entity-list.${delegator-name}.${entity-name}.expireTime=1800000 -Cache.entity-list.${delegator-name}.${entity-name}.maxSize=500 - -# high count, low access -# 5 minute cache time -Cache.entity-list.${delegator-name}.PartyAttribute=300000 -== - - - doogie - 2004-07-06 14:35:48 - Created an attachment (id=80) -The patch - - - - jonesde - 2004-07-07 01:12:25 - This is now in CVS, thanks Adam! - - - text/plain - 80 - 2004-07-06 14:35:48 - The patch - 1 - UtilCache-wildcard-config.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/80/UtilCache-wildcard-config.patch - - - doogie - 2004-07-06 14:35:48 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=80) -The patch - - - - jonesde - 2004-07-07 01:12:25 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 01:12:25 - resolution - Resolution - - FIXED - - - - 158 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040707011838 - Product - sichen - not determined - DEFECT - 2004-07-06 17:08:44 - issues@ofbiz - - - - All - distinct attribute for getProductFeatures is not working - - - sichen - 2004-07-06 17:08:44 - distinct attribute for getProductFeatures service does not work because it is -trying to use ProductFeatureType rather than ProductFeatureTypeId in -ProductServices.prodGetFeatures - - - sichen - 2004-07-06 17:16:51 - Created an attachment (id=81) -Corrects productFeatureType to productFeatureTypeId - - - - jonesde - 2004-07-07 01:18:38 - It's in CVS now, thanks Si! - - - text/plain - 81 - 2004-07-06 17:16:51 - Corrects productFeatureType to productFeatureTypeId - 1 - ProductServices_1.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/81/ProductServices_1.patch - - - sichen - 2004-07-06 17:16:51 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=81) -Corrects productFeatureType to productFeatureTypeId - - - - jonesde - 2004-07-07 01:18:38 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 01:18:38 - resolution - Resolution - - FIXED - - - - 159 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040707012137 - Product - sichen - not determined - ENHANCEMENT - 2004-07-06 17:26:05 - issues@ofbiz - - - - All - Adds productFeatureApplTypeId field to getProductFeatureSet service - - - sichen - 2004-07-06 17:26:05 - Adds productFeatureApplTypeId as optional field to getProductFeatureSet service. - If none is specified, it will still search for "SELECTABLE_FEATURE"s (to be -compatible with existing code), but if one is specified, it will use that -productFeatureApplTypeId, so the same service can now be used to search for -STANDARD, DISTINGUISHING, OPTIONAL features. - - - sichen - 2004-07-06 17:27:49 - Created an attachment (id=82) -Extends getProductFeatures with optional productFeatureApplTypeId field - - - - jonesde - 2004-07-07 01:21:37 - It's in CVS now, thanks Si! - - - text/plain - 82 - 2004-07-06 17:27:49 - Extends getProductFeatures with optional productFeatureApplTypeId field - 1 - ProductServices_2.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/82/ProductServices_2.patch - - - sichen - 2004-07-06 17:27:49 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=82) -Extends getProductFeatures with optional productFeatureApplTypeId field - - - - jonesde - 2004-07-07 01:21:37 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 01:21:37 - resolution - Resolution - - FIXED - - - - 160 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040707144701 - Entity Extensions - doogie - not determined - ENHANCEMENT - 2004-07-07 07:27:45 - issues@ofbiz - - - - All - implement condition versions of functions in entityext - - - doogie - 2004-07-07 07:27:45 - I had sent an earlier version of this patch to the mailing list. I'm now adding -it as an issue, as I have for all the other patches. - - - doogie - 2004-07-07 07:28:22 - Created an attachment (id=83) -The patch - - - - jonesde - 2004-07-07 14:47:01 - This is now in CVS. Thanks Adam! - - - text/plain - 83 - 2004-07-07 07:28:22 - The patch - 1 - cache-entityext.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/83/cache-entityext.patch - - - doogie - 2004-07-07 07:28:22 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=83) -The patch - - - - jonesde - 2004-07-07 14:47:01 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-07 14:47:01 - resolution - Resolution - - FIXED - - - - 161 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040708153407 - WebTools - doogie - not determined - DEFECT - 2004-07-08 11:51:01 - issues@ofbiz - - - - All - NPE in FindUtilCacheElements.jsp - - - doogie - 2004-07-08 11:51:01 - Missed one NPE when key is null(calls key.toString()). - - - doogie - 2004-07-08 11:51:22 - Created an attachment (id=84) -The patch - - - - jonesde - 2004-07-08 15:34:07 - Thanks Adam, it is now in CVS. - - - text/plain - 84 - 2004-07-08 11:51:22 - The patch - 1 - FindUtilCacheElements.jsp.patch - 270 - doogie - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/84/FindUtilCacheElements.jsp.patch - - - doogie - 2004-07-08 11:51:22 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=84) -The patch - - - - jonesde - 2004-07-08 15:34:07 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-08 15:34:07 - resolution - Resolution - - FIXED - - - - 162 - RESOLVED - P3 - WORKSFORME - Components - CVS - All - issues@ofbiz - 20040713170819 - Workflow - ktippetts - not determined - DEFECT - 2004-07-12 09:32:42 - issues@ofbiz - - - - Linux - NoSuchMethodError in Entity Data Maintenance - - - ktippetts - 2004-07-12 09:32:42 - Getting this error when trying to view entity data in Webtools | Entity Data -Maintenance: - -<snip> -Exception: java.lang.NoSuchMethodError -Message: -org.ofbiz.entity.condition.EntityFieldMap.<init>(Ljava/util/Map;Lorg/ofbiz/entity/condition/EntityOperator;)V ------ stack trace ---------------------------------------- -java.lang.NoSuchMethodError: -org.ofbiz.entity.condition.EntityFieldMap.<init>(Ljava/util/Map;Lorg/ofbiz/entity/condition/EntityOperator;)V -org.apache.jsp.entity.FindGeneric_jsp._jspService(FindGeneric_jsp.java:159) -<snip> - -To duplicate Using CVS code as of 09Jul2004: -* Webtools > Entity Data Maintenance -* Click 'All' on any entity. - -Possible Solution: -* in FindGeneric.jsp (line 94) change 2nd parameter to EntityJoinOperator.AND - - - jonesde - 2004-07-12 20:41:10 - This works fine from a clean compile, but if have partial old code and partial new code in a build it may -have problems. Try an "ant clean" and then an "ant". - - - doogie - 2004-07-13 17:08:19 - The signature of the constructor changed. It used to take an EntityOperator. -However, the code only accepted an EntityJoinOperator. Passing in an -EntityComparisonOperator would have caused it to fail. - -Also, running ant clean will *not* fix the problem. The parsed/compiled jsp -pages need to be cleaned out. - - - jonesde - 2004-07-12 20:41:10 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-07-12 20:41:10 - resolution - Resolution - - WORKSFORME - - - - 163 - RESOLVED - P3 - INVALID - Documentation - CVS - All - issues@ofbiz - 20040730150851 - website - michaelrempel - not determined - TASK - 2004-07-13 11:11:43 - issues@ofbiz - - - - All - cant get csv instructions - - - michaelrempel - 2004-07-13 11:11:43 - When I pull up csv instructions for either the wincsv or command line, I get a -logon request screen, even though I am logged on. - -Thx - -Michael Rempel - - - ajzeneski - 2004-07-30 15:08:51 - This is a java.net related issue not OFBiz; please contact the Java.Net team for help. - - - ajzeneski - 2004-07-30 15:08:51 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 15:08:51 - resolution - Resolution - - INVALID - - - - 164 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040730204811 - Security - adrianc - not determined - DEFECT - 2004-07-14 12:24:23 - issues@ofbiz - - - - All - SecurityData.xml File - - - adrianc - 2004-07-14 12:24:23 - From mailing list: - -On Jul 14, 2004, at 12:03 PM, Adrian Crum wrote: - -> I was just wondering... -> -> Why is the security data for ALL components in the SecurityData.xml file? This -file looks monolithic. Shouldn't each component load its own security data? -> -> -Adrian - - -Adrian, - -Yes, good point, monolithic is a good word for this. Ideally it should be split -up, I think that's a good idea. - -If anyone wants to work on this please do... In the mean time it might be a good -idea to create an issue for it. - --David - - - ajzeneski - 2004-07-30 20:48:11 - applied patch file(s); now in CVS - - - ajzeneski - 2004-07-30 20:48:11 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 20:48:11 - resolution - Resolution - - FIXED - - - - 165 - RESOLVED - P4 - FIXED - Components - CVS - All - ajzeneski - 20040730065021 - Order - pgoron - not determined - PATCH - 2004-07-15 06:34:37 - issues@ofbiz - - - - All - Allow user to specify default value for desired delivery date and comment fields in order entry GUI - - - pgoron - 2004-07-15 06:34:37 - This patch allows user to define default desired delivery date and default -comment during quickaddform filling in OrderEntry page. Thus, users are not -obliged any more to reinput these informations for each order item. - - - pgoron - 2004-07-15 06:35:35 - Created an attachment (id=85) -The patch - - - - jacopo - 2004-07-30 06:50:21 - The patch is in CVS. - - - text/plain - 85 - 2004-07-15 06:35:35 - The patch - 1 - order20040707.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/85/order20040707.patch - - - pgoron - 2004-07-15 06:35:35 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=85) -The patch - - - - jonesde - 2004-07-15 16:16:54 - assigned_to - Assigned To - issues@ofbiz - ajzeneski - - - jonesde - 2004-07-15 16:16:54 - issue_type - Issue Type - ENHANCEMENT - PATCH - - - jacopo - 2004-07-30 06:50:21 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-07-30 06:50:21 - resolution - Resolution - - FIXED - - - - 166 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040730115233 - Order - pgoron - not determined - PATCH - 2004-07-21 02:46:56 - issues@ofbiz - - - - All - Allow user to associate parties to an order in OrderEntry website - - - pgoron - 2004-07-21 02:46:56 - Hi, - -Currently, I did not found any way to associate additional parties to an order. -That's why I've written this enhancement patch. - - -This patch adds a new step during order entry in which user can associate -additional party&role to order. Then, these informations are stored in OrderRole -entity. - - -List of modifications : -- I've written a new view in which user can select a party and party's role to -associate to order -+ webapp/ordermgr/entry/SetAdditionalParty.ftl -+ webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.bsh -+ webapp/ordermgr/WEB-INF/pagedefs/entry/SetAdditionalParty.xml -+ webapp/ordermgr/entry/AdditionalPartyListing.ftl -+ webapp/ordermgr/WEB-INF/actions/entry/AdditionalPartyListing.bsh -+ webapp/ordermgr/entry/PartySettingsForm.xml -M webapp/ordermgr/WEB-INF/controller.xml - -- I've included list of additional parties associated to order in confimorder view -M webapp/ordermgr/entry/confirmorder.ftl -M webapp/ordermgr/WEB-INF/pagedefs/entry/confirmorder.xml - -- I've modified these files so that my view is shown before order confirmation -M src/org/ofbiz/order/shoppingcart/CheckOutEvents.java -M webapp/ordermgr/entry/showcart.ftl - -- I've modified storeOrder service and ShoppingCart to take in account -additional parties. -M servicedef/services.xml -M src/org/ofbiz/order/order/OrderServices.java -M src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java -M src/org/ofbiz/order/shoppingcart/ShoppingCart.java - -- I've copied some files from content module to be able to use GenericLookup. -+ src/org/ofbiz/order/lookupParams.java -+ webapp/ordermgr/lookup/FieldLookupForms.xml -+ webapp/ordermgr/lookup/GenericLookup.ftl -+ webapp/ordermgr/templates/lookup.ftl -+ webapp/ordermgr/templates/lookup.xml -+ webapp/ordermgr/WEB-INF/actions/includes/findprepLk.bsh -+ webapp/ordermgr/WEB-INF/actions/includes/formprep.bsh -+ webapp/ordermgr/WEB-INF/actions/includes/pagelistprepLk.bsh -+ webapp/ordermgr/WEB-INF/pagedefs/lookup/GenericLookup.xml - - - pgoron - 2004-07-21 02:47:42 - Created an attachment (id=86) -The patch - - - - pgoron - 2004-07-22 00:38:39 - I've found some minor mistakes. I am correcting them and I will send a new patch -as soon as possible. - - - pgoron - 2004-07-22 01:29:07 - Created an attachment (id=87) -The corrected patch - - - - jacopo - 2004-07-30 11:52:33 - The patches are in CVS. - - - text/plain - 86 - 2004-07-21 02:47:42 - The patch - 1 - order20040721.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/86/order20040721.patch - - - text/plain - 87 - 2004-07-22 01:29:07 - The corrected patch - 1 - order20040722.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/87/order20040722.patch - - - pgoron - 2004-07-21 02:47:42 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=86) -The patch - - - - pgoron - 2004-07-22 01:29:07 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=87) -The corrected patch - - - - jacopo - 2004-07-30 11:52:33 - issue_status - Status - NEW - RESOLVED - - - jacopo - 2004-07-30 11:52:33 - resolution - Resolution - - FIXED - - - - 167 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040730145814 - Accounting - sichen - not determined - PATCH - 2004-07-28 17:15:09 - issues@ofbiz - - - - All - Fixes a couple of other getNextSeqId methods - - - sichen - 2004-07-28 17:15:09 - getNextSeqId now returns a string(), so .toString() is no longer needed and will -cause runtime exceptions. - - - sichen - 2004-07-28 17:19:29 - Created an attachment (id=88) -Changes getNextSeqId usage to PaymentGatewayServices and GenericAsyncEngine - - - - ajzeneski - 2004-07-30 14:58:14 - patch applied - - - text/plain - 88 - 2004-07-28 17:19:29 - Changes getNextSeqId usage to PaymentGatewayServices and GenericAsyncEngine - 1 - changes.txt - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/88/changes.txt - - - sichen - 2004-07-28 17:19:29 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=88) -Changes getNextSeqId usage to PaymentGatewayServices and GenericAsyncEngine - - - - ajzeneski - 2004-07-30 14:58:14 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 14:58:14 - resolution - Resolution - - FIXED - - - - 168 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040730144804 - Content - pgoron - not determined - PATCH - 2004-07-29 02:43:55 - issues@ofbiz - - - - All - FreeMarker localization issues - - - pgoron - 2004-07-29 02:43:55 - Hi, - -This patch resolves some localization issues. Currently, FreeMarker formats -number according to the machine's locale. My patch forces FreeMarker to use the -user session's locale. - -It must be applied in ofbiz/components/content/src/org/ofbiz/content/webapp/ftl -folder. - - - pgoron - 2004-07-29 02:45:19 - Created an attachment (id=89) -The patch - - - - ajzeneski - 2004-07-30 14:48:04 - This has been fixed in CVS - - - text/plain - 89 - 2004-07-29 02:45:19 - The patch - 1 - locale-freemaker-200040727.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/89/locale-freemaker-200040727.patch - - - pgoron - 2004-07-29 02:45:19 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=89) -The patch - - - - ajzeneski - 2004-07-30 14:48:04 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 14:48:04 - resolution - Resolution - - FIXED - - - - 169 - RESOLVED - P3 - FIXED - Components - CVS - PC - issues@ofbiz - 20040730220642 - E-Commerce - amheiss - not determined - DEFECT - 2004-07-30 09:53:11 - issues@ofbiz - - https://localhost:8443/ecommerce/control/finalizeOrder - - Linux - Party/Userlogin issues - - - amheiss - 2004-07-30 09:53:11 - Application will not allow run of createPartyPostalAddress (due to null user -login?). Sequence of events from july 30th, 11am build: goto ecommerce, -login, then logout. attempt to use anonymous checkout after this, and shipping -address feilds prepopulated with previous logins settings. After adjusting and -trying to save, get error 'User authorization is required for this service: -createPartyPostalAddress ' . - -Debug output from shipsettings.bsh: -Debug.log("party ID : " + partyId); ---> output admin ( i logged in as admin, -then logged out) -Debug.log("ul: " + session.getAttribute("userLogin")); ---> (null) - - - ajzeneski - 2004-07-30 22:06:42 - Yes, if there is an autoUserLogin attribute available that will break anonymous checkout. In theory, the -anonymous checkout links should not be displayed if there is an auto-userlogin. However, I have added -some code to clear this when entering the anonymous checkout process. - - - ajzeneski - 2004-07-30 22:06:42 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-07-30 22:06:42 - resolution - Resolution - - FIXED - - - - 170 - RESOLVED - P3 - FIXED - Components - CVS - All - issues@ofbiz - 20040804093020 - Product - sichen - not determined - ENHANCEMENT - 2004-08-03 17:02:41 - issues@ofbiz - - - - All - Optionally duplicates ProductContent when duplicating a Product - - - sichen - 2004-08-03 17:02:41 - Will now optionally duplicate ProductContent entries when duplicating a Product - - - sichen - 2004-08-03 17:03:19 - Created an attachment (id=90) -Patches services.xml, EditProduct.ftl, and ProductServices.xml - - - - jonesde - 2004-08-04 09:30:20 - Thanks Si. This is now in CVS. I also did a content remove option, and fixed an issue I noticed with the -product IDs (GoodIdentification). BTW, this is from a slightly earlier version of OFBiz than the current -CVS as this form has been moved to the file EditProductDupForm.ftl. - - - text/plain - 90 - 2004-08-03 17:03:19 - Patches services.xml, EditProduct.ftl, and ProductServices.xml - 1 - duplicateProduct.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/90/duplicateProduct.patch - - - sichen - 2004-08-03 17:03:19 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=90) -Patches services.xml, EditProduct.ftl, and ProductServices.xml - - - - jonesde - 2004-08-04 09:30:20 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-08-04 09:30:20 - resolution - Resolution - - FIXED - - - - 171 - RESOLVED - P2 - FIXED - Components - CVS - All - issues@ofbiz - 20040804091929 - Product - pgoron - not determined - PATCH - 2004-08-04 00:59:53 - issues@ofbiz - - - - All - Comparaison bug in InventoryServices.xml minilang script - - - pgoron - 2004-08-04 00:59:53 - Some if-compare element forget to declare type used to compare fields. By -default, string comparison is used whereas Double is required. - - -Applying patch : -cd /ofbiz/components/product/script/org/ofbiz/product/inventory -patch -p0 < InventoryServices.xml.patch - - - pgoron - 2004-08-04 01:01:13 - Created an attachment (id=91) -The patch - - - - jonesde - 2004-08-04 09:19:29 - Thanks, it's now in CVS. - - - text/plain - 91 - 2004-08-04 01:01:13 - The patch - 1 - InventoryServices.xml.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/91/InventoryServices.xml.patch - - - pgoron - 2004-08-04 01:01:13 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=91) -The patch - - - - jonesde - 2004-08-04 09:19:29 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-08-04 09:19:29 - resolution - Resolution - - FIXED - - - - 172 - NEW - P2 - - Components - CVS - All - issues@ofbiz - 20040819033400 - Order - pgoron - not determined - PATCH - 2004-08-05 07:09:49 - issues@ofbiz - - - - All - Bug in shippableWeight calculation from OrderReadHelper.getShippableWeight method - - - pgoron - 2004-08-05 07:09:49 - Hi, - -The purpose of this patch is to solve a bug in -OrderReadHelper.getShippableWeight method. The algorithm of shippable weight -calculation don't care of order item's quantity. So there is an inconsistency -with ShoppingCart.getShippableWeight method when order is modified after his -creation (for example, by RecalcShippingTotal service). - -Applying patch: -cd ofbiz/components/order/src/org/ofbiz/order/order -patch -p0 < OrderReadHelper-20040805.patch - -Peter Goron - - - pgoron - 2004-08-05 07:10:36 - Created an attachment (id=92) -The patch - - - - pgoron - 2004-08-19 03:34:00 - Created an attachment (id=96) -An up to date patch - - - - text/plain - 92 - 2004-08-05 07:10:36 - The patch - 1 - OrderReadHelper-20040805.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/92/OrderReadHelper-20040805.patch - - - text/plain - 96 - 2004-08-19 03:34:00 - An up to date patch - 1 - OrderReadHelper-200408019.patch - 392 - pgoron - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/96/OrderReadHelper-200408019.patch - - - pgoron - 2004-08-05 07:10:36 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=92) -The patch - - - - pgoron - 2004-08-19 03:34:00 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=96) -An up to date patch - - - - - 173 - RESOLVED - P3 - INVALID - Base - CVS - PC - issues@ofbiz - 20040809165336 - Startup - mn - not determined - PATCH - 2004-08-09 13:38:08 - issues@ofbiz - - - - Linux - typo in base/config/debug.properties - - - mn - 2004-08-09 13:38:08 - Index: base/config/debug.properties -=================================================================== -RCS file: /cvs/ofbiz/base/config/debug.properties,v -retrieving revision 1.10 -diff -u -r1.10 debug.properties ---- base/config/debug.properties 9 Jun 2004 18:12:59 -0000 1.10 -+++ base/config/debug.properties 9 Aug 2004 19:32:33 -0000 -@@ -7,7 +7,7 @@ - pack.exception=true - - # These top level switches are used before calling Log4J, or if Log4J is not used --print.verbose=ftrue -+print.verbose=true - print.timing=true - print.info=true - print.important=true - - - mn - 2004-08-09 13:40:09 - Created an attachment (id=93) -corerct typo for print.verbose property - - - - jonesde - 2004-08-09 16:25:29 - In this case "ftrue" is not a misspelling of "true", we add the "f" before "true" so that it is easier to switch -between true and false than it would be to type out "true" and "false". In other words, anything but -"true" is false. - - - mn - 2004-08-09 16:53:36 - What about placing comment into debug.properties about this decision? - - - text/plain - 93 - 2004-08-09 13:40:09 - corerct typo for print.verbose property - 1 - debug.properties.patch - 377 - mn - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/93/debug.properties.patch - - - mn - 2004-08-09 13:40:09 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=93) -corerct typo for print.verbose property - - - - jonesde - 2004-08-09 16:25:29 - issue_status - Status - NEW - RESOLVED - - - jonesde - 2004-08-09 16:25:29 - resolution - Resolution - - INVALID - - - - 174 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040810161004 - Accounting - amheiss - not determined - PATCH - 2004-08-10 16:08:36 - issues@ofbiz - - - - All - retry failed auths fix - - - amheiss - 2004-08-10 16:08:36 - retryFailedAuths service was creating superfluous retryFailedOrderAuth -services. I'll see if i can attach the patch to check on order status before -dispatching retryFailedOrderAuth service. If not, patch will be to dev list -soon enough. - - - amheiss - 2004-08-10 16:10:04 - Created an attachment (id=94) -Patch for retryFailedAuth fix - - - - text/plain - 94 - 2004-08-10 16:10:04 - Patch for retryFailedAuth fix - 1 - retryAuth.patch - 336 - amheiss - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/94/retryAuth.patch - - - amheiss - 2004-08-10 16:10:04 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=94) -Patch for retryFailedAuth fix - - - - - 175 - RESOLVED - P3 - FIXED - foo - unspecified - All - ajzeneski - 20040817213241 - bar - ajzeneski - milestone 1 - DEFECT - 2004-08-17 21:31:38 - ajzeneski - - - - All - bar - - - ajzeneski - 2004-08-17 21:31:38 - foo - - - ajzeneski - 2004-08-17 21:32:41 - . - - - ajzeneski - 2004-08-17 21:32:41 - issue_status - Status - NEW - RESOLVED - - - ajzeneski - 2004-08-17 21:32:41 - resolution - Resolution - - FIXED - - - - 176 - NEW - P3 - - Components - CVS - All - issues@ofbiz - 20040818174622 - Content - sichen - not determined - DEFECT - 2004-08-18 17:45:44 - issues@ofbiz - - - - All - Possible bug in renderContentAsText - - - sichen - 2004-08-18 17:45:44 - It seems that renderContentAsText is still trying to do a findByAnd on -SubContentDataResourceView with a fromDate as the orderBy, whereas -renderContentAsTextCache no longer does (it passes a null.) We got an -exception from this in ProductContentWrapper and made this change to fix it. -Is this a defect? - - - sichen - 2004-08-18 17:46:22 - Created an attachment (id=95) -Changes findByAnd of SubContentDataResourceView - - - - text/plain - 95 - 2004-08-18 17:46:22 - Changes findByAnd of SubContentDataResourceView - 1 - ContentWorker.patch - 178 - sichen - - https://ofbiz.dev.java.net/nonav/issues/showattachment.cgi/95/ContentWorker.patch - - - sichen - 2004-08-18 17:46:22 - attachments.ispatch - Attachment is Patch - - Created an attachment (id=95) -Changes findByAnd of SubContentDataResourceView - - - - - 177 - NEW - P3 - - Base - CVS - Other - issues@ofbiz - 20040910075014 - Base - lrawley - not determined - TASK - 2004-09-10 07:50:14 - issues@ofbiz - - - - Windows XP - HTTP Header needs Expires - - - lrawley - 2004-09-10 07:50:14 - Using Internet Explorer 6.0 with settings for automatically obtaining newer -versions of page. - -Images are cached and if changed are not refreshed on visits to the same page. -Pages get cached with login page because the first time a user requested they -were prompted to login first and then redirected to the page. - -This behavior is resolved if set to obtain newer versions on every visit, -however, this causes performance issues. So, automatically is the desired -browser setting. - -I would like to be able to set the EXPIRE in the HTTP header. I'm not sure -where this change needs to occur. Can you assist? Is this available in 3.0? -I am using 2.1.1. - -Please contact me at lrawley@tla.com. - -Lisa Rawley - - - diff --git a/test/rexml/data/pi.xml b/test/rexml/data/pi.xml deleted file mode 100644 index 980bbf98ec..0000000000 --- a/test/rexml/data/pi.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/test/rexml/data/pi2.xml b/test/rexml/data/pi2.xml deleted file mode 100644 index 46bce4505f..0000000000 --- a/test/rexml/data/pi2.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - foo - - bar - diff --git a/test/rexml/data/project.xml b/test/rexml/data/project.xml deleted file mode 100644 index a02582fde5..0000000000 --- a/test/rexml/data/project.xml +++ /dev/null @@ -1 +0,0 @@ -tool testing diff --git a/test/rexml/data/simple.xml b/test/rexml/data/simple.xml deleted file mode 100644 index 3cff71a02b..0000000000 --- a/test/rexml/data/simple.xml +++ /dev/null @@ -1,2 +0,0 @@ - -abd diff --git a/test/rexml/data/stream_accents.xml b/test/rexml/data/stream_accents.xml deleted file mode 100644 index 6def54ee55..0000000000 --- a/test/rexml/data/stream_accents.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/test/rexml/data/t63-1.xml b/test/rexml/data/t63-1.xml deleted file mode 100644 index f8d0c543ef..0000000000 Binary files a/test/rexml/data/t63-1.xml and /dev/null differ diff --git a/test/rexml/data/t63-2.svg b/test/rexml/data/t63-2.svg deleted file mode 100644 index 706c0e96bd..0000000000 --- a/test/rexml/data/t63-2.svg +++ /dev/null @@ -1,2828 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - SYMBOL 640 - - OFF - - - - SYMBOL 642 - - NORMAL - - - - SYMBOL 643 - - ARMED - - - - SYMBOL 644 - - ALARM - - - - SYMBOL 646 - - FAILED - - - - SYMBOL 652 - - ON - - - - SYMBOL 660 - - AUTO - - - - SYMBOL 675 - - MARGINAL - - - - SYMBOL 835 - - TRIPPED - - - - SYMBOL 922 - - MANUAL - - - - Select - - S - - - - Unack - - U - - - - Alarm - - A - - - - Deact - - D - - - - Alinh - - I - - - - Telem - - E - - - - Manual - - M - - - - TagInfo - - I - - - - - - - - TagCtl - - - - - - N - - - - TagCls - - - - - - H - - - - TagOpn - - O - - - - - - - - RDV - - R - - - - Gmerr - - G - - - - Limovr - - O - - - - Limit1 - - 1 - - - - Kimit2 - - 2 - - - - Limit3 - - 3 - - - - - - - - - - - - - 03/16/06 ADDED DFK 6 -- K. POPE - - - - - 01/05/05 FIXED DFK'S -- K. POPE - - - - - 10/14/04 CHANGED ACRONYM FOR REG CONTROL TO MANUAL / AUTO -- O. WAHLSTROM - - - - - 12/24/03 DISPLAY BUILT AND DATA ADDED -- K. POPE - - - - - 01/06/04 DISPLAY CORRECTED PER R. MCCORMICK -- N. FISHER - - - - - 03/18/04 DISPLAY UPDATED/DFK'S FIXED/APPENDED SYMBOLS MOVED -- T. TURNER - - - - - 03/29/04 REVIEWED -- O. WAHLSTROM - - - - - 05/11/04 RTU BOX FIXED AND DISPLAY UPDATED -- K. POPE - - - - - 10/18/05 REMOVED BUS VOLT MAXIMUM ALARM -- K. POPE - - - - - - - 118TH SOUTH (118TH-SO) - - - - - - - - - - - Salt Lake County, Utah - - - - - - - - - - - REG 1 AUTOMATIC (C) - - - - - To control regulator, right click on the tap position - - - - - indication and select the regulation option. - - - - - XFMR 1 TEMPERATURE - - - - - XFMR 1 NITROGEN CYL LOW - - - - - XFMR 1 LOW OIL LEVEL - - - - - XFMR 1 NITROGEN PRESSURE - - - - - XFMR 1 PRESSURE FAULT - - - - - XFMR 1 LTC CONTROL LOSS - - - - - RELAY LOSS OF AC - - - - - STATION SERVICE - - - - - XFMR 1 LTC FAIL - - - - - XFMR 1 WINDING TEMP TRIP - - - - - XFMR 1 LOCKOUT - - - - - CONTROL SYSTEM FAIL - - - - - UNDER FREQ TRIP RELAY - - - - - CB LOW SPRING CHARGE - - - - - RELAY FAILURE - - - - - CAP 1 VOLT CONTROL (C) - - - - - HMI PLC STALLED - - - - - XFMR 1 LTC FILTER - - - - - CONTROL SYSTEM NON CRITICAL - - - - - Station Alarms - - - - - Regulator 1 Control and Tap Position - - - - - REG 1 TAP POSITION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1234.6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1234.6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1234.6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16 - - - 12 - - - 8 - - - 4 - - - 0 - - - -4 - - - -8 - - - -12 - - - -16 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REG 1 12KV BUS VOLTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RTU STATUS: - - - - - - - - - - - - - - - RTU COMMUNICATIONS: - - - - - ENTRY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RTU - 481 - - - - diff --git a/test/rexml/data/t75.xml b/test/rexml/data/t75.xml deleted file mode 100644 index eb3cccee4b..0000000000 --- a/test/rexml/data/t75.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - ]> - - -Next_Actions - @class - @agenda - this is something I'd like to do - - @dorm - clean room - - @computer - Write general makefile for cs projects - Set up bash podder - - @errands - Purchase geo lab book - - @dublin - -projects - diff --git a/test/rexml/data/test/tests.xml b/test/rexml/data/test/tests.xml deleted file mode 100644 index cf03b42b0b..0000000000 --- a/test/rexml/data/test/tests.xml +++ /dev/null @@ -1,683 +0,0 @@ - - - - - - - span - - - - - - - - - - - - - - abd - - - abd - - - a - - - d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 2 - 1 - 2 - - - - - - - true - true - - - - - - true - true - true - true - true - true - - - - - - - true - true - true - true - - - 0 - - 1 - - 3 - - false - - false - - false - - false - - true - - true - - - - - - - - - - - - order-by="x" - foo - order-by="x" - - - - - - foobar - - - - - - - - - - - - - - - - - - - - - - - - is tasty - - - - - - - - - - - - - - - - - - - - - true - true - false - true - true - false - - - - - - - - - - - - - - - - - - - - - - a.2 - a.1 - - - - a.4 - a.5 - - - - - - - - - snoop - snoop - file - file - - - - snoop - snoop - - - - - - - - - - - - - - - - - - - - web-app - - - - - - web-app - - - web-app - - - web-app - - - web-app - - - web-app - - - - - - - - - - - - - web-app - web-app - web-app - web-app - web-app - web-app - web-app - web-app - web-app - - - - - - - - - - - web-app - web-app - web-app - web-app - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://c.moreover.com/click/here.pl?x13563273 - - - http://c.moreover.com/click/here.pl?x13563273 - - - http://c.moreover.com/click/here.pl?x13563273 - - - http://c.moreover.com/click/here.pl?x13563273 - - - http://c.moreover.com/click/here.pl?x13563273 - - - http://c.moreover.com/click/here.pl?x13563273 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196417 - 325 - 1 - 75025 - 46368 - - - - - - - - - - - - - - - - - - - - 2 - - 2 - - - - - - - - - - - - - - Much Ado about Nothing - 4 - 21 - 5 - 35 - 75 - - - - - - - 646 - 142 - 2 - 1 - 3 - 1 - 6 - - - - 5 - - - - - - - - - - - - - - - - - - snoop - snoop - - snoop - - - - 3foo3 - 3snoop3 - - - - - - Pruefgebiete - Pruefgebiete - - - - - - - - ab - ba - ba - db - - - - - - abcd - abcd - abcd - dcba - ab - cd - xy - abcd - abcd - - - - 234 - 12 - - - 12345 - - 345 - 12345 - - - - - - abc - a b c - a b c - - - - - - - - - - - - - SNOOPSERVLET - snoopservlet - SNOOPSERVLET - SNOOPSERVLET - SNOOPSERVLET - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hello - Hey - Hey3 - Hey3 - Hey3 - - - - - - - - - - - - - - - - - - baz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/rexml/data/test/tests.xsl b/test/rexml/data/test/tests.xsl deleted file mode 100644 index 3ecd648b3b..0000000000 --- a/test/rexml/data/test/tests.xsl +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/test/rexml/data/testNamespaces.xml b/test/rexml/data/testNamespaces.xml deleted file mode 100644 index 50f7c9306b..0000000000 --- a/test/rexml/data/testNamespaces.xml +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/test/rexml/data/testsrc.xml b/test/rexml/data/testsrc.xml deleted file mode 100644 index 9c7a78212f..0000000000 --- a/test/rexml/data/testsrc.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - xmlhack - http://www.xmlhack.com - Developer news from the XML community - en-us - Copyright 1999-2001, xmlhack team. - editor@xmlhack.com - webmaster@xmlhack.com - - xmlhack - http://www.xmlhack.com/images/mynetscape88.gif - http://www.xmlhack.com - 88 - 31 - News, opinions, tips and issues concerning XML development - - -Experimental non-XML syntax for RELAX NG -http://www.xmlhack.com/read.php?item=1343 - - James Clark has announced the release of an experimental non-XML syntax for RELAX - NG and a Java translator implementation that converts - instances of the syntax into RELAX NG's XML syntax. - -Schemas - - -Long-awaited entity-resolver Java classes finally released -http://www.xmlhack.com/read.php?item=1342 -Norman Walsh has - announced the release of SAX entityResolver() and JAXP - URIResolver() Java - classes he wrote to implement the OASIS XML Catalogs - Committee Specification (in addition to the TR9401 and - Apache XCatalogs specifications). - -SGML/XML -Java - - - -Beepcore-C framework released -http://www.xmlhack.com/read.php?item=1341 -Invisible Worlds have announced the publication of Beepcore-C, an implementation of the BEEP framework written in C. -Protocols -C++ - - -SVG and XSL-FO by example -http://www.xmlhack.com/read.php?item=1340 -Jirka Jirat has announced the -addition of an XSL-FO and SVG examples repository to the Zvon developer -reference site. -SVG -XSL-FO - - - - - diff --git a/test/rexml/data/text.xml b/test/rexml/data/text.xml deleted file mode 100644 index e1865c7977..0000000000 --- a/test/rexml/data/text.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - baz - - baz - - baz - - diff --git a/test/rexml/data/ticket_61.xml b/test/rexml/data/ticket_61.xml deleted file mode 100644 index 4df1cc9b86..0000000000 --- a/test/rexml/data/ticket_61.xml +++ /dev/null @@ -1,4 +0,0 @@ - - -



ListMatters

Open | Closed | All
Open Matters











- diff --git a/test/rexml/data/ticket_68.xml b/test/rexml/data/ticket_68.xml deleted file mode 100644 index 7ab34b08cd..0000000000 --- a/test/rexml/data/ticket_68.xml +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - - - -1000000 - - - - -くりかえし - - -&n; -repetition mark in katakana -Wiederholungszeichen für Katakana -normalerweise nur in vertikaler Schreibweise verwendet -marque de la répétition dans katakana -(JF2) - - - -1000010 - - - - -くりかえし - - -&n; -voiced repetition mark in katakana -stimmhaftes Wiederholungszeichen für Katakana -normalerweise nur in vertikaler Schreibweise verwendet -marque de la répétition sonore dans katakana -(JF2) - - - -1000020 - - - - -くりかえし - - -&n; -repetition mark in hiragana -Wiederholungszeichen für Hiragana -normalerweise nur in vertikaler Schreibweise verwendet -marque de la répétition dans hiragana -(JF2) - - - -1000030 - - - - -くりかえし - - -&n; -voiced repetition mark in hiragana -stimmhaftes Wiederholungszeichen für Hiragana -normalerweise nur in vertikaler Schreibweise verwendet -marque de la répétition sonore dans hiragana -(JF2) - - - -1000040 - - - - -おなじく - - -&n; -ditto mark -знак "то же самое" -Wiederholungszeichen in Tabellen -idem marque -(JF2) - - - -1000050 - - - - -どうじょう - - -&n; -"as above" mark -Abkürzung für "siehe oben" -comme au-dessus -(JF2) - - - -1000060 - - - - -くりかえし - - -&n; -repetition of kanji (sometimes voiced) -Wiederholungszeichen für Kanji -(Laut wird durch Wiederholung manchmal stimmhaft) -répétition de kanji(quelquefois a exprimé) -(JF2) - - - -1000070 - - - - -しめ - - -&n; -end or closure mark -Zeichen als eine Art Versiegelung über der zugeklebten Lasche auf der Rückseite eines Briefumschlages -fin ou marque de la fermeture -(JF2) - - - -1000080 - - - - - -&iK; - - -かんすうじゼロ - - -&n; -漢数字 -ゼロ -"kanji" zero -Kanji-Ziffer für Null -kanji -(JF2) - - - -1000090 - - - - - -&iK; - - -まる - - -&n; -circle (sometimes used for zero) -круг -но́ль -Kreis -Markierung für "richtig" -Maru -(ein japan. Schriftfont hat mindestens drei verschiedene Codierungen und Darstellungen für "maru") -entourez -mettez à zéro -(JF2) - - - -1000100 - -ABC順 - - -エービーシーじゅん - - -ええびいしいじゅん - - -&n; -alphabetical order -alphabetische Ordnung -alphabetische Reihenfolge -ordre alphabétique -(JF2) - - - -1000110 - -CDプレーヤー - - -シーディープレーヤー - - -&n; -CD player -CD плеер -проигрыватель компакт-дисков - - - -1000120 - -Hな映画 - - -エッチな映画 - - -エッチなえいが - - -&n; -pornographic film -salacious film - - - -1000130 - -N響 - - -エヌきょう - - -&n; -&abbr; -NHK Symphony Orchestra -NHK Symphonie Orchestre(abbr) -(JF2) - - - -1000140 - -Oバック - - -&n; -O-back -skirt with peek-a-boo hole in rump -O En arrière -contournez avec coucou trou dans croupe -(JF2) - - - -1000150 - -RS232ケーブル - - -&n; -rs232 cable -les rs232 câblent -(JF2) - - - diff --git a/test/rexml/data/tutorial.xml b/test/rexml/data/tutorial.xml deleted file mode 100644 index bf5783d09a..0000000000 --- a/test/rexml/data/tutorial.xml +++ /dev/null @@ -1,678 +0,0 @@ - - - - - - - REXML Tutorial - - $Revision: 1.1.2.1 $ - - *2001-296+594 - - http://www.germane-software.com/~ser/software/rexml - - - - ruby - - Sean Russell - - - - -

This is a tutorial for using REXML, - a pure Ruby XML processor.

-
- - -

REXML was inspired by the Electric XML library for Java, which - features an easy-to-use API, small size, and speed. Hopefully, REXML, - designed with the same philosophy, has these same features. I've tried - to keep the API as intuitive as possible, and have followed the Ruby - methodology for method naming and code flow, rather than mirroring the - Java API.

- -

REXML supports both tree and stream document parsing. Stream parsing - is faster (about 1.5 times as fast). However, with stream parsing, you - don't get access to features such as XPath.

- -

The API documentation also - contains code snippits to help you learn how to use various methods. - This tutorial serves as a starting point and quick guide to using - REXML.

- - -

We'll start with parsing an XML document

- - require "rexml/document" -file = File.new( "mydoc.xml" ) -doc = REXML::Document.new file - -

Line 3 creates a new document and parses the supplied file. You can - also do the following

- - require "rexml/document" -include REXML # so that we don't have to prefix everything with REXML::... -string = <<EOF - <mydoc> - <someelement attribute="nanoo">Text, text, text</someelement> - </mydoc> -EOF -doc = Document.new string - -

So parsing a string is just as easy as parsing a file. For future - examples, I'm going to omit both the require and - include lines.

- -

Once you have a document, you can access elements in that document - in a number of ways:

- - - The Element class itself has - each_element_with_attribute, a common way of accessing - elements. - - The attribute Element.elements is an - Elements class instance which has the each - and [] methods for accessing elements. Both methods can - be supplied with an XPath for filtering, which makes them very - powerful. - - Since Element is a subclass of Parent, you can - also access the element's children directly through the Array-like - methods Element[], Element.each, Element.find, - Element.delete. This is the fastest way of accessing - children, but note that, being a true array, XPath searches are not - supported, and that all of the element children are contained in - this array, not just the Element children. - - -

Here are a few examples using these methods. First is the source - document used in the examples. Save this as mydoc.xml before running - any of the examples that require it:

- - <inventory title="OmniCorp Store #45x10^3"> - <section name="health"> - <item upc="123456789" stock="12"> - <name>Invisibility Cream</name> - <price>14.50</price> - <description>Makes you invisible</description> - </item> - <item upc="445322344" stock="18"> - <name>Levitation Salve</name> - <price>23.99</price> - <description>Levitate yourself for up to 3 hours per application</description> - </item> - </section> - <section name="food"> - <item upc="485672034" stock="653"> - <name>Blork and Freen Instameal</name> - <price>4.95</price> - <description>A tasty meal in a tablet; just add water</description> - </item> - <item upc="132957764" stock="44"> - <name>Grob winglets</name> - <price>3.56</price> - <description>Tender winglets of Grob. Just add water</description> - </item> - </section> -</inventory> - - doc = Document.new File.new("mydoc.xml") -doc.elements.each("inventory/section") { |element| puts element.attributes["name"] } -# -> health -# -> food -doc.elements.each("*/section/item") { |element| puts element.attributes["upc"] } -# -> 123456789 -# -> 445322344 -# -> 485672034 -# -> 132957764 -root = doc.root -puts root.attributes["title"] -# -> OmniCorp Store #45x10^3 -puts root.elements["section/item[@stock='44']"].attributes["upc"] -# -> 132957764 -puts root.elements["section"].attributes["name"] -# -> health (returns the first encountered matching element) -puts root.elements[1].attributes["name"] -# -> health (returns the FIRST child element) -root.detect {|node| node.kind_of? Element and node.attributes["name"] == "food" } - -

Notice the second-to-last line of code. Element children in REXML - are indexed starting at 1, not 0. This is because XPath itself counts - elements from 1, and REXML maintains this relationship; IE, - root.elements['*[1]'] == root.elements[1]. The last line - finds the first child element with the name of "food". As you can see - in this example, accessing attributes is also straightforward.

- -

You can also access xpaths directly via the XPath class.

- - # The invisibility cream is the first <item> -invisibility = XPath.first( doc, "//item" ) -# Prints out all of the prices -XPath.each( doc, "//price") { |element| puts element.text } -# Gets an array of all of the "name" elements in the document. -names = XPath.match( doc, "//name" ) - -

Another way of getting an array of matching nodes is through - Element.elements.to_a(). Although this is a method on elements, if - passed an XPath it can return an array of arbitrary objects. This is - due to the fact that XPath itself can return arbitrary nodes - (Attribute nodes, Text nodes, and Element nodes).

- - all_elements = doc.elements.to_a -all_children = doc.to_a -all_upc_strings = doc.elements.to_a( "//item/attribute::upc" ) -all_name_elements = doc.elements.to_a( "//name" ) -
- - -

REXML attempts to make the common case simple, but this means that - the uncommon case can be complicated. This is especially true with - Text nodes.

- -

Text nodes have a lot of behavior, and in the case of internal - entities, what you get may be different from what you expect. When - REXML reads an XML document, in parses the DTD and creates an internal - table of entities. If it finds any of these entities in the document, - it replaces them with their values:

- - doc = Document.new '<!DOCTYPE foo [ -<!ENTITY ent "replace"> -]><a>&ent;</a>' -doc.root.text #-> "replace" - - -

When you write the document back out, REXML replaces the values - with the entity reference:

- - doc.to_s -# Generates: -# <!DOCTYPE foo [ -# <!ENTITY ent "replace"> -# ]><a>&ent;</a> - -

But there's a problem. What happens if only some of the words are - also entity reference values?

- - doc = Document.new '<!DOCTYPE foo [ -<!ENTITY ent "replace"> -]><a>replace &ent;</a>' -doc.root.text #-> "replace replace" - - -

Well, REXML does the only thing it can:

- - doc.to_s -# Generates: -# <!DOCTYPE foo [ -# <!ENTITY ent "replace"> -# ]><a>&ent; &ent;</a> - -

This is probably not what you expect. However, when designing - REXML, I had a choice between this behavior, and using immutable text - nodes. The problem is that, if you can change the text in a node, - REXML can never tell which tokens you want to have replaced with - entities. There is a wrinkle: REXML will write what it gets in as long - as you don't access the text. This is because REXML does lazy - evaluation of entities. Therefore,

- - doc = Document.new( '<!DOCTYPE foo - [ <!ENTITY ent "replace"> ]><a>replace - &ent;</a>' ) doc.to_s # Generates: # <!DOCTYPE foo [ # - <!ENTITY ent "replace"> # ]><a>replace - &ent;</a> doc.root.text #-> Now accessed, - entities have been resolved doc.to_s # Generates: # <!DOCTYPE foo [ - # <!ENTITY ent "replace"> # ]><a>&ent; - &ent;</a> - -

There is a programmatic solution: :raw. If you set the - :raw flag on any Text or Element node, the entities - within that node will not be processed. This means that you'll have to - deal with entities yourself:

- - doc = Document.new('<!DOCTYPE - foo [ <!ENTITY ent "replace"> ]><a>replace - &ent;</a>',{:raw=>:all}) - doc.root.text #-> "replace &ent;" doc.to_s # Generates: # - <!DOCTYPE foo [ # <!ENTITY ent "replace"> # - ]><a>replace &ent;</a> -
- - -

Again, there are a couple of mechanisms for creating XML documents - in REXML. Adding elements by hand is faster than the convenience - method, but which you use will probably be a matter of aesthetics.

- - el = someelement.add_element "myel" -# creates an element named "myel", adds it to "someelement", and returns it -el2 = el.add_element "another", {"id"=>"10"} -# does the same, but also sets attribute "id" of el2 to "10" -el3 = Element.new "blah" -el1.elements << el3 -el3.attributes["myid"] = "sean" -# creates el3 "blah", adds it to el1, then sets attribute "myid" to "sean" - -

If you want to add text to an element, you can do it by either - creating Text objects and adding them to the element, or by using the - convenience method text=

- - el1 = Element.new "myelement" -el1.text = "Hello world!" -# -> <myelement>Hello world!</myelement> -el1.add_text "Hello dolly" -# -> <myelement>Hello world!Hello dolly</element> -el1.add Text.new("Goodbye") -# -> <myelement>Hello world!Hello dollyGoodbye</element> -el1 << Text.new(" cruel world") -# -> <myelement>Hello world!Hello dollyGoodbye cruel world</element> - -

But note that each of these text objects are still stored as - separate objects; el1.text will return "Hello world!"; - el1[2] will return a Text object with the contents - "Goodbye".

- -

Please be aware that all text nodes in REXML are UTF-8 encoded, and - all of your code must reflect this. You may input and output other - encodings (UTF-8, UTF-16, ISO-8859-1, and UNILE are all supported, - input and output), but within your program, you must pass REXML UTF-8 - strings.

- -

I can't emphasize this enough, because people do have problems with - this. REXML can't possibly alway guess correctly how your text is - encoded, so it always assumes the text is UTF-8. It also does not warn - you when you try to add text which isn't properly encoded, for the - same reason. You must make sure that you are adding UTF-8 text. -  If you're adding standard 7-bit ASCII, which is most common, you - don't have to worry.  If you're using ISO-8859-1 text (characters - above 0x80), you must convert it to UTF-8 before adding it to an - element.  You can do this with the shard: - text.unpack("C*").pack("U*"). If you ignore this warning - and add 8-bit ASCII characters to your documents, your code may - work... or it may not.  In either case, REXML is not at fault. - You have been warned.

- -

One last thing: alternate encoding output support only works from - Document.write() and Document.to_s(). If you want to write out other - nodes with a particular encoding, you must wrap your output object - with Output:

- - e = Element.new "<a/>" -e.text = "f\xfcr" # ISO-8859-1 'ü' -o = '' -e.write( Output.new( o, "ISO-8859-1" ) ) - - -

You can pass Output any of the supported encodings.

- -

If you want to insert an element between two elements, you can use - either the standard Ruby array notation, or - Parent.insert_before and - Parent.insert_after.

- - doc = Document.new "<a><one/><three/></a>" -doc.root[1,0] = Element.new "two" -# -> <a><one/><two/><three/></a> -three = doc.elements["a/three"] -doc.root.insert_after three, Element.new "four" -# -> <a><one/><two/><three/><four/></a> -# A convenience method allows you to insert before/after an XPath: -doc.root.insert_after( "//one", Element.new("one-five") ) -# -> <a><one/><one-five/><two/><three/><four/></a> -# Another convenience method allows you to insert after/before an element: -four = doc.elements["//four"] -four.previous_sibling = Element.new("three-five") -# -> <a><one/><one-five/><two/><three/><three-five/><four/></a> - -

The raw flag in the Text constructor can - be used to tell REXML to leave strings which have entities defined for - them alone.

- - doc = Document.new( "<?xml version='1.0?> -<!DOCTYPE foo SYSTEM 'foo.dtd' [ -<!ENTITY % s "Sean"> -]> -<a/>" -t = Text.new( "Sean", false, nil, false ) -doc.root.text = t -t.to_s # -> &s; -t = Text.new( "Sean", false, nil, true ) -doc.root.text = t -t.to_s # -> Sean - -

Note that, in all cases, the value() method returns - the text with entities expanded, so the raw flag only - affects the to_s() method. If the raw is set - for a text node, then to_s() will not entities will not - normalize (turn into entities) entity values. You can not create raw - text nodes that contain illegal XML, so the following will generate a - parse error:

- - t = Text.new( "&", false, nil, true ) - -

You can also tell REXML to set the Text children of given elements - to raw automatically, on parsing or creating:

- - doc = REXML::Document.new( source, { :raw => %w{ tag1 tag2 tag3 } } - -

In this example, all tags named "tag1", "tag2", or "tag3" will have - any Text children set to raw text. If you want to have all of the text - processed as raw text, pass in the :all tag:

- - doc = REXML::Document.new( source, { :raw => :all }) -
- - -

There aren't many things that are more simple than writing a REXML - tree. Simply pass an object that supports <<( String - ) to the write method of any object. In Ruby, both - IO instances (File) and String instances support <<.

- - doc.write $stdout -output = "" -doc.write output - -

If you want REXML to pretty-print output, pass write() - an indent value greater than -1:

- - doc.write( $stdout, 0 ) - -

REXML will not, by default, write out the XML declaration unless - you specifically ask for them. If a document is read that contains an - XML declaration, that declaration will be written - faithfully. The other way you can tell REXML to write the declaration - is to specifically add the declaration:

- - doc = Document.new -doc.add_element 'foo' -doc.to_s #-> <foo/> -doc << XMLDecl.new -doc.to_s #-> <?xml version='1.0'?><foo/> -
- - -

There are four main methods of iterating over children. - Element.each, which iterates over all the children; - Element.elements.each, which iterates over just the child - Elements; Element.next_element and - Element.previous_element, which can be used to fetch the - next Element siblings; and Element.next_sibling and - Eleemnt.previous_sibling, which fetches the next and - previous siblings, regardless of type.

-
- - -

REXML stream parsing requires you to supply a Listener class. When - REXML encounters events in a document (tag start, text, etc.) it - notifies your listener class of the event. You can supply any subset - of the methods, but make sure you implement method_missing if you - don't implement them all. A StreamListener module has been supplied as - a template for you to use.

- - list = MyListener.new -source = File.new "mydoc.xml" -REXML::Document.parse_stream(source, list) - -

Stream parsing in REXML is much like SAX, where events are - generated when the parser encounters them in the process of parsing - the document. When a tag is encountered, the stream listener's - tag_start() method is called. When the tag end is - encountered, tag_end() is called. When text is - encountered, text() is called, and so on, until the end - of the stream is reached. One other note: the method - entity() is called when an &entity; is - encountered in text, and only then.

- -

Please look at the StreamListener - API for more information.You must generate the API - documentation with rdoc or download the API documentation from the - REXML website for this documentation.

-
- - -

By default, REXML respects whitespace in your document. In many - applications, you want the parser to compress whitespace in your - document. In these cases, you have to tell the parser which elements - you want to respect whitespace in by passing a context to the - parser:

- - doc = REXML::Document.new( source, { :compress_whitespace => %w{ tag1 tag2 tag3 } } - -

Whitespace for tags "tag1", "tag2", and "tag3" will be compressed; - all other tags will have their whitespace respected. Like :raw, you - can set :compress_whitespace to :all, and have all elements have their - whitespace compressed.

- -

You may also use the tag :respect_whitespace, which - flip-flops the behavior. If you use :respect_whitespace - for one or more tags, only those elements will have their whitespace - respected; all other tags will have their whitespace compressed.

-
- - -

REXML does some automatic processing of entities for your - convenience. The processed entities are &, <, >, ", and '. - If REXML finds any of these characters in Text or Attribute values, it - automatically turns them into entity references when it writes them - out. Additionally, when REXML finds any of these entity references in - a document source, it converts them to their character equivalents. - All other entity references are left unprocessed. If REXML finds an - &, <, or > in the document source, it will generate a - parsing error.

- - bad_source = "<a>Cats & dogs</a>" -good_source = "<a>Cats &amp; &#100;ogs</a>" -doc = REXML::Document.new bad_source -# Generates a parse error -doc = REXML::Document.new good_source -puts doc.root.text -# -> "Cats & &#100;ogs" -doc.root.write $stdout -# -> "<a>Cats &amp; &#100;ogs</a>" -doc.root.attributes["m"] = "x'y\"z" -puts doc.root.attributes["m"] -# -> "x'y\"z" -doc.root.write $stdout -# -> "<a m='x&apos;y&quot;z'>Cats &amp; &#100;ogs</a>" -
- - -

Namespaces are fully supported in REXML and within the XPath - parser. There are a few caveats when using XPath, however:

- - - If you don't supply a namespace mapping, the default namespace - mapping of the context element is used. This has its limitations, - but is convenient for most purposes. - - If you need to supply a namespace mapping, you must use the - XPath methods each, first, and - match and pass them the mapping. - - - source = "<a xmlns:x='foo' xmlns:y='bar'><x:b id='1'/><y:b id='2'/></a>" -doc = Document.new source -doc.elements["/a/x:b"].attributes["id"] # -> '1' -XPath.first(doc, "/a/m:b", {"m"=>"bar"}).attributes["id"] # -> '2' -doc.elements["//x:b"].prefix # -> 'x' -doc.elements["//x:b"].namespace # -> 'foo' -XPath.first(doc, "//m:b", {"m"=>"bar"}).prefix # -> 'y' -
- - -

The pull parser API is not yet stable. When it settles down, I'll - fill in this section. For now, you'll have to bite the bullet and read - the PullParser - API docs. Ignore the PullListener class; it is a private helper - class.

-
- - -

The original REXML stream parsing API is very minimal. This also - means that it is fairly fast. For a more complex, more "standard" API, - REXML also includes a streaming parser with a SAX2+ API. This API - differs from SAX2 in a couple of ways, such as having more filters and - multiple notification mechanisms, but the core API is SAX2.

- -

The two classes in the SAX2 API are SAX2Parser - and SAX2Listener. - You can use the parser in one of five ways, depending on your needs. - Three of the ways are useful if you are filtering for a small number - of events in the document, such as just printing out the names of all - of the elements in a document, or getting all of the text in a - document. The other two ways are for more complex processing, where - you want to be notified of multiple events. The first three involve - Procs, and the last two involve listeners. The listener mechanisms are - very similar to the original REXML streaming API, with the addition of - filtering options, and are faster than the proc mechanisms.

- -

An example is worth a thousand words, so we'll just take a look at - a small example of each of the mechanisms. The first example involves - printing out only the text content of a document.

- - require 'rexml/sax2parser' -parser = REXML::SAX2Parser.new( File.new( 'documentation.xml' ) ) -parser.listen( :characters ) {|text| puts text } -parser.parse - -

In this example, we tell the parser to call our block for every - characters event. "characters" is what SAX2 calls Text - nodes. The event is identified by the symbol :characters. - There are a number of these events, including - :element_start, :end_prefix_mapping, and so - on; the events are named after the methods in the - SAX2Listener API, so refer to that document for a - complete list.

- -

You can additionally filter for particular elements by passing an - array of tag names to the listen method. In further - examples, we will not include the require or parser - construction lines, as they are the same for all of these - examples.

- - parser.listen( :characters, %w{ changelog todo } ) {|text| puts text } -parser.parse - -

In this example, only the text content of changelog and todo - elements will be printed. The array of tag names can also contain - regular expressions which the element names will be matched - against.

- -

Finally, as a shortcut, if you do not pass a symbol to the listen - method, it will default to :element_start

- - parser.listen( %w{ item }) do |uri,localname,qname,attributes| - puts attributes['version'] -end -parser.parse - -

This example prints the "version" attribute of all "item" elements - in the document. Notice that the number of arguments passed to the - block is larger than for :text; again, check the - SAX2Listener API for a list of what arguments are passed the blocks - for a given event.

- -

The last two mechanisms for parsing use the SAX2Listener API. Like - StreamListener, SAX2Listener is a module, so you can - include it in your class to give you an adapter. To use - the listener model, create a class that implements some of the - SAX2Listener methods, or all of them if you don't include the - SAX2Listener model. Add them to a parser as you would blocks, and when - the parser is run, the methods will be called when events occur. - Listeners do not use event symbols, but they can filter on element - names.

- - listener1 = MySAX2Listener.new -listener2 = MySAX2Listener.new -parser.listen( listener1 ) -parser.listen( %{ changelog, todo, credits }, listener2 ) -parser.parse - -

In the previous example, listener1 will be notified of - all events that occur, and listener2 will only be - notified of events that occur in changelog, - todo, and credits elements. We also see that - multiple listeners can be added to the same parser; multiple blocks - can also be added, and listeners and blocks can be mixed together.

- -

There is, as yet, no mechanism for recursion. Two upcoming features - of the SAX2 API will be the ability to filter based on an XPath, and - the ability to specify filtering on an elemnt and all of its - descendants.

- -

WARNING: The SAX2 API for dealing with doctype (DTD) - events almost certainly will change.

-
- - -

Michael Neumann contributed some convenience functions for nodes, - and they are general enough that I've included. Michael's use-case - examples follow: # - Starting with +root_node+, we recursively look for a node with the - given # +tag+, the given +attributes+ (a Hash) and whoose text equals - or matches the # +text+ string or regular expression. # # To find the - following node: # # <td class='abc'>text</td> # # We use: - # # find_node(root, 'td', {'class' => 'abc'}, "text") # # Returns - +nil+ if no matching node was found. def find_node(root_node, tag, - attributes, text) root_node.find_first_recursive {|node| node.name == - tag and attributes.all? {|attr, val| node.attributes[attr] == val} and - text === node.text } end # # Extract specific columns (specified by - the position of it's corresponding # header column) from a table. # # - Given the following table: # # <table> # <tr> # - <td>A</td> # <td>B</td> # - <td>C</td> # </tr> # <tr> # - <td>A.1</td> # <td>B.1</td> # - <td>C.1</td> # </tr> # <tr> # - <td>A.2</td> # <td>B.2</td> # - <td>C.2</td> # </tr> # </table> # # To extract - the first (A) and last (C) column: # # extract_from_table(root_node, - ["A", "C"]) # # And you get this as result: # # [ # ["A.1", "C.1"], # - ["A.2", "C.2"] # ] # def extract_from_table(root_node, headers) # - extract and collect all header nodes header_nodes = headers.collect { - |header| find_node(root_node, 'td', {}, header) } raise "some headers - not found" if header_nodes.compact.size < headers.size # assert - that all headers have the same parent 'header_row', which is the row # - in which the header_nodes are contained. 'table' is the surrounding - table tag. header_row = header_nodes.first.parent table = - header_row.parent raise "different parents" unless header_nodes.all? - {|n| n.parent == header_row} # we now iterate over all rows in the - table that follows the header_row. # for each row we collect the - elements at the same positions as the header_nodes. # this is what we - finally return from the method. (header_row.index_in_parent+1 .. - table.elements.size).collect do |inx| row = table.elements[inx] - header_nodes.collect { |n| row.elements[ n.index_in_parent ].text } - end end

-
- - -

This isn't everything there is to REXML, but it should be enough to - get started. Check the API - documentationYou must generate the API documentation - with rdoc or download the API documentation from the REXML website for - this documentation. for particulars and more examples. - There are plenty of unit tests in the test/ directory, - and these are great sources of working examples.

-
-
-
- - -

Among the people who've contributed to this document are:

- - - Eichert, Diana (bug - fix) - -
-
\ No newline at end of file diff --git a/test/rexml/data/underscore.xml b/test/rexml/data/underscore.xml deleted file mode 100644 index 111446f4bd..0000000000 --- a/test/rexml/data/underscore.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 1 - <_b>2 - - diff --git a/test/rexml/data/utf16.xml b/test/rexml/data/utf16.xml deleted file mode 100644 index f7e5e90d0c..0000000000 Binary files a/test/rexml/data/utf16.xml and /dev/null differ diff --git a/test/rexml/data/web.xml b/test/rexml/data/web.xml deleted file mode 100644 index 972cf5d272..0000000000 --- a/test/rexml/data/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - snoop - SnoopServlet - - - file - ViewFile - - initial - - 1000 - - - The initial value for the counter - - - - - - mv - - - *.wm - - - - - - - - manager - - - director - - - president - - - diff --git a/test/rexml/data/web2.xml b/test/rexml/data/web2.xml deleted file mode 100644 index 7d479d37e9..0000000000 --- a/test/rexml/data/web2.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/test/rexml/data/working.rss b/test/rexml/data/working.rss deleted file mode 100644 index b38c45f5d8..0000000000 --- a/test/rexml/data/working.rss +++ /dev/null @@ -1,202 +0,0 @@ - - - - - Paul Duncan - http://www.paulduncan.org/ - Paul Duncan's personal blog. - - - - Fun With Tense - - Wed Sep 3 19:37:18 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=23 - -<pre> -&lt;richlowe&gt; blah. -&lt;richlowe&gt; that's what I say. -&lt;pabs&gt; if i say it too then what happens? -&lt;richlowe&gt; then "that's what we say" -&lt;richlowe&gt; duh. -&lt;pabs&gt; what if i say it, then retract it? -&lt;richlowe&gt; Did they teach you nothing in school! -&lt;richlowe&gt; "that's what I say, and he said" -&lt;pabs&gt; :( -&lt;pabs&gt; okay what if i say it, retract it, but then plan on saying it - again at some point in the indeterminite future? -&lt;richlowe&gt; "that's what I say, and he has said, and will possibly say - again"? -&lt;pabs&gt; see now that's not concise at all -</pre> - - - - - - We'll Miss You, Michael - - Mon Aug 25 09:52:41 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=22 - -<p> -Perhaps <a href='http://www.dash-dash.org/pix/death.jpg'>the image</a> -on <a href='http://www.dash-dash.org/'>his site</a> was a bit more -fitting than we realized. I'm frustrated that nothing and noone around -him could help ease the pain that he was going through. We can take -comfort in knowing that he felt the decision he made was best for him. -We'll miss you, Michael. -</p> - - - - - - Horis, Isis, Osiris, Oh My! - - Fri Aug 22 22:39:23 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=21 - -<p> -I started reading one of the several mythology books I checked out -earlier this week (as part of a personal research project, the results -of which will be available here eventually). I've only made it through -about 60 pages of Egyptian mythology so far, but it's interesting stuff. -One thing that's impressive to me is how the sexes appear to be on much -more equal footing (as compared to the Judeo/Christian mythology we've -been innundated with for most of our lives). For example, Isis revives -her husband Osiris by collecting his body parts, which are scattered -throughout Egypt. She also saves her son Horus from death and nurtures -him until he can fend for himself. Really interesting stuff. Anyway, -I'll have more about the project as I get farther along. -</p> - - - - - - Nature Sucks - - Fri Aug 22 08:33:41 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=20 - -<p> -<a href='http://www.linuxbrit.co.uk/'>Tom</a> has been having a rough -couple of weeks. Apparently he's got <a -href='http://www.ninds.nih.gov/health_and_medical/disorders/bells_doc.htm'>Bell's -Palsy</a> (link from ljlane), which, while treatable and rarely -permanent, still leaves his face partially paralyzed. If you have a few -minutes, you might consider sending him an <abbr title='Electronic -Card'>E-Card</abbr> or an <a -href='mailto:dr_spock@linuxbrit.co.uk'>email</a>. -</p> - - - - - - Or Maybe He Does - - Thu Aug 21 23:45:40 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=19 - -<p> -Okay, apparently Ed <em>does</em> read this page. :-D -</p> - - - - - - Ed Got Married!! - - Thu Aug 21 15:52:34 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=18 - -<p> -Ed got married in the Bahamas! Here's a picture from the honeymoon: -</p> - -<img src='/files/ed_dolphin.jpg' width='252' height='288' - title='Ed on his honeymoon!' alt='Ed on his honeymoon!' /> - -<p> -(Fortunately he doesn't read this site). -</p> - -<p> -One other thing. I weigh 186<abbr title='Pounds'>lbs</abbr> now. -The <a href='http://www.pablotron.org/weight/'>weight page</a> has been -updated. -</p> - - - - - - Gratuitous Douglas Adams Reference, #32427! - - Tue Aug 19 08:25:42 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=17 - -<p> -Just saw this <acronym title='Uniform Resource Locator'>URL</acronym> -on <a href='http://www.diveintomark.org/'>Dive Into -Mark</a>: -</p> - -<p> -<a -href='http://www.google.com/search?q=answer+to+life+the+universe+and+everything'>http://www.google.com/search?q=answer+to+life+the+universe+and+everything</a> -</p> - -<p> -<a href='http://www.bbc.co.uk/h2g2/guide/'><acronym title='Hitchhikers -Guide to the Galaxy'>H2G2</acronym></a> references never get old for me. -</p> - - - - - - Weekend Update, sans Norm McDonald - - Tue Aug 19 08:18:32 2003 - paul@paulduncan.org - http://www.paulduncan.org/?id=16 - -<p> -What a nutty weekend. A friend of mine went to the <acronym -title='Emergency Room'>ER</acronym> on Friday night, so I spent 4 hours -down there. It's really frustrating to see that many sick and injured -people in once place, and not really be able to do anything about it. -Also, for that much chaos, both the atmosphere and the staff are -disturbingly calm. -</p> - -<p> -I finally got <a href='http://www.raggle.org/'>Raggle</a> to a point -worthy of a new release. I'm not going to blather on about the new -stuff; if you're interested you can <a -href='http://www.raggle.org/'>check it out</a> on your own. -</p> - -<p> -<a href='http://www.pablotron.org/weight/'>The war against obesity</a> -continues! I'm down to 188 pounds now, a total of 75 pounds lost since -the beginning of March. I've been having trouble losing these last 10 -pounds, so this week is officially "Go to the Gym Every Night or Else" -week. 2 days down, 5 to go. -</p> - - - - - diff --git a/test/rexml/data/xmlfile-bug.xml b/test/rexml/data/xmlfile-bug.xml deleted file mode 100644 index d4396682f7..0000000000 --- a/test/rexml/data/xmlfile-bug.xml +++ /dev/null @@ -1,15 +0,0 @@ - - -Technik - -Technik -Die Technik ist das Rckgrat der meisten Geschftsprozesse bei Home of the Brave. Deshalb sollen hier alle relevanten technischen Ablufe, Daten und Einrichtungen beschrieben werden, damit jeder im Bedarfsfall die ntigen Informationen, Anweisungen und Verhaltensempfehlungen nachlesen und/oder abrufen kann. - - - Flash - Ntzliches von Flashern fr Flasher. - CVS-FAQ - FAQ zur Benutzung von CVS bei HOB - - - diff --git a/test/rexml/data/xp.tst b/test/rexml/data/xp.tst deleted file mode 100644 index 6551372575..0000000000 --- a/test/rexml/data/xp.tst +++ /dev/null @@ -1,27 +0,0 @@ -/ -/rss -//rss -/rss/channel -//link -//image/* -//link[2] -//link[last()] -rss/channel/link[last()] -rss/channel/item/link[last()] -rss/channel/item/link[1] -rss/channel/item[@x='1'] -rss/channel/item[@x] -//item[@x] -//item[normalize-space(@name)='x'] -//*[count(title)=1] -//*[name()='link'] -//*[starts-with(name(),'li')] -//*[contains(name(),'y')] -//*[string-length(name()) = 4] -//copyright | //title -/child::rss -/descendant::* -//language/parent::* -/rss/channel/ancestor::* -//item[position() mod 2 = 0 ] -//item/ancestor::* \ No newline at end of file diff --git a/test/rexml/data/yahoo.xml b/test/rexml/data/yahoo.xml deleted file mode 100644 index b63a9440bc..0000000000 --- a/test/rexml/data/yahoo.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - -<![CDATA[Yahoo! News Search Results for market]]> -http://news.search.yahoo.com/search/news?p=market&ei=UTF-8 - -en-us -Copyright (c) 2004 Yahoo! Inc. All rights reserved. -Sun, 03 Sep 2006 16:34:54 GMT -5 - -Yahoo! News -142 -18 -http://news.search.yahoo.com/news -http://us.i1.yimg.com/us.yimg.com/i/us/nws/th/main_142.gif - -false -<![CDATA[Toyota increases share in US auto market (Manila Bulletin)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=13ck33lrk/*http%3A//www.mb.com.ph/archive_pages.php?url=http://www.mb.com.ph/issues/2006/09/04/BSNS2006090473427.html -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=13ck33lrk/*http%3A//www.mb.com.ph/archive_pages.php?url=http://www.mb.com.ph/issues/2006/09/04/BSNS2006090473427.html -Sun, 03 Sep 2006 16:21:30 GMT - - -<![CDATA[ANALYSIS - North Korea finds market for missiles shrinking (Reuters via Yahoo! Asia News)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=11ibfq78e/*http%3A//asia.news.yahoo.com/060903/3/2pd1j.html -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=11ibfq78e/*http%3A//asia.news.yahoo.com/060903/3/2pd1j.html -Sun, 03 Sep 2006 08:37:33 GMT - - -<![CDATA[Broward labor market's a solid performer (Miami Herald)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=13671c2t8/*http%3A//www.miami.com/mld/miamiherald/business/15427113.htm?source=rss&channel=miamiherald_business -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=13671c2t8/*http%3A//www.miami.com/mld/miamiherald/business/15427113.htm?source=rss&channel=miamiherald_business -Sun, 03 Sep 2006 07:39:53 GMT - - -<![CDATA[NID to help Jharkhand e-market crafts (Yahoo! India News)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=11hg1j19f/*http%3A//in.news.yahoo.com/060903/43/6780a.html -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=11hg1j19f/*http%3A//in.news.yahoo.com/060903/43/6780a.html -Sun, 03 Sep 2006 10:02:54 GMT - - -<![CDATA[Reinsurance market goes high-tech to predict disasters (The Herald-Tribune)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12j43rdgp/*http%3A//www.heraldtribune.com/apps/pbcs.dll/article?AID=/20060903/NEWS/609030458 -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12j43rdgp/*http%3A//www.heraldtribune.com/apps/pbcs.dll/article?AID=/20060903/NEWS/609030458 -Sun, 03 Sep 2006 10:34:36 GMT - - -<![CDATA[Government warned against going into property market (Sunday Business Post)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12pru5k6v/*http%3A//www.sbpost.ie/breakingnews/breaking_story.asp?j=4126020&p=4yz6x35&n=4126112&x= -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12pru5k6v/*http%3A//www.sbpost.ie/breakingnews/breaking_story.asp?j=4126020&p=4yz6x35&n=4126112&x= -Sun, 03 Sep 2006 09:31:34 GMT - - -<![CDATA[Farmers Market gets shoulder-to-shoulder crowds on Saturdays (Great Falls Tribune)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12pfls0n1/*http%3A//www.greatfallstribune.com/apps/pbcs.dll/article?AID=/20060903/NEWS01/609030306 -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12pfls0n1/*http%3A//www.greatfallstribune.com/apps/pbcs.dll/article?AID=/20060903/NEWS01/609030306 -Sun, 03 Sep 2006 11:12:36 GMT - - -<![CDATA[City Hall takes Plan B for SF market rehab (Sun Star)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=138rfnhvi/*http%3A//www.sunstar.com.ph/static/pam/2006/09/03/news/city.hall.takes.plan.b.for.sf.market.rehab.html -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=138rfnhvi/*http%3A//www.sunstar.com.ph/static/pam/2006/09/03/news/city.hall.takes.plan.b.for.sf.market.rehab.html -Sun, 03 Sep 2006 08:18:46 GMT - - -<![CDATA[Market watch (AG Weekly)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12ahobgi6/*http%3A//www.agweekly.com/articles/2006/09/02/news/markets/markets01.txt -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=12ahobgi6/*http%3A//www.agweekly.com/articles/2006/09/02/news/markets/markets01.txt -Sun, 03 Sep 2006 04:20:37 GMT - - -<![CDATA[Catholic War Vets Ladies Club sets flea market (Times Leader)]]> -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=1383flil1/*http%3A//www.timesleader.com/mld/timesleader/living/15431391.htm?source=rss&channel=timesleader_living -http://us.rd.yahoo.com/dailynews/rss/search/market/SIG=1383flil1/*http%3A//www.timesleader.com/mld/timesleader/living/15431391.htm?source=rss&channel=timesleader_living -Sun, 03 Sep 2006 07:07:50 GMT - - - - diff --git a/test/rexml/formatter/test_default.rb b/test/rexml/formatter/test_default.rb deleted file mode 100644 index b5b131724b..0000000000 --- a/test/rexml/formatter/test_default.rb +++ /dev/null @@ -1,19 +0,0 @@ -require_relative "../rexml_test_utils" - -module REXMLTests - class DefaultFormatterTest < Test::Unit::TestCase - def format(node) - formatter = REXML::Formatters::Default.new - output = "" - formatter.write(node, output) - output - end - - class InstructionTest < self - def test_content_nil - instruction = REXML::Instruction.new("target") - assert_equal("", format(instruction)) - end - end - end -end diff --git a/test/rexml/functions/test_base.rb b/test/rexml/functions/test_base.rb deleted file mode 100644 index 74dc1a31de..0000000000 --- a/test/rexml/functions/test_base.rb +++ /dev/null @@ -1,261 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" - -require "rexml/document" - -# TODO: Split me -module REXMLTests - class FunctionsTester < Test::Unit::TestCase - include REXML - - def setup - super - REXML::Functions.context = nil - end - - def test_functions - # trivial text() test - # confuse-a-function - source = "more dumb text" - doc = Document.new source - res = "" - XPath::each(doc.root, "text()") {|val| res << val.to_s} - assert_equal "more text", res - - res = XPath::first(doc.root, "b[last()]") - assert_equal '3', res.attributes['id'] - res = XPath::first(doc.root, "b[position()=2]") - assert_equal '2', res.attributes['id'] - res = XPath::first(doc.root, "*[name()='c']") - assert_equal "c", res.name - end - - # Contributed by Mike Stok - def test_starts_with - source = <<-EOF - - a@b.c - http://www.foo.com - - EOF - doc = Document.new source - mailtos = doc.elements.to_a("//a[starts-with(@href, 'mailto:')]") - assert_equal 1, mailtos.size - assert_equal "mailto:a@b.c", mailtos[0].attributes['href'] - - ailtos = doc.elements.to_a("//a[starts-with(@href, 'ailto:')]") - assert_equal 0, ailtos.size - end - - def test_string_length - doc = Document.new <<-EOF - - - - - - - - - EOF - assert doc, "create doc" - - set = doc.elements.to_a("//*[string-length(name()) = 3]") - assert_equal 2, set.size, "nodes with names length = 3" - - set = doc.elements.to_a("//*[string-length(name()) < 3]") - assert_equal 2, set.size, "nodes with names length < 3" - - set = doc.elements.to_a("//*[string-length(name()) > 3]") - assert_equal 3, set.size, "nodes with names length > 3" - end - - # Test provided by Mike Stok - def test_contains - source = <<-EOF - - a@b.c - http://www.foo.com - - EOF - doc = Document.new source - - [['o', 2], ['foo', 1], ['bar', 0]].each { |test| - search, expected = test - set = doc.elements.to_a("//a[contains(@href, '#{search}')]") - assert_equal expected, set.size - } - end - - # Mike Stok and Sean Russell - def test_substring - # examples from http://www.w3.org/TR/xpath#function-substring - doc = Document.new('') - - #puts XPath.first(d, 'node()[0 + 1]') - #d = Document.new("") - #puts XPath.first(d, 'a[0 mod 0]') - [ [1.5, 2.6, '234'], - [0, 3, '12'], - [0, '0 div 0', ''], - [1, '0 div 0', ''], - ['-42', '1 div 0', '12345'], - ['-1 div 0', '1 div 0', ''] - ].each { |start, length, expected| - set = doc.elements.to_a("//test[substring(@string, #{start}, #{length}) = '#{expected}']") - assert_equal 1, set.size, "#{start}, #{length}, '#{expected}'" - } - end - - def test_substring_angrez - testString = REXML::Functions::substring_after("helloworld","hello") - assert_equal( 'world', testString ) - end - - def test_translate - source = <<-EOF - - - - - - - - EOF - - doc = Document.new(source) - - [ ['bar', 'abc', 'ABC', 'w3c one'], - ['--aaa--','abc-','ABC', 'w3c two'], - ['lead', 'dear language', 'doll groover', 'alchemy'], - ['A Space Odissei', 'i', 'y', 'vbxml one'], - ['abcdefg', 'aceg', 'ACE', 'vbxml two'], - ].each { |arg1, arg2, arg3, name| - translate = "translate('#{arg1}', '#{arg2}', '#{arg3}')" - set = doc.elements.to_a("//case[@result = #{translate}]") - assert_equal 1, set.size, translate - assert_equal name, set[0].attributes['name'] - } - end - - def test_name - d = REXML::Document.new("") - assert_equal 1, d.root.elements.to_a('*[name() = "b"]').size - assert_equal 1, d.elements.to_a('//*[name() = "x:b"]').size - end - - def test_local_name - d = REXML::Document.new("") - assert_equal 2, d.root.elements.to_a('*[local_name() = "b"]').size - assert_equal 2, d.elements.to_a('//*[local_name() = "b"]').size - end - - def test_substring2 - doc = Document.new('') - assert_equal(1,doc.elements.to_a("//test[substring(@string,2)='2345']").size) - end - - # Submitted by Kouhei - def test_floor_ceiling_round - source = "" - doc = REXML::Document.new(source) - - id_1 = doc.elements["/a/b[@id='1']"] - id_2 = doc.elements["/a/b[@id='2']"] - id_3 = doc.elements["/a/b[@id='3']"] - - good = { - "floor" => [[], [id_1], [id_2], [id_3]], - "ceiling" => [[id_1], [id_2], [id_3], []], - "round" => [[id_1], [id_2], [id_3], []] - } - good.each do |key, value| - (0..3).each do |i| - xpath = "//b[number(@id) = #{key}(#{i+0.5})]" - assert_equal(value[i], REXML::XPath.match(doc, xpath)) - end - end - - good["round"] = [[], [id_1], [id_2], [id_3]] - good.each do |key, value| - (0..3).each do |i| - xpath = "//b[number(@id) = #{key}(#{i+0.4})]" - assert_equal(value[i], REXML::XPath.match(doc, xpath)) - end - end - end - - # Submitted by Kou - def test_lang - d = Document.new(<<-XML) - - - - - - - - - XML - - assert_equal(1, d.elements.to_a("//*[lang('fr')]").size) - assert_equal(3, d.elements.to_a("//*[lang('ja')]").size) - assert_equal(2, d.elements.to_a("//*[lang('en')]").size) - assert_equal(1, d.elements.to_a("//*[lang('en-us')]").size) - - d = Document.new(<<-XML) - - -
- - -
- XML - - assert_equal(5, d.elements.to_a("//*[lang('en')]").size) - end - - def test_ticket_60 - document = REXML::Document.new("A1") - assert_equal( "A", REXML::XPath.first(document, '//b[.="A"]').text ) - assert_equal( "1", REXML::XPath.first(document, '//b[.="1"]').text ) - end - - def test_normalize_space - source = "" - doc = REXML::Document.new(source) - predicate = "string(.)=normalize_space('\nCOMMENT \n A \n\n ')" - m = REXML::XPath.match(doc, "//comment()[#{predicate}]") - assert_equal( [REXML::Comment.new("COMMENT A")], m ) - end - - def test_string_nil_without_context - doc = REXML::Document.new(<<-XML) - - - - - - XML - - assert_equal([doc.root.elements[2]], - REXML::XPath.match(doc, - "//foo[@bar=$n]", - nil, - {"n" => nil})) - end - - def test_unregistered_method - doc = Document.new("") - assert_nil(XPath::first(doc.root, "to_s()")) - end - - def test_nonexistent_function - doc = Document.new("") - # TODO: Maybe, this is not XPath spec behavior. - # This behavior must be reconsidered. - assert_equal(doc.root.elements[1], - XPath::first(doc.root, "nonexistent()")) - end - end -end diff --git a/test/rexml/functions/test_boolean.rb b/test/rexml/functions/test_boolean.rb deleted file mode 100644 index b3e2117c10..0000000000 --- a/test/rexml/functions/test_boolean.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: false - -require "test/unit" -require "rexml/document" -require "rexml/functions" - -module REXMLTests - class TestFunctionsBoolean < Test::Unit::TestCase - def setup - REXML::Functions.context = nil - end - - def test_true - assert_equal(true, REXML::Functions.boolean(true)) - end - - def test_false - assert_equal(false, REXML::Functions.boolean(false)) - end - - def test_integer_true - assert_equal(true, REXML::Functions.boolean(1)) - end - - def test_integer_positive_zero - assert_equal(false, REXML::Functions.boolean(0)) - end - - def test_integer_negative_zero - assert_equal(false, REXML::Functions.boolean(-0)) - end - - def test_float_true - assert_equal(true, REXML::Functions.boolean(1.1)) - end - - def test_float_positive_zero - assert_equal(false, REXML::Functions.boolean(-0.0)) - end - - def test_float_negative_zero - assert_equal(false, REXML::Functions.boolean(-0.0)) - end - - def test_float_nan - assert_equal(false, REXML::Functions.boolean(Float::NAN)) - end - - def test_string_true - assert_equal(true, REXML::Functions.boolean("content")) - end - - def test_string_empty - assert_equal(false, REXML::Functions.boolean("")) - end - - def test_node_set_true - root = REXML::Document.new("").root - assert_equal(true, REXML::Functions.boolean([root])) - end - - def test_node_set_empty - assert_equal(false, REXML::Functions.boolean([])) - end - - def test_nil - assert_equal(false, REXML::Functions.boolean(nil)) - end - - def test_context - REXML::Functions.context = {node: true} - assert_equal(true, REXML::Functions.boolean()) - end - end -end diff --git a/test/rexml/functions/test_local_name.rb b/test/rexml/functions/test_local_name.rb deleted file mode 100644 index 97c9e74852..0000000000 --- a/test/rexml/functions/test_local_name.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: false - -require "test/unit" -require "rexml/document" -require "rexml/functions" - -module REXMLTests - class TestFunctionsLocalName < Test::Unit::TestCase - def setup - REXML::Functions.context = nil - end - - def test_one - document = REXML::Document.new(<<-XML) - - - - XML - node_set = document.root.children - assert_equal("child", REXML::Functions.local_name(node_set)) - end - - def test_multiple - document = REXML::Document.new(<<-XML) - - - - - XML - node_set = document.root.children - assert_equal("child1", REXML::Functions.local_name(node_set)) - end - - def test_nonexistent - assert_equal("", REXML::Functions.local_name([])) - end - - def test_context - document = REXML::Document.new("") - REXML::Functions.context = {node: document.root} - assert_equal("root", REXML::Functions.local_name()) - end - end -end diff --git a/test/rexml/functions/test_number.rb b/test/rexml/functions/test_number.rb deleted file mode 100644 index 16e635701c..0000000000 --- a/test/rexml/functions/test_number.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: false - -require "test/unit" -require "rexml/document" -require "rexml/functions" - -module REXMLTests - class TestFunctionsNumber < Test::Unit::TestCase - def setup - REXML::Functions.context = nil - end - - def test_true - assert_equal(1, REXML::Functions.number(true)) - end - - def test_false - assert_equal(0, REXML::Functions.number(false)) - end - - def test_numeric - assert_equal(29, REXML::Functions.number(29)) - end - - def test_string_integer - assert_equal(100, REXML::Functions.number("100")) - end - - def test_string_float - assert_equal(-9.13, REXML::Functions.number("-9.13")) - end - - def test_node_set - root = REXML::Document.new("100").root - assert_equal(100, REXML::Functions.number([root])) - end - end -end diff --git a/test/rexml/listener.rb b/test/rexml/listener.rb deleted file mode 100644 index 6bede03c59..0000000000 --- a/test/rexml/listener.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: false -class Listener - attr_reader :ts, :te - attr_reader :normalize - def initialize - @ts = false - @te = false - end - def tag_start name, attrs - @ts = true if name=="subsection" and attrs["title"]=="Namespaces" - end - def tag_end name - @te = true if name=="documentation" - end - def text text - @normalize = text - #text.tr! "\n", ' ' - #puts "text #{text[0..10]}..." - end - def instruction name, instruction - #puts "instruction" - end - def comment comment - #puts "comment #{comment[0..10]}..." - end - def doctype name, pub_sys, long_name, uri - #puts "doctype #{name}" - end - def attlistdecl content - #puts "attlistdecl" - end - def elementdecl content - #puts "elementdecl" - end - def entitydecl content - #puts "entitydecl" - end - def notationdecl content - #puts "notationdecl" - end - def entity content - #puts "entity" - end - def cdata content - #puts "cdata" - end - def xmldecl version, encoding, standalone - #puts "xmldecl #{version}" - end -end - diff --git a/test/rexml/parse/test_document_type_declaration.rb b/test/rexml/parse/test_document_type_declaration.rb deleted file mode 100644 index 80f70888fb..0000000000 --- a/test/rexml/parse/test_document_type_declaration.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: false -require "test/unit" -require "rexml/document" - -module REXMLTests - class TestParseDocumentTypeDeclaration < Test::Unit::TestCase - private - def xml(internal_subset) - <<-XML - - - XML - end - - def parse(internal_subset) - REXML::Document.new(xml(internal_subset)).doctype - end - - class TestMixed < self - def test_entity_element - doctype = parse(<<-INTERNAL_SUBSET) - - - INTERNAL_SUBSET - assert_equal([REXML::Entity, REXML::ElementDecl], - doctype.children.collect(&:class)) - end - - def test_attlist_entity - doctype = parse(<<-INTERNAL_SUBSET) - - - INTERNAL_SUBSET - assert_equal([REXML::AttlistDecl, REXML::Entity], - doctype.children.collect(&:class)) - end - - def test_notation_attlist - doctype = parse(<<-INTERNAL_SUBSET) - - - INTERNAL_SUBSET - assert_equal([REXML::NotationDecl, REXML::AttlistDecl], - doctype.children.collect(&:class)) - end - end - end -end diff --git a/test/rexml/parse/test_element.rb b/test/rexml/parse/test_element.rb deleted file mode 100644 index 7322e0eb4e..0000000000 --- a/test/rexml/parse/test_element.rb +++ /dev/null @@ -1,51 +0,0 @@ -require "test/unit" -require "rexml/document" - -module REXMLTests - class TestParseElement < Test::Unit::TestCase - def parse(xml) - REXML::Document.new(xml) - end - - class TestInvalid < self - def test_top_level_end_tag - exception = assert_raise(REXML::ParseException) do - parse("") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Unexpected top-level end tag (got 'a') -Line: 1 -Position: 4 -Last 80 unconsumed characters: - - DETAIL - end - - def test_no_end_tag - exception = assert_raise(REXML::ParseException) do - parse("
") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Invalid attribute name: <:a=""> -Line: 1 -Position: 9 -Last 80 unconsumed characters: - - DETAIL - end - end - end -end diff --git a/test/rexml/parse/test_notation_declaration.rb b/test/rexml/parse/test_notation_declaration.rb deleted file mode 100644 index 0d29f0d81f..0000000000 --- a/test/rexml/parse/test_notation_declaration.rb +++ /dev/null @@ -1,100 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' -require 'rexml/document' - -module REXMLTests - class TestParseNotationDeclaration < Test::Unit::TestCase - private - def xml(internal_subset) - <<-XML - - - XML - end - - def parse(internal_subset) - REXML::Document.new(xml(internal_subset)).doctype - end - - class TestCommon < self - def test_name - doctype = parse("") - assert_equal("name", doctype.notation("name").name) - end - end - - class TestExternalID < self - class TestSystem < self - def test_single_quote - doctype = parse(<<-INTERNAL_SUBSET) - - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - - def test_double_quote - doctype = parse(<<-INTERNAL_SUBSET) - - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - end - - class TestPublic < self - class TestPublicIDLiteral < self - def test_single_quote - doctype = parse(<<-INTERNAL_SUBSET) - - INTERNAL_SUBSET - assert_equal("public-id-literal", doctype.notation("name").public) - end - - def test_double_quote - doctype = parse(<<-INTERNAL_SUBSET) - - INTERNAL_SUBSET - assert_equal("public-id-literal", doctype.notation("name").public) - end - end - - class TestSystemLiteral < self - def test_single_quote - doctype = parse(<<-INTERNAL_SUBSET) - - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - - def test_double_quote - doctype = parse(<<-INTERNAL_SUBSET) - - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - end - end - - class TestMixed < self - def test_system_public - doctype = parse(<<-INTERNAL_SUBSET) - - - INTERNAL_SUBSET - assert_equal(["system-name", "public-name"], - doctype.notations.collect(&:name)) - end - - def test_public_system - doctype = parse(<<-INTERNAL_SUBSET) - - - INTERNAL_SUBSET - assert_equal(["public-name", "system-name"], - doctype.notations.collect(&:name)) - end - end - end - end -end diff --git a/test/rexml/parse/test_processing_instruction.rb b/test/rexml/parse/test_processing_instruction.rb deleted file mode 100644 index a23513fc6e..0000000000 --- a/test/rexml/parse/test_processing_instruction.rb +++ /dev/null @@ -1,25 +0,0 @@ -require "test/unit" -require "rexml/document" - -module REXMLTests - class TestParseProcessinInstruction < Test::Unit::TestCase - def parse(xml) - REXML::Document.new(xml) - end - - class TestInvalid < self - def test_no_name - exception = assert_raise(REXML::ParseException) do - parse("") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Invalid processing instruction node -Line: 1 -Position: 4 -Last 80 unconsumed characters: - - DETAIL - end - end - end -end diff --git a/test/rexml/parser/test_sax2.rb b/test/rexml/parser/test_sax2.rb deleted file mode 100644 index 91d135f5f7..0000000000 --- a/test/rexml/parser/test_sax2.rb +++ /dev/null @@ -1,203 +0,0 @@ -# frozen_string_literal: false -require "test/unit" -require "rexml/parsers/sax2parser" -require "rexml/sax2listener" - -module REXMLTests -class TestSAX2Parser < Test::Unit::TestCase - class TestDocumentTypeDeclaration < self - private - def xml(internal_subset) - <<-XML - - - XML - end - - class TestEntityDeclaration < self - class Listener - include REXML::SAX2Listener - attr_reader :entity_declarations - def initialize - @entity_declarations = [] - end - - def entitydecl(declaration) - super - @entity_declarations << declaration - end - end - - private - def parse(internal_subset) - listener = Listener.new - parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset)) - parser.listen(listener) - parser.parse - listener.entity_declarations - end - - class TestGeneralEntity < self - class TestValue < self - def test_double_quote - assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - def test_single_quote - assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - - class TestExternlID < self - class TestSystem < self - def test_with_ndata - declaration = [ - "name", - "SYSTEM", "system-literal", - "NDATA", "ndata-name", - ] - assert_equal([declaration], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - def test_without_ndata - declaration = [ - "name", - "SYSTEM", "system-literal", - ] - assert_equal([declaration], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - - class TestPublic < self - def test_with_ndata - declaration = [ - "name", - "PUBLIC", "public-literal", "system-literal", - "NDATA", "ndata-name", - ] - assert_equal([declaration], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - def test_without_ndata - declaration = [ - "name", - "PUBLIC", "public-literal", "system-literal", - ] - assert_equal([declaration], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - end - end - - class TestParameterEntity < self - class TestValue < self - def test_double_quote - assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - def test_single_quote - assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - - class TestExternlID < self - def test_system - declaration = [ - "%", - "name", - "SYSTEM", "system-literal", - ] - assert_equal([declaration], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - def test_public - declaration = [ - "%", - "name", - "PUBLIC", "public-literal", "system-literal", - ] - assert_equal([declaration], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - end - end - - class TestNotationDeclaration < self - class Listener - include REXML::SAX2Listener - attr_reader :notation_declarations - def initialize - @notation_declarations = [] - end - - def notationdecl(*declaration) - super - @notation_declarations << declaration - end - end - - private - def parse(internal_subset) - listener = Listener.new - parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset)) - parser.listen(listener) - parser.parse - listener.notation_declarations - end - - class TestExternlID < self - def test_system - declaration = ["name", "SYSTEM", nil, "system-literal"] - assert_equal([declaration], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - def test_public - declaration = ["name", "PUBLIC", "public-literal", "system-literal"] - assert_equal([declaration], parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - - class TestPublicID < self - def test_literal - declaration = ["name", "PUBLIC", "public-literal", nil] - assert_equal([declaration], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - end - end - end -end -end diff --git a/test/rexml/parser/test_stream.rb b/test/rexml/parser/test_stream.rb deleted file mode 100644 index c315833e4b..0000000000 --- a/test/rexml/parser/test_stream.rb +++ /dev/null @@ -1,32 +0,0 @@ -require "test/unit" -require "rexml/document" -require "rexml/streamlistener" - -module REXMLTests - class TestStreamParser < Test::Unit::TestCase - class NullListener - include REXML::StreamListener - end - - class TestInvalid < self - def test_no_end_tag - xml = "" - exception = assert_raise(REXML::ParseException) do - parse(xml) - end - assert_equal(<<-MESSAGE, exception.to_s) -Missing end tag for '/root/sub' -Line: 1 -Position: #{xml.bytesize} -Last 80 unconsumed characters: - MESSAGE - end - - private - def parse(xml, listener=nil) - listener ||= NullListener.new - REXML::Document.parse_stream(xml, listener) - end - end - end -end diff --git a/test/rexml/parser/test_tree.rb b/test/rexml/parser/test_tree.rb deleted file mode 100644 index 8a5d9d1223..0000000000 --- a/test/rexml/parser/test_tree.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: false -require "test/unit" -require "rexml/document" -require "rexml/parsers/treeparser" - -module REXMLTests -class TestTreeParser < Test::Unit::TestCase - class TestInvalid < self - def test_unmatched_close_tag - xml = "" - exception = assert_raise(REXML::ParseException) do - parse(xml) - end - assert_equal(<<-MESSAGE, exception.to_s) -Missing end tag for 'root' (got 'not-root') -Line: 1 -Position: #{xml.bytesize} -Last 80 unconsumed characters: - MESSAGE - end - - def test_no_close_tag - xml = "" - exception = assert_raise(REXML::ParseException) do - parse(xml) - end - assert_equal(<<-MESSAGE, exception.to_s) -No close tag for /root -Line: 1 -Position: #{xml.bytesize} -Last 80 unconsumed characters: - MESSAGE - end - - private - def parse(xml) - document = REXML::Document.new - parser = REXML::Parsers::TreeParser.new(xml, document) - parser.parse - end - end -end -end diff --git a/test/rexml/parser/test_ultra_light.rb b/test/rexml/parser/test_ultra_light.rb deleted file mode 100644 index 8f4a3980d5..0000000000 --- a/test/rexml/parser/test_ultra_light.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: false -require "test/unit" -require "rexml/parsers/ultralightparser" - -module REXMLTests -class TestUltraLightParser < Test::Unit::TestCase - class TestDocumentTypeDeclaration < self - def test_entity_declaration - assert_equal([ - [ - :start_doctype, - :parent, - "root", - "SYSTEM", - "urn:x-test", - nil, - [:entitydecl, "name", "value"] - ], - [:text, "\n"], - [:start_element, :parent, "root", {}], - [:text, "\n"], - ], - parse(<<-INTERNAL_SUBSET)) - - INTERNAL_SUBSET - end - - private - def xml(internal_subset) - <<-XML - - - XML - end - - def parse(internal_subset) - parser = REXML::Parsers::UltraLightParser.new(xml(internal_subset)) - normalize(parser.parse) - end - - def normalize(root) - root.collect do |child| - normalize_child(child) - end - end - - def normalize_child(child) - tag = child.first - case tag - when :start_doctype - normalized_parent = :parent - normalized_doctype = child.dup - normalized_doctype[1] = normalized_parent - normalized_doctype - when :start_element - tag, _parent, name, attributes, *children = child - normalized_parent = :parent - normalized_children = children.collect do |sub_child| - normalize_child(sub_child) - end - [tag, normalized_parent, name, attributes, *normalized_children] - else - child - end - end - end -end -end diff --git a/test/rexml/rexml_test_utils.rb b/test/rexml/rexml_test_utils.rb deleted file mode 100644 index 8bb002cee2..0000000000 --- a/test/rexml/rexml_test_utils.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: false - -require "test/unit" -require "rexml/document" - -module REXMLTestUtils - def fixture_path(*components) - File.join(File.dirname(__FILE__), "data", *components) - end -end diff --git a/test/rexml/test_attribute.rb b/test/rexml/test_attribute.rb deleted file mode 100644 index 5175bd4454..0000000000 --- a/test/rexml/test_attribute.rb +++ /dev/null @@ -1,14 +0,0 @@ -require_relative "rexml_test_utils" - -module REXMLTests - class AttributeTest < Test::Unit::TestCase - def test_empty_prefix - error = assert_raise(ArgumentError) do - REXML::Attribute.new(":x") - end - assert_equal("name must be " + - "\#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: <\":x\">", - error.message) - end - end -end diff --git a/test/rexml/test_attributes.rb b/test/rexml/test_attributes.rb deleted file mode 100644 index d6f566bdf8..0000000000 --- a/test/rexml/test_attributes.rb +++ /dev/null @@ -1,223 +0,0 @@ -# frozen_string_literal: false -require 'test/unit/testcase' -require 'rexml/document' - -module REXMLTests - class AttributesTester < Test::Unit::TestCase - include REXML - def test_accessor - doc = Document.new("") - assert_equal '3', doc.root.attributes['att'] - assert_equal '2', doc.root.attributes['bar:att'] - doc.root.attributes['att'] = 5 - assert_equal '5', doc.root.attributes['att'] - end - - def test_each_attribute - doc = Document.new('') - doc.root.attributes.each_attribute {|attr| - if attr.expanded_name == 'x' - assert_equal '1', attr.value - elsif attr.expanded_name == 'y' - assert_equal '2', attr.value - else - assert_fail "No such attribute!!" - end - } - end - - def test_each - doc = Document.new('') - doc.root.attributes.each {|name, value| - if name == 'x' - assert_equal '1', value - elsif name == 'y' - assert_equal '2', value - else - assert_fail "No such attribute!!" - end - } - end - - def test_get_attribute - doc = Document.new('') - assert_equal '2', doc.root.attributes.get_attribute("foo").value - assert_equal '1', doc.root.attributes.get_attribute("x:foo").value - end - - def test_size - doc = Document.new("") - assert_equal 4, doc.root.attributes.length - end - - def test_setter - doc = Document.new("") - doc.root.attributes['y:foo'] = '2' - assert_equal '2', doc.root.attributes['y:foo'] - doc.root.attributes['foo'] = '4' - assert_equal '4', doc.root.attributes['foo'] - doc.root.attributes['x:foo'] = nil - assert_equal 3, doc.root.attributes.size - end - - def test_delete - doc = Document.new("") - doc.root.attributes.delete 'foo' - assert_equal 6, doc.root.attributes.size - assert_equal '1', doc.root.attributes['x:foo'] - - doc.root.attributes.delete 'x:foo' - assert_equal 5, doc.root.attributes.size - - attr = doc.root.attributes.get_attribute('y:foo') - doc.root.attributes.delete attr - assert_equal 4, doc.root.attributes.size - - assert_equal '4', doc.root.attributes['z:foo'] - end - - def test_prefixes - doc = Document.new("") - prefixes = doc.root.attributes.prefixes - assert_equal 2, prefixes.size - assert_equal 0, (prefixes - ['x', 'y']).size - end - - # Contributed by Mike Stok - def test_values_with_apostrophes - doc = Document.new(%q##) - s = doc.to_s - assert(s =~ /h1='1'2''/) - assert(s =~ /h2='1"2'/) - end - - # Submitted by Kou - def test_namespace_conflict - assert_raise( ParseException, - "Declaring two attributes with the same namespace should be an error" ) do - REXML::Document.new <<-XML - - - - XML - end - - REXML::Document.new("") - end - - # Submitted by Kou - def test_attribute_deletion - e = REXML::Element.new - e.add_namespace("a", "http://a/") - e.add_namespace("b", "http://b/") - e.add_attributes({"c" => "cc", "a:c" => "cC", "b:c" => "CC"}) - - e.attributes.delete("c") - assert_nil(e.attributes.get_attribute("c")) - - before_size = e.attributes.size - e.attributes.delete("c") - assert_nil(e.attributes.get_attribute("c")) - assert_equal(before_size, e.attributes.size) - - e.attributes.delete(e.attributes.get_attribute("a:c")) - assert_nil(e.attributes.get_attribute("a:c")) - - e.attributes.delete("b:c") - assert_nil(e.attributes.get_attribute("b:c")) - - before_size = e.attributes.size - e.attributes.delete(e.attributes.get_attribute("b:c")) - assert_nil(e.attributes.get_attribute("b:c")) - assert_equal(before_size, e.attributes.size) - - before_size = e.attributes.size - e.attributes.delete("c") - assert_nil(e.attributes.get_attribute("c")) - assert_equal(before_size, e.attributes.size) - - e.add_attribute("c", "cc") - - e.attributes.delete(e.attributes.get_attribute("c")) - assert_nil(e.attributes.get_attribute("c")) - end - - # Submitted by Kou - def test_element_usage - attr = Attribute.new("name", "value") - elem = Element.new("elem") - a = Attribute.new(attr, elem) - assert_equal(elem, a.element) - end - - def attr_test(attr_name,attr_value) - a1 = REXML::Attribute.new(attr_name,attr_value) - - s1 = a1.value - s2 = a1.value - - #p s1 - #p s2 - assert_equal(s1,s2) - - a2 = REXML::Attribute.new(attr_name,attr_value) - - a2.to_s # NB invocation of to_s - s1 = a2.value - s2 = a2.value - - #p s1 - #p s2 - assert_equal(s1,s2) - end - - def test_amp_attributes - attr_test('name','value with & ampersand only') - end - - def test_amp_and_lf_attributes - attr_test('name','value with LF & ampersand') - end - - def test_quoting - d = Document.new(%q{}) - assert_equal( %q{}, d.to_s ) - d.root.context[:attribute_quote] = :quote - assert_equal( %q{}, d.to_s ) - - d = Document.new(%q{}) - assert_equal( %q{}, d.to_s ) - d.root.context[:attribute_quote] = :quote - assert_equal( %q{}, d.to_s ) - end - - def test_ticket_127 - doc = Document.new - doc.add_element 'a', { 'v' => 'x & y' } - assert doc.to_s.index(';') - end - - def test_to_a_with_namespaces - document = Document.new(<<-XML) - - - -XML - child = document.root.elements["child"] - assert_equal([ - "attribute='no-ns'", - "ns1:attribute='ns1'", - "ns2:attribute='ns2'", - "other-attribute='other-value'", - ], - child.attributes.to_a.collect(&:to_string).sort) - end - end -end diff --git a/test/rexml/test_attributes_mixin.rb b/test/rexml/test_attributes_mixin.rb deleted file mode 100644 index 3a9f54eefd..0000000000 --- a/test/rexml/test_attributes_mixin.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' -require 'rexml/document' - -module REXMLTests - class TestAttributes < Test::Unit::TestCase - def setup - @ns_a = "urn:x-test:a" - @ns_b = "urn:x-test:b" - element_string = <<-"XMLEND" - - XMLEND - @attributes = REXML::Document.new(element_string).root.attributes - end - - def test_get_attribute_ns - assert_equal("1", @attributes.get_attribute_ns("", "a").value) - assert_equal("2", @attributes.get_attribute_ns("", "b").value) - assert_equal("3", @attributes.get_attribute_ns(@ns_a, "c").value) - assert_equal("4", @attributes.get_attribute_ns(@ns_a, "d").value) - assert_equal("5", @attributes.get_attribute_ns(@ns_a, "e").value) - assert_equal("6", @attributes.get_attribute_ns(@ns_b, "f").value) - end - end -end diff --git a/test/rexml/test_changing_encoding.rb b/test/rexml/test_changing_encoding.rb deleted file mode 100644 index a2dc07254a..0000000000 --- a/test/rexml/test_changing_encoding.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# frozen_string_literal: false - -require 'rexml/encoding' - -module REXMLTests - class ChangingEncodings < Test::Unit::TestCase - def initialize a - @u = 'テスト ほげ ふが 美しい' - @e = @u.encode("EUC-JP") - @f = Foo.new - super - end - - class Foo - include REXML::Encoding - end - - # Note that these tests must be executed in order for the third one to - # actually test anything. - def test_0_euc - @f.encoding = 'EUC-JP' - assert_equal( @u, @f.decode(@e) ) - # This doesn't happen anymore, for some reason - #assert_raise( Iconv::IllegalSequence, "Decoding unicode should fail" ) { - # @f.decode(@u) == @u - #} - end - - def test_1_utf - @f.encoding = 'UTF-8' - assert_not_equal( @u, @f.decode( @e ) ) - assert_equal( @u, @f.decode( @u ) ) - end - - def test_2_euc - @f.encoding = 'EUC-JP' - assert_equal( @u, @f.decode(@e) ) - # This doesn't happen anymore, for some reason - #assert_raise( Iconv::IllegalSequence, "Decoding unicode should fail" ) { - # @f.decode(@u) == @u - #} - end - end -end diff --git a/test/rexml/test_comment.rb b/test/rexml/test_comment.rb deleted file mode 100644 index 0af2f5ca76..0000000000 --- a/test/rexml/test_comment.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" - -require 'rexml/document' - -module REXMLTests - class CommentTester < Test::Unit::TestCase - # Bug #5278 - def test_hyphen_end_line_in_doctype - xml = <<-XML - - -]> - - XML - document = REXML::Document.new(xml) - comments = document.doctype.children.find_all do |child| - child.is_a?(REXML::Comment) - end - assert_equal([" comment end with hyphen -\n here "], - comments.collect(&:to_s)) - end - end -end diff --git a/test/rexml/test_contrib.rb b/test/rexml/test_contrib.rb deleted file mode 100644 index 8462b3c23f..0000000000 --- a/test/rexml/test_contrib.rb +++ /dev/null @@ -1,585 +0,0 @@ -# coding: binary -# frozen_string_literal: false - -require_relative "rexml_test_utils" - -require "rexml/document" -require "rexml/parseexception" -require "rexml/formatters/default" - -module REXMLTests - class ContribTester < Test::Unit::TestCase - include REXMLTestUtils - include REXML - - XML_STRING_01 = < - - - Thomas, David; Hunt, Andrew - english - Addison-Wesley - Programming Ruby. The Pragmatic Programmer's Guide - 2000 - - - Blammo, Blah - english - Hubbabubba - Foozboozer's Life - Book - 2002 - - -DELIMITER - - XML_STRING_02 = < - - english - Addison-Wesley - Programming Ruby. The Pragmatic Programmer's Guide - Book - 2000 - - - Blammo, Blah - english - Hubbabubba - Foozboozer's Life - Book - 2002 - - -DELIMITER - - # Tobias Reif - def test_bad_doctype_Tobias - source = <<-EOF - --> - - - ' - > - ] - > - EOF - doc = REXML::Document.new source - doc.write(out="") - assert(out[/>\'>/] != nil, "Couldn't find >'>") - assert(out[/\]>/] != nil, "Couldn't find ]>") - end - - # Peter Verhage - def test_namespace_Peter - source = <<-EOF - - - - - - - - EOF - doc = REXML::Document.new source - assert_equal "myprog-config", doc.root.name - count = 0 - REXML::XPath.each(doc, "x:myprog-config/x:main/x:parameter", - {"x"=>"http://someurl/program/version"}) { |element| - assert_equal "name", element.attributes["name"] - count += 1; - } - assert_equal 1, count - assert_equal "myprog-config", doc.elements["config:myprog-config"].name - end - - # Tobias Reif - def test_complex_xpath_Tobias - source = <<-EOF - - - - - - - - - - - - - EOF - # elements that have child elements - # but not grandchildren - # and not children that don't have a style attribute - # and not children that have a unique style attribute - complex_path = "*[* "+ - "and not(*/node()) "+ - "and not(*[not(@style)]) "+ - "and not(*/@style != */@style)]" - doc = REXML::Document.new source - results = REXML::XPath.match( doc.root, complex_path ) - assert(results) - assert_equal 1, results.size - assert_equal "foo", results[0].name - end - - # "Chris Morris" - def test_extra_newline_on_read_Chris - text = 'test text' - e = REXML::Element.new('Test') - e.add_text(text) - REXML::Formatters::Default.new.write(e,out="") - - doc = REXML::Document.new(out) - outtext = doc.root.text - - assert_equal(text, outtext) - end - - # Tobias Reif - def test_other_xpath_Tobias - schema = <<-DELIM - - - - - - - - - - - - - - - - DELIM - - doc = REXML::Document.new schema - - result = REXML::XPath.first(doc.root, 'xs:element[descendant::xs:element[@ref]]') - assert result - assert_equal "svg", result.attributes['name'] - result = REXML::XPath.first(doc, 'element[descendant::element[@ref]]') - assert_nil result - end - - #this first test succeeds, to check if stuff is set up correctly - def test_xpath_01_TobiasReif - doc = Document.new XML_STRING_01.dup - desired_result = Document.new 'Thomas, David; Hunt, Andrew' - xpath = '//author' - result = XPath.first(doc, xpath) - assert_equal desired_result.to_s, result.to_s - end - - def test_xpath_whitespace_TobiasReif - # same as above, with whitespace in XPath - doc = Document.new(XML_STRING_01.dup) - desired_result = Document.new('Thomas, David; Hunt, Andrew') - xpath = "\/\/author\n \n" - result = XPath.first(doc, xpath) - failure_message = "\n[[[TR: AFAIK, whitespace should be allowed]]]\n" - assert_equal(desired_result.to_s, result.to_s, failure_message) - end - - def test_xpath_02_TobiasReif - doc = Document.new XML_STRING_01.dup - desired_result = Document.new 'Thomas, David; Hunt, Andrew' - # Could that quirky - # Programmer',"'",'s - # be handled automatically, somehow? - # Or is there a simpler way? (the below XPath should match the author element above, - # AFAIK; I tested it inside an XSLT) - xpath = %q{/biblio/entry[ - title/text()=concat('Programming Ruby. The Pragmatic Programmer',"'",'s Guide') - and - year='2000' - ]/author} - result = XPath.first(doc, xpath) - failure_message = "\nHow to handle the apos inside the string inside the XPath?\nXPath = #{xpath}\n" - assert_equal desired_result.to_s, result.to_s, failure_message - end - - def test_xpath_03_TobiasReif - doc = Document.new XML_STRING_02.dup - desired_result_string = " - english - Addison-Wesley - Programming Ruby. The Pragmatic Programmer's Guide - Book - 2000 - " - Document.new desired_result_string - xpath = "/biblio/entry[not(author)]" - result = XPath.first(doc, xpath) - assert_equal desired_result_string, result.to_s - end - - def test_umlaut - koln_iso = "K\xf6ln" - koln_utf = "K\xc3\xb6ln" - source_iso = "#{koln_iso}" - source_utf = "#{koln_utf}" - - if String.method_defined? :encode - koln_iso.force_encoding('iso-8859-1') - koln_utf.force_encoding('utf-8') - source_iso.force_encoding('iso-8859-1') - source_utf.force_encoding('utf-8') - end - - doc = REXML::Document.new(source_iso) - assert_equal('ISO-8859-1', doc.xml_decl.encoding) - assert_equal(koln_utf, doc.root.text) - doc.write(out="") - assert_equal(source_iso, out ) - doc.xml_decl.encoding = 'UTF-8' - doc.write(out="") - assert_equal(source_utf, out) - - doc = Document.new <<-EOF - - -Technik - -Technik -Die Technik ist das R\xFCckgrat der meisten Gesch\xFCftsprozesse bei Home of the Brave. Deshalb sollen hier alle relevanten technischen Abl\xFCufe, Daten und Einrichtungen beschrieben werden, damit jeder im Bedarfsfall die n\xFCtigen Informationen, Anweisungen und Verhaltensempfehlungen nachlesen und/oder abrufen kann. - - - Flash - N\xFCtzliches von Flashern f\xFCr Flasher. - CVS-FAQ - FAQ zur Benutzung von CVS bei HOB - - -EOF - tn = XPath.first(doc, "//nebenspalte/text()[2]") - expected_iso = "N\xFCtzliches von Flashern f\xFCr Flasher." - expected_utf = expected_iso.unpack('C*').pack('U*') - expected_iso.force_encoding(::Encoding::ISO_8859_1) - expected_utf.force_encoding(::Encoding::UTF_8) - assert_equal(expected_utf, tn.to_s.strip) - f = REXML::Formatters::Default.new - f.write( tn, Output.new(o = "", "ISO-8859-1") ) - assert_equal(expected_iso, o.strip) - - doc = File.open(fixture_path('xmlfile-bug.xml')) {|file| Document.new file } - tn = XPath.first(doc, "//nebenspalte/text()[2]") - assert_equal(expected_utf, tn.to_s.strip) - f.write( tn, Output.new(o = "", "ISO-8859-1") ) - assert_equal(expected_iso, o.strip) - end - - def test_element_cloning_namespace_Chris - aDoc = REXML::Document.new '

Dummy title

' - - anElement = anElement = aDoc.elements[1] - elementAttrPrefix = anElement.attributes.get_attribute('content').prefix - - aClone = anElement.clone - cloneAttrPrefix = aClone.attributes.get_attribute('content').prefix - - assert_equal( elementAttrPrefix , cloneAttrPrefix ) - end - - def test_namespaces_in_attlist_tobias - in_string = File.open(fixture_path('foo.xml'), 'r') do |file| - file.read - end - - doc = Document.new in_string - - assert_nil XPath.first(doc,'//leg') - assert_equal 'http://www.foo.com/human', doc.root.elements[1].namespace - assert_equal 'human leg', - XPath.first(doc, '//x:leg/text()', {'x'=>'http://www.foo.com/human'}).to_s - end - - # Alun ap Rhisiart - def test_less_than_in_element_content - doc = File.open(fixture_path('ProductionSupport.xml')) do |source| - REXML::Document.new source - end - h = Hash.new - doc.elements.each("//CommonError") { |el| - h[el.elements['Key'].text] = 'okay' - } - assert(h.include?('MotorInsuranceContract(Object)>>#error:')) - end - - # XPaths provided by Thomas Sawyer - def test_various_xpath - #@doc = REXML::Document.new('

') - doc = REXML::Document.new('

3

') - - [['/r', REXML::Element], - ['/r/p/c', REXML::Element], - ['/r/attribute::a', Attribute], - ['/r/@a', Attribute], - ['/r/attribute::*', Attribute], - ['/r/@*', Attribute], - ['/r/p/c/attribute::b', Attribute], - ['/r/p/c/@b', Attribute], - ['/r/p/c/attribute::*', Attribute], - ['/r/p/c/@*', Attribute], - ['//c/attribute::b', Attribute], - ['//c/@b', Attribute], - ['//c/attribute::*', Attribute], - ['//c/@*', Attribute], - ['.//node()', REXML::Node ], - ['.//node()[@a]', REXML::Element ], - ['.//node()[@a="1"]', REXML::Element ], - ['.//node()[@b]', REXML::Element ], # no show, why? - ['.//node()[@b="2"]', REXML::Element ] - ].each do |xpath,kind| - begin - REXML::XPath.each( doc, xpath ) do |what| - assert_kind_of( kind, what, "\n\nWrong type (#{what.class}) returned for #{xpath} (expected #{kind.name})\n\n" ) - end - rescue Exception - puts "PATH WAS: #{xpath}" - raise - end - end - - [ - ['/r', 'attribute::a', Attribute ], - ['/r', '@a', Attribute ], - ['/r', 'attribute::*', Attribute ], - ['/r', '@*', Attribute ], - ['/r/p/c', 'attribute::b', Attribute ], - ['/r/p/c', '@b', Attribute ], - ['/r/p/c', 'attribute::*', Attribute ], - ['/r/p/c', '@*', Attribute ] - ].each do |nodepath, xpath, kind| - begin - context = REXML::XPath.first(doc, nodepath) - REXML::XPath.each( context, xpath ) do |what| - assert_kind_of kind, what, "Wrong type (#{what.class}) returned for #{xpath} (expected #{kind.name})\n" - end - rescue Exception - puts "PATH WAS: #{xpath}" - raise - end - end - end - - def test_entities_Holden_Glova - document = <<-EOL - - - - - - - - - - - - - ]> - - - - - uga.rb - 0444 - &rbconfig.libdir;/rexml - ... the file here - - - booga.h - 0444 - &rbconfig.includedir; - ... the file here - - - foo.so - 0555 - &rbconfig.sitearchdir;/rexml - Li4uIHRoZSBmaWxlIGhlcmU=\n - - - - - EOL - - file_xpath = '/rubynet/pkg/files/file' - - root = REXML::Document.new(document) - - root.elements.each(file_xpath) do |metadata| - text = metadata.elements['path'].get_text.value - assert text !~ /&rbconfig/, "'#{text}' failed" - end - - #Error occurred in test_package_file_opens(TC_PackageInstall): - # ArgumentError: - #illegal access mode &rbconfig.prefix;/lib/rexml - # - #[synack@Evergreen] src $ ruby --version - #ruby 1.6.7 (2002-03-01) [i686-linux-gnu] - # - #It looks like it expanded the first entity, but didn't reparse it for more - #entities. possible bug - or have I mucked this up? - end - - def test_whitespace_after_xml_decl - Document.new < - - - - -EOL - end - - def test_external_entity - xp = '//channel/title' - - %w{working.rss broken.rss}.each do |path| - File.open(File.join(fixture_path(path))) do |file| - doc = REXML::Document.new file.readlines.join('') - - # check to make sure everything is kosher - assert_equal( doc.root.class, REXML::Element ) - assert_equal( doc.root.elements.class, REXML::Elements ) - - # get the title of the feed - assert( doc.root.elements[xp].kind_of?( REXML::Element ) ) - end - end - end - - def test_maintain_dtd - src = %q{ - - -%extern-packages; -%extern-common; -]>} - doc = Document.new( src ) - doc.write( out="" ) - src = src.tr('"', "'") - out = out.tr('"', "'") - assert_equal( src, out ) - end - - def test_text_nodes_nomatch - source = "test" - d = REXML::Document.new( source ) - r = REXML::XPath.match( d, %q{/root/child[text()="no-test"]} ) - assert_equal( 0, r.size ) - end - - def test_raw_Terje_Elde - f = REXML::Formatters::Default.new - txt = 'abcødef' - a = Text.new( txt,false,nil,true ) - f.write(a,out="") - assert_equal( txt, out ) - - txt = 'abcødef' - a = Document.new( txt, { :raw => ["russell"] } ) - f.write(a,out="") - assert_equal( txt, out ) - end - - def test_indenting_error - a=Element.new("test1") - b=Element.new("test2") - c=Element.new("test3") - b << c - a << b - - REXML::Formatters::Pretty.new.write(a,"") - end - - def test_pos - require 'tempfile' - Tempfile.create("tidal") {|testfile| - testdata = %Q{ -
-760 -50 -
-
-} - - testfile.puts testdata - testfile.rewind - assert_nothing_raised do - REXML::Document.new(testfile) - end - } - end - - def test_deep_clone - a = Document.new( '' ) - b = a.deep_clone - assert_equal a.to_s, b.to_s - end - - def test_double_escaping - data = 'AT&T' - xml = "" - - doc = REXML::Document.new(xml) - description = doc.find {|e| e.name=="description"} - assert_equal data, description.text - end - - def test_ticket_12 - cfg = "ab" - - config = REXML::Document.new( cfg ) - - assert_equal( "a", config.elements[ "//child1" ].text ) - end - -=begin - # This is a silly test, and is low priority - def test_namespace_serialization_tobi_reif - doc = Document.new ' - - ' - ns = 'http://www.foo.foo' - ns_declaration={'f'=>ns} - returned = XPath.match(doc,'//f:p',ns_declaration) - # passes: - assert( (returned[0].namespace==ns), 'namespace should be '+ns) - serialized = returned.to_s - serialized_and_parsed = Document.new(serialized) - puts 'serialized: '+serialized - # ... currently brings - # prefix b is undeclared (!) - assert( (serialized_and_parsed.namespace==ns), - 'namespace should still be '+ns.inspect+ - ' and not '+serialized_and_parsed.namespace.inspect) - # ... currently results in a failure: - # 'namespace should still be "http://www.foo.foo" and not ""' - end -=end - end -end diff --git a/test/rexml/test_core.rb b/test/rexml/test_core.rb deleted file mode 100644 index 41e6e43540..0000000000 --- a/test/rexml/test_core.rb +++ /dev/null @@ -1,1517 +0,0 @@ -# -*- coding: utf-8 -*- -# frozen_string_literal: false - -require_relative "rexml_test_utils" - -require "rexml/document" -require "rexml/parseexception" -require "rexml/output" -require "rexml/source" -require "rexml/formatters/pretty" -require "rexml/undefinednamespaceexception" - -require_relative "listener" - -module REXMLTests - class Tester < Test::Unit::TestCase - include REXMLTestUtils - include REXML - def setup - @xsa_source = <<-EOL - - - - - - - - Lars Marius Garshol - larsga@garshol.priv.no - http://www.stud.ifi.uio.no/~lmariusg/ - - - EOL - end - - def test_bad_markup - [ - " foo ", - '<0/>', - '&', - '&a', -# '&a;', # FIXME - '', - '', - '', - '', - '', - '', - '', - "", - "\f", - "", - "\000", -# FIXME '', - '', - '￿', -# FIXME '', -# FIXME '', - ].each do |src| - assert_raise( ParseException, %Q{Parse #{src.inspect} should have failed!} ) do - Document.new(src) - end - end - end - - def test_attribute - # Testing constructors - #a = Attribute.new "hello", "dolly" - #b = Attribute.new a - #d = Document.new( "" ) - #c = d[0].attributes.get_attribute( "hello" ) - - #assert_equal a, b - #for attr in [ a, b, c] - # assert_equal "hello", attr.name - # assert_equal "dolly", attr.value - #end - - # This because of a reported bug in attribute handling in 1.0a8 - source = 'blah' - doc = Document.new source - doc.elements.each do |a| - a.attributes['att'] << 'B' - assert_equal "AB", a.attributes['att'] - a.attributes['att'] = 'C' - assert_equal "C", a.attributes['att'] - end - - # Bryan Murphy - text = "this is a {target[@name='test']/@value} test" - source = <<-EOL - - - EOL - - xml = Document.new source - value = xml.root.attributes["search"] - assert_equal text, value.to_s - - e = Element.new "test" - e.add_attributes({ "name1" => "test1", "name4" => "test4" }) - e.add_attributes([["name3","test3"], ["name2","test2"]]) - assert_equal "test1", e.attributes["name1"] - assert_equal "test2", e.attributes["name2"] - assert_equal "test3", e.attributes["name3"] - assert_equal "test4", e.attributes["name4"] - - # ensure that the attributes come out in sorted order - assert_equal %w().join(' '), e.to_s - end - - def test_attribute_namespace_conflict - # https://www.w3.org/TR/xml-names/#uniqAttrs - message = <<-MESSAGE -Duplicate attribute "a" -Line: 4 -Position: 140 -Last 80 unconsumed characters: - MESSAGE - assert_raise_with_message(REXML::ParseException, message) do - Document.new(<<-XML) - - - - - - XML - end - end - - def test_attribute_default_namespace - # https://www.w3.org/TR/xml-names/#uniqAttrs - document = Document.new(<<-XML) - - - - - - XML - attributes = document.root.elements.collect do |element| - element.attributes.each_attribute.collect do |attribute| - [attribute.prefix, attribute.namespace, attribute.name] - end - end - assert_equal([ - [ - ["", "", "a"], - ["", "", "b"], - ], - [ - ["", "", "a"], - ["n1", "http://www.w3.org", "a"], - ], - ], - attributes) - end - - def test_cdata - test = "The quick brown fox jumped - & < & < \" ' - over the lazy dog." - - source = "" - d = REXML::Document.new( source ) - - # Test constructors - cdata = d[0][0] - assert_equal test, cdata.value - end - - def test_comment - string = "This is a new comment!" - source = "" - comment = Comment.new string - REXML::Formatters::Default.new.write( comment, out = "" ) - assert_equal(source, out) - - comment2 = Comment.new comment - assert_equal(comment, comment2) - - assert_raise(ParseException) { - REXML::Document.new("") - } - assert_raise(ParseException) { - REXML::Document.new(" - - - - - - - - - - - - - - - - - - EOF - doc = Document.new source - assert_equal "someuri", doc.root.namespace - assert_equal "default", doc.root.elements[1].namespace - assert_equal "someuri", doc.root.elements[2].namespace - assert_equal "notdefault", doc.root.elements[ 3 ].namespace - - # Testing namespaces in attributes - source = <<-EOF - - - - - - EOF - doc = Document.new source - b = doc.root.elements["b"] - assert_equal "x", b.attributes["b:a"] - assert_equal "y", b.attributes["a"] - - doc = Document.new - doc.add_element "sean:blah" - doc.root.text = "Some text" - out = "" - doc.write(out) - assert_equal "Some text", out - end - - - def test_add_namespace - e = Element.new 'a' - e.add_namespace 'someuri' - e.add_namespace 'foo', 'otheruri' - e.add_namespace 'xmlns:bar', 'thirduri' - assert_equal 'someuri', e.attributes['xmlns'] - assert_equal 'otheruri', e.attributes['xmlns:foo'] - assert_equal 'thirduri', e.attributes['xmlns:bar'] - end - - - def test_big_documentation - d = File.open(fixture_path("documentation.xml")) {|f| Document.new f } - assert_equal "Sean Russell", d.elements["documentation/head/author"].text.tr("\n\t", " ").squeeze(" ") - out = "" - d.write out - end - - def test_tutorial - doc = File.open(fixture_path("tutorial.xml")) {|f| Document.new f } - out = "" - doc.write out - end - - def test_stream - c = Listener.new - File.open(fixture_path("documentation.xml")) do |f| - Document.parse_stream( f, c ) - end - assert(c.ts, "Stream parsing apparently didn't parse the whole file") - assert(c.te, "Stream parsing dropped end tag for documentation") - - Document.parse_stream(" ", c) - - Document.parse_stream("<>&", c) - assert_equal('<>&', c.normalize) - end - - def test_line - f = File.new(fixture_path("bad.xml")) - Document.new f - assert_fail "There should have been an error" - rescue Exception - # We should get here - assert($!.line == 5, "Should have been an error on line 5, "+ - "but was reported as being on line #{$!.line}" ) - ensure - f.close if f - end - - def test_substitution - val = "a'b\"c" - el = Element.new("a") - el.attributes["x"] = val - REXML::Formatters::Default.new.write(el, out="") - - nel = Document.new( out) - assert_equal( val, nel.root.attributes["x"] ) - end - - def test_exception - source = SourceFactory.create_from "" - p = ParseException.new( "dummy message", source ) - begin - raise "dummy" - rescue Exception - p.continued_exception = $! - end - end - - def test_bad_content - in_gt = 'content>content' - in_lt = 'content' - - # This is OK - tree_gt = Document.new in_gt - assert_equal "content>content", tree_gt.elements[1].text - # This isn't - begin - Document.new in_lt - assert_fail "Should have gotten a parse error" - rescue ParseException - end - end - - def test_iso_8859_1_output_function - out = "" - output = Output.new( out ) - koln_iso_8859_1 = "K\xF6ln" - koln_utf8 = "K\xc3\xb6ln" - source = Source.new( koln_iso_8859_1, 'iso-8859-1' ) - results = source.scan(/.*/)[0] - koln_utf8.force_encoding('UTF-8') if koln_utf8.respond_to?(:force_encoding) - assert_equal koln_utf8, results - output << results - if koln_iso_8859_1.respond_to?(:force_encoding) - koln_iso_8859_1.force_encoding('ISO-8859-1') - end - assert_equal koln_iso_8859_1, out - end - - def test_attributes_each - doc = Document.new("") - count = 0 - doc.root.elements[1].attributes.each {|k,v| count += 1 } - assert_equal 4, count - end - - def test_delete_namespace - doc = Document.new "" - doc.root.delete_namespace - doc.root.delete_namespace 'x' - assert_equal "", doc.to_s - end - - def test_each_element_with_attribute - doc = Document.new "" - arry = [] - block = proc { |e| - assert arry.include?(e.name) - arry.delete e.name - } - # Yields b, c, d - arry = %w{b c d} - doc.root.each_element_with_attribute( 'id', &block ) - assert_equal 0, arry.size - # Yields b, d - arry = %w{b d} - doc.root.each_element_with_attribute( 'id', '1', &block ) - assert_equal 0, arry.size - # Yields b - arry = ['b'] - doc.root.each_element_with_attribute( 'id', '1', 1, &block ) - assert_equal 0, arry.size - # Yields d - arry = ['d'] - doc.root.each_element_with_attribute( 'id', '1', 0, 'd', &block ) - assert_equal 0, arry.size - end - def test_each_element_with_text - doc = Document.new 'bbd' - arry = [] - block = proc { |e| - assert arry.include?(e.name) - arry.delete e.name - } - # Yields b, c, d - arry = %w{b c d} - doc.root.each_element_with_text(&block) - assert_equal 0, arry.size - # Yields b, d - arry = %w{b c} - doc.root.each_element_with_text( 'b', &block ) - assert_equal 0, arry.size - # Yields b - arry = ['b'] - doc.root.each_element_with_text( 'b', 1, &block ) - assert_equal 0, arry.size - # Yields d - arry = ['d'] - doc.root.each_element_with_text( nil, 0, 'd', &block ) - assert_equal 0, arry.size - end - - def test_element_parse_stream - s = Source.new( "some text" ) - l = Listener.new - class << l - def tag_start name, attributes - raise "Didn't find proper tag name" unless 'a'==name - end - end - - Document::parse_stream(s, l) - end - - def test_deep_clone - a = Document.new( 'texttexttext' ) - b = a.deep_clone - assert_equal a.to_s, b.to_s - - a = Document.new( 'some < text more > text > ' ) - b = a.deep_clone - assert_equal a.to_s, b.to_s - c = Document.new( b.to_s ) - assert_equal a.to_s, c.to_s - end - - def test_whitespace_before_root - a = < - - - - -EOL - d = Document.new(a) - b = "" - d.write( b ) - assert_equal a,b - end - - def test_entities - a = Document.new( 'eeü' ) - assert_equal('eeü'.force_encoding("UTF-8"), a.root.text) - end - - def test_element_decl - element_decl = Source.new(" -]>") - doc = Document.new( element_decl ) - d = doc[0] - assert_equal("", d.to_s.split(/\n/)[1].strip) - end - - def test_attlist_decl - doc = Document.new <<-EOL - - - ]> - - EOL - assert_equal 'gobble', doc.root.attributes['bar'] - assert_equal 'xxx', doc.root.elements[2].namespace - assert_equal 'two', doc.root.elements[1].namespace - assert_equal 'foo', doc.root.namespace - - doc = Document.new <<-EOL - - - - ]> - - EOL - prefixes = doc.root.prefixes.sort - correct = ['svg', 'xlink', 'xml'] - assert_equal correct, prefixes - end - - def test_attlist_write - doc = File.open(fixture_path("foo.xml")) {|file| Document.new file } - out = '' - doc.write(out) - end - - def test_more_namespaces - assert_raise( REXML::UndefinedNamespaceException, - %Q{Should have gotten an Undefined Namespace error} ) { - Document.new("

") - } - doc2 = Document.new("

") - es = XPath.match(doc2, '//c') - assert_equal 0, es.size - es = XPath.match(doc2, '//n:c') - assert_equal 1, es.size - doc2.root.add_namespace('m', '2') - doc2.root.add_element("m:o") - es = XPath.match(doc2, './/o') - assert_equal 0, es.size - es = XPath.match(doc2, '//n:c') - assert_equal 1, es.size - end - - def test_ticket_51 - doc = REXML::Document.new <<-EOL - - X - Y - - - Z - - - EOL - - # The most common case. People not caring about the namespaces much. - assert_equal( "XY", XPath.match( doc, "/*:test/*:a/text()" ).join ) - assert_equal( "XY", XPath.match( doc, "/*:test/x:a/text()" ).join ) - # Surprising? I don't think so, if you believe my definition of the "common case" - assert_equal( "XYZ", XPath.match( doc, "//*:a/text()" ).join ) - - # These are the uncommon cases. Namespaces are actually important, so we define our own - # mappings, and pass them in. - assert_equal( "XY", XPath.match( doc, "/f:test/f:a/text()", { "f" => "1" } ).join ) - # The namespaces are defined, and override the original mappings - assert_equal( "XY", XPath.match( doc, "/*:test/*:a/text()", { "f" => "1" } ).join ) - assert_equal( "", XPath.match( doc, "/x:test/x:a/text()", { "f" => "1" } ).join ) - assert_equal( "XYZ", XPath.match( doc, "//*:a/text()", { "f" => "1" } ).join ) - end - - def test_processing_instruction - d = Document.new("") - assert_equal 4, XPath.match(d, '//processing-instruction()' ).size - match = XPath.match(d, "//processing-instruction('foo3')" ) - assert_equal 1, match.size - assert_equal 'bar3', match[0].content - end - - def test_oses_with_bad_EOLs - Document.new("\n\n\n\n\n\n\n\n") - end - - # Contributed (with patch to fix bug) by Kouhei - def test_ignore_whitespace - source = " abc " - - context_all = {:ignore_whitespace_nodes => :all} - context_a = {:ignore_whitespace_nodes => %(a)} - context_b = {:ignore_whitespace_nodes => %(b)} - - tests = [[[" abc ", "def"], context_all], - [[" abc ", "def"], context_a], - [[" ", " abc ", "def", " "], context_b]] - - tests.each do |test| - assert_equal(test[0], Document.new(source, test[1]).root.texts.collect{|x| - x.to_s}) - end - end - - def test_0xD_in_preface - doc = "\x0D\x0D" - doc = Document.new doc - end - - def test_hyphens_in_doctype - doc = REXML::Document.new <<-EOQ - - - - - - EOQ - - assert_equal('a-b-c', doc.doctype.name) - end - - def test_accents - docs = [ - %Q{ - - - - -}, - ' - - - - -', - %Q{ - - - - -}, - %Q{ - - - - -} ] - docs.each_with_index { |d,i| - begin - REXML::Document.new(d) - rescue - puts "#{i} => #{docs[i]}" - raise - end - } - end - - def test_replace_text - e = REXML::Element.new( "a" ) - e.add_text( "foo" ) - assert_equal( "foo", e.to_s ) - e[0].value = "bar" - assert_equal( "bar", e.to_s ) - e[0].value = "<" - assert_equal( "<", e.to_s ) - assert_equal( "<", e[0].value ) - end - - - def test_write_doctype - ## XML Document and Declaration - document = REXML::Document.new - xmldecl = REXML::XMLDecl.new("1.0", "UTF-8") - document.add(xmldecl) - s = "" - document.write(s) - - ## XML Doctype - str = '' - source = REXML::Source.new(str) - doctype = REXML::DocType.new(source) - document.add(doctype) - document.write(s) - - ## Element - element = REXML::Element.new("hoge") - document.add(element) - - document.write(s) - end - - def test_write_cdata - src = "A" - doc = REXML::Document.new( src ) - out = "" - doc.write( out ) - assert_equal( src, out ) - - src = "" - doc = REXML::Document.new( src ) - out = "" - doc.write( out ) - assert_equal( src, out ) - end - - def test_namespace_attributes - source = <<-EOL - - - - EOL - d = Document.new( source ) - assert_equal( 'foo', REXML::XPath.first(d.root, "//x:b/@x:n").value ) - assert_equal( nil, REXML::XPath.first(d.root, "//x:b/@x:n", {})) - end - - def test_null_element_name - a = REXML::Document.new - assert_raise( RuntimeError ) { - a.add_element( nil ) - } - end - - def test_text_raw - # From the REXML tutorial - # (http://www.germane-software.com/software/rexml/test/data/tutorial.html) - doc = Document.new <<-EOL - - - ]> - - EOL - a = doc.root - - # This makes sure that RAW text nodes don't have their entity strings - # replaced - t = Text.new "Sean", false, nil, true - a.text = t - assert_equal( "Sean", t.to_s ) - assert_equal( "Sean", t.value ) - - # This makes sure that they do - t = Text.new "Sean", false, nil, false - a.text = t - assert_equal( "&s;", t.to_s ) - assert_equal( "Sean", t.value ) - - t = Text.new "&s;", false, nil, true - a.text = t - assert_equal( "&s;", t.to_s ) - assert_equal( "Sean", t.value ) - - t = Text.new "&s;", false, nil, true - a.text = t - assert_equal( "&s;", t.to_s ) - assert_equal( "Sean", t.value ) - - # Ticket #44 - t = REXML::Text.new( "&", false, nil, true ) - assert_equal( "&", t.to_s ) - - t = REXML::Text.new("&", false, false) - assert_equal( "&amp;", t.to_s ) - end - - def test_to_xpath - doc = REXML::Document.new( %q{ - - - }) - names = %w{ /tag1/tag2[1] /tag1/tag2[2] } - doc.root.elements.each_with_index {|el, i| - assert_equal( names[i], el.xpath ) - } - end - - def test_transitive - doc = REXML::Document.new( "") - s = "" - doc.write( s, 0, true ) - end - - # This is issue #40 - def test_replace_with - old = 'oldold' - d = REXML::Document.new(old).root - new = REXML::Text.new('new',true,nil,true) - child = d.children[2] - child.replace_with(new) - assert_equal( new, d.children[2] ) - end - - def test_repeated_writes - a = IO.read(fixture_path("iso8859-1.xml")) - f = REXML::Formatters::Pretty.new - - xmldoc = REXML::Document.new( a ) - a_andre = xmldoc.elements['//image'].attributes['caption'] - - f.write(xmldoc,b="") - - xmldoc = REXML::Document.new(b) - b_andre = xmldoc.elements['//image'].attributes['caption'] - assert_equal( a_andre, b_andre ) - - f.write(xmldoc,c="") - - xmldoc = REXML::Document.new(c) - c_andre = xmldoc.elements['//image'].attributes['caption'] - assert_equal( b_andre, c_andre ) - - o = Output.new(d="","UTF-8") - f.write(xmldoc,o) - assert_not_equal( c, d ) - end - - def test_pretty_format_long_text_finite - n = 1_000_000 - long_text = 'aaaa ' * n - xml = "#{long_text}" - formatter = REXML::Formatters::Pretty.new - document = nil - begin - document = REXML::Document.new(xml) - rescue REXML::ParseException - skip_message = "skip this test because we can't check Pretty#wrap " + - "works without # on " + - "small memory system. # " + - "will be raised on the system. See also [ruby-dev:42599]." - return skip_message - end - output = "" - formatter.write(document, output) - assert_equal("\n" + - ((" " + (" aaaa" * 15) + "\n") * (n / 15)) + - " " + ("aaaa " * (n % 15)) + "\n" + - "", - output) - end - - def test_pretty_format_deep_indent - n = 6 - elements = "" - n.times do |i| - elements << "" - elements << "element#{i} " * 5 - end - (n - 1).downto(0) do |i| - elements << "" - end - xml = "#{elements}" - document = REXML::Document.new(xml) - formatter = REXML::Formatters::Pretty.new - formatter.width = 20 - output = "" - formatter.write(document, output) - assert_equal(<<-XML.strip, output) - - - element0 - element0 - element0 - element0 - element0\s - - element1 - element1 - element1 - element1 - element1\s - - element2 - element2 - element2 - element2 - element2\s - - element3 - element3 - element3 - element3 - element3\s - - element4 - element4 - element4 - element4 - element4 - \s - - element5 element5 element5 element5 element5\s - - - - - - - - XML - end - - def test_ticket_58 - doc = REXML::Document.new - doc << REXML::XMLDecl.default - doc << REXML::Element.new("a") - - str = "" - doc.write(str) - - assert_equal("", str) - - doc = REXML::Document.new - doc << REXML::XMLDecl.new("1.0", "UTF-8") - doc << REXML::Element.new("a") - - str = "" - doc.write(str) - - assert_equal("", str) - end - - # Incomplete tags should generate an error - def test_ticket_53 - assert_raise( REXML::ParseException ) { - REXML::Document.new( "" ) - } - assert_raise( REXML::ParseException ) { - REXML::Document.new( "" ) - } - assert_raise( REXML::ParseException ) { - REXML::Document.new( "" ) - } - end - - def test_ticket_52 - source = "" - d = REXML::Document.new(source) - d.write(k="") - assert_equal( source, k ) - - source = "" - target = "\n \n" - d = REXML::Document.new(source) - REXML::Formatters::Pretty.new(4).write(d,k="") - assert_equal( target, k ) - end - - def test_ticket_76 - src = "
at&t" - assert_raise( ParseException, %Q{"#{src}" is invalid XML} ) { - REXML::Document.new(src) - } - end - - def test_ticket_21 - src = "" - exception = assert_raise(ParseException) do - Document.new(src) - end - assert_equal(<<-DETAIL, exception.to_s) -Missing attribute value start quote: -Line: 1 -Position: 16 -Last 80 unconsumed characters: - DETAIL - end - - def test_ticket_63 - File.open(fixture_path("t63-1.xml")) {|f| Document.new(f) } - end - - def test_ticket_75 - d = File.open(fixture_path("t75.xml")) {|f| REXML::Document.new(f) } - assert_equal("tree", d.root.name) - end - - def test_ticket_48_part_II - f = REXML::Formatters::Pretty.new - #- rexml sanity check (bugs in ruby 1.8.4, ruby 1.8.6) - xmldoc = Document.new("") - xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, "UTF-8") - content = ['61c3a927223c3e26'].pack("H*") - content.force_encoding('UTF-8') if content.respond_to?(:force_encoding) - #- is some UTF-8 text but just to make sure my editor won't magically convert.. - xmldoc.root.add_attribute('attr', content) - f.write(xmldoc,out=[]) - - xmldoc = REXML::Document.new(out.join) - sanity1 = xmldoc.root.attributes['attr'] - f.write(xmldoc,out=[]) - - xmldoc = REXML::Document.new(out.join) - sanity2 = xmldoc.root.attributes['attr'] - f.write(xmldoc,out=[]) - - assert_equal( sanity1, sanity2 ) - end - - def test_ticket_88 - doc = REXML::Document.new("") - assert_equal("", doc.to_s) - doc = REXML::Document.new("") - assert_equal("", doc.to_s) - end - - def test_ticket_85 - xml = < - - - - -ENDXML - - yml = " - - - -" - - # The pretty printer ignores all whitespace, anyway so output1 == output2 - f = REXML::Formatters::Pretty.new( 2 ) - d = Document.new( xml, :ignore_whitespace_nodes=>:all ) - f.write( d, output1="" ) - - d = Document.new( xml ) - f.write( d, output2="" ) - - # Output directives should override whitespace directives. - assert_equal( output1, output2 ) - - # The base case. - d = Document.new(yml) - f.write( d, output3="" ) - - assert_equal( output3.strip, output2.strip ) - - d = Document.new(yml) - f.write( d, output4="" ) - - assert_equal( output3.strip, output4.strip ) - end - - def test_ticket_91 - source=" - - great - - " - expected=" - - great - - -" - d = Document.new( source ) - d.root.add_element( "bah" ) - p=REXML::Formatters::Pretty.new(2) - p.compact = true # Don't add whitespace to text nodes unless necessary - p.write(d,out="") - assert_equal( expected, out ) - end - - def test_ticket_95 - testd = REXML::Document.new "" - testd.write(out1="") - testd.elements["//c[2]"].xpath - testd.write(out2="") - assert_equal(out1,out2) - end - - def test_ticket_102 - doc = REXML::Document.new '' - assert_equal( "foo", doc.root.elements["*:item"].attribute("name","ns").to_s ) - assert_equal( "item", doc.root.elements["*:item[@name='foo']"].name ) - end - - def test_ticket_14 - # Per .2.5 Node Tests of XPath spec - assert_raise( REXML::UndefinedNamespaceException, - %Q{Should have gotten an Undefined Namespace error} ) { - Document.new("") - } - end - - # 5.7 Text Nodes - # Character data is grouped into text nodes. As much character data as - # possible is grouped into each text node: a text node never has an - # immediately following or preceding sibling that is a text node. The - # string-value of a text node is the character data. A text node always has - # at least one character of data. - def test_ticket_105 - d = Document.new("") - d.root.add_text( "a" ) - d.root.add_text( "b" ) - assert_equal( 1, d.root.children.size ) - end - - # phantom namespace same as default namespace - def test_ticket_121 - doc = REXML::Document.new( - 'text' - ) - assert_equal 'text', doc.text( "/*:doc/*:item[@name='foo']" ) - assert_equal "name='foo'", - doc.root.elements["*:item"].attribute("name", "ns").inspect - assert_equal "text", - doc.root.elements["*:item[@name='foo']"].to_s - end - - def test_ticket_135 - bean_element = REXML::Element.new("bean") - textToAdd = "(&(|(memberof=CN=somegroupabcdefgh,OU=OUsucks,DC=hookemhorns,DC=com)(mail=*someco.com))(acct=%u)(!(extraparameter:2.2.222.222222.2.2.222:=2)))" - bean_element.add_element("prop", {"key"=> "filter"}).add_text(textToAdd) - doc = REXML::Document.new - doc.add_element(bean_element) - - REXML::Formatters::Pretty.new(3).write( doc, out = "" ) - - assert_equal "\n \n (&#38;(|(memberof=CN=somegroupabcdefgh,OU=OUsucks,DC=hookemhorns,DC=com)(mail=*someco.com))(acct=%u)(!(extraparameter:2.2.222.222222.2.2.222:=2)))\n \n", out - end - - def test_ticket_138 - doc = REXML::Document.new( - '' - ) - expected = { - "inkscape" => attribute("xmlns:inkscape", - "http://www.inkscape.org/namespaces/inkscape"), - "version" => { - "inkscape" => attribute("inkscape:version", "0.44"), - "" => attribute("version", "1.0"), - }, - } - assert_equal(expected, doc.root.attributes) - assert_equal(expected, REXML::Document.new(doc.root.to_s).root.attributes) - end - - def test_empty_doc - assert(REXML::Document.new('').children.empty?) - end - - private - def attribute(name, value) - REXML::Attribute.new(name, value) - end - end -end diff --git a/test/rexml/test_doctype.rb b/test/rexml/test_doctype.rb deleted file mode 100644 index 7f42669170..0000000000 --- a/test/rexml/test_doctype.rb +++ /dev/null @@ -1,157 +0,0 @@ -# frozen_string_literal: false - -require_relative "rexml_test_utils" - -module REXMLTests - class TestDocTypeAccessor < Test::Unit::TestCase - def setup - @sysid = "urn:x-test:sysid1" - @notation_id1 = "urn:x-test:notation1" - @notation_id2 = "urn:x-test:notation2" - xml_system = <<-XML - - - ]> - - XML - @doc_type_system = REXML::Document.new(xml_system).doctype - - @pubid = "TEST_ID" - xml_public = <<-XML - - - XML - @doc_type_public = REXML::Document.new(xml_public).doctype - - xml_public_system = <<-XML - - - XML - @doc_type_public_system = REXML::Document.new(xml_public_system).doctype - end - - def test_public - assert_equal([ - nil, - @pubid, - @pubid, - ], - [ - @doc_type_system.public, - @doc_type_public.public, - @doc_type_public_system.public, - ]) - end - - def test_to_s - assert_equal("", - @doc_type_public_system.to_s) - end - - def test_to_s_apostrophe - @doc_type_public_system.parent.context[:prologue_quote] = :apostrophe - assert_equal("", - @doc_type_public_system.to_s) - end - - def test_system - assert_equal([ - @sysid, - nil, - @sysid, - ], - [ - @doc_type_system.system, - @doc_type_public.system, - @doc_type_public_system.system, - ]) - end - - def test_notation - assert_equal([ - @notation_id1, - @notation_id2, - ], - [ - @doc_type_system.notation("n1").system, - @doc_type_system.notation("n2").system, - ]) - end - - def test_notations - notations = @doc_type_system.notations - assert_equal([ - @notation_id1, - @notation_id2, - ], - notations.collect(&:system)) - end - end - - class TestNotationDeclPublic < Test::Unit::TestCase - def setup - @name = "vrml" - @id = "VRML 1.0" - @uri = "http://www.web3d.org/" - end - - def test_to_s - assert_equal("", - decl(@id, nil).to_s) - end - - def test_to_s_with_uri - assert_equal("", - decl(@id, @uri).to_s) - end - - def test_to_s_apostrophe - document = REXML::Document.new(<<-XML) - - - XML - document.context[:prologue_quote] = :apostrophe - notation = document.doctype.notations[0] - assert_equal("", - notation.to_s) - end - - private - def decl(id, uri) - REXML::NotationDecl.new(@name, "PUBLIC", id, uri) - end - end - - class TestNotationDeclSystem < Test::Unit::TestCase - def setup - @name = "gif" - @id = "gif viewer" - end - - def test_to_s - assert_equal("", - decl(@id).to_s) - end - - def test_to_s_apostrophe - document = REXML::Document.new(<<-XML) - - - XML - document.context[:prologue_quote] = :apostrophe - notation = document.doctype.notations[0] - assert_equal("", - notation.to_s) - end - - private - def decl(id) - REXML::NotationDecl.new(@name, "SYSTEM", id, nil) - end - end -end diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb deleted file mode 100644 index c0faae4ae0..0000000000 --- a/test/rexml/test_document.rb +++ /dev/null @@ -1,416 +0,0 @@ -# -*- coding: utf-8 -*- -# frozen_string_literal: false - -require "rexml/document" -require "test/unit" - -module REXMLTests - class TestDocument < Test::Unit::TestCase - def test_version_attributes_to_s - doc = REXML::Document.new(<<-eoxml) - - - - eoxml - - string = doc.to_s - assert_match('xmlns:sodipodi', string) - assert_match('xmlns:inkscape', string) - assert_match('sodipodi:version', string) - assert_match('inkscape:version', string) - end - - def test_new - doc = REXML::Document.new(< -Hello world! -EOF - assert_equal("Hello world!", doc.root.children.first.value) - end - - class EntityExpansionLimitTest < Test::Unit::TestCase - def setup - @default_entity_expansion_limit = REXML::Security.entity_expansion_limit - end - - def teardown - REXML::Security.entity_expansion_limit = @default_entity_expansion_limit - end - - class GeneralEntityTest < self - def test_have_value - xml = < - - - - - - - -]> - -&a; - -EOF - - doc = REXML::Document.new(xml) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - doc = REXML::Document.new(xml) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - assert_equal(101, doc.entity_expansion_count) - end - - def test_empty_value - xml = < - - - - - - - -]> - -&a; - -EOF - - doc = REXML::Document.new(xml) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - doc = REXML::Document.new(xml) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - assert_equal(101, doc.entity_expansion_count) - end - - def test_with_default_entity - xml = < - - -]> - -&a; -&a2; -< - -EOF - - REXML::Security.entity_expansion_limit = 4 - doc = REXML::Document.new(xml) - assert_equal("\na\na a\n<\n", doc.root.children.first.value) - REXML::Security.entity_expansion_limit = 3 - doc = REXML::Document.new(xml) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - end - end - - class ParameterEntityTest < self - def test_have_value - xml = < - - - - - - - -]> - -EOF - - assert_raise(REXML::ParseException) do - REXML::Document.new(xml) - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - assert_raise(REXML::ParseException) do - REXML::Document.new(xml) - end - end - - def test_empty_value - xml = < - - - - - - - -]> - -EOF - - assert_raise(REXML::ParseException) do - REXML::Document.new(xml) - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - assert_raise(REXML::ParseException) do - REXML::Document.new(xml) - end - end - end - end - - def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source - tag = "..." - message = "こんにちは、世界!" # Hello world! in Japanese - xml = < - -EOX - xml.force_encoding(Encoding::ASCII_8BIT) - doc = REXML::Document.new(xml) - assert_equal("#{tag}#{message}", doc.root.children.first.value) - end - - def test_xml_declaration_standalone - bug2539 = '[ruby-core:27345]' - doc = REXML::Document.new('') - assert_equal('no', doc.stand_alone?, bug2539) - doc = REXML::Document.new('') - assert_equal('no', doc.stand_alone?, bug2539) - doc = REXML::Document.new('') - assert_equal('no', doc.stand_alone?, bug2539) - end - - class WriteTest < Test::Unit::TestCase - def setup - @document = REXML::Document.new(<<-EOX) - -Hello world! -EOX - end - - class ArgumentsTest < self - def test_output - output = "" - @document.write(output) - assert_equal(<<-EOX, output) - -Hello world! -EOX - end - - def test_indent - output = "" - indent = 2 - @document.write(output, indent) - assert_equal(<<-EOX.chomp, output) - - - Hello world! - -EOX - end - - def test_transitive - output = "" - indent = 2 - transitive = true - @document.write(output, indent, transitive) - assert_equal(<<-EOX, output) - -Hello world! -EOX - end - - def test_ie_hack - output = "" - indent = -1 - transitive = false - ie_hack = true - document = REXML::Document.new("") - document.write(output, indent, transitive, ie_hack) - assert_equal("", output) - end - - def test_encoding - output = "" - indent = -1 - transitive = false - ie_hack = false - encoding = "Windows-31J" - - @document.xml_decl.encoding = "Shift_JIS" - japanese_text = "こんにちは" - @document.root.text = japanese_text - @document.write(output, indent, transitive, ie_hack, encoding) - assert_equal(<<-EOX.encode(encoding), output) - -#{japanese_text} -EOX - end - end - - class OptionsTest < self - def test_output - output = "" - @document.write(:output => output) - assert_equal(<<-EOX, output) - -Hello world! -EOX - end - - def test_indent - output = "" - @document.write(:output => output, :indent => 2) - assert_equal(<<-EOX.chomp, output) - - - Hello world! - -EOX - end - - def test_transitive - output = "" - @document.write(:output => output, :indent => 2, :transitive => true) - assert_equal(<<-EOX, output) - -Hello world! -EOX - end - - def test_ie_hack - output = "" - document = REXML::Document.new("") - document.write(:output => output, :ie_hack => true) - assert_equal("", output) - end - - def test_encoding - output = "" - encoding = "Windows-31J" - @document.xml_decl.encoding = "Shift_JIS" - japanese_text = "こんにちは" - @document.root.text = japanese_text - @document.write(:output => output, :encoding => encoding) - assert_equal(<<-EOX.encode(encoding), output) - -#{japanese_text} -EOX - end - end - end - - class BomTest < Test::Unit::TestCase - class HaveEncodingTest < self - def test_utf_8 - xml = <<-EOX.force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-8", document.encoding) - end - - def test_utf_16le - xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-16", document.encoding) - end - - def test_utf_16be - xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-16", document.encoding) - end - end - - class NoEncodingTest < self - def test_utf_8 - xml = <<-EOX.force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-8", document.encoding) - end - - def test_utf_16le - xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-16", document.encoding) - end - - def test_utf_16be - xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-16", document.encoding) - end - end - - class WriteTest < self - def test_utf_16 - xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - - actual_xml = "" - document.write(actual_xml) - expected_xml = <<-EOX.encode("UTF-16BE") -\ufeff -Hello world! -EOX - assert_equal(expected_xml, actual_xml) - end - end - end - end -end diff --git a/test/rexml/test_element.rb b/test/rexml/test_element.rb deleted file mode 100644 index 82830b44e6..0000000000 --- a/test/rexml/test_element.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: false - -require "test/unit/testcase" -require "rexml/document" - -module REXMLTests - class ElementTester < Test::Unit::TestCase - def test_array_reference_string - doc = REXML::Document.new("") - assert_equal("Ruby", doc.root["name"]) - end - - def test_array_reference_symbol - doc = REXML::Document.new("") - assert_equal("Ruby", doc.root[:name]) - end - end -end diff --git a/test/rexml/test_elements.rb b/test/rexml/test_elements.rb deleted file mode 100644 index a850e62209..0000000000 --- a/test/rexml/test_elements.rb +++ /dev/null @@ -1,119 +0,0 @@ -# frozen_string_literal: false -require 'test/unit/testcase' -require 'rexml/document' - -module REXMLTests - class ElementsTester < Test::Unit::TestCase - include REXML - def test_accessor - doc = Document.new '' - assert_equal 'b', doc.root.elements[1].name - assert_equal '1', doc.root.elements['c'].attributes['id'] - assert_equal '2', doc.root.elements[2,'c'].attributes['id'] - end - - def test_indexing - doc = Document.new '' - doc.root.elements[10] = Element.new('b') - assert_equal 'b', doc.root.elements[1].name - doc.root.elements[1] = Element.new('c') - assert_equal 'c', doc.root.elements[1].name - doc.root.elements['c'] = Element.new('d') - assert_equal 'd', doc.root.elements[1].name - end - - def test_delete - doc = Document.new '' - block = proc { |str| - out = '' - doc.write out - assert_equal str, out - } - b = doc.root.elements[1] - doc.root.elements.delete b - block.call( "" ) - doc.elements.delete("a/c[@id='1']") - block.call( '' ) - doc.root.elements.delete 1 - block.call( '' ) - end - - def test_delete_all - doc = Document.new '' - deleted = doc.elements.delete_all 'a/c' - assert_equal 4, deleted.size - end - - def test_ticket_36 - doc = Document.new( "" ) - - deleted = doc.root.elements.delete_all( "xi:c" ) - assert_equal( 1, deleted.size ) - - doc = Document.new( "" ) - deleted = doc.root.elements.delete_all( "//xi:c" ) - assert_equal( 2, deleted.size ) - end - - def test_add - a = Element.new 'a' - a.elements.add Element.new('b') - assert_equal 'b', a.elements[1].name - a.elements.add 'c' - assert_equal 'c', a.elements[2].name - end - - def test_size - doc = Document.new 'seanelliottrussell' - assert_equal 6, doc.root.size - assert_equal 3, doc.root.elements.size - end - - def test_each - doc = Document.new 'sean' - count = 0 - block = proc {|e| count += 1} - doc.root.elements.each(&block) - assert_equal 6, count - count = 0 - doc.root.elements.each('b', &block) - assert_equal 2, count - count = 0 - doc.root.elements.each('child::node()', &block) - assert_equal 6, count - count = 0 - XPath.each(doc.root, 'child::node()', &block) - assert_equal 7, count - end - - def test_each_with_frozen_condition - doc = Document.new('') - names = [] - doc.root.elements.each('book'.freeze) do |element| - names << element.attributes["name"] - end - assert_equal(["Ruby", "XML"], names) - end - - def test_to_a - doc = Document.new 'seanelliott' - assert_equal 2, doc.root.elements.to_a.size - assert_equal 2, doc.root.elements.to_a("child::node()").size - assert_equal 4, XPath.match(doc.root, "child::node()").size - end - - def test_collect - doc = Document.new( "" ) - r = doc.elements.collect( "/a/b" ) { |e| e.attributes["id"].to_i } - assert_equal( [1,2], r ) - end - - def test_inject - doc = Document.new( "" ) - r = doc.elements.inject( "/a/b", 3 ) { |s, e| - s + e.attributes["id"].to_i - } - assert_equal 6, r - end - end -end diff --git a/test/rexml/test_encoding.rb b/test/rexml/test_encoding.rb deleted file mode 100644 index 919db131f0..0000000000 --- a/test/rexml/test_encoding.rb +++ /dev/null @@ -1,108 +0,0 @@ -# coding: binary -# frozen_string_literal: false - -require_relative "rexml_test_utils" - -require 'rexml/source' -require 'rexml/document' - -module REXMLTests - class EncodingTester < Test::Unit::TestCase - include REXMLTestUtils - include REXML - - def setup - @encoded_root = "\346" - @encoded = ""+ - @encoded_root - @not_encoded = "ĉ" - end - - # Given an encoded document, try to write out to that encoding - def test_encoded_in_encoded_out - doc = Document.new( @encoded ) - doc.write( out="" ) - out.force_encoding(::Encoding::ASCII_8BIT) - assert_equal( @encoded, out ) - end - - # Given an encoded document, try to change the encoding and write it out - def test_encoded_in_change_out - doc = Document.new( @encoded ) - doc.xml_decl.encoding = "UTF-8" - assert_equal("UTF-8", doc.encoding) - REXML::Formatters::Default.new.write( doc.root, out="" ) - out.force_encoding(::Encoding::ASCII_8BIT) - assert_equal( @not_encoded, out ) - char = XPath.first( doc, "/a/b/text()" ).to_s - char.force_encoding(::Encoding::ASCII_8BIT) - assert_equal( "ĉ", char ) - end - - # * Given an encoded document, try to write it to a different encoding - def test_encoded_in_different_out - doc = Document.new( @encoded ) - REXML::Formatters::Default.new.write( doc.root, Output.new( out="", "UTF-8" ) ) - out.force_encoding(::Encoding::ASCII_8BIT) - assert_equal( @not_encoded, out ) - end - - # * Given a non-encoded document, change the encoding - def test_in_change_out - doc = Document.new( @not_encoded ) - doc.xml_decl.encoding = "ISO-8859-3" - assert_equal("ISO-8859-3", doc.encoding) - doc.write( out="" ) - out.force_encoding(::Encoding::ASCII_8BIT) - assert_equal( @encoded, out ) - end - - # * Given a non-encoded document, write to a different encoding - def test_in_different_out - doc = Document.new( @not_encoded ) - doc.write( Output.new( out="", "ISO-8859-3" ) ) - out.force_encoding(::Encoding::ASCII_8BIT) - assert_equal( "#{@encoded_root}", out ) - end - - # * Given an encoded document, accessing text and attribute nodes - # should provide UTF-8 text. - def test_in_different_access - doc = Document.new <<-EOL - - \xFF - EOL - expect = "\303\277" - expect.force_encoding(::Encoding::UTF_8) - assert_equal( expect, doc.elements['a'].attributes['a'] ) - assert_equal( expect, doc.elements['a'].text ) - end - - - def test_ticket_89 - doc = Document.new <<-EOL - - - EOL - - REXML::Document.new doc - end - - def test_parse_utf16 - utf16 = File.open(fixture_path("utf16.xml")) do |f| - REXML::Document.new(f) - end - assert_equal("UTF-16", utf16.encoding) - assert( utf16[0].kind_of?(REXML::XMLDecl)) - end - - def test_parse_utf16_with_utf8_default_internal - EnvUtil.with_default_internal("UTF-8") do - utf16 = File.open(fixture_path("utf16.xml")) do |f| - REXML::Document.new(f) - end - assert_equal("UTF-16", utf16.encoding) - end - end - end -end diff --git a/test/rexml/test_entity.rb b/test/rexml/test_entity.rb deleted file mode 100644 index 6dc6637074..0000000000 --- a/test/rexml/test_entity.rb +++ /dev/null @@ -1,206 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" - -require 'rexml/document' -require 'rexml/entity' -require 'rexml/source' - -module REXMLTests - class EntityTester < Test::Unit::TestCase - def test_parse_general_decl - simple = "" - simple =~ /#{REXML::Entity::GEDECL}/ - assert $& - assert_equal simple, $& - - REXML::Entity::ENTITYDECL =~ simple - assert REXML::Entity::matches?(simple) - match = REXML::Entity::ENTITYDECL.match(simple) - assert_equal 'foo', match[1] - assert_equal "'bar'", match[2] - - simple = '' - assert REXML::Entity::matches?(simple) - match = REXML::Entity::ENTITYDECL.match(simple) - assert_equal 'Pub-Status', match[1] - assert_equal '"This is a pre-release of the specification."', match[2] - - txt = '"This is a - pre-release of specification."' - simple = "" - assert REXML::Entity::matches?(simple) - match = REXML::Entity::ENTITYDECL.match(simple) - assert_equal 'Pub-Status', match[1] - assert_equal txt, match[2] - end - - def test_parse_external_decl - zero = '' - one = '' - two = '' - three = '' - assert REXML::Entity::matches?(zero) - assert REXML::Entity::matches?(one) - assert REXML::Entity::matches?(two) - assert REXML::Entity::matches?(three) - end - - def test_parse_entity - one = %q{} - two = %q{} - assert REXML::Entity::matches?(one) - assert REXML::Entity::matches?(two) - end - - def test_constructor - one = [ %q{}, - %q{}, - %q{}, - '', - '', - '' ] - source = %q{ - - - - - - ]>} - - d = REXML::Document.new( source ) - dt = d.doctype - c = 0 - dt.each do |child| - if child.kind_of? REXML::Entity - str = one[c].tr("\r\n\t", ' ').squeeze(" ") - assert_equal str, child.to_s - c+=1 - end - end - end - - def test_replace_entities - source = "\n]>&foo;" - doc = REXML::Document.new(source) - assert_equal 'bar', doc.root.text - out = '' - doc.write out - assert_equal source, out - end - - def test_entity_string_limit - template = ' ]> $' - len = 5120 # 5k per entity - template.sub!(/\^/, "B" * len) - - # 10k is OK - entities = '&a;' * 2 # 5k entity * 2 = 10k - xmldoc = REXML::Document.new(template.sub(/\$/, entities)) - assert_equal(len * 2, xmldoc.root.text.bytesize) - - # above 10k explodes - entities = '&a;' * 3 # 5k entity * 2 = 15k - xmldoc = REXML::Document.new(template.sub(/\$/, entities)) - assert_raise(RuntimeError) do - xmldoc.root.text - end - end - - def test_entity_string_limit_for_parameter_entity - template = ' ]>' - len = 5120 # 5k per entity - template.sub!(/\^/, "B" * len) - - # 10k is OK - entities = '%a;' * 2 # 5k entity * 2 = 10k - REXML::Document.new(template.sub(/\$/, entities)) - - # above 10k explodes - entities = '%a;' * 3 # 5k entity * 2 = 15k - assert_raise(REXML::ParseException) do - REXML::Document.new(template.sub(/\$/, entities)) - end - end - - def test_raw - source = ' -]>replace &ent;' - doc = REXML::Document.new( source, {:raw=>:all}) - assert_equal('replace &ent;', doc.root.get_text.to_s) - assert_equal(source, doc.to_s) - end - - def test_lazy_evaluation - source = ' -]>replace &ent;' - doc = REXML::Document.new( source ) - assert_equal(source, doc.to_s) - assert_equal("replace replace", doc.root.text) - assert_equal(source, doc.to_s) - end - - # Contributed (not only test, but bug fix!!) by Kouhei Sutou - def test_entity_replacement - source = %q{ - ]> - &WhatHeSaid;} - - d = REXML::Document.new( source ) - dt = d.doctype - assert_equal( '"Yes"', dt.entities[ "YN" ].value ) - assert_equal( 'He said "Yes"', dt.entities[ "WhatHeSaid" ].value ) - assert_equal( 'He said "Yes"', d.elements[1].text ) - end - - # More unit tests from Kouhei. I looove users who give me unit tests. - def test_entity_insertions - assert_equal("&", REXML::Text.new("&", false, nil, true).to_s) - #assert_equal("&", REXML::Text.new("&", false, false).to_s) - end - - def test_single_pass_unnormalization # ticket 123 - assert_equal '&&', REXML::Text::unnormalize('&amp;&') - end - - def test_entity_filter - document = REXML::Document.new(<<-XML) - - -]> - -XML - respect_whitespace = false - parent = document.root - raw = false - entity_filter = ["copy"] - assert_equal("(c) &release-year;", - REXML::Text.new("(c) 2013", - respect_whitespace, - parent, - raw, - entity_filter).to_s) - end - end -end diff --git a/test/rexml/test_instruction.rb b/test/rexml/test_instruction.rb deleted file mode 100644 index 96fa909e17..0000000000 --- a/test/rexml/test_instruction.rb +++ /dev/null @@ -1,14 +0,0 @@ -require_relative "rexml_test_utils" - -module REXMLTests - class InstructionTest < Test::Unit::TestCase - def test_target_nil - error = assert_raise(ArgumentError) do - REXML::Instruction.new(nil) - end - assert_equal("processing instruction target must be String or " + - "REXML::Instruction: ", - error.message) - end - end -end diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb deleted file mode 100644 index 9640b8290b..0000000000 --- a/test/rexml/test_jaxen.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: false -require_relative 'rexml_test_utils' - -require "rexml/document" -require "rexml/xpath" - -# Harness to test REXML's capabilities against the test suite from Jaxen -# ryan.a.cox@gmail.com - -module REXMLTests - class JaxenTester < Test::Unit::TestCase - include REXMLTestUtils - include REXML - - def test_axis ; process_test_case("axis") ; end - def test_basic ; process_test_case("basic") ; end - def test_basicupdate ; process_test_case("basicupdate") ; end - def test_contents ; process_test_case("contents") ; end - def test_defaultNamespace ; process_test_case("defaultNamespace") ; end - def test_fibo ; process_test_case("fibo") ; end - def test_id ; process_test_case("id") ; end - def test_jaxen24 ; process_test_case("jaxen24") ; end - def test_lang ; process_test_case("lang") ; end - # document() function for XSLT isn't supported - def _test_message ; process_test_case("message") ; end - def test_moreover ; process_test_case("moreover") ; end - def test_much_ado ; process_test_case("much_ado") ; end - def test_namespaces ; process_test_case("namespaces") ; end - def test_nitf ; process_test_case("nitf") ; end - # Exception should be considered - def _test_numbers ; process_test_case("numbers") ; end - def test_pi ; process_test_case("pi") ; end - def test_pi2 ; process_test_case("pi2") ; end - def test_simple ; process_test_case("simple") ; end - # TODO: namespace node is needed - def _test_testNamespaces ; process_test_case("testNamespaces") ; end - # document() function for XSLT isn't supported - def _test_text ; process_test_case("text") ; end - def test_underscore ; process_test_case("underscore") ; end - def _test_web ; process_test_case("web") ; end - def test_web2 ; process_test_case("web2") ; end - - private - def process_test_case(name) - xml_path = "#{name}.xml" - doc = File.open(fixture_path(xml_path)) do |file| - Document.new(file) - end - test_doc = File.open(fixture_path("test/tests.xml")) do |file| - Document.new(file) - end - XPath.each(test_doc, - "/tests/document[@url='xml/#{xml_path}']/context") do |context| - process_context(doc, context) - end - end - - # processes a tests/document/context node - def process_context(doc, context) - test_context = XPath.match(doc, context.attributes["select"]) - namespaces = context.namespaces - namespaces.delete("var") - namespaces = nil if namespaces.empty? - variables = {} - var_namespace = "http://jaxen.org/test-harness/var" - XPath.each(context, - "@*[namespace-uri() = '#{var_namespace}']") do |attribute| - variables[attribute.name] = attribute.value - end - XPath.each(context, "valueOf") do |value| - process_value_of(test_context, variables, namespaces, value) - end - XPath.each(context, - "test[not(@exception) or (@exception != 'true')]") do |test| - process_nominal_test(test_context, variables, namespaces, test) - end - XPath.each(context, - "test[@exception = 'true']") do |test| - process_exceptional_test(test_context, variables, namespaces, test) - end - end - - # processes a tests/document/context/valueOf or tests/document/context/test/valueOf node - def process_value_of(context, variables, namespaces, value_of) - expected = value_of.text - xpath = value_of.attributes["select"] - matched = XPath.match(context, xpath, namespaces, variables, strict: true) - - message = user_message(context, xpath, matched) - assert_equal(expected || "", - REXML::Functions.string(matched), - message) - end - - # processes a tests/document/context/test node ( where @exception is false or doesn't exist ) - def process_nominal_test(context, variables, namespaces, test) - xpath = test.attributes["select"] - matched = XPath.match(context, xpath, namespaces, variables, strict: true) - # might be a test with no count attribute, but nested valueOf elements - expected = test.attributes["count"] - if expected - assert_equal(Integer(expected, 10), - matched.size, - user_message(context, xpath, matched)) - end - - XPath.each(test, "valueOf") do |value_of| - process_value_of(matched, variables, namespaces, value_of) - end - end - - # processes a tests/document/context/test node ( where @exception is true ) - def process_exceptional_test(context, variables, namespaces, test) - xpath = test.attributes["select"] - assert_raise(REXML::ParseException) do - XPath.match(context, xpath, namespaces, variables, strict: true) - end - end - - def user_message(context, xpath, matched) - message = "" - context.each_with_index do |node, i| - message << "Node#{i}:\n" - message << "#{node}\n" - end - message << "XPath: <#{xpath}>\n" - message << "Matched <#{matched}>" - message - end - end -end diff --git a/test/rexml/test_light.rb b/test/rexml/test_light.rb deleted file mode 100644 index 99bd9cac3f..0000000000 --- a/test/rexml/test_light.rb +++ /dev/null @@ -1,107 +0,0 @@ -# frozen_string_literal: false -require_relative "rexml_test_utils" -require "rexml/light/node" -require "rexml/parsers/lightparser" - -module REXMLTests - class LightTester < Test::Unit::TestCase - include REXMLTestUtils - include REXML::Light - - def test_parse_large - xml_string = fixture_path("documentation.xml") - parser = REXML::Parsers::LightParser.new(xml_string) - tag, content = parser.parse - assert_equal([:document, :text], [tag, content.first]) - end - - # FIXME INCOMPLETE - # This is because the light API is not yet ready to be used to produce - # trees. -=begin - def test_add_element - doc = Node.new - foo = doc.add_element( 'foo' ) - assert_equal( "foo", foo.name ) - end - - def test_add_attribute - foo = Node.new( "a" ) - foo["attr"] = "bar" - assert_equal( "bar", foo["attr"] ) - end - - def test_write_document - r = make_small_document - assert_equal( "", r.to_s ) - end - - def test_add_attribute_under_namespace - foo = Node.new("a") - foo["attr", "a"] = "1" - foo["attr", "b"] = "2" - foo["attr"] = "3" - assert_equal( '1', foo['attr', 'a'] ) - assert_equal( '2', foo['attr', 'b'] ) - assert_equal( '3', foo['attr'] ) - end - - def test_change_namespace_of_element - foo = Node.new - assert_equal( '', foo.namespace ) - foo.namespace = 'a' - assert_equal( 'a', foo.namespace ) - end - - def test_access_child_elements - foo = make_small_document - assert_equal( 1, foo.size ) - a = foo[0] - assert_equal( 2, a.size ) - assert_equal( 'b', a[0].name ) - assert_equal( 'c', a[1].name ) - end - - def test_itterate_over_children - foo = make_small_document - ctr = 0 - foo[0].each { ctr += 1 } - assert_equal( 2, ctr ) - end - - def test_add_text - foo = Node.new( "a" ) - foo.add_text( "Sean" ) - sean = foo[0] - assert( sean.node_type == :text ) - end - - def test_add_instruction - foo = Node.new( "a" ) - foo.add_instruction( "target", "value" ) - assert( foo[0].node_type == :processing_instruction ) - end - - def test_add_comment - foo = Node.new( "a" ) - foo.add_comment( "target", "value" ) - assert( foo[0].node_type == :comment ) - end - - def test_get_root - foo = Node.new( 'a' ) - 10.times { foo = foo.add_element('b') } - assert_equals( 'b', foo.name ) - assert_equals( 'a', foo.root.name ) - end - - def make_small_document - r = Node.new - a = r.add_element( "a" ) - a.add_element( 'b' ) - a.add_element( 'c' ) - r - end -=end - end -end diff --git a/test/rexml/test_lightparser.rb b/test/rexml/test_lightparser.rb deleted file mode 100644 index 1aeac072dd..0000000000 --- a/test/rexml/test_lightparser.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: false -require_relative 'rexml_test_utils' -require 'rexml/parsers/lightparser' - -module REXMLTests - class LightParserTester < Test::Unit::TestCase - include REXMLTestUtils - include REXML - def test_parsing - File.open(fixture_path("documentation.xml")) do |f| - parser = REXML::Parsers::LightParser.new( f ) - parser.parse - end - end - end -end diff --git a/test/rexml/test_listener.rb b/test/rexml/test_listener.rb deleted file mode 100644 index 322d368be8..0000000000 --- a/test/rexml/test_listener.rb +++ /dev/null @@ -1,131 +0,0 @@ -# coding: binary -# frozen_string_literal: false - -require_relative 'rexml_test_utils' - -require 'rexml/document' -require 'rexml/streamlistener' - -module REXMLTests - class BaseTester < Test::Unit::TestCase - include REXMLTestUtils - def test_empty - return unless defined? @listener - # Empty. - t1 = %Q{} - assert_equal( "", @listener.parse( t1 ), - "Empty" ) - end - - def test_space - return unless defined? @listener - # Space. - t2 = %Q{ } - assert_equal( " ", @listener.parse( t2 ), - "Space" ) - end - - def test_whitespace - return unless defined? @listener - # Whitespaces. - t3 = %Q{RE\n \t \n \t XML} - assert_equal( "RE\n \t \n \t XML", @listener.parse( t3 ), - "Whitespaces" ) - end - - def test_leading_trailing_whitespace - return unless defined? @listener - # Leading and trailing whitespaces. - t4 = %Q{ REXML } - assert_equal( " REXML ", @listener.parse( t4 ), - "Leading and trailing whitespaces" ) - end - - def test_entity_reference - return unless defined? @listener - # Entity reference. - t5 = %Q{<>&lt;&gt;} - assert_equal( "<><>", @listener.parse( t5 ), - "Entity reference" ) - end - - def test_character_reference - return unless defined? @listener - # Character reference. - t6 = %Q{ } - assert_equal( "\r", @listener.parse( t6 ), - "Character reference." ) - end - - def test_cr - return unless defined? @listener - # CR. - t7 = %Q{ \r\n \r \n } - assert_equal( " \n \n \n ".unpack("C*").inspect, - @listener.parse( t7 ).unpack("C*").inspect, "CR" ) - end - - # The accent bug, and the code that exhibits the bug, was contributed by - # Guilhem Vellut - class AccentListener - def tag_start(name,attributes) - #p name - #p attributes - end - def tag_end(name) - #p "/"+name - end - def xmldecl(a,b,c) - #puts "#{a} #{b} #{c}" - end - def text(tx) - #p tx - end - end - - def test_accents - source = %[ - - -] - doc = REXML::Document.new( source ) - a = doc.elements['/g/f'].attribute('a') - if a.value.respond_to? :force_encoding - a.value.force_encoding('binary') - end - assert_equal( "\xC3\xA9", a.value) - doc = File::open(fixture_path("stream_accents.xml")) do |f| - REXML::Document.parse_stream(f, AccentListener::new) - end - end - end - - class MyREXMLListener - include REXML::StreamListener - - def initialize - @text = nil - end - - def parse( stringOrReadable ) - @text = "" - REXML::Document.parse_stream( stringOrReadable, self ) - @text - end - - def text( text ) - @text << text - end - end - - class REXMLTester < BaseTester - def setup - @listener = MyREXMLListener.new - end - - def test_character_reference_2 - t6 = %Q{ } - assert_equal( t6.strip, REXML::Document.new(t6).to_s ) - end - end -end diff --git a/test/rexml/test_martin_fowler.rb b/test/rexml/test_martin_fowler.rb deleted file mode 100644 index add3c82723..0000000000 --- a/test/rexml/test_martin_fowler.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' -require 'rexml/document' - -module REXMLTests - class OrderTesterMF < Test::Unit::TestCase - DOC = < -Remove this element and figs order differently -
-
-

Para of text

-

Remove this and figs order differently

-
-
-
-
- -END - - def initialize n - @doc = REXML::Document.new(DOC) - @figs = REXML::XPath.match(@doc,'//figure') - @names = @figs.collect {|f| f.attributes['src']} - super - end - def test_fig1 - assert_equal 'fig1', @figs[0].attributes['src'] - end - def test_fig2 - assert_equal 'fig2', @figs[1].attributes['src'] - end - def test_fig3 - assert_equal 'fig3', @figs[2].attributes['src'] - end - def test_fig4 - assert_equal 'fig4', @figs[3].attributes['src'] - end - end -end diff --git a/test/rexml/test_namespace.rb b/test/rexml/test_namespace.rb deleted file mode 100644 index 90e1d36945..0000000000 --- a/test/rexml/test_namespace.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: false -require_relative "rexml_test_utils" - -require "rexml/document" - -module REXMLTests - class TestNamespace < Test::Unit::TestCase - include REXMLTestUtils - include REXML - - def setup - @xsa_source = <<-EOL - - - - - - - - Lars Marius Garshol - larsga@garshol.priv.no - http://www.stud.ifi.uio.no/~lmariusg/ - - - EOL - end - - def test_xml_namespace - xml = <<-XML - - -XML - document = Document.new(xml) - assert_equal("http://www.w3.org/XML/1998/namespace", - document.root.namespace("xml")) - end - end -end diff --git a/test/rexml/test_order.rb b/test/rexml/test_order.rb deleted file mode 100644 index 807d9faa96..0000000000 --- a/test/rexml/test_order.rb +++ /dev/null @@ -1,110 +0,0 @@ -# frozen_string_literal: false -require_relative 'rexml_test_utils' -require 'rexml/document' -begin - require 'zlib' -rescue LoadError -end - -module REXMLTests - class OrderTester < Test::Unit::TestCase - include REXMLTestUtils - - TESTDOC = < - - - - - - - - -END - - def setup - @doc = REXML::Document.new(TESTDOC) - @items = REXML::XPath.match(@doc,'//x') - end - def test_first_element - assert_equal '1', @items[0].attributes['id'] - end - def test_second_element - assert_equal '2', @items[1].attributes['id'] - end - def test_third_element - assert_equal '3', @items[2].attributes['id'] - end - def test_order - d = REXML::Document.new( " - " ) - items = REXML::XPath.match( d, '//x' ) - assert_equal( %w{1 2 3 4 5}, items.collect{|e| e.attributes['id']} ) - d = REXML::Document.new( " - - " ) - items = REXML::XPath.match( d, '//y' ) - assert_equal( %w{1 2 3 4}, items.collect{|e| e.attributes['id']} ) - end - # Provided by Tom Talbott - def test_more_ordering - doc = Zlib::GzipReader.open(fixture_path('LostineRiver.kml.gz'), encoding: 'utf-8') do |f| - REXML::Document.new(f) - end - actual = [ - "Head south from Phinney Ave N", - "Turn left at N 36th St", - "Turn right at Fremont Ave N", - "Continue on 4th Ave N", - "Turn left at Westlake Ave N", - "Bear right at 9th Ave N", - "Turn left at Mercer St", - "Take the I-5 ramp", - "Take the I-5 S ramp", - "Take the I-90 E exit #164 to Bellevue/Spokane/4th Ave S.", - "Take the I-90 E ramp to Bellevue/Spokane", - "Take exit #137 to Wanapum Dam/Richland", - "Bear right at WA-26", - "Bear right and head toward WA-243", - "Continue on WA-243", - "Bear right at WA-24", - "Continue on WA-240", - "Turn right at WA-240 E", - "Take the I-182 W ramp to Yakima (I-82)/Pendleton", - "Take the I-82 E ramp to Umatilla/Pendleton", - "Take the I-84 E ramp to Pendleton", - "Take the OR-82 exit #261 to La Grande/Elgin", - "Turn right at Island Ave", - "Continue on W 1st St", - "Turn left at N McAlister Rd", - "Bear right at OR-82", - "Continue on Wallowa Lake Hwy", - "Continue on OR-82", - "Continue on Ruckman Ave", - "Continue on OR-82", - "Continue on S 8th Ave", - "Turn right at Albany St", - "Continue on OR-82", - "Continue on Wallowa Lake Hwy", - "Continue on N Madison St", - "Bear left at W 1st St", - "Continue on Wallowa Lake Hwy", - "Continue on Water St", - "Bear right at Lostine River Rd", - "Bear right and head toward Lostine River Rd", - "Turn right at Lostine River Rd", - "Continue on NF-8210", - "Turn right and head toward NF-8210", - "Turn right at NF-8210", - "", - "Route" - ] - count = 0 - REXML::XPath.each( doc, "//Placemark") { |element| - n = element.elements["name"].text.squeeze(" ") - assert_equal( actual[count], n ) unless n =~ /Arrive at/ - count += 1 - } - end if defined?(Zlib::GzipReader) - end -end diff --git a/test/rexml/test_preceding_sibling.rb b/test/rexml/test_preceding_sibling.rb deleted file mode 100644 index d89a1e1c90..0000000000 --- a/test/rexml/test_preceding_sibling.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: false -# ISSUE 32 -require 'test/unit' -require 'rexml/document' - -module REXMLTests - # daz - for report by Dan Kohn in: - # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/156328 - class XPathTesterDd < Test::Unit::TestCase - include REXML - - def setup - @@docDd = Document.new(<<-EOS, :ignore_whitespace_nodes => :all) - - - Success - - - abc02C - - - EOS - end - - def test_Dd_preceding_sibling_children - arr = [] - XPath.each(@@docDd, "//b[@x='ab02A']/preceding-sibling::b/child::*") do |cell| - arr << cell.texts.join - end - assert_equal( 'Success', arr.join ) - end - - def test_Dd_preceding_sibling_all - arr = [] - XPath.each(@@docDd, "//b[@x='ab02A']/preceding-sibling::*") do |cell| - arr << cell.to_s - end - assert_equal( "Success", arr.join ) - end - end -end diff --git a/test/rexml/test_pullparser.rb b/test/rexml/test_pullparser.rb deleted file mode 100644 index 31b5b74bd6..0000000000 --- a/test/rexml/test_pullparser.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" - -require 'rexml/parsers/pullparser' - -module REXMLTests - class PullParserTester < Test::Unit::TestCase - include REXML - def test_basics - source = ' - - foo <bar nooo' - parser = REXML::Parsers::PullParser.new(source) - res = { :text=>0 } - until parser.empty? - results = parser.pull - res[ :xmldecl ] = true if results.xmldecl? - res[ :doctype ] = true if results.doctype? - res[ :a ] = true if results.start_element? and results[0] == 'a' - if results.start_element? and results[0] == 'b' - res[ :b ] = true - assert_equal 'value', results[1]['attribute'] - end - res[ :text ] += 1 if results.text? - end - [ :xmldecl, :doctype, :a, :b ].each { |tag| - assert res[tag] , "#{tag} wasn't processed" - } - assert_equal 4, res[ :text ] - rescue ParseException - puts $! - end - - def test_bad_document - source = "" - parser = REXML::Parsers::PullParser.new(source) - assert_raise(ParseException, "Parsing should have failed") { - parser.pull while parser.has_next? - } - end - - def test_entity_replacement - source = ' - - - ]>&la;&lala;' - pp = REXML::Parsers::PullParser.new( source ) - el_name = '' - while pp.has_next? - event = pp.pull - case event.event_type - when :start_element - el_name = event[0] - when :text - case el_name - when 'la' - assert_equal('1234', event[1]) - when 'lala' - assert_equal('--1234--', event[1]) - end - end - end - end - - def test_peek_unshift - source = "" - REXML::Parsers::PullParser.new(source) - # FINISH ME! - end - - def test_inspect - xml = 'Hey' - parser = Parsers::PullParser.new( xml ) - while parser.has_next? - pull_event = parser.pull - if pull_event.start_element? - peek = parser.peek() - peek.inspect - end - end - end - - def test_peek - xml = 'Hey' - parser = Parsers::PullParser.new( xml ) - names = %w{ a b } - while parser.has_next? - pull_event = parser.pull - if pull_event.start_element? - assert_equal( :start_element, pull_event.event_type ) - assert_equal( names.shift, pull_event[0] ) - if names[0] == 'b' - peek = parser.peek() - assert_equal( :start_element, peek.event_type ) - assert_equal( names[0], peek[0] ) - end - end - end - assert_equal( 0, names.length ) - end - end -end diff --git a/test/rexml/test_rexml_issuezilla.rb b/test/rexml/test_rexml_issuezilla.rb deleted file mode 100644 index 1c54c9d53d..0000000000 --- a/test/rexml/test_rexml_issuezilla.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: false -require_relative 'rexml_test_utils' -require 'rexml/document' - -module REXMLTests - class TestIssuezillaParsing < Test::Unit::TestCase - include REXMLTestUtils - def test_rexml - doc = File.open(fixture_path("ofbiz-issues-full-177.xml")) do |f| - REXML::Document.new(f) - end - ctr = 1 - doc.root.each_element('//issue') do |issue| - assert_equal( ctr, issue.elements['issue_id'].text.to_i ) - ctr += 1 - end - end - end -end diff --git a/test/rexml/test_sax.rb b/test/rexml/test_sax.rb deleted file mode 100644 index 00539f0d4c..0000000000 --- a/test/rexml/test_sax.rb +++ /dev/null @@ -1,287 +0,0 @@ -# frozen_string_literal: false -require_relative "rexml_test_utils" -require 'rexml/sax2listener' -require 'rexml/parsers/sax2parser' -require 'rexml/document' - -module REXMLTests - class SAX2Tester < Test::Unit::TestCase - include REXMLTestUtils - include REXML - def test_characters - d = Document.new( "@blah@" ) - txt = d.root.text - p = Parsers::SAX2Parser.new "@blah@" - p.listen(:characters) {|x| assert_equal txt, x} - p.listen(:characters, ["A"]) {|x| assert_equal txt,x} - p.parse - end - - def test_entity_replacement - source = ' - - - ]>&la;&lala;' - sax = Parsers::SAX2Parser.new( source ) - results = [] - sax.listen(:characters) {|x| results << x } - sax.parse - assert_equal 2, results.size - assert_equal '1234', results[0] - assert_equal '--1234--', results[1] - end - - def test_sax2 - File.open(fixture_path("documentation.xml")) do |f| - parser = Parsers::SAX2Parser.new( f ) - # Listen to all events on the following elements - count = 0 - blok = proc { |uri,localname,qname,attributes| - assert %w{ bugs todo }.include?(localname), - "Mismatched name; we got '#{qname}'\nArgs were:\n\tURI: #{uri}\n\tLOCALNAME: #{localname}\n\tQNAME: #{qname}\n\tATTRIBUTES: #{attributes.inspect}\n\tSELF=#{blok}" - count += 1 - } - - start_document = 0 - end_document = 0 - parser.listen( :start_document ) { start_document += 1 } - parser.listen( :end_document ) { end_document += 1 } - parser.listen( :start_element, %w{ changelog bugs todo }, &blok ) - # Listen to all events on the following elements. Synonymous with - # listen( :start_element, %w{ ... } ) - parser.listen( %w{ changelog bugs todo }, &blok ) - # Listen for all start element events - parser.listen( :start_element ) { |uri,localname,qname,attributes| - } - listener = MySAX2Listener.new - # Listen for all events - parser.listen( listener ) - # Listen for all events on the given elements. Does not include children - # events. Regular expressions work as well! - parser.listen( %w{ /change/ bugs todo }, listener ) - # Test the deafening method - blok = proc { |uri,localname,qname,attributes| - assert_fail "This listener should have been deafened!" - } - parser.listen( %w{ changelog }, &blok ) - parser.deafen( &blok ) - - tc = 0 - parser.listen( :characters, %w{version} ) {|text| - assert(text=~/@ANT_VERSION@/, "version was '#{text}'") - tc += 1 - } - - begin - parser.parse - rescue => exception - if exception.kind_of? Test::Unit::AssertionFailedError - raise exception - end - puts $! - puts exception.backtrace - end - assert_equal 2, count - assert_equal 1, tc - assert_equal 1, start_document - assert_equal 1, end_document - end - end - - # used by test_simple_doctype_listener - # submitted by Jeff Barczewski - class SimpleDoctypeListener - include REXML::SAX2Listener - attr_reader :name, :pub_sys, :long_name, :uri - - def initialize - @name = @pub_sys = @long_name = @uri = nil - end - - def doctype(name, pub_sys, long_name, uri) - @name = name - @pub_sys = pub_sys - @long_name = long_name - @uri = uri - end - end - - # test simple non-entity doctype in sax listener - # submitted by Jeff Barczewski - def test_simple_doctype_listener - xml = <<-END - - - Hello, world! - END - parser = Parsers::SAX2Parser.new(xml) - dtl = SimpleDoctypeListener.new - parser.listen(dtl) - tname = nil - tpub_sys = nil - tlong_name = nil - turi = nil - parser.listen(:doctype) do |name, pub_sys, long_name, uri| - tname = name - tpub_sys = pub_sys - tlong_name = long_name - turi = uri - end - parser.parse - assert_equal 'greeting', tname, 'simple doctype block listener failed - incorrect name' - assert_equal 'PUBLIC', tpub_sys, 'simple doctype block listener failed - incorrect pub_sys' - assert_equal 'Hello Greeting DTD', tlong_name, 'simple doctype block listener failed - incorrect long_name' - assert_equal 'http://foo/hello.dtd', turi, 'simple doctype block listener failed - incorrect uri' - assert_equal 'greeting', dtl.name, 'simple doctype listener failed - incorrect name' - assert_equal 'PUBLIC', dtl.pub_sys, 'simple doctype listener failed - incorrect pub_sys' - assert_equal 'Hello Greeting DTD', dtl.long_name, 'simple doctype listener failed - incorrect long_name' - assert_equal 'http://foo/hello.dtd', dtl.uri, 'simple doctype listener failed - incorrect uri' - end - - # test doctype with missing name, should throw ParseException - # submitted by Jeff Barczewseki - def test_doctype_with_mising_name_throws_exception - xml = <<-END - - - Hello, world! - END - parser = Parsers::SAX2Parser.new(xml) - assert_raise(REXML::ParseException, 'doctype missing name did not throw ParseException') do - parser.parse - end - end - - - class KouListener - include REXML::SAX2Listener - attr_accessor :sdoc, :edoc - attr_reader :selem, :decl, :pi - def initialize - @sdoc = @edoc = @selem = false - @decl = 0 - @pi = 0 - end - def start_document - @sdoc = true - end - def end_document - @edoc = true - end - def xmldecl( *arg ) - @decl += 1 - end - def processing_instruction( *arg ) - @pi += 1 - end - def start_element( *arg ) - @selem = true - end - end - - # Submitted by Kou - def test_begin_end_document - parser = Parsers::SAX2Parser.new("") - - kl = KouListener.new - parser.listen(kl) - sd = false - ed = false - parser.listen(:start_document) { sd = true } - parser.listen(:end_document) { ed = true } - - parser.parse - assert( sd, ':start_document block failed' ) - assert( ed, ':end_document block failed' ) - assert( kl.sdoc, ':start_document listener failed' ) - assert( kl.edoc, ':end_document listener failed' ) - end - - # Submitted by Kou - def test_listen_before_start - # FIXME: the following comment should be a test for validity. (The xml declaration - # is invalid). - #parser = Parsers::SAX2Parser.new( "") - parser = Parsers::SAX2Parser.new( "") - k1 = KouListener.new - parser.listen( k1 ) - xmldecl = false - pi = 0 - parser.listen( :xmldecl ) { xmldecl = true } - parser.listen( :processing_instruction ) { pi += 1 } - - parser.parse - - assert( xmldecl, ':xmldecl failed' ) - assert_equal( 2, pi, ':processing_instruction failed' ) - assert( k1.decl, 'Listener for xmldecl failed' ) - assert_equal( 2, k1.pi, 'Listener for processing instruction failed' ) - end - - - def test_socket - require 'socket' - - TCPServer.open('127.0.0.1', 0) do |server| - TCPSocket.open('127.0.0.1', server.addr[1]) do |socket| - ok = false - session = server.accept - begin - session << '' - parser = REXML::Parsers::SAX2Parser.new(socket) - Fiber.new do - parser.listen(:start_element) do - ok = true - Fiber.yield - end - parser.parse - end.resume - assert(ok) - ensure - session.close - end - end - end - end - - def test_char_ref_sax2() - parser = REXML::Parsers::SAX2Parser.new('ü') - result = nil - parser.listen(:characters) {|text| result = text.unpack('U*')} - parser.parse() - assert_equal(1, result.size) - assert_equal(252, result[0]) - end - - - def test_char_ref_dom() - doc = REXML::Document.new('ü') - result = doc.root.text.unpack('U*') - assert_equal(1, result.size) - assert_equal(252, result[0]) - end - - class Ticket68 - include REXML::SAX2Listener - end - def test_ticket_68 - File.open(fixture_path('ticket_68.xml')) do |f| - parser = REXML::Parsers::SAX2Parser.new(f) - parser.listen( Ticket68.new ) - begin - parser.parse - rescue - p parser.source.position - p parser.source.current_line - puts $!.backtrace.join("\n") - flunk $!.message - end - end - end - end - - class MySAX2Listener - include REXML::SAX2Listener - end -end diff --git a/test/rexml/test_stream.rb b/test/rexml/test_stream.rb deleted file mode 100644 index 08d4462ef9..0000000000 --- a/test/rexml/test_stream.rb +++ /dev/null @@ -1,130 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" -require "rexml/document" -require 'rexml/streamlistener' -require 'stringio' - -module REXMLTests - class MyListener - include REXML::StreamListener - end - - - class StreamTester < Test::Unit::TestCase - # Submitted by Han Holl - def test_listener - data = %Q{\n} - - RequestReader.new( data ) - RequestReader.new( data ) - end - - def test_ticket_49 - source = StringIO.new( <<-EOL ) - - ]> - &ent; - EOL - REXML::Document.parse_stream(source, MyListener.new) - end - - def test_ticket_10 - source = StringIO.new( <<-EOL ) - - - - - ]> - - EOL - listener = MyListener.new - class << listener - attr_accessor :events - def entitydecl( content ) - @events[ :entitydecl ] = true - end - def attlistdecl( element_name, attributes, raw_content ) - @events[ :attlistdecl ] = true - end - def elementdecl( content ) - @events[ :elementdecl ] = true - end - def notationdecl( content ) - @events[ :notationdecl ] = true - end - end - listener.events = {} - - REXML::Document.parse_stream( source, listener ) - - assert( listener.events[:entitydecl] ) - assert( listener.events[:attlistdecl] ) - assert( listener.events[:elementdecl] ) - assert( listener.events[:notationdecl] ) - end - - def test_entity - listener = MyListener.new - class << listener - attr_accessor :entities - def entity(content) - @entities << content - end - end - listener.entities = [] - - source = StringIO.new(<<-XML) - -%ISOLat2; -]> - - XML - REXML::Document.parse_stream(source, listener) - - assert_equal(["ISOLat2"], listener.entities) - end - end - - - # For test_listener - class RequestReader - attr_reader :doc - def initialize(io) - @stack = [] - @doc = nil - catch(:fini) do - REXML::Document.parse_stream(io, self) - raise IOError - end - end - def tag_start(name, args) - if @doc - @stack.push(REXML::Element.new(name, @stack.last)) - else - @doc = REXML::Document.new("<#{name}/>") - @stack.push(@doc.root) - end - args.each do |attr,val| - @stack.last.add_attribute(attr, val) - end - end - def tag_end(name, *args) - @stack.pop - throw(:fini) if @stack.empty? - end - def text(str) - @stack.last.text = str - end - def comment(str) - end - def doctype( name, pub_sys, long_name, uri ) - end - def doctype_end - end - end -end diff --git a/test/rexml/test_text.rb b/test/rexml/test_text.rb deleted file mode 100644 index e9a246e27f..0000000000 --- a/test/rexml/test_text.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: false - -require_relative "rexml_test_utils" - -module REXMLTests - class TextTester < Test::Unit::TestCase - include REXML - - def test_new_text_response_whitespace_default - text = Text.new("a b\t\tc", true) - assert_equal("a b\tc", Text.new(text).to_s) - end - - def test_new_text_response_whitespace_true - text = Text.new("a b\t\tc", true) - assert_equal("a b\t\tc", Text.new(text, true).to_s) - end - - def test_new_text_raw_default - text = Text.new("&lt;", false, nil, true) - assert_equal("&lt;", Text.new(text).to_s) - end - - def test_new_text_raw_false - text = Text.new("&lt;", false, nil, true) - assert_equal("&amp;lt;", Text.new(text, false, nil, false).to_s) - end - - def test_new_text_entity_filter_default - document = REXML::Document.new(<<-XML) - - -]> - - XML - text = Text.new("aaa bbb", false, document.root, nil, ["a"]) - assert_equal("aaa &b;", - Text.new(text, false, document.root).to_s) - end - - def test_new_text_entity_filter_custom - document = REXML::Document.new(<<-XML) - - -]> - - XML - text = Text.new("aaa bbb", false, document.root, nil, ["a"]) - assert_equal("&a; bbb", - Text.new(text, false, document.root, nil, ["b"]).to_s) - end - - def test_shift_operator_chain - text = Text.new("original\r\n") - text << "append1\r\n" << "append2\r\n" - assert_equal("original\nappend1\nappend2\n", text.to_s) - end - - def test_shift_operator_cache - text = Text.new("original\r\n") - text << "append1\r\n" << "append2\r\n" - assert_equal("original\nappend1\nappend2\n", text.to_s) - text << "append3\r\n" << "append4\r\n" - assert_equal("original\nappend1\nappend2\nappend3\nappend4\n", text.to_s) - end - - def test_clone - text = Text.new("&lt; <") - assert_equal(text.to_s, - text.clone.to_s) - end - end -end diff --git a/test/rexml/test_ticket_80.rb b/test/rexml/test_ticket_80.rb deleted file mode 100644 index ab6a57efaf..0000000000 --- a/test/rexml/test_ticket_80.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: false -#------------------------------------------------------------------------------ -# file: rexml_test.rb -# desc: test's REXML's XML/XPath implementation -# auth: Philip J Grabner atdot -# date: 2006/08/17 -# copy: (C) CopyLoose 2006 Bib Development Team atdot -#------------------------------------------------------------------------------ - -require 'test/unit' -require 'rexml/document' - -module REXMLTests - class Ticket80 < Test::Unit::TestCase - - @@xmlstr = ' - - - - - - - - - - - - - -' - - #---------------------------------------------------------------------------- - def test_xpathNamespacedChildWildcard - # tests the "prefix:*" node test syntax - out = Array.new - REXML::XPath.each( REXML::Document.new(@@xmlstr), - '/ns:root/ns:*/ns:l2/@value', - { 'ns' => 'urn:some-xml-ns' } ) do |node| out.push node.value ; end - chk = [ 'foo-01', 'foo-02', 'foo-03', 'bar-01', 'bar-02' ] - assert_equal chk, out - end - - #---------------------------------------------------------------------------- - def test_xpathNamespacedChildWildcardWorkaround - # tests a workaround for the "prefix:*" node test syntax - out = Array.new - REXML::XPath.each( REXML::Document.new(@@xmlstr), - '/ns:root/*[namespace-uri()="urn:some-xml-ns"]/ns:l2/@value', - { 'ns' => 'urn:some-xml-ns' } ) do |node| out.push node.value ; end - chk = [ 'foo-01', 'foo-02', 'foo-03', 'bar-01', 'bar-02' ] - assert_equal chk, out - end - - end -end - -#------------------------------------------------------------------------------ -# end of rexml_test.rb -#------------------------------------------------------------------------------ diff --git a/test/rexml/test_validation_rng.rb b/test/rexml/test_validation_rng.rb deleted file mode 100644 index b5b50450e0..0000000000 --- a/test/rexml/test_validation_rng.rb +++ /dev/null @@ -1,793 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" - -require "rexml/document" -require "rexml/validation/relaxng" - -module REXMLTests - class RNGValidation < Test::Unit::TestCase - include REXML - - def test_validate - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{} ) - error( validator, %q{} ) - end - - - def test_sequence - rng = %q{ - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - end - - - def test_choice - rng = %q{ - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_optional - rng = %q{ - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - end - - def test_zero_or_more - rng = %q{ - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - end - - def test_one_or_more - rng = %q{ - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - end - - def test_attribute - rng = %q{ - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_choice_attributes - rng = %q{ - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{}) - no_error( validator, %q{} ) - end - - def test_choice_attribute_element - rng = %q{ - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{}) - no_error( validator, %q{} ) - end - - def test_empty - rng = %q{ - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{Text} ) - no_error( validator, %q{}) - end - - def test_text_val - rng = %q{ - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{Text} ) - error( validator, %q{}) - end - - def test_choice_text - rng = %q{ - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{Text} ) - error( validator, %q{Text} ) - no_error( validator, %q{Text} ) - no_error( validator, %q{} ) - end - - def test_group - rng = %q{ - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_value - # Values as text nodes - rng = %q{ - - - - VaLuE - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{X} ) - error( validator, %q{} ) - no_error( validator, %q{VaLuE} ) - - # Values as text nodes, via choice - rng = %q{ - - - - - Option 1 - Option 2 - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{XYZ} ) - no_error( validator, %q{Option 1} ) - no_error( validator, %q{Option 2} ) - - # Attribute values - rng = %q{ - - - - VaLuE - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - - # Attribute values via choice - rng = %q{ - - - - - Option 1 - Option 2 - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_interleave - rng = %q{ - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - end - - def test_mixed - rng = %q{ - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{Text} ) - no_error( validator, %q{Text} ) - end - - def test_ref_sequence - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{} ) - error( validator, %q{} ) - end - - def test_ref_choice - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - - def test_ref_zero_plus - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - - def test_ref_one_plus - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_ref_interleave - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_ref_recurse - rng = %q{ - - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{} ) - no_error( validator, %q{} ) - no_error( validator, %q{} ) - end - - def test_ref_optional - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - - rng = %q{ - - - - - - - - - - - - - - - - } - validator = REXML::Validation::RelaxNG.new( rng ) - - no_error( validator, %q{} ) - no_error( validator, %q{} ) - error( validator, %q{} ) - error( validator, %q{} ) - end - - - - def error( validator, source ) - parser = REXML::Parsers::TreeParser.new( source ) - parser.add_listener( validator.reset ) - assert_raise( REXML::Validation::ValidationException, - "Expected a validation error" ) { parser.parse } - end - - def no_error( validator, source ) - parser = REXML::Parsers::TreeParser.new( source ) - parser.add_listener( validator.reset ) - assert_nothing_raised { parser.parse } - end - end -end diff --git a/test/rexml/test_xml_declaration.rb b/test/rexml/test_xml_declaration.rb deleted file mode 100644 index da7076126e..0000000000 --- a/test/rexml/test_xml_declaration.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: false -# -# Created by Henrik Mårtensson on 2007-02-18. -# Copyright (c) 2007. All rights reserved. - -require "rexml/document" -require "test/unit" - -module REXMLTests - class TestXmlDeclaration < Test::Unit::TestCase - def setup - xml = <<-XML - - - - XML - @doc = REXML::Document.new xml - @root = @doc.root - @xml_declaration = @doc.children[0] - end - - def test_is_first_child - assert_kind_of(REXML::XMLDecl, @xml_declaration) - end - - def test_has_document_as_parent - assert_kind_of(REXML::Document, @xml_declaration.parent) - end - - def test_has_sibling - assert_kind_of(REXML::XMLDecl, @root.previous_sibling.previous_sibling) - assert_kind_of(REXML::Element, @xml_declaration.next_sibling.next_sibling) - end - - def test_write_prologue_quote - @doc.context[:prologue_quote] = :quote - assert_equal("", - @xml_declaration.to_s) - end - - def test_is_writethis_attribute_copied_by_clone - assert_equal(true, @xml_declaration.clone.writethis) - @xml_declaration.nowrite - assert_equal(false, @xml_declaration.clone.writethis) - end - end -end diff --git a/test/rexml/xpath/test_attribute.rb b/test/rexml/xpath/test_attribute.rb deleted file mode 100644 index 713d77b22f..0000000000 --- a/test/rexml/xpath/test_attribute.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' -require 'rexml/document' - -module REXMLTests - class TestXPathAttribute < Test::Unit::TestCase - def setup - @xml = <<-XML - - - child1 - child2 - child3 - - XML - @document = REXML::Document.new(@xml) - end - - def test_elements - root = @document.elements["root"] - second_child = root.elements["child[@name='two']"] - assert_equal("child2", second_child.text) - end - - def test_xpath_each - children = REXML::XPath.each(@document, "/root/child[@name='two']") - assert_equal(["child2"], children.collect(&:text)) - end - - def test_no_namespace - children = REXML::XPath.match(@document, - "/root/child[@nothing:name='two']", - "" => "http://example.com/", - "nothing" => "") - assert_equal(["child2"], children.collect(&:text)) - end - end -end diff --git a/test/rexml/xpath/test_axis_preceding_sibling.rb b/test/rexml/xpath/test_axis_preceding_sibling.rb deleted file mode 100644 index 5842c6bc50..0000000000 --- a/test/rexml/xpath/test_axis_preceding_sibling.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" -require "rexml/document" - -module REXMLTests - class TestXPathAxisPredcedingSibling < Test::Unit::TestCase - include REXML - SOURCE = <<-EOF - - - - - - - - - EOF - - def setup - @@doc = Document.new(SOURCE) unless defined? @@doc - end - - def test_preceding_sibling_axis - context = XPath.first(@@doc,"/a/e/f[last()]") - assert_equal "6", context.attributes["id"] - - prev = XPath.first(context, "preceding-sibling::f") - assert_equal "5", prev.attributes["id"] - - prev = XPath.first(context, "preceding-sibling::f[1]") - assert_equal "5", prev.attributes["id"] - - prev = XPath.first(context, "preceding-sibling::f[2]") - assert_equal "4", prev.attributes["id"] - - prev = XPath.first(context, "preceding-sibling::f[3]") - assert_equal "3", prev.attributes["id"] - end - end -end diff --git a/test/rexml/xpath/test_base.rb b/test/rexml/xpath/test_base.rb deleted file mode 100644 index 210d6c7c81..0000000000 --- a/test/rexml/xpath/test_base.rb +++ /dev/null @@ -1,1125 +0,0 @@ -# frozen_string_literal: false -require_relative "../rexml_test_utils" - -require "rexml/document" - -module REXMLTests - class TestXPathBase < Test::Unit::TestCase - include REXMLTestUtils - include REXML - SOURCE = <<-EOF - - - - - - - - - - - - - - - - - - - - - - -

- - - - - EOF - JENI_TENNISON = <<-EOJT - - - - - - - - - - - - - - - - - - - - - - - - EOJT - - def setup - @@doc = Document.new(SOURCE) unless defined? @@doc - @@jeni = Document.new( JENI_TENNISON ) unless defined? @@jeni - end - - def each_test( element, xpath ) - count = 0 - XPath::each( element, xpath ) { |child| - count += 1 - yield child if block_given? - } - count - end - - def test_descendant - doc = Document.new("") - p = XPath.match( doc, "//c" ) - assert_equal( 2, p.size ) - p = XPath.first( @@doc, "//p" ) - assert_equal "p", p.name - c = each_test( @@doc, "//c" ) { |child| assert_equal "c", child.name } - assert_equal 5, c - c = each_test( @@doc.root, "b//c" ) { |child| - assert_equal "c", child.name - } - assert_equal 2, c - - doc = Document.new( "" ) - # //para[1] : all descendants which are the first para child of their parent - assert_equal( 4, XPath.match( doc, "//z[1]" ).size ) - # /descendant::para[1] : the first descendant para element - assert_equal( 1, XPath.match( doc, "/descendant::z[1]" ).size ) - end - - def test_root - source = "" - doc = Document.new( source ) - assert_equal doc, doc.root_node - assert_equal "a", XPath::first( doc, "/" ).elements[1].name - end - - def test_abbreviated_simple_child - assert_equal "a", XPath::first(@@doc, "a").name - end - - def test_child - c = XPath::first( @@doc, "a/b/c" ) - assert_equal "c", c.name - assert_equal "3", XPath::first(@@doc, "a/b/c").attributes["id"] - end - - def test_root_child - assert_equal "a", XPath::first(@@doc, "/a").name - c = XPath::first( @@doc, "a/b/c" ) - assert_equal "a", XPath::first(c, "/a").name - end - - def test_root_children - c = XPath::first( @@doc, "a/b/c" ) - assert_equal "2", XPath::first(c, "/a/b").attributes["id"] - end - - def test_abbreviated_step - c = XPath::first( @@doc, "a/b/c" ) - assert_equal("c", c.name) - assert_equal("a", XPath::first(@@doc.root, ".").name) - assert_equal("b", XPath::first(c, "..").name) - assert_equal("a", XPath::first(@@doc, "a/b/..").name) - - doc = File.open(fixture_path("project.xml")) do |f| - REXML::Document.new(f) - end - c = each_test(doc.root, "./Description" ) { |child| - assert_equal("Description",child.name) - } - assert_equal 1, c - end - - # Things that aren't tested elsewhere - def test_predicates - assert_equal "12", XPath::first(@@doc, "a/e/f[3]").attributes["id"] - assert_equal "13", XPath::first(@@doc, "a/e/f[3]/g").attributes["id"] - assert_equal "14", XPath::first(@@doc, "a/e/f[@a='d'][2]").attributes["id"] - assert_equal "14", XPath::first(@@doc, "a/e/f[@a='d'][@id='14']").attributes["id"] - assert_equal "a", XPath::first( @@doc, "*[name()='a' and @id='1']" ).name - c=each_test( @@doc, "//*[name()='f' and @a='d']") { |i| - assert_equal "f", i.name - } - assert_equal 2, c - c=each_test( @@doc, "//*[name()='m' or @a='d']") { |i| - assert ["m","f"].include?(i.name) - } - assert_equal 3, c - - assert_equal "b", XPath::first( @@doc, "//b[@x]" ).name - end - - def test_node_type - doc = Document.new "text" - #res = XPath::first(doc.root, "text()") - #assert_equal "text", res.to_s - - #res = XPath::first(doc, "*") - #assert_equal "a", res.name - - assert_equal( :processing_instruction, - XPath::first(doc.root, "processing-instruction()").node_type) - assert_equal( :comment, XPath::first(doc.root, "comment()").node_type) - end - - def test_functions - # trivial text() test - # confuse-a-function - source = "more dumb text" - doc = Document.new source - res = "" - #XPath::each(doc.root, "text()") {|val| res << val.to_s} - #assert_equal "more text", res - - #res = XPath::first(doc.root, "b[last()]") - #assert_equal '3', res.attributes['id'] - res = XPath::first(doc.root, "b[position()=2]") - assert_equal '2', res.attributes['id'] - res = XPath::first(doc.root, "*[name()='c']") - assert_equal "c", res.name - end - - def no_test_ancestor - doc = REXML::Document.new(File.new(fixture_path("testsrc.xml"))) - doc.elements.each("//item") { |el| print el.name - if el.attributes['x'] - puts " -- "+el.attributes['x'] - else - puts - end - } - doc.elements.each("//item/ancestor::") { |el| print el.name - if el.attributes['x'] - puts " -- "+el.attributes['x'] - else - puts - end - } - end - - # Here are some XPath tests that were originally submitted by ... - # The code has changed some, but the logic and the source documents are the - # same. - # This method reads a document from a file, and then a series of xpaths, - # also from a file. It then checks each xpath against the source file. - def test_more - xmlsource = fixture_path("testsrc.xml") - xpathtests = fixture_path("xp.tst") - - doc = File.open(xmlsource) {|f| REXML::Document.new(f) } - #results = "" - results = REXML::Document.new - results.add_element "test-results" - File.foreach(xpathtests) do |line| - line.strip! - begin - doc.root - #puts "#"*80 - #print "\nDoing #{line} " ; $stdout.flush - doc.elements.each(line) do |el| - #print "." ; $stdout.flush - results.root << el.clone - #results << el.to_s - end - #ObjectSpace.garbage_collect - GC::start - rescue Exception => z - #puts "\n'#{line}' failed" - fail("Error on line #{line}:\n#{z.message}\n"+z.backtrace[0,10].join("\n")) - #results.root.add_element( "error", {"path"=>line}).text = z.message+"\n"+z.backtrace[0,10].join("\n") - #results << ""+z.message+"" - end - end - end - - def test_axe_descendant - assert_equal "f", XPath::first( @@doc, "descendant::f").name - end - - def test_axe_parent - q = XPath.first( @@doc, "a/d/c/parent::*/q" ) - assert_equal 19, q.attributes["id"].to_i - end - - def test_abbreviated_attribute - assert_equal 'a', XPath::first( @@doc, "a[@id='1']" ).name - c = XPath::first( @@doc, "a/b/c[@id='4']" ) - assert_equal 'c', c.name - assert_equal '4', c.attributes['id'] - - result = XPath::first( @@doc, "descendant::f[@a='c']") - assert_equal "11", result.attributes['id'] - - assert_equal "11", XPath::first(@@doc, "a/e/f[@a='c']").attributes["id"] - assert_equal "11", XPath::first(@@doc, "a/e/*[@a='c']").attributes["id"] - end - - def test_axe_self - c = XPath::first( @@doc, "a/b/c" ) - assert c - assert_equal "c", c.name - assert_equal "c", XPath::first( c, "self::node()" ).name - end - - def test_axe_ancestor - doc = REXML::Document.new " - - - - - - - - - " - - d = XPath.first( doc, "//d" ) - assert_equal "d", d.name - b = each_test( d, "ancestor::b" ) { |el| - assert((1..2) === el.attributes['id'].to_i, - "Expected #{el.attributes['id']} to be either 1 or 2" - ) - } - assert_equal 2, b - end - - def test_axe_child - m = XPath.first( @@doc, "a/child::m" ) - assert_equal 15, m.attributes['id'].to_i - end - - def test_axe_attribute - a = XPath.first( @@doc, "a/attribute::id" ) - assert_equal "1", a.value - a = XPath.first( @@doc, "a/e/f[@id='14']/attribute::a" ) - assert_equal "d", a.value - end - - def test_axe_sibling - doc = Document.new "" - first_f = XPath.first( doc, "a/e/f" ) - assert first_f - assert_equal '10', first_f.attributes['id'] - next_f = XPath.first( doc, "a/e/f/following-sibling::node()" ) - assert_equal '11', next_f.attributes['id'] - - b = XPath.first( doc, "a/e/preceding-sibling::node()" ) - assert_equal 'b', b.name - end - - def test_lang - doc = File.open(fixture_path("lang0.xml")) {|f| Document.new(f) } - #puts IO.read( "test/lang.xml" ) - - #puts XPath.match( doc, "//language/*" ).size - c = each_test( doc, "//language/*" ) { |element| - #puts "#{element.name}: #{element.text}" - } - assert_equal 4, c - end - - def test_namespaces_1 - source = <<-EOF - - this bar - that bar - - EOF - doc = Document.new source - XPath.each( doc, "//bar" ) { - fail "'bar' should match nothing in this case" - } - - namespace = {"t"=>"this"} - results = XPath.first( doc, "//t:bar", namespace ) - assert_equal "this bar", results.text - end - - def test_namespaces_2 - source = <<-EOF - - this bar - that bar - - EOF - doc = Document.new source - res = XPath::first(doc, "//*[local_name()='bar']") - assert res, "looking for //*[name()='bar']" - assert_equal 'this', res.namespace - res = XPath::first(doc.root, "*[namespace_uri()='that']") - assert_equal 'that bar', res.text - end - - def test_complex - next_f = XPath.first( @@doc, "a/e/f[@id='11']/following-sibling::*" ) - assert_equal 12, next_f.attributes['id'].to_i - prev_f = XPath.first( @@doc, "a/e/f[@id='11']/preceding-sibling::*" ) - assert_equal 10, prev_f.attributes['id'].to_i - c = each_test( @@doc, "descendant-or-self::*[@x='y']" ) - assert_equal 2, c - end - - def match(xpath) - XPath.match(@@doc, xpath).collect(&:to_s) - end - - def test_grouping - assert_equal([], - match("a/d/*[name()='d' and (name()='f' or name()='q')]")) - assert_equal([""], - match("a/d/*[(name()='d' and name()='f') or name()='q']")) - end - - def test_preceding - d = Document.new "" - start = XPath.first( d, "/a/b[@id='1']" ) - assert_equal 'b', start.name - c = XPath.first( start, "preceding::c" ) - assert_equal '2', c.attributes['id'] - - c1, c0 = XPath.match( d, "/a/b/c[@id='2']/preceding::node()" ) - assert_equal '1', c1.attributes['id'] - assert_equal '0', c0.attributes['id'] - - c2, c1, c0, b, b2, b0 = XPath.match( start, "preceding::node()" ) - - assert_equal 'c', c2.name - assert_equal 'c', c1.name - assert_equal 'c', c0.name - assert_equal 'b', b.name - assert_equal 'b', b2.name - assert_equal 'b', b0.name - - assert_equal '2', c2.attributes['id'] - assert_equal '1', c1.attributes['id'] - assert_equal '0', c0.attributes['id'] - assert b.attributes.empty? - assert_equal '2', b2.attributes['id'] - assert_equal '0', b0.attributes['id'] - - d = REXML::Document.new("") - matches = REXML::XPath.match(d, "/a/d/preceding::node()") - assert_equal("c", matches[0].name) - assert_equal("b", matches[1].name) - - s = "" - d = REXML::Document.new(s) - c = REXML::XPath.match( d, "//c[@id = '5']") - cs = REXML::XPath.match( c, "preceding::c" ) - assert_equal( 4, cs.length ) - end - - def test_following - d = Document.new "" - start = XPath.first( d, "/a/b[@id='0']" ) - assert_equal 'b', start.name - c = XPath.first( start, "following::c" ) - assert_equal '1', c.attributes['id'] - - s = "" - d = Document.new(s) - c = XPath.first(d, '/a/b/c') - assert_equal 'c', c.name - res = XPath.match( c, 'following::*' ) - assert_equal 6, res.size - res = XPath.match( c, 'following::i' ) - assert_equal 2, res.size - end - - # The following three paths were provided by - # Jeni Tennison - # a consultant who is also an XSL and XPath expert - #def test_child_cubed - # els = @@jeni.elements.to_a("*****") - # assert_equal 3, els.size - #end - - #def test_div_2 - # results = doc.elements.to_a("/ div 2") - #end - - #def test_nested_predicates - # puts @@jeni.root.elements[1].elements[1].name - # results = @@jeni.root.elements[1].elements[1].elements.to_a("../following-sibling::*[*[name() = name(current())]]") - # puts results - #end - - # Contributed by Mike Stok - def test_starts_with - source = <<-EOF - - a@b.c - http://www.foo.com - - EOF - doc = Document.new source - mailtos = doc.elements.to_a("//a[starts-with(@href, 'mailto:')]") - assert_equal 1, mailtos.size - assert_equal "mailto:a@b.c", mailtos[0].attributes['href'] - - ailtos = doc.elements.to_a("//a[starts-with(@href, 'ailto:')]") - assert_equal 0, ailtos.size - end - - def test_toms_text_node - file = "ABCDEF" - doc = Document.new(file) - assert_equal 'A', XPath.first(doc[0], 'text()').to_s - assert_equal 'AF', XPath.match(doc[0], 'text()').collect { |n| - n.to_s - }.join('') - assert_equal 'B', XPath.first(doc[0], 'b/text()').to_s - assert_equal 'D', XPath.first(doc[0], '//d/text()').to_s - assert_equal 'ABCDEF', XPath.match(doc[0], '//text()').collect {|n| - n.to_s - }.join('') - end - - def test_string_length - doc = Document.new <<-EOF - - - - - - - - - EOF - assert doc, "create doc" - - set = doc.elements.to_a("//*[string-length(name()) = 3]") - assert_equal 2, set.size, "nodes with names length = 3" - - set = doc.elements.to_a("//*[string-length(name()) < 3]") - assert_equal 2, set.size, "nodes with names length < 3" - - set = doc.elements.to_a("//*[string-length(name()) > 3]") - assert_equal 3, set.size, "nodes with names length > 3" - end - - # Test provided by Mike Stok - def test_contains - source = <<-EOF - - a@b.c - http://www.foo.com - - EOF - doc = Document.new source - - [ - #['o', 2], - ['foo', 1], ['bar', 0]].each { |search, expected| - set = doc.elements.to_a("//a[contains(@href, '#{search}')]") - assert_equal expected, set.size - } - end - - # Mike Stok and Sean Russell - def test_substring - # examples from http://www.w3.org/TR/xpath#function-substring - doc = Document.new('') - - Document.new("") - #puts XPath.first(d, 'node()[0 + 1]') - #d = Document.new("") - #puts XPath.first(d, 'a[0 mod 0]') - [ [1.5, 2.6, '234'], - [0, 3, '12'], - [0, '0 div 0', ''], - [1, '0 div 0', ''], - ['-42', '1 div 0', '12345'], - ['-1 div 0', '1 div 0', ''] - ].each { |start, length, expected| - set = doc.elements.to_a("//test[substring(@string, #{start}, #{length}) = '#{expected}']") - assert_equal 1, set.size, "#{start}, #{length}, '#{expected}'" - } - end - - def test_translate - source = <<-EOF - - - - - - - - EOF - - doc = Document.new(source) - - [ ['bar', 'abc', 'ABC', 'w3c one'], - ['--aaa--','abc-','ABC', 'w3c two'], - ['lead', 'dear language', 'doll groover', 'alchemy'], - ['A Space Odissei', 'i', 'y', 'vbxml one'], - ['abcdefg', 'aceg', 'ACE', 'vbxml two'], - ].each { |arg1, arg2, arg3, name| - translate = "translate('#{arg1}', '#{arg2}', '#{arg3}')" - set = doc.elements.to_a("//case[@result = #{translate}]") - assert_equal 1, set.size, translate - assert_equal name, set[0].attributes['name'] - } - end - - def test_math - d = Document.new( '' ) - assert XPath.first( d.root, 'node()[1]' ) - assert_equal 'b', XPath.first( d.root, 'node()[1]' ).name - assert XPath.first( d.root, 'node()[0 + 1]' ) - assert_equal 'b', XPath.first( d.root, './node()[0 + 1]' ).name - assert XPath.first( d.root, 'node()[1 + 1]' ) - assert_equal 'c', XPath.first( d.root, './node()[1 + 1]' ).name - assert XPath.first( d.root, 'node()[4 div 2]' ) - assert_equal 'c', XPath.first( d.root, './node()[4 div 2]' ).name - assert XPath.first( d.root, 'node()[2 - 1]' ) - assert_equal 'b', XPath.first( d.root, './node()[2 - 1]' ).name - assert XPath.first( d.root, 'node()[5 mod 2]' ) - assert_equal 'b', XPath.first( d.root, './node()[5 mod 2]' ).name - assert XPath.first( d.root, 'node()[8 mod 3]' ) - assert_equal 'c', XPath.first( d.root, './node()[8 mod 3]' ).name - assert XPath.first( d.root, 'node()[1 * 2]' ) - assert_equal 'c', XPath.first( d.root, './node()[1 * 2]' ).name - assert XPath.first( d.root, 'node()[2 + -1]' ) - assert_equal 'b', XPath.first( d.root, './node()[2 + -1]' ).name - end - - def test_name - assert_raise( UndefinedNamespaceException, "x should be undefined" ) { - REXML::Document.new("") - } - d = REXML::Document.new("") - assert_equal 1, d.root.elements.to_a('*[name() = "b"]').size - assert_equal 1, d.elements.to_a('//*[name() = "x:b"]').size - end - - def test_local_name - d = REXML::Document.new("") - assert_equal 2, d.root.elements.to_a('*[local_name() = "b"]').size - assert_equal 2, d.elements.to_a('//*[local_name() = "b"]').size - end - - def test_comparisons - source = "" - doc = REXML::Document.new(source) - - # NOTE TO SER: check that number() is required - assert_equal 2, REXML::XPath.match(doc, "//b[number(@id) > 1]").size - assert_equal 3, REXML::XPath.match(doc, "//b[number(@id) >= 1]").size - assert_equal 1, REXML::XPath.match(doc, "//b[number(@id) <= 1]").size - assert_equal 1, REXML::XPath.match(doc, "//b[number(@id) = (1 * 1)]").size - assert_equal 1, REXML::XPath.match(doc, "//b[number(@id) = (1 mod 2)]").size - assert_equal 1, REXML::XPath.match(doc, "//b[number(@id) = (4 div 2)]").size - end - - # Contributed by Kouhei - def test_substring_before - doc = Document.new("") - assert_equal("a", doc.root.elements.to_a("*[name()=substring-before('abc', 'b')]")[0].name) - assert_equal("c", doc.root.elements.to_a("*[name()=substring-after('abc', 'b')]")[0].name) - end - - def test_spaces - doc = Document.new(" - - - - - - - ") - match = lambda do |xpath| - REXML::XPath.match(doc, xpath).collect(&:to_s) - end - assert_equal([""], - match.call("//*[local-name()='c' and @id='b']")) - assert_equal([""], - match.call("//*[ local-name()='c' and @id='b' ]")) - assert_equal([""], - match.call("//*[ local-name() = 'c' and @id = 'b' ]")) - assert_equal(["", ""], - match.call('/a/c[@id]')) - assert_equal(["", ""], - match.call('/a/c[(@id)]')) - assert_equal(["", ""], - match.call('/a/c[ @id ]')) - assert_equal(["", ""], - match.call('/a/c[ (@id) ]')) - assert_equal(["", ""], - match.call('/a/c[( @id )]')) - assert_equal(["", ""], - match.call('/a/c[ ( @id ) ]')) - assert_equal(["", ""], - match.call('/a/c [ ( @id ) ] ')) - assert_equal(["", ""], - match.call(' / a / c [ ( @id ) ] ')) - assert_equal(["", ""], - match.call('/ a / child:: c [( @id )] /')) - end - - def test_text_nodes - # source = " - # - #test - #" - source = "test" - d = REXML::Document.new( source ) - r = REXML::XPath.match( d, %q{/root/child[text()="test"]} ) - assert_equal( 1, r.size ) - assert_equal( "child", r[0].name ) - assert_equal( "test", r[0].text ) - end - - def test_auto_string_value - source = "Introduction" - d = REXML::Document.new( source ) - #r = REXML::XPath.match( d, %q{/root[title="Introduction"]} ) - #assert_equal( 1, r.size ) - source = "test" - d = REXML::Document.new( source ) - r = REXML::XPath.match( d, %q{/a[c='test']} ) - assert_equal( 1, r.size ) - r = REXML::XPath.match( d, %q{a[c='test']} ) - assert_equal( 1, r.size ) - r = d.elements["/a[c='test']"] - assert_not_nil( r ) - r = d.elements["a[c='test']"] - assert_not_nil( r ) - r = d.elements["a[c='xtest']"] - assert_nil( r ) - r = REXML::XPath.match( d, %q{a[c='xtest']} ) - assert_equal( 0, r.size ) - end - - def test_ordering - source = <<-XML - - - - - - - - - - - XML - d = REXML::Document.new( source ) - r = REXML::XPath.match( d, %q{/a/*/*[1]} ) - assert_equal(["1", "3"], - r.collect {|element| element.attribute("id").value}) - end - - def test_descendant_or_self_ordering - source = " - - - - - - - - - - - - - - - " - d = REXML::Document.new( source ) - cs = XPath.match( d, "/descendant-or-self::c" ) - assert_equal( 4, cs.length ) - 1.upto(4) {|x| assert_equal( x.to_s, cs[x-1].attributes['id'] ) } - end - - def test_and - d = Document.new %q{} - assert_equal( nil, d.root.elements["route[@run='0']"] ) - assert_equal( nil, d.root.elements["route[@run='0' and @title='HNO']"] ) - end - - - def test_numbers - d = Document.new %q{} - - xp1 = "/a[ @x = 0 ]" - xp2 = "/a[ @x = '0' ]" - xp3 = "/a[ (@x + 1) = 1 ]" - xp4 = "/a[ @y = 0 ]" - xp5 = "/a[ (@z + 1) = 5 ]" - xp6 = "/a[ (@w + 1) = 5 ]" - xp7 = "/a[ (@v + 1) = 1 ]" - xp8 = "/a[ @n = 0 ]" - - assert_equal( 1, XPath.match( d, xp1 ).length ) - assert_equal( 1, XPath.match( d, xp2 ).length ) - assert_equal( 1, XPath.match( d, xp3 ).length ) - assert_equal( 0, XPath.match( d, xp4 ).length ) - assert_equal( 0, XPath.match( d, xp5 ).length ) - assert_equal( 0, XPath.match( d, xp6 ).length ) - assert_equal( 0, XPath.match( d, xp7 ).length ) - assert_equal( 0, XPath.match( d, xp8 ).length ) - end - - def test_tobis_preceding - doc_string = ' - - - - - -' - - doc = Document.new(doc_string) - - # e = REXML::XPath.first(doc,'/a/c/e') - e = doc.root.get_elements('/a/c/e')[0] - assert_equal( 1, e.get_elements('preceding-sibling::*').length ) - assert_equal( 2, XPath.match(e, 'preceding::*').length ) - end - - - def test_filtering - #doc=Document.new("") - #assert_equal( 3, XPath.match( doc, '/a/b/*[1]' ).length ) - #assert_equal( 2, XPath.match( doc, '/a/b/following-sibling::*[1]' ).length ) - end - - # Submitted by Alex - def test_union - data = %Q{

- - a - - b -
} - rd = REXML::Document.new( data ) - #union = rd.get_elements("/div/span | /div/em") - #assert_equal(2, union.length, "/div/span | /div/em" ) - union = rd.get_elements('//*[name()="em" or name()="strong"]') - assert_equal(2, union.length, 'name() and "or" failed') - union = rd.get_elements('//em|//strong') - assert_equal(2, union.length, - 'Both tag types are returned by XPath union operator') - end - - - def test_union2 - src = <<-EOL -
- -a - -b -
- EOL - rd = REXML::Document.new( src ) - union = rd.get_elements('//em|//strong') - assert_equal(2, union.length, - 'Both tag types are returned by XPath union operator') - end - - - def test_a_star_star_one - string = <<-EOL - - - - - - - - - - - - - - - EOL - d = REXML::Document.new( string ) - cs = XPath.match( d, '/a/*/*[1]' ) - assert_equal(["c1", "c2"], cs.collect(&:name)) - end - - def test_sum - d = Document.new(<<-XML) - - 1 - 2 - 3 - - 1 - 2 - - - - - XML - - assert_equal([6], XPath::match(d, "sum(/a/b)")) - assert_equal([9], XPath::match(d, "sum(//b | //d)")) - assert_equal([3], XPath::match(d, "sum(/a/e/@*)")) - end - - def test_xpath_namespace - d = REXML::Document.new(<<-XML) - - - xa - xb - - XML - actual = [] - d.root.each_element('tada') do |element| - actual << element.to_s - end - assert_equal(["xa", "xb"], - actual) - end - - def test_ticket_39 - doc = REXML::Document.new( <<-EOL ) - - - - true - - Item 1 - - - Item 2 - Thu, 13 Oct 2005 19:59:00 +0000 - - - Item 3 - - - - EOL - root_node = XPath.first(doc, "rss") - assert_not_nil root_node - channel_node = XPath.first(root_node, "channel") - assert_not_nil channel_node - items = XPath.match(channel_node, "*") - assert_equal 4, items.size - items = XPath.match(channel_node, "item") - assert_equal 3, items.size # fails - end - - - def test_ticket_42 - source = "" - doc = Document.new(source) - bElem = Element.new('b') - doc.root.add_element(bElem) - doc.elements.each('//b[name(..) = "a"]') { |x| - assert_equal x,bElem - } - end - - def test_ticket_56 - namespaces = {'h' => 'http://www.w3.org/1999/xhtml'} - - finaldoc = REXML::Document.new(File.read(fixture_path('google.2.xml'))) - - column_headers = [] - - REXML::XPath.each(finaldoc, '//h:form[@action="ModifyCampaign"]//h:th', - namespaces) do |el| - node = REXML::XPath.first(el, 'h:a/text()', namespaces) - column_headers << (node ? node.value : nil) - end - column_headers.map! { |h| h.to_s.strip.chomp } - expected = ["", "", "Current Status", "Current Budget", - "Clicks", "Impr.", "CTR", "Avg. CPC", "Cost", "Conv. Rate", - "Cost/Conv."] - assert_equal( expected, column_headers ) - end - - - def test_ticket_70 - string = < - - Text1, text, -text - - Text2, text, -text - - - - -EOF - doc = Document.new string - assert_equal( 1, XPath.match( doc, "//someelement[contains(@attribute,'1.10')]" ).length ) - end - - def test_ticket_43 - #url = http://news.search.yahoo.com/news/rss?p=market&ei=UTF-8&fl=0&x=wrt - - sum = File.open(fixture_path("yahoo.xml")) do |f| - Document.new(f).elements.to_a("//item").size - end - assert_equal( 10, sum ) - - text = File.open(fixture_path("yahoo.xml")) do |f| - Document.new(f).elements.to_a(%Q{//title[contains(text(), "'")]}).collect{|e| e.text}.join - end - assert_equal( "Broward labor market's a solid performer (Miami Herald)", text ) - end - - def test_ticket_57 - data = "zzz" - - r = Document.new(data) - - assert_equal(Text, REXML::XPath.first(r,"a:x/a:y[@p='p' and @q='q']/a:z/text()").class) - assert_equal("zzz", REXML::XPath.first(r,"a:x/a:y[@p='p' and @q='q']/a:z/text()").to_s) - end - - def test_ticket_59 - data = " - - - - - - - - - - - - - - - - - - - - - - - - - - - " - d = Document.new(data) - res = d.elements.to_a( "//c" ).collect {|e| e.attributes['id'].to_i} - assert_equal((1..12).to_a, res) - end - - def ticket_61_fixture(doc, xpath) - matches = [] - doc.elements.each(xpath) do |element| - matches << element - assert_equal('Add', element.text) - assert_equal('ButtonText', element.attributes['class']) - end - assert_equal(1, matches.length) - end - - def test_ticket_61_text - doc = File.open(fixture_path("ticket_61.xml")) do |file| - REXML::Document.new file - end - ticket_61_fixture( doc, "//div[text()='Add' and @class='ButtonText']" ) - end - - def test_ticket_61_contains - doc = File.open(fixture_path("ticket_61.xml")) do |file| - REXML::Document.new file - end - ticket_61_fixture( doc, "//div[contains(.,'Add') and @class='ButtonText']" ) - end - - def test_namespaces_0 - d = Document.new(%q{}) - assert_equal( 1, XPath.match( d, "//x:a" ).size ) - assert_equal( 1, XPath.match( d, "//x:*" ).size ) - end - - def test_ticket_71 - doc = Document.new(%Q{}) - el = doc.root.elements[1] - assert_equal( "element", el.name ) - el2 = XPath.first( doc.root, "element[@ns:attrname='foo']", { 'ns' => "xyz" } ) - assert_equal( el, el2 ) - end - - def test_ticket_78 - doc = <<-EOT - - - 123 - - - 123a - - - EOT - seq = %w{BEGIN 123 END BEGIN 123a END} - - xmlDoc = Document.new(doc) - - ["//element[tag='123']/tag", "//element[tag='123a']/tag"].each do |query| - assert_equal( "BEGIN", seq.shift ) - XPath.each(xmlDoc, query) { |element| - assert_equal( seq.shift, element.text ) - } - assert_equal( "END", seq.shift ) - end - end - - def test_ticket_79 - source = "test3" - d = REXML::Document.new( source ) - r = REXML::XPath.match( d, %q{/a/b[c='test']} ) - assert_equal(1, r.size()) - r = REXML::XPath.match( d, %q{/a/b[c='3']} ) - assert_equal(1, r.size()) - end - - def test_or_and - doc = " - - - test - - -

- A link. -

- - -" - - xmldoc = REXML::Document.new(doc) - xpath = "descendant::node()[(local-name()='link' or local-name()='a') and @rel='sub']" - hrefs = [] - xmldoc.elements.each(xpath) do |element| - hrefs << element.attributes["href"] - end - assert_equal(["/"], hrefs, "Bug #3842 [ruby-core:32447]") - end - end -end diff --git a/test/rexml/xpath/test_compare.rb b/test/rexml/xpath/test_compare.rb deleted file mode 100644 index bb666c9b12..0000000000 --- a/test/rexml/xpath/test_compare.rb +++ /dev/null @@ -1,256 +0,0 @@ -# frozen_string_literal: false - -require_relative "../rexml_test_utils" - -require "rexml/document" - -module REXMLTests - class TestXPathCompare < Test::Unit::TestCase - def match(xml, xpath) - document = REXML::Document.new(xml) - REXML::XPath.match(document, xpath) - end - - class TestEqual < self - class TestNodeSet < self - def test_boolean_true - xml = <<-XML - - - - - - XML - assert_equal([true], - match(xml, "/root/child=true()")) - end - - def test_boolean_false - xml = <<-XML - - - - XML - assert_equal([false], - match(xml, "/root/child=true()")) - end - - def test_number_true - xml = <<-XML - - - 100 - 200 - - XML - assert_equal([true], - match(xml, "/root/child=100")) - end - - def test_number_false - xml = <<-XML - - - 100 - 200 - - XML - assert_equal([false], - match(xml, "/root/child=300")) - end - - def test_string_true - xml = <<-XML - - - text - string - - XML - assert_equal([true], - match(xml, "/root/child='string'")) - end - - def test_string_false - xml = <<-XML - - - text - string - - XML - assert_equal([false], - match(xml, "/root/child='nonexistent'")) - end - end - - class TestBoolean < self - def test_number_true - xml = "" - assert_equal([true], - match(xml, "true()=1")) - end - - def test_number_false - xml = "" - assert_equal([false], - match(xml, "true()=0")) - end - - def test_string_true - xml = "" - assert_equal([true], - match(xml, "true()='string'")) - end - - def test_string_false - xml = "" - assert_equal([false], - match(xml, "true()=''")) - end - end - - class TestNumber < self - def test_string_true - xml = "" - assert_equal([true], - match(xml, "1='1'")) - end - - def test_string_false - xml = "" - assert_equal([false], - match(xml, "1='2'")) - end - end - end - - class TestGreaterThan < self - class TestNodeSet < self - def test_boolean_truex - xml = <<-XML - - - - - XML - assert_equal([true], - match(xml, "/root/child>false()")) - end - - def test_boolean_false - xml = <<-XML - - - - - XML - assert_equal([false], - match(xml, "/root/child>true()")) - end - - def test_number_true - xml = <<-XML - - - 100 - 200 - - XML - assert_equal([true], - match(xml, "/root/child>199")) - end - - def test_number_false - xml = <<-XML - - - 100 - 200 - - XML - assert_equal([false], - match(xml, "/root/child>200")) - end - - def test_string_true - xml = <<-XML - - - 100 - 200 - - XML - assert_equal([true], - match(xml, "/root/child>'199'")) - end - - def test_string_false - xml = <<-XML - - - 100 - 200 - - XML - assert_equal([false], - match(xml, "/root/child>'200'")) - end - end - - class TestBoolean < self - def test_string_true - xml = "" - assert_equal([true], - match(xml, "true()>'0'")) - end - - def test_string_false - xml = "" - assert_equal([false], - match(xml, "true()>'1'")) - end - end - - class TestNumber < self - def test_boolean_true - xml = "" - assert_equal([true], - match(xml, "true()>0")) - end - - def test_number_false - xml = "" - assert_equal([false], - match(xml, "true()>1")) - end - - def test_string_true - xml = "" - assert_equal([true], - match(xml, "1>'0'")) - end - - def test_string_false - xml = "" - assert_equal([false], - match(xml, "1>'1'")) - end - end - - class TestString < self - def test_string_true - xml = "" - assert_equal([true], - match(xml, "'1'>'0'")) - end - - def test_string_false - xml = "" - assert_equal([false], - match(xml, "'1'>'1'")) - end - end - end - end -end diff --git a/test/rexml/xpath/test_node.rb b/test/rexml/xpath/test_node.rb deleted file mode 100644 index e0e958e70f..0000000000 --- a/test/rexml/xpath/test_node.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# frozen_string_literal: false - -require_relative "../rexml_test_utils" - -require "rexml/document" - -module REXMLTests - class TestXPathNode < Test::Unit::TestCase - def matches(xml, xpath) - document = REXML::Document.new(xml) - REXML::XPath.each(document, xpath).collect(&:to_s) - end - - class TestQName < self - def test_ascii - xml = <<-XML - - - - child - - - XML - assert_equal(["child"], - matches(xml, "/root/ascii/child")) - end - - def test_non_ascii - xml = <<-XML - - - - child - - - XML - assert_equal(["child"], - matches(xml, "/root/non-àscii/child")) - end - end - end -end diff --git a/test/rexml/xpath/test_predicate.rb b/test/rexml/xpath/test_predicate.rb deleted file mode 100644 index ce1aaa324b..0000000000 --- a/test/rexml/xpath/test_predicate.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: false -require "test/unit/testcase" -require "rexml/document" -require "rexml/xpath" -require "rexml/parsers/xpathparser" - -module REXMLTests - class TestXPathPredicate < Test::Unit::TestCase - include REXML - SRC=<<-EOL -
-
- free flowing text. -
-
-
- free flowing text. -
-
- free flowing text. -
-
-
- EOL - - def setup - @doc = REXML::Document.new( SRC ) - @parser = REXML::Parsers::XPathParser.new - - end - - def test_predicates_parent - path = '//section[../self::section[@role="division"]]' - m = do_path( path ) - assert_equal( 2, m.size ) - assert_equal( "2", m[0].attributes["id"] ) - assert_nil( m[1].attributes["id"] ) - end - - def test_predicates_single - path = '//section[@role="subdivision" and not(../self::section[@role="division"])]' - m = do_path( path ) - assert_equal( 1, m.size ) - assert_equal( "1", m[0].attributes["id"] ) - end - - def test_predicates_multi - path = '//section[@role="subdivision"][not(../self::section[@role="division"])]' - m = do_path( path ) - assert_equal( 1, m.size ) - assert_equal( "1", m[0].attributes["id"] ) - end - - def do_path( path ) - m = REXML::XPath.match( @doc, path ) - #puts path, @parser.parse( path ).inspect - return m - end - - def test_get_no_siblings_terminal_nodes - source = <<-XML - - TEXT1 - - - - TEXT2 - - - -XML - doc = REXML::Document.new(source) - predicate = "count(child::node()|" + - "following-sibling::node()|" + - "preceding-sibling::node())=0" - m = REXML::XPath.match(doc, "/descendant-or-self::node()[#{predicate}]") - assert_equal( [REXML::Text.new("TEXT1"), - REXML::Text.new("TEXT2"), - REXML::Comment.new("COMMENT")], - m ) - end - end -end diff --git a/test/rexml/xpath/test_text.rb b/test/rexml/xpath/test_text.rb deleted file mode 100644 index 7222388e1b..0000000000 --- a/test/rexml/xpath/test_text.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' -require 'rexml/document' -require 'rexml/element' -require 'rexml/xpath' - -module REXMLTests - class TestXPathText < Test::Unit::TestCase - def setup - @doc = REXML::Document.new - end - - def tear_down - end - - def test_text_as_element - node1 = REXML::Element.new('a', @doc) - node2 = REXML::Element.new('b', node1) - REXML::Text.new('test', false, node2) - assert_equal(1, @doc.elements.size, "doc owns 1 element node1") - assert_same(node1, @doc.elements[1], "doc owns 1 element node1") - assert_equal(1, node1.elements.size, "node1 owns 1 element node2") - assert_same(node2, node1.elements[1], "node1 owns 1 element node2") - assert_equal(1, node2.size, "node2 owns 1 text element") - end - - def test_text_in_xpath_query - node1 = REXML::Element.new('a', @doc) - node2 = REXML::Element.new('b', node1) - textnode = REXML::Text.new('test', false, node2) - textnode.parent = node2 # should be unnecessary - nodes = @doc.get_elements('//b') - assert_equal(1, nodes.size, "document has one element") - # why doesn't this query work right? - nodes = REXML::XPath.match(@doc, '//text()') - assert_equal(1, nodes.size, "//text() should yield one Text element") - assert_equal(REXML::Text, nodes[0].class) - end - - def test_comment_in_xpath_query - node1 = REXML::Element.new('a', @doc) - node2 = REXML::Element.new('b', node1) - commentnode = REXML::Comment.new('test', node2) - nodes = REXML::XPath.match(@doc, '//comment()') - assert_equal(1, nodes.size, "//comment() should yield one Comment element") - assert_same commentnode, nodes[0] - end - - def test_parentage - node1 = REXML::Element.new('a', @doc) - assert_same(@doc, node1.parent, "node1 parent is document") - node2 = REXML::Element.new('b', node1) - assert_same(node1, node2.parent, "node2 parent is node1") - textnode = REXML::Text.new('test', false, node2) - # why isn't the text's parent node2? - # Also look at Comment, etc. - assert_same(node2, textnode.parent) - comment = REXML::Comment.new('Test comment', node2) - assert_same(node2, comment.parent) - end - - def test_ancestors - node1 = REXML::Element.new('a', @doc) - node2 = REXML::Element.new('b', node1) - textnode = REXML::Text.new('test', false, node2) - #textnode.parent = node2 # should be unnecessary - assert_same node2, textnode.parent - nodes = @doc.get_elements('//b/ancestor::*') - assert_equal(1, nodes.size, " has one element ancestor") - nodes = @doc.get_elements('//b/ancestor::node()') - assert_equal(2, nodes.size, " has two node ancestors") - nodes.sort_by!(&:name) - assert_kind_of REXML::Document, nodes[0] - assert_kind_of REXML::Element, nodes[1] - end - end -end diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index c206017ae2..a472567194 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -25,7 +25,6 @@ # * https://github.com/ruby/prime # * https://github.com/ruby/matrix # * https://github.com/ruby/ostruct -# * https://github.com/ruby/rexml # * https://github.com/ruby/rss # * https://github.com/ruby/irb # * https://github.com/ruby/tracer @@ -80,7 +79,6 @@ $repositories = { prime: 'ruby/prime', matrix: 'ruby/matrix', ostruct: 'ruby/ostruct', - rexml: 'ruby/rexml', rss: 'ruby/rss', irb: 'ruby/irb', tracer: 'ruby/tracer', -- cgit v1.2.3