Main /

Fusion

Home Page

Fusion

Fusion

Fusion is an XML Binding Framework. It allows you to bind classes to XML data types, and class properties to sub-elements and attributes of that type. When run, XML is mapped to instances of these classes according to the binding definition then made available for you to use in your application code.

1. Overview

Background - TODO

What is Fusion? - TODO

Why Fusion? - TODO

Keep in mind that Fusion was not designed to be a swiss army knife for XML, nor was it intended to provide a quick'n'dirty means of reading and editing XML files. If this is what you need, Fusion will probably work for you, but there may be other libraries that do this easier. Rather, Fusion works best in your application when you think of your XML files as strongly typed data sources, as you would with a database. Despite the complexities involved with this type of abstraction, it was designed to do these things for you easily, and with as little fuss as possible.

2. Architecture

2.1. Overview

2.2. Unmarshalling

Unmarshalling is the process of reading an XML file and parsing it so it can be read in an object-oriented fashion.

  • Type Conversion
  • Data Adaptation

2.3. Marshalling

3. The Config File

4. The Fusion Generator

4.1. A schema-oriented approach

4.2. A binding-oriented approach

5. Binding Resources to Classes

The binding schema, fusion-binding.xsd, defines the structure of a binding document for Fusion. A binding document represents the association between a data object and a data resource. The term data resource is used in this sense to mean

While Fusion's primary data resource is XML, the binding schema was designed to be extensible such that other data resources may be added and therefore not limited soley to XML. Gravity?, for example, provides relational database bindings by extending the Fusion binding schema.

For this reason, all XML-specific bindings are kept in the schema fusion-binding-xml.xsd.

The binding schema has been developed to be extensible.

5.1. Concepts

Let's define a few terms that are key to understanding the binding schema.

  • Data Resources - the source of the data, as in XML, relational database, and so on. Fusion deals primarily with XML.
  • Data Structure - the structure of the data within the resource
  • Data Elements - individual fields within the data structure
  • Data Adapters

5.2. Classes and Properties

Binding definitions are given at a class level. The

An instance of the binding schema is structured roughly as follows:

<?xml version="1.0" ?>
<fusion-binding xmlns="http://www.phorce.org/schema/fusion/binding">
  <class name="myns\MyClass">
    <!-- data structure info goes here -->
    <property name="value" type="string">
      <!-- data element (and adapter) info goes here -->
    </property>
    <property name="dates" type="object" class="\DateTime" many="true">
      <!-- data element (and adapter) info goes here -->
    </property>
    <property name="myObj" type="object" class="myns\MyOtherClass">
      <!-- data element (and adapter) info goes here -->
    </property>
  </class>
</fusion-binding>

5.3. Elements in the XML Data Resource

5.4. Data Structures

5.5. Data Elements

5.6. Data Adapters

6. Data Adapters

6.1. Predefined Adapters

6.2. Using Data Adapters

6.3. Building Data Adapters

6.3.1. The Easy Way

6.3.2. The Hard Way

7. Extending Fusion

Recent Changes (All) | Edit SideBar Page last modified on April 27, 2010, at 06:14 AM Edit Page | Page History
Powered by PmWiki