Aaron James Trevena > SOAP-Data-Builder > SOAP::Data::Builder::Element

Download:
SOAP-Data-Builder-1.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

  SOAP::Data::Builder::Element - A simple wrapper SOAP::Data Elements

DESCRIPTION ^

  This Module provides a quick and easy way to build complex SOAP data
  and header structures for use with SOAP::Lite, managed by SOAP::Data::Builder.

METHODS ^

new(autotype=>0)

Constructor method for this class, it instantiates and returns the element object, taking value and attributes as named parameters

my $element = SOAP::Data::Builder::Element->new( name=> 'anExample', VALUE=> 'foo', attributes => { 'ns1:foo' => 'bar'});

optional parameters are : value, attributes, header, isMethod

parent should be an element fetched using get_elem

value should be a string, to add child nodes use add_elem(parent=>get_elem('name/of/parent'), .. )

attributes should be a hashref : { 'ns:foo'=> bar, .. }

header should be 1 or 0 specifying whether the element should be built using SOAP::Data or SOAP::Header

value()

the value() method sets/gets the VALUE of the element

name()

the name() method gets/sets the name of the element

fullname()

the fullname() method returns the full '/' delimited name of the element

'eb:foo/eb:name' would return the inner element on <eb:foo><eb:name ..> .. </eb:name></eb:foo>

attributes()

returns a hashref of the elements attributes

remove_attribute($name)

removes a named attribute - returns 1 if it existed , 0 if not

set_attribute($name,$value)

sets a named attribute

get_attribute($name)

gets a named attribute

add_elem($elem)

This method adds an element as a child to another element.

Accepts either a SOAP::Data::Builder::Element object or a hash of arguments to create the object

Returns the added element

my $child = $parent->add_elem(name=>'foo',..);

or

$parent->add_elem($child);

get_children()

returns a list of the child nodes of an element

remove_elem($name)

removes the named node from the element, returns 1 if existed, 0 if not

get_as_data()

    returns the element and its sub-nodes in SOAP::Data objects.
syntax highlighting: