-
Notifications
You must be signed in to change notification settings - Fork 263
What is the DOM For
The DOM offers a comprehensive way to handle application data, containing interdependent parts to handle data definition, adaptation, editing, event monitoring, and persistence.
Application data is the data created and saved by your application in some sort of document, which you can open later with the application to edit and add more data.
You can use ATF without its DOM. However, the DOM encompasses so many compelling features for handling application data that you will probably want to use it for all your ATF applications. We think you'll find the DOM really is lovable once you get to know it.
The DOM consists of several parts and is flexible. Just because you use one part doesn't mean you have to use other parts. There are advantages to using the entire package though, which are revealed as you explore DOM features.
When you examine your application's data, you see that it falls into various types and collections of those types. Data types can have attributes associated with them. There is usually some sort of hierarchy to the data, some data elements containing other elements. All together, this is your data model. With ATF's DOM, you can define your data model either programmatically in C# or in an XML Schema file.
The hierarchy of data types lends itself to representing application data as a tree of nodes. ATF defines a {''}DomNode{''
} class to represent these nodes. Each DomNode
is considered to be one of the types you defined. Each piece of data in your application can be associated with a DomNode
. Once this connection is made, your application can handle its data by manipulating DomNode
s. All the application data is in a tree of DomNode
s, and the tree reflects how data is contained in other data.
When accessing your data in the DOM, it may be more convenient to use a "business class" as the view of your data, rather than using the DomNode
directly. We call this adaptation. Doing so decouples the data representation from its usage throughout the rest of your application and provides type safety and improved code readability and convenience. The ATF DOM allows you to adapt each DomNode
to other types of C# objects. A particularly useful DOM adapter is ATF's {''}DomNodeAdapter{''
}. Classes deriving from DomNodeAdapter
have convenient methods and properties for accessing the underlying DomNode. You design the DOM adapter class with an API that's convenient for doing whatever you want with that kind of application data. For example, you can easily define C# properties in the DOM adapter class that correspond to the underlying data type's attributes. Setting the property results in changing the data's attributes. For more information on how adaptation works in general, see Adaptation in ATF.
You can also define events on the DOM adapter that correspond to changes in the data. When an event occurs, the application can take the appropriate actions for the data change. For instance, you can validate data as it's entered.
With the DOM it's easy to display DOM data in a property editor control so you can edit properties, that is, attributes of your data objects. For each attribute you want to edit, define a property descriptor, which is an object containing attribute information. For more information, see DOM Property Descriptors.
It's essential to save application data to continue creating and editing it later. ATF provides a DomXmlWriter
class to save the entire DomNode
tree to XML, using the information in the type definition file. You can read the XML file back to a DomNode
tree using the DomXmlReader
class so the user can resume editing.
- What is the DOM For: Overview of the DOM's features and advantages.
- It All Starts With Data: Defining application data models with types, especially using XML Schema.
-
DomNodes and DOM Metadata Classes: The fundamental
DomNode
class and its type metadata classes, such asDomNodeType
. Application data resides in a tree ofDomNode
s. - Type Loaders: Loading the type definition file into the application to use the file's data types and create type metadata class objects.
-
DOM Adapters: DOM adapters allow adapting
DomNode
s to other types and monitor events in theDomNode
tree to validate data. - DOM Property Descriptors: DOM property descriptors make it easy to use property editors on application data and are stored in type metadata.
- Using DOM Metadata for Palettes and Other Items: Type metadata can hold all sorts of data, such as palette object information.
-
DOM Persistence: Persisting application data using classes to write the
DomNode
tree to XML and read it back to aDomNode
tree. - DOM Debugging: ATF tools to facilitate debugging DOM code.
- DOM Use in Simple DOM Editor: Explains how the ATF Simple DOM Editor Sample uses the DOM.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC