Getting data from an XML element

The main work of an XML element happens in the type instance associated with each XML element. The type instance of an XML element is responsible for nearly all of the element behavior but does not contain the element’s name. You can usually ignore the division of labor between an XmlElement and its backing type instance. If you are using an XSD, this distinction is useful.

If you instantiate a type instance, typically you use a more specific subclass of gw.xsd.w3c.xmlschema.types.complex.AnyType.

Gosu exposes properties and methods on the XML type instances for you to get child elements or simple values.

Note that XML elements contain two basic types of content:

  • Child elements
  • Simple values

An element can contain either child elements or a simple value, but not both at the same time.

See also