[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: New draft snapshot
Hi all, I've made almost all the changes that were requested during Wednesday's conference call. Here is the list of changes: - modified Metafile interface to use metafileVersion instead of cgmVersion (same goes for other attributes). - added getAppStructuresByName on the Picture interface, returns a nodelist. - added highlight on the Picture interface, takes a nodelist as parameter. - changed the RGB and intensity syntax in tables. - added 'background-color' (Picture level). - added 'intensity' (APS level). We'll need rules for this. Feel free to send suggestions. - combined edge-color, line-color and marker-color into stroke-color (same for edge-weight, line-weight). - added 'text-font' at the picture and aps level. - modified list of DOMException, i think it's closer to what we need (more specific). - added, NodeList, Attr, Text interfaces. - I'm wondering if a Hypertext interface is not needed? Don't know what getLinkuris() should return? - I'm wondering if the DOM Level 3 DOMStringList interface wouldn't make sense for getNames()? Still to do: - Lots of sections need some (or improved) wording. - Need to add Event interfaces. - XML companion file architecture picture. Please send comments. I'll try to send another version mid next week! Regards, -- Benoit mailto:benoit@itedo.comTitle: WebCGM DOM
WebCGM Document Object Model (DOM) SpecificationVersion 1.0Working Draft June 10, 2004This version:Latest version:Previous version:Editors:Authors:AbstractStatus of this documentTable of contentsExpanded Table of Contents Copyright Notice 1. WebCGM Document Object Model Appendix A: Changes Appendix B: IDL Definitions Appendix C: ECMAScript Language Binding Appendix D: Acknowledgements Glossary References Index 1. WebCGM Document Object Model1.1 Overview of the WebCGM DOM InterfacesThis section defines a set of objects and interfaces for accessing and manipulating WebCGM documents. The functionality specified in this section is to allow script writers to manipulate WebCGM documents and to access information found in WebCGM XML companion files. The WebCGM DOM API does not allow for the creation of Pictures but instead provides methods to update a WebCGM Picture based on external metadata (XML companion file). 1.1.b Comparison with XML DOM Level 3Many attributes which are read/write in the XML DOM are readonly in the WebCGM DOM. More to come. 1.1.1 Relationship with XML companion fileThe WebCGM DOM is designed to provide access to XML metadata found in XML companion files. Practice has shown that some CGM illustrations are easier to maintain if some of the non graphical information remains outside the illustration. An example of such information could be for example; language sensitive tooltips. A scaled down DOM is then required to 'attach' the information from the XML companion file into the WebCGM document. For more information on XML companion files, please refer to the WebCGM XML companion file section. Another benefit of the XML companion file is to carry application specific data (or metadata) concerning a WebCGM illustration. This information is expressed using namespace attributes and elements in the XML companion file. The WebCGM DOM provides method to load the XML metadata into the user agent's (viewer's) object model. Using the DOM, a user can gain access to the metadata. Here is an example to better illustrate the concept, let us assume we are working with the following WebCGM document (expressed in clearText encoding):
The in memory tree representation of this illustration should be similar to the illustration found below. It is a simple tree structure with a root element Metafile, one of the children of the root is a Picture; the Picture contains a Layer and the layer contains an Application Structure of type grobject. Now let us assume example.cgm has the following XML companion file for...
As mentioned above, the WebCGM provides methods to 'apply' an XML companion file to a WebCGM document. A comforming user agent is expected to load and parse the XML companion file and possibly 'apply' the XML companion file to the user agent's object model. The purpose of applying a companion file is to: i) Replace standard Application Structure Attributes that are present in the WebCGM instance with new values (if found in XML companion file). ii) Supply standard Application Structure Attributes to Application Structures in the WebCGM instance that contain no values. iii) Add XML metadata to the user agent's object model to be retrieved using DOM APIs at a later stage (e.g., the <wiring:data> element is added as a child node of grobject G1; for example; the data could be of use to an interactive -scripted- wiring application). Once the user agent has loaded the XML companion file into its memory model, the tree should resemble this: 1.1.2 Data types and interfacesDOMString String Comparision 1.1.3 Coordinate valuesNeed wording to say: Origin at lower left corner, width and height represent the VDC extent, coordinate axes x to the right, y up. Coordinate values are the resulting values after having read the WebCGM. 1.1.4 Namespaces1.2 Fundamental InterfacesSummary will go here. Exception DOMExceptionWebCGM operations only raise exceptions when an operation is impossible to perform. IDL Definition
Definition group ExceptionCode An integer indicating the type of error generated Defined Constants INDEX_SIZE_ERR; if index or size is negative, or greater than the allowed value. DOMSTRING_SIZE_ERR; if the specified range of text does not fit into a DOMString. INVALID_CHARACTER_ERR; if an invalid or illegal character is specified, such as in an XML name. NO_DATA_ALLOWED_ERR; if data is specified for a node which does not support data. NO_MODIFICATION_ALLOWED_ERR; if an attempt is made to modify an object where modifications are not allowed. NOT_SUPPORTED_ERR; if the implementation does not support the requested type of object or operation. INVALID_ACCESS_ERR; if a parameter or an operation is not supported by the underlying object. VALIDATION_ERR; if a call to a method such as insertBefore or removeChild would make the Node invalid with respect to "partial validity", this exception would be raised and the operation would not be done. This code is used in [DOM Level 3 Validation]. Refer to this specification for further information. FILE_NOT_FOUND_ERR; if the reference document could not be accessed FILE_INCOMPATIBILITY_ERR; if the reference document was not well-formed or in error. Interface GetWebCGMDocumentSince WebCGM documents are often embedded within a host document such as XHTML, WebCGM user agents are required to implement the GetWebCGMDocument interface for the element which references the WebCGM document (e.g., the 'object' tag). IDL Definition
Methods getWebCGMDocument Returns the Metafile object for the referenced WebCGM document. No parameters Return value Metafile; The Metafile object for the referenced WebCGM document. Exceptions DOMException; NOT_SUPPORTED_ERR: No Metafile object is available. Interface MetafileThe Metafile interface is the entry point to the entire WebCGM document. The interface expose information regarding the metafile and provides access to the first Picture of the WebCGM document. IDL Definition
Attributes metafileDescription of type DOMString, readonly Returns the Metafile Descriptor of the WebCGM document (e.g., "ProfileId:WebCGM,ProfileEd:1.0,Source:A software vendor,Date:20040602,ColourClass:monochrome" ). The cgmDescription must contain the ProfileId: and the ProfileEd:, other information such as Source, ColourClass etc... is considered optional. firstPicture of type Picture, readonly Returns the first Picture element of the WebCGM document. Subsequent Pictures can be accessed using the Picture interface. A WebCGM document contains at least one Picture. metafileID of type DOMString, readonly Returns the Metafile Identifier (also known as the cgm ID). metafileVersion of type integer, readonly Returns the Metafile Version of the WebCGM document. Interface NodeThe Node interface is the base datatype of the WebCGM Document Object Model. The Node object is the basis of several other interfaces; XMLElements and WebCGM specific elements (i.e., AppStructure & Picture). The Node interface specifies the attributes and methods to perform simple and generic tree traversal routines. IDL Definition
Definition group NodeType An integer indicating which type of node this is. Defined Constants: PICTURE_NODE; the node is a Picture. APP_STRUCTURE_NODE; the node is an AppStructure. XML_ELEMENT_NODE; the node is XML companion information attached to a CGM element. TEXT_NODE; the node is a Text. ATTR_NODE; the node is an Attr. The values of nodeName and nodeValue vary according to the node type as follows:
Attributes nodeName of type DOMString, readonly The name of this node, depending on its type; see the table above. nodeValue of type DOMString, readonly The value of this node, depending on its type; see the table above. Exceptions on retrieval DOMException; DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform. nodeType of type unsigned short, readonly A code representing the type of the underlying object, see the table above. parentNode of type Node, readonly The parent (immediate ancestor node of a node) of this node. All nodes, except Picture may have a parent. childNodes of type NodeList, readonly A NodeList that contains all children of this node. If there are no children, this returns an empty NodeList. firstChild of type Node, readonly The first child of this node. If there is no such node, this returns null. lastChild of type Node, readonly The last child of this node. If there is no such node, this returns null. previousSibling of type Node, readonly The node immediately preceding this node. If there is no such node, this returns null. nextSibling of type Node, readonly The node immediately following this node. If there is no such node, this returns null. ownerPicture of type Picture, readonly The Picture object associated with this node. When the node is a Picture node, this returns null. attributes of type NodeList, A NodeList containing the attributes (Application Structure and namespace attributes) of this node (must be a XML_ELEMENT_NODE, PICTURE_NODE or APP_STRUCTURE_NODE), null otherwise.
namespaceURI of type DOMString, readonly The namespace URI of this node (e.g., elementName xmlns="http://www.example.org/2004", returns "http://www.example.org/2004"). This returns null if the Node is not of type XML_ELEMENT_NODE. prefix of type DOMString, readonly The namespace prefix of this node (e.g., foo:elementName, returns "foo"). This returns null if the Node is not of type XML_ELEMENT_NODE. localName of type DOMString, readonly Returns the local part of the qualified name of this node (e.g., foo:elementName, returns "elementName"). This returns null if the Node is not of type XML_ELEMENT_NODE. Methods hasChildNodes Returns whether this node has any children. No Parameters Return Value boolean; true if this node has any children, false otherwise. No Exceptions hasAttributes Returns whether this node (if of type XML_ELEMENT_NODE) has any attributes. No Parameters Return Value boolean; true if this node has any attributes, false otherwise. Exceptions INVALID_ACCESS_ERR if called on a non XML_ELEMENT_NODE object. hasAttributeNS Returns true when an attribute with a given local name and namespace URI is specified on this Node (must be of type XML_ELEMENT_NODE), returns false otherwise. No Parameters Return Value boolean; true if this node has any children, false otherwise. Exceptions INVALID_ACCESS_ERR if called on a non XML_ELEMENT_NODE object. getAttributeNS Returns the node (must be of type XML_ELEMENT_NODE) attribute value by local name and namespace URI. Parameters namespaceURI of type DOMString The namespace URI of the attribute to retrieve. localName of type DOMString The local name of the attribute to retrieve. Return Value DOMString; The Attr value as a string, or the empty string if that attribute does not have a specified value. Exceptions INVALID_ACCESS_ERR if called on a non XML_ELEMENT_NODE object. getElementsByTagNameNS Returns a NodeList of all the descendant XML element (companion information) with a given local name and namspace URI in the order in which they are encountered in a preorder traversal of the Node tree. Parameters namespaceURI of type DOMString The namespace URI of the XML elements to match on. localName of type DOMString The local name of the XML elements to match on. Return Value NodeList; A list of matching XML element nodes. No Exceptions getElementsByAttrNameValueNS
No Parameters Return Value No Exceptions Interface PictureThe Picture interface allows for access to the application structures of the WebCGM document. It also specifies how to load an XML companion file into a WebCGM document. IDL Definition
Attributes width of type number, readonly Represents the Picture width in millimeters. Please refer to Coordinate Values section for more information. height of type number, readonly Represents the Picture height in millimeters. Please refer to Coordinate Values section for more information. Methods applyCompanionFile The applyCompanionFile reads an XML companion file into the user agent's object model. If companion information is found in the companion file (in the form of namespace attributes and namespace children elements), the user agent will create new namespace application structures as children of existing WebCGM Application Structures within it's object model. This information will then be accessible using methods found on the Picture, AppStructure and Node interfaces. Depending on the parameters, the applyCompanionFile method may or may not 'apply' the XML companion file. Please refer to the Relationship with XML companion file section for more detail.
Parameters fileURI of type DOMString The file name and location of the XML companion file to load and apply into the object model. refresh of type boolean When set to true, the method will delete any additional companion information that was added to the object model from a previous applyCompanionFile; a value of false implies that the caller may be loading companion information in addition to already loaded companion information. Return value boolean; true if the implementation was able to load and parse the XML companion file into memory as requested; false otherwise. Exceptions FILE_NOT_FOUND_ERR; if the reference document could not be accessed. Exceptions FILE_INCOMPATIBILITY_ERR; if the reference document was not well-formed or in error. getAppStructureById Returns the Application Structure whose ID is given by apsId. If no such Application Structure exists, returns null. Behavior is not defined if more than one element has this ID. The method does not apply to XML_ELEMENT_NODEs. Parameters apsId of type DOMString The unique id value for an Application Structure. Return value Node; the matching Application Structure. No Exceptions getAppStructuresByName Returns the list of Application Structures whose name are given by apsName. If no such Application Structures exists, returns null. The method does not apply to XML_ELEMENT_NODEs. Parameters apsName of type DOMString A non-unique name value for an Application Structure. Return value NodeList; the matching Application Structures. No Exceptions getAppStructuresByType Returns a NodeList of all Application Structures of the given type in the order in which they are encountered in a preorder traversal of the Picture tree. Possible values for WebCGM 1.0 Application Structure types are 'layer','grobject', 'para', 'subpara'. Parameters apsType of type DOMString The name of the Application Structure type to match on. Return value NodeList; A new NodeList object containing all the matched Application Struture Nodes. No Exceptions highlight Highlights a collection of Application Structures.
Parameters nodes of type NodeList A NodeList of APP_STRUCTURE_NODEs to highlight. state of type boolean A true value with highlight the nodes, where as false will remove the highlight. No Return value No Exceptions setStyleAttr Set a style attribute at the picture level by name. The following table describes in more details each style attribute, their scope and allowed values:
Note: Descriptions of all style attributes have to be provided. stroke-color includes CGM attributes edge-color, line-color and marker-color. stroke-weight includes CGM attributes edge-weight and line-weight. RGB colors are expressed has hexadecimal values. Absolute mm are expressed with a number followed by the 'mm' unit, ex: "3mm". Relative scale values are expressed as a number followed by a '%' unit, ex: "225%", the value can exceed 100%. Relative intensity values are expressed as a number followed by a '%' unit, ex: "75%", the value cannot exceed 100%.
Parameters style of type DOMString The name of the style attribute to modify. value of type DOMString The new value for the given style. No Return value No Exceptions clearStyleAttr Restores a style attribute to its original value (load time). Parameters style of type DOMString The name of the style attribute. The special value "*" matches all style attributes. No Return value No Exceptions clearData Removes all XML companion information that was loaded into the user agent's object model from one or multiple applyCompanionFile calls. The method clearData does not reset Application Structure attributes to their inital values if they were modified by an applyCompanionFile call, the purpose of this method is to remove additional companion information from the object model. No Parameters No Return value No Exceptions Interface AppStructureThe AppStructure interface offers method for setting and retrieving Application Structure attributes. The general methods for accessing Application Structure attributes are getAppStructureAttr and setAppStructureAttr, however; since some attributes are allowed to be set multiple times (e.g., linkuri), specific methods are offered for certain attributes. The following table identifies the attributes which can get access using getAppStructureAttr and setAppStructureAtt:
Note: Descriptions of all Application Structure attributes have to be provided. The AppStructure interface, like the Picture interface, provides methods for modifying style attributes at the Application Structure level. For more information about available style attribute, refer to the Style Attributes Table. IDL Definition
Attributes apsId of type DOMString, readonly The unique identifier of the Application Structure. Methods getAppStructureAttr Gets an Application Structure attribute by name. Please refer to the Application Structure Attributes table for more detailed information on retrievable and modifiable Application Structure attributes. Parameters name of type DOMString The name of the Application Structure attribute to retrieve. No Return value No Exceptions setAppStructureAttr Sets an Application Structure attribute by name. Please refer to the Application Structure Attributes table for more detailed information on retrievable and modifiable Application Structure attributes. Parameters name of type DOMString The name of the Application Structure attribute to set. value of type DOMString The new value for the given attribute. No Return value No Exceptions removeAppStructureAttr Removes an Application Structure attribute by name. Please refer to the Application Structure Attributes table for more detailed information on retrievable and modifiable Application Structure attributes. Parameters name of type DOMString The name of the Application Structure attribute to remove. No Return value No Exceptions getLinkuris Returns a list of all Hyperlinks associated with the given Application Structure. No Parameters No Return value Nodelist; A list of of Hyperlink Nodes containing hyperlink attributes.
No Exceptions setLinkuris Associates one or several hyperlinks with the given Application Structure. Parameters hyperlinks of type NodeList The Hyperlink node list to be associated with the given Application Structure. No Return value No Exceptions getNames Need wording. Parameters style of type DOMString The name of the style attribute to modify. value of type DOMString The new value for the given style. No Return value No Exceptions setStyleAttr Set a style attribute at the picture level by name. Please refer to the Style Attributes Table for more detailed information on style attributes. Parameters style of type DOMString The name of the style attribute to modify. value of type DOMString The new value for the given style. No Return value No Exceptions clearStyleAttr Restores a style attribute to its original value (load time). Parameters style of type DOMString The name of the style attribute. The special value "*" matches all style attributes. No Return value No Exceptions getAppStructuresByType Returns a NodeList of all Application Structures of the given type in the order in which they are encountered in a preorder traversal of the AppStructure tree. Unlike the same method on the Picture interface, the valid types are defined by the current Application Structure type. Parameters apsType of type DOMString The name of the Application Structure type to match on. Return value NodeList; A new NodeList object containing all the matched Application Struture Nodes. No Exceptions SHOULD THROW AN EXCEPTION. Interface NodeListThe NodeList interface provides the abstraction of an ordered collection of nodes. NodeList objects in the WebCGM DOM are live. The index with the NodeList start at 0. IDL Definition
Attributes length of type unsigned long, readonly The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. Methods items Returns the index th item in the collection. Parameters index of type unsigned long Index into the collection. Return value Node; The node of the index th position in the NodeList, or null if that is not a valid index. No Exceptions Interface AttrThe IDL Definition
Attributes name of type DOMString, readonly Returns the name of this attribute. If Node.localName is different from null, this attribute is a qualified name. specified of type boolean, readonly True if this attribute was explicitly given a value in the instance document, false otherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set to true. value of type DOMString, readonly The value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface. ownerNode of type Node, readonly The Element node this attribute is attached to or null if this attribute is not in use. isId of type boolean, readonly Returns whether this attribute is known to be of type ID. Interface TextThe
IDL Definition
Attributes isElementContentWhitespace of type boolean, readonly Returns whether this text node contains element content whitespace (see XML specification).
wholeText of type DOMString, readonly Returns the text of Text nodes logically-adjacent text nodes to this node, concatenated in document order. Example at: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-FF21A306 data of type DOMString, readonly The character data of the node that implements this interface.
Exceptions on retrieval DOMException, DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform. length of type unsigned long, readonly The number of 16-bit units that are available through 'data'. This may have the value zero, i.e., Text nodes may be empty. TODO: Event interfaces. |
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]