class XML::DOM::Parser

Defined in:

dom/parser.cr

Constructors

Instance Method Summary

Instance methods inherited from class XML::SAX::Handlers

attlist_decl(element_name : String, name : String, type : Symbol, names : Array(String) | Nil, default : Symbol, value : String | Nil) : Nil attlist_decl, cdata_section(data : String) : Nil cdata_section, character_data(data : String) : Nil character_data, comment(data : String) : Nil comment, element_decl(name : String, content : ElementDecl) : Nil element_decl, empty_element(name : String, attributes : Array(Tuple(String, String))) : Nil empty_element, end_doctype_decl : Nil end_doctype_decl, end_element(name : String) : Nil end_element, entity_decl(entity : Entity) : Nil entity_decl, entity_reference(name : String) entity_reference, error(message : String, location : Location) error, notation_decl(name : String, public_id : String | Nil, system_id : String | Nil) : Nil notation_decl, open_external(base : String | Nil, uri : String, & : String, IO -> ) : Nil
open_external(base : String | Nil, uri : String) : Tuple(String, IO) | Nil
open_external
, processing_instruction(target : String, data : String) : Nil processing_instruction, start_doctype_decl(name : String, system_id : String | Nil, public_id : String | Nil, intsubset : Bool) start_doctype_decl, start_element(name : String, attributes : Array(Tuple(String, String))) : Nil start_element, text_decl(version : String, encoding : String | Nil) : Nil text_decl, xml_decl(version : String, encoding : String | Nil, standalone : Bool | Nil) : Nil xml_decl

Constructor Detail

def self.new(io : IO) #

[View source]

Instance Method Detail

def base : String | Nil #

[View source]
def base=(value : String | Nil) #

[View source]
def cdata_section(data : String) : Nil #
Description copied from class XML::SAX::Handlers

Called for CDATA sections.

  • data is all the text inside the data section.

[View source]
def character_data(data : String) : Nil #
Description copied from class XML::SAX::Handlers

Called for text.

It might be called multiple times for a single contiguous text in a XML document (for example because we processed an entity). You might have to concatenate data when searching for some pattern in text, or to build a single text node in a DOM tree.


[View source]
def comment(data : String) : Nil #
Description copied from class XML::SAX::Handlers

Called for comments.

  • data is all the text inside the comment.

[View source]
def document : XMLDocument #

[View source]
def empty_element(name : String, attributes : Array(Tuple(String, String))) : Nil #
Description copied from class XML::SAX::Handlers

Called for an empty element tag.

See #start_element for details.

Unless overridden, calls #start_element then #end_element by default.


[View source]
def end_doctype_decl : Nil #
Description copied from class XML::SAX::Handlers

Called at the and of a DOCTYPE declaration.


[View source]
def end_element(name : String) : Nil #
Description copied from class XML::SAX::Handlers

Called at the end of an element tag.


[View source]
def entity_decl(entity : SAX::Entity) : Nil #

[View source]
def entity_reference(name : String) : Nil #
Description copied from class XML::SAX::Handlers

Called when trying to expand an undeclared or invalid entity within character data.


[View source]
def notation_decl(name : String, public_id : String | Nil, system_id : String | Nil) : Nil #
Description copied from class XML::SAX::Handlers

Called for notation declarations in a DTD.

  • name is the declared notation name.
  • system_id and public_id will be nil when unspecified.

[View source]
def parse : Nil #

[View source]
def processing_instruction(target : String, data : String) : Nil #
Description copied from class XML::SAX::Handlers

Called for processing instructions.

  • target is the first word in the processing instruction.
  • data is the rest of the instruction.

[View source]
def start_doctype_decl(name : String, system_id : String | Nil, public_id : String | Nil, intsubset : Bool) #
Description copied from class XML::SAX::Handlers

Called at the start of a DOCTYPE declaration.

  • name is the root element name.
  • system_id and public_id will be nil when unspecified.
  • intsubset is true when the doctype has an internal subset declaration.

[View source]
def start_element(name : String, attributes : Array(Tuple(String, String))) : Nil #
Description copied from class XML::SAX::Handlers

Called at the start of an element tag.

  • name is the tag name.
  • attributes is an array of attribute name/value tuples.

The attributes array presents the attributes in the order they have been parsed. If an attribute is present twice with the same name, there will be two entries in the array.


[View source]
def xml_decl(version : String, encoding : String | Nil, standalone : Bool | Nil) : Nil #
Description copied from class XML::SAX::Handlers

Called for XML declarations.

  • version defaults to "1.0".
  • encoding may be nil, in which case the parser assumes UTF-8 or the detected encoding.
  • standalone will be nil when unspecified.

[View source]