OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

cgmo-webcgm message

[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.com

treeExample2.png

Title: WebCGM DOM

WebCGM Document Object Model (DOM) Specification

Version 1.0

Working Draft June 10, 2004

This version:

Latest version:

Previous version:

Editors:

Authors:

Abstract

Status of this document

Table of contents

Expanded 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 Model

1.1 Overview of the WebCGM DOM Interfaces

This 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 3

Many 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 file

The 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):

BEGMF 'example.cgm';
...
BEGPIC 'Picture 1';
...
BEGAPS 'L1' 'layer' STLIST;
  APSATTR 'layername' "14 1 'Standard layer'";
  BEGAPSBODY;
  BEGAPS 'G1' 'grobject' STLIST;
    BEGAPSBODY;
    LINE 210,265 210,200 300,200;
    LINE 300,200 300,265 210,265;
  ENDAPS;
ENDAPS;
...
ENDPIC;
...
ENDMF;

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.

Original tree structure

Now let us assume example.cgm has the following XML companion file for...

<cgmCompanion id="example" xmlns:wiring="http://namespace_declaration">
  <grobject apsId="G1" screentip="A new screentip">
    <wiring:data color="rgb(255,0,0)"/>
  </grobject>
</cgmCompanion>

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:

New tree structure

1.1.2 Data types and interfaces

DOMString

String Comparision

1.1.3 Coordinate values

Need 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 Namespaces

1.2 Fundamental Interfaces

Summary will go here.

Exception DOMException

WebCGM operations only raise exceptions when an operation is impossible to perform.

IDL Definition

exception DOMException {
  unsigned short   code;
};

// ExceptionCode
const unsigned short      INDEX_SIZE_ERR                 = 1;
const unsigned short      DOMSTRING_SIZE_ERR             = 2;
const unsigned short      INVALID_CHARACTER_ERR          = 3;
const unsigned short      NO_DATA_ALLOWED_ERR            = 4;
const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 5;
const unsigned short      NOT_SUPPORTED_ERR              = 6;
const unsigned short      INVALID_ACCESS_ERR             = 7;
const unsigned short      VALIDATION_ERR                 = 8; 
const unsigned short      FILE_NOT_FOUND_ERR             = 9; 
const unsigned short      FILE_INCOMPATIBILITY_ERR       = 10;        

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 GetWebCGMDocument

Since 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

interface GetWebCGMDocument { 
  Metafile getWebCGMDocument ( ) 
                 raises ( DOMException ); 
};

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 Metafile

The 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

interface Metafile { 
  readonly attribute DOMString metafileDescription;
  readonly attribute Picture   firstPicture;
  readonly attribute DOMString metafileID;
  readonly attribute integer   metafileVersion;
};

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 Node

The 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

interface Node {
  const unsigned short PICTURE_NODE           = 1;
  const unsigned short APP_STRUCTURE_NODE     = 2;
  const unsigned short XML_ELEMENT_NODE       = 3; // or XML_METADATA_NODE?
  const unsigned short TEXT_NODE              = 4;
  const unsigned short ATTR_NODE              = 5;

  readonly attribute DOMString        nodeName;
  readonly attribute DOMString        nodeValue;
                                        // raises(DOMException) on retrieval

  readonly attribute unsigned short   nodeType;
  readonly attribute Node             parentNode;
  readonly attribute NodeList         childNodes;
  readonly attribute Node             firstChild;
  readonly attribute Node             lastChild;
  readonly attribute Node             previousSibling;
  readonly attribute Node             nextSibling;
  readonly attribute Picture          ownerPicture;
  boolean                             hasChildNodes();
  boolean                             hasAttributes();
  boolean                             hasAttributeNS(in DOMString namespaceURI, 
                                                     in DOMString localName);
  readonly attribute NodeList         attributes;

  readonly attribute DOMString        namespaceURI;
           attribute DOMString        prefix;
                                        // raises(DOMException) on setting

  readonly attribute DOMString        localName;

  DOMString                           getAttributeNS(in DOMString namespaceURI, 
                                                     in DOMString localName);
  NodeList                            getElementsByTagNameNS(in DOMString namespaceURI, 
                                                             in DOMString localName);
  NodeList                            getElementsByAttrNameValueNS(in DOMString namespaceURI,
                                                                   in DOMString attrName,
                                                                   in DOMString attrValue);
};

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:

Interface nodeName nodeValue
AppStructure AppStructure type null
Attr Attr.name Attr.value
Picture "#picture" null
Text #text content of the text node
XMLElement prefix + localName null

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.

Do people want a NodeList or a NamedNodeMap?

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

Need Dave on this one! On which interface do you need this functionality?

