SOAP::...Element(3pm)

๐Ÿ’– SOAP::WSDL::XSD::Typelib::Element ๐Ÿ’–

okay bestie, welcome to SOAP::...Element(3pm) โ€” yes that's the manual name, she's a long one and she's ICONIC. This is the element base class (the original literally says "clase" and honestly? a queen can spell however she wants ๐Ÿ’…).

This is the little base class you inherit from when you wanna make a Perl class that represents an XML Schema <element>. She doesn't do a ton on her own, but she holds the vibes and the properties, and everything else in the typelib family builds on her. Lowkey foundational. Main character energy, fr fr. ๐ŸŽ€


โœจ NAME โœจ

SOAP::WSDL::XSD::Typelib::Element โ€” element base class ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

So the tea is: this example creates a class for this XML schema definition:

<element name="MyElement" type="xsd:string" nillable="1"
  minOccurs="1" maxOccurs="1"/>

and here's the whole class, look at her go:

package MyElement;
use strict;
use Class::Std::Fast::Storable constructor => 'none';
use base (
   'SOAP::WSDL::XSD::Typelib::Element',
   'SOAP::WSDL::XSD::Typelib::Builtin::string',
);

__PACKAGE__->__set_name('MyElementName');
__PACKAGE__->__set_nillable(1);
__PACKAGE__->__set_minOccurs(1);
__PACKAGE__->__set_maxOccurs(1);
__PACKAGE__->__set_ref(0);

slay. ๐Ÿซถ

Now we create this XML schema definition type class:

<element name="MyElement2" ref="tns:MyElement"/>

and the class itself:

package MyElement2;
use strict;
use Class::Std::Fast::Storable constructor => 'none';
use base (
   'SOAP::WSDL::XSD::Typelib::Element',
   'MyElement'
);

__PACKAGE__->__set_name('MyElementName');
__PACKAGE__->__set_nillable(0);
__PACKAGE__->__set_ref(1);

bestie. that's it. that's the whole glow-up. ๐Ÿ’–


๐Ÿ’… NOTES ๐Ÿ’…

  • type="Foo"
    • Implemented via inheritance. Not me doing a whole class hierarchy and making it look effortless โœจ
  • ref="Foo"
    • Implemented via inheritance, too. Calling
__PACKAGE__->__set_ref(1)

is highly encouraged, though it has no effect yet โ€” it will probably be needed for serialization to XML Schema definitions some day. So like, set it now, thank your past self later. no cap. ๐Ÿ”ฎ


๐Ÿ’€ BUGS AND LIMITATIONS ๐Ÿ’€

ok so here's where we get real. listen up. ๐Ÿซถ

You should definitely provide your XML envelope generator with the same prefix namespace combination (Default for SOAP::WSDL::Envelope). fr fr, otherwise it's giving chaos. ๐Ÿ˜ญ


Copyright 2004-2007 Martin Kutter.

This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself.

periodt. ๐ŸŽ€


๐Ÿฆ‹ AUTHOR ๐Ÿฆ‹

Martin Kutter <martin.kutter fen-net.de>


๐ŸŒˆ REPOSITORY INFORMATION ๐ŸŒˆ

 $Rev: 851 $
 $LastChangedBy: kutterma $
 $Id: Element.pm 851 2009-05-15 22:45:18Z kutterma $
 $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/Element.pm $

k that's the whole page bestie!! ๐Ÿ’œ this was perl v5.36.0, dated 2022-10-14, and you've been reading SOAP::...Element(3pm). go forth and inherit responsibly. mwah. ๐ŸŒธโœจ

๐Ÿ“ฆ where this page comes from