Module provides the build methods in an independent namespace.
Methods
- attlist!
- cdata
- comment
- doctype!
- document
- element
- element!
- entity!
- instruct
- instruction
- new
- notation!
- pi
- raw
- text
- xml
Public Instance methods
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 238 def attlist!( *args ) REXML::AttlistDecl.new( *args ) end
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 224 def cdata( str, *args ) REXML::CData.new( str, *args ) end
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 220 def comment( str, *args ) REXML::Comment.new( str, *args ) end
DTD declarations
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 230 def doctype!( *args ) REXML::DocType.new( *args ) end
New REXML document.
This method is also aliased as
new
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 175 def document( options={} ) #@options = options doc = REXML::Document.new # xml declaration if options[:version] doc << xml( options[:version], options[:encoding], options[:standalone] ) end doc end
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 198 def element( tag, *args ) keys = (Hash === args.last ? args.pop : {}) skeys = {} keys.each { |k,v| skeys[k.to_s] = v.to_s } e = REXML::Element.new( tag ) e.add_attributes( skeys ) e.add_text(args.join(' ')) unless args.empty? e end
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 234 def element!( *args ) REXML::ElementDecl.new( *args ) end
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 242 def entity!( *args ) REXML::EntityDecl.new( *args ) end
This method is also aliased as
instruction
pi
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 208 def instruct( name, *args ) keys = (Hash === args.last ? args.pop : {}) content = ( args + keys.collect{ |k,v| %{#{k}="#{v}"} } ).join(' ') REXML::Instruction.new( name, content.strip ) end
Alias for instruct
Alias for document
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 246 def notation!( *args ) REXML::NotationDecl.new( *args ) end
Alias for instruct
Add raw XML markup
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 169 def raw( str ) REXML::Document.new( "<root>#{str}</root>" ).root.to_a end
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 216 def text( str, *args ) REXML::Text.new( str, *args ) end
XML declaration instruction.
[ show source ]
# File lib/facets/more/rexmlbuilder.rb, line 194 def xml( version=nil, *args ) REXML::XMLDecl.new( version=nil, *args ) end