No Parameters

Return Value

No Exceptions

Interface Picture

The 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

interface Picture : Node { 
  readonly attribute number            width;
  readonly attribute number            height;

  boolean            applyCompanionFile(in DOMString fileURI, 
                                        in boolean refresh);
  Node               getAppStructureById(in apsId);
  Node               getAppStructureByName(in apsName);
  void               highlight(in NodeList nodes,
                               in boolean state);
  NodeList           getAppStructuresByType(in apsType);
  void               setStyleAttr(in DOMString style,
                                  in DOMString value);
  void               clearStyleAttr(in DOMString style);
  void               clearData();
};

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.

applyCompanionFile is probably the most important API of the entire DOM, please comment on wording and parameters!

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.

I need a method description from group members regarding highlight!

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:

Style Attribute Name Picture level APS level Attribute value(s) Example
background-color yes no absolute RGB or relative intensity (0..1)
character-height yes yes absolute mm or relative scale (> 0) "3mm" or "225%"
fill-color yes yes absolute RGB or relative intensity (0..1) "#FF0000" or "75%"
intensity no yes relative intensity (0..1) "75%"
stroke-color yes yes absolute RGB or relative intensity (0..1) "#FF0000" or "75%"
stroke-weight yes yes absolute mm or relative scale (> 0) "3mm" or "225%"
text-color yes yes absolute RGB or relative intensity (0..1) "#FF0000" or "75%"
text-font yes yes DOMString "helvetica"
raster-intensity yes yes relative intensity (0..1) "75%"
visibility no yes DOMString "visible" | "hidden"

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%.

Should character-height be expressed in mm or pt?

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 AppStructure

The 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:

APS Attribute Name getAppStructureAttr setAppStructureAttr Return/parameter type Example
content allowed allowed DOMString "car engine transmission"
interactivity allowed allowed interactive | none "interactive"
layerdesc allowed allowed DOMString "This layer contains English instructions"
layername allowed no, readonly DOMString "English instructions"
linkuri use getLinkuris use setLinkuris NamedNodeMap see getLinkuris method
name use getNames no, readonly NamedNodeMap see getNames method
region allowed allowed DOMString (coma delimited SDR) "1,0,0,100,100"
screentip allowed allowed DOMString "This is a screentip"
viewContext allowed allowed DOMString (two corner points) "0,0,100,100"
virtualViewContext allowed no, readonly DOMString (two corner points) "0,0,100,100"

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

interface AppStructure : Node {
  readonly attribute DOMString        apsId;

  DOMString        getAppStructureAttr(in DOMString name);
  DOMString        setAppStructureAttr(in DOMString name,
                                       in DOMString value);
  DOMString        removeAppStructureAttr(in DOMString name);
  DOMStringList    getLinkuris();
  DOMStringList    setLinkuris();
  DOMStringList    getNames();
  DOMString        setStyleAttr(in DOMString style,
                                in DOMString value);
  void             clearStyleAttr(in DOMString style);
  NodeList         getAppStructuresByType(in apsType);
};

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.

I don't know how to do getLinkuris without introducing a HyperLink interface? http://www.w3.org/TR/REC-WebCGM/REC-03-CGM-IC.html#webcgm_3_2_2_3

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 NodeList

The 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

interface NodeList {
  readonly attribute unsigned long length;
  Node               item(in unsigned long index);
};

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 Attr

The Attr interface represents an attribute in a XML_ELEMENT_NODE, a PICTURE_NODE or a APP_STRUCTURE_NODE.

IDL Definition

interface Attr: Node {
  readonly attribute DOMString        name;
  readonly attribute boolean          specified; // do we need this?
  readonly attribute DOMString        value;
  readonly attribute Node             ownerNode;
  readonly attribute boolean          isId; // do we need this?
};

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 Text

The Text interface represents the textual content of an XML_ELEMENT_NODE and ATTR_NODE.

I'm combining the DOM Text and CharacterData interface into this single WebCGM DOM Text interface. I very knowledgeable on the topic of entities; what happends in the textual content of an XML file contains entities? How do we handle that?

IDL Definition

interface Text: Node {
  readonly attribute boolean        isElementContentWhitespace; // do we need this?
  readonly attribute DOMString      wholeText; // do we need this?
  readonly attribute DOMString      data;
  readonly attribute unsigned long  length;
};

Attributes

isElementContentWhitespace of type boolean, readonly

Returns whether this text node contains element content whitespace (see XML specification).

What does WebCGM say about Whitespace handling, would this be useful to us?

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.

Do we want the DOM substringData method in case the 'data' is too long to fit in a DOMString?

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.

treeExample1.png



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]