Constructor
dt = DocType.new( 'foo', '-//I/Hate/External/IDs' ) # <!DOCTYPE foo '-//I/Hate/External/IDs'> dt = DocType.new( doctype_to_clone ) # Incomplete. Shallow clone of doctype
Note
that the constructor:
Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
is deprecated. Do not use it. It will probably disappear.
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
.
Constructor
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.
if supplied, must be a Parent
, and will be used as the parent of this object.
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.
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', '&' )
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.
Constructor @param parent if supplied, will be set as the parent of this object
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
block_size has been deprecated
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
Creates a new DRbObjectTemplate
that will match against uri
and ref
.
Creates a new TupleSpaceProxy
to wrap ts
.
Creates a new SimpleRenewer
that keeps an object alive for another sec
seconds.