Creates a new Resolv::Hosts
, using filename
for its data source.
Creates a new DNS
resolver.
config_info
can be:
Uses /etc/resolv.conf.
String
Path to a file using /etc/resolv.conf’s format.
Hash
Must contain :nameserver, :search and :ndots keys.
:nameserver_port can be used to specify port number of nameserver address.
The value of :nameserver should be an address string or an array of address strings.
:nameserver => ‘8.8.8.8’
:nameserver => [‘8.8.8.8’, ‘8.8.4.4’]
The value of :nameserver_port should be an array of pair of nameserver address and port number.
:nameserver_port => [[‘8.8.8.8’, 53], [‘8.8.4.4’, 53]]
Example:
Resolv::DNS.new(:nameserver => ['210.251.121.21'], :search => ['ruby-lang.org'], :ndots => 1)
Creates a new one-shot Multicast DNS
(mDNS) resolver.
config_info
can be:
Uses the default mDNS addresses
Hash
Must contain :nameserver or :nameserver_port like Resolv::DNS#initialize.
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?
Constructor. FIXME: The parser doesn’t catch illegal characters in attributes
Either: an Attribute
, which this new attribute will become a clone of; or a String
, which is the name of this attribute
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).
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 )
Constructor. CData is data between <![CDATA[ ... ]]>
Examples
CData.new( source ) CData.new( "Here is some CDATA" ) CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
Constructor. Any inheritors of this class should call super to make sure this method is called.
if supplied, the parent of this child will be set to the supplied value, and self will be added to the parent
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
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.