This appendix is normative.
This appendix consists of the following parts:
The following sections describe the key features and constraints within the SVG Tiny 1.2 DOM.
Note that, like all other W3C DOM definitions, the SVG Tiny 1.2 DOM is programming-language independent. Although this appendix only contain ECMAScript and Java examples, the SVG Tiny 1.2 DOM is compatible with other programming languages.
initializeEventListeners(dom::Document
doc)
method once your programming logic has been
loaded and is ready to bind to the document. The
Document object typically will be
available via various other means, also.SVG Tiny 1.2 DOM only allows navigation of the element nodes in the DOM tree. Two options are available for navigating the hierarchy of elements:
getElementById
method on the Document interface.parentNode
attribute on the
Node interfaceThe ElementTraversal interface
provides firstElementChild
,
lastElementChild
,
previousElementSibling
and
nextElementSibling
, which are particularly
suitable for constrained devices. These traversal
mechanisms skip over intervening nodes between element
nodes, such as text nodes which might only contain spaces,
tabs and newlines.
Element myRect = document.createElementNS(svgNS, "rect");The type of elements which can be created through the createElementNS method is restricted to the following elements in the SVG namespace: <rect>, <circle>, <ellipse>, <line>, <path>, <text>, <image>, <use>, <a> and <g>.
String svgNS = "http://www.w3.org/2000/svg"; // Create a new <rect> element Element myRect = document.createElementNS(svgNS, "rect"); // Set the various <rect> properties before appending ... // Add element to the root of the document Element svgRoot = document.documentElement(); svgRoot.appendChild(myRect); // Create a new <ellipse> element Element myEllipse = document.createElementNS(svgNS, "ellipse"); // Set the various <ellipse> properties before insertion ... // Insert the ellipse before the rectangle svgRoot.insertBefore(myEllipse, myRect);The types of nodes which can be inserted into the Document is limited to the same list specified in the Element Creation section.
Element myRect = ...; // See Element creation Element myGroup = document.getElementById("myGroup"); myGroup.appendChild(myRect); .... myGroup.removeChild(myRect);Any element nodes in the document can be removed, including both element nodes that were created via the DOM and element nodes that existed in the original document.
SVG 1.2 adds a new ability to access XML attribute and CSS property values through the SVG DOM through the concept of traits. A trait is a potentially animatable parameter associated with an element. Trait is the typed value (e.g., a number, not just a string) that gets assigned through an XML attribute, CSS property or a SMIL animation [SMILANIM]. Traits can be thought of as a unification and generalization of some of the notions of XML attributes and CSS properties.
The trait facilities in the SVG DOM allow for
strongly-typed access to certain attribute and property
values. For example, there is a
getFloatTrait(...)
method for getting an
attribute or property value directly as a float. This
contrasts the DOM Core getAttributeNS(...)
method which always returns a string.
The SVG Tiny 1.2 DOM includes a subset of the trait facilities in the full SVG 1.2 DOM. The trait facilities in the SVG Tiny 1.2 DOM are available on the TraitAccess interface.
Here is an example which uses the trait facilities to get and set the width of a rectangle:
float width = myRect.getFloatTrait('width'); width += 10; myRect.setFloatTrait('width', width);
In the SVG 1.2 Tiny DOM, text node access is available
via trait getters and setters. To access or set the text
string value for a text element (e.g., a <text>
element), you invoke getTrait()
or
setTrait()
on that text element and pass
#text
as the name of the trait you want to get
or set. For example, MyTextElement.setTrait("#text",
"Hello");
class MyEventListener implements EventListener { public void handleEvent(Event evt) { // Do whatever is needed here } } ... EventListener l = new MyEventListener(); SVGElement myRect = (SVGElement)document.getElementById("myRect"); // Listen to click events, during the bubbling phase myRect.addEventListener("click", l, false); .... // Remove the click listener myRect.removeEventListener("click", l, false);
The SVG 1.2 Tiny DOM only supports the bubble phase. Any attempt to specify event operations on the capture phase will raise a DOMException of type NOT_SUPPORTED_ERR.
Refer to the DOM Events Level 3 specification or the XML Events specification introduction for an explanation of the SVG event flow and the meaning of event targets, event current target, bubble and capture.
AnimationElement animateColor = (AnimationElement) document.getElementById("myAnimation"); // Start the animation 2.5 seconds from now. animateColor.beginElementAt(2.5);
The SVG 1.2 Tiny DOM will use the same package names as the SVG 1.2 Full DOM (e.g., org.w3c.dom, org.w3c.dom.events, org.w3c.dom.svg). This allows applications which restrict themselves to the features in the SVG 1.2 Tiny DOM to also run in implementations that support the SVG 1.2 Full DOM.
The DOMException
class defines a subset of
the error codes defined in the DOM Core
Level 3 specification.
exception DOMException { unsigned short code; }; // ExceptionCode const unsigned short INDEX_SIZE_ERR = 1; const unsigned short HIERARCHY_REQUEST_ERR = 3; const unsigned short WRONG_DOCUMENT_ERR = 4; const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; const unsigned short NOT_FOUND_ERR = 8; const unsigned short NOT_SUPPORTED_ERR = 9; const unsigned short INVALID_MODIFICATION_ERR = 13; const unsigned short INVALID_ACCESS_ERR = 15; const unsigned short TYPE_MISMATCH_ERR = 17;
INDEX_SIZE_ERR | If index or size is negative, or greater than the allowed value. | |
HIERARCHY_REQUEST_ERR | If any Node is inserted somewhere it doesn't belong. | |
WRONG_DOCUMENT_ERR | If a node is used in a different document than the one that created it (that doesn't support it) | |
NO_MODIFICATION_ALLOWED_ERR | If an attempt is made to modify an object where modifications are not allowed. | |
NOT_FOUND_ERR | If an attempt is made to reference a node in a context where it does not exist . | |
NOT_SUPPORTED_ERR | If the implementation does not support the requested type of object or operation. | |
INVALID_MODIFICATION_ERR | If an attempt is made to modify the type of the underlying object. | |
INVALID_ACCESS_ERR | If a parameter or an operation is not supported by the underlying object. | |
TYPE_MISMATCH_ERR | If the type of an object is incompatible with the expected type of the parameter associated to the object. |
The Node
interface is the interface for all
XML tree model content. This interface is a subset of the
Node
interface defined in the DOM Core
Level 3 specification.
interface Node { readonly attribute Node parentNode; readonly attribute DOMString namespaceURI; readonly attribute DOMString localName; Node insertBefore(in Node newChild, in Node refChild) raises(DOMException); Node removeChild(in Node oldChild) raises(DOMException); Node appendChild(in Node newChild) raises(DOMException); };
newChild
to the end of the
children list for this node.
in Node newChild | The new Node to
add. |
Node | the newly added node |
DOMException | If the operation is not allowed (e.g., if the newChild node type is incompatible with this node) or if addition of the given Node type is not supported by the implementation. |
newChild
before
refChild
.
in Node newChild | The Node to insert. |
|
in Node refChild | The Node before which
newChild is inserted |
Node | the newly inserted node |
DOMException | If the operation is not allowed or not supported. |
in Node oldChild | The Node to remove. |
Node | the removed node |
DOMException | See the DOM Level 3 specification. |
The Element
interface represents an XML
element in a Document
. This interface is a
subset of the Element
interface defined in the
DOM Core
Level 3 specification.
interface Element : Node { };
The Document
interface is the interface for
an XML Document
model. This interface is a
subset of the Document
interface defined in
the DOM Core
Level 3 specification. Note that the
getFirstChild
method returns the root of the
document.
interface Document : Node { readonly attribute Element documentElement; Element createElementNS(in DOMString namespaceURI, in DOMString qualifiedName) raises(DOMException); Element getElementById(in DOMString elementId); };
in DOMString namespaceURI | The namespace uri for the newly created element. | |
in DOMString qualifiedName | The qualified name for the newly created element. |
Element | The newly created element |
DOMException | See DOM Level 3 specification. In addition, a DOMException (NOT_SUPPORTED_ERR) is thrown if the type of element is not supported by the implementation. |
in DOMString elementId | The unique id of the
retrieved element. |
Element | The matching element or null if none. |
The interface for DOM nodes which can receive and
dispatch Event
s to
EventListener
s. This interface is a subset of
the EventTarget
interface defined in the
DOM Level 3 Events specification. Please refer to that
specification for details on what the different methods and
members mean.
The SVG Tiny DOM only supports the event bubbling phase.
If useCapture
is true, a DOMException of type
NOT_SUPPORTED_ERR is raised.
interface EventTarget { void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture); void removeEventListener(in DOMString type, in EventListener listener, in boolean useCapture); };
in DOMString type | The type of event to listen to. | |
in EventListener listener | Will be notified when an event of the desired type happens on this target or one of its descendant. | |
in boolean useCapture | If true, the listener will be called during the event flow capture phase. Otherwise, the listener will be called during the bubble phase. If the event's target is this target, then the listener will be called during the 'at target' phase of event flow. |
addEventListener
call.in DOMString type | The type of event that was listened to. | |
in EventListener listener | The listener that was previously registered. | |
in boolean useCapture | If true, the listener was listening to events in the capture phase of event flow. |
Interface used to receive Event
s from an
EventTarget
This interface is a subset of the
EventListener
interface defined in the
DOM Level 3 Events specification. Please refer to that
specification for details on what the different methods and
members mean.
iinterface EventListener { void handleEvent(in Event evt); };
in Event evt | Contains
contextual information about the
event. |
Provides information about an event and its propagation.
This interface is a subset of the Event
interface defined in the
DOM Level 3 Events specification and defines additional
constraints.
interface Event { readonly attribute DOMString type; readonly attribute EventTarget currentTarget; };
The MouseEvent interface provides specific contextual information associated with Mouse events.
interface MouseEvent : Event { readonly attribute long screenX; readonly attribute long screenY; readonly attribute long clientX; readonly attribute long clientY; readonly attribute unsigned short button; };
The following events are supported:
interface ElementTimeControl { boolean beginElementAt( in float offset ); boolean endElementAt( in float offset ); };
exception SVGException { unsigned short code; }; // SVGExceptionCode const unsigned short SVG_INVALID_VALUE_ERR = 1; const unsigned short SVG_MATRIX_NOT_INVERTABLE = 2;
interface SVGRect { attribute float x; attribute float y; attribute float width; attribute float height; };
interface SVGPoint { attribute float x; attribute float y; };
interface SVGMatrix { float getComponent(in unsigned long index) raises(dom::DOMException); SVGMatrix multiply( in SVGMatrix secondMatrix ); SVGMatrix inverse() raises( SVGException ); SVGMatrix translate( in float x, in float y ); SVGMatrix scale( in float scaleFactor ); SVGMatrix rotate( in float angle ); };
SVGPath
provides an API to access and
manipulate the 'd'
attribute on the
<path> element
interface SVGPath { const unsigned short MOVE_TO = 0x4d; // 'M' const unsigned short LINE_TO = 0x4C; // 'L' const unsigned short CURVE_TO = 0x43;// 'C' const unsigned short QUAD_TO = 0x51; // 'Q' const unsigned short CLOSE = 0x5a; // 'Z' readonly attribute unsigned long numberOfSegments; unsigned short getSegment( in unsigned long index ) raises(dom::DOMException); float getSegmentParam( in unsigned long cmdIndex, in unsigned long paramIndex ) raises(dom::DOMException); void moveTo( float x, float y ); void lineTo( float x, float y ); void quadTo( float x1, float y1, float x2, float y2 ); void curveTo( float x1, float y1, float x2, float y2, float x3, float y3 ); void close(); };
interface SVGRGBColor { readonly attribute unsigned long red; readonly attribute unsigned long green; readonly attribute unsigned long blue; };
interface SVGLocatable { SVGRect getBBox(); SVGMatrix getScreenCTM(); SVGRect getScreenBBox(); };
TraitAccess
is an interface to access
trait values (see Attribute Access). A trait is a
potentially animatable parameter associated with an
element. Trait is the typed value (e.g., a number, not just
a string) that gets assigned through an XML attribute, CSS
property or a SMIL animation [SMILANIM].
Traits can be thought of as a unification and
generalization of some of the notions of XML attributes and
CSS properties. The trait facilities allow for
strongly-typed access to certain attribute and property
values. For example, there is a
getFloatTrait(...)
method for getting an
attribute or property value directly as a float. This
contrasts the DOM Core getAttributeNS(...)
method which always returns a string.
Each trait corresponds to an attribute or property which is parsed and understood by the element and in most cases animatable. For any given profile there is a well-defined set of traits that all implementations must support. Each increasing profile may support a larger set of traits. If an implementation does not support a trait it must throw an exception. Unlike attributes traits are typed and their values are normalized; for instance SVG path specification is parsed and all path commands are converted to their absolute variants, it is not possible to say through the value of the trait if a path command was absolute or relative. When getting and setting trait values, accessor of the correct type must be used or exception will be thrown.
For XML attributes, the setter methods (e.g.,
setTrait(...)
,
setFloatTrait(...)
) add a new attribute for
the given element. If an attribute with that name is
already present on the element, its value is changed to be
that of the value
parameter. For CSS
properties, the setter methods set the specified value for
the given property, with equivalent specificity rules to
using setAttributeNS(...)
on a presentation
attribute (see
presentation attributes). The value which is modified
is always a base value (in terms of SMIL animation). For
inheritable traits the trait value can always be set to
"inherit" (but quering the value will always return the
actual inherited value as explained above).
The XML attributes, the getter methods (e.g.,
getTrait(...)
,
getFloatTrait(...)
) return the attribute value
for the named attribute. If the given attribute has a
value, then return that value; else if the attribute does
not have a value, and if the attribute is a CSS property
then return the computed value; else if the attribute is inheritable and
an inheritable value is available, then return the
inherited value; else if there is a default value, then
return the default value; otherwise, an INVALID_ACCESS_ERR
DOMException is raised. In either case (i.e., XML
attributes or CSS properties), the returned value
corresponds to the base value before animation is
applied and not the presentation value (aka,
animated value), where base value and
presentation value corresponds to the SMIL
Animation definitions of these terms (see [SMILANIM]). For the attribute "xlink:href" then the returned value follows
the processing rules of xml:base.
For both the getter and setter methods, if the trait name does not correspond to a defined attribute or property, an exception is raised.
interface TraitAccess { DOMString getTrait( in DOMString name ) raises (DOMException); DOMString getTraitNS( in DOMString namespaceURI, in DOMString name ) raises (DOMException); float getFloatTrait( in DOMString name ) raises (DOMException); SVGMatrix getMatrixTrait( in DOMString name ) raises (DOMException); SVGRect getRectTrait( in DOMString name ) raises (DOMException); SVGPath getPathTrait( in DOMString name ) raises (DOMException); SVGRGBColor getRGBColorTrait( in DOMString name ) raises (DOMException); void setTrait( in DOMString name, in DOMString value ) raises (DOMException); void setTraitNS( in DOMString namespaceURI, in DOMString name, in DOMString value ) raises (DOMException); void setFloatTrait( in DOMString name, in float value ) raises (DOMException); void setMatrixTrait( in DOMString name, in SVGMatrix matrix ) raises (DOMException); void setRectTrait( in DOMString name, in SVGRect rect ) raises (DOMException); void setPathTrait( in DOMString name, in SVGPath path ) raises (DOMException); void setRGBColorTrait( in DOMString name, in SVGRGBColor color ) raises (DOMException); };
getTrait |
Returns the computed value for the trait with the requested localName. |
Parameters |
|
Return value |
|
Exceptions |
|
setTrait |
Sets the specified value for the trait with the given localName. |
Parameters |
|
No return value |
Exceptions |
|
getTraitNS |
Returns the computed value for the trait with the requested localName and namespaceURI. |
Parameters |
|
Return value |
|
Exceptions |
|
setTraitNS |
Sets the specified value for the
trait with the given localName and
namespaceURI |
Parameters |
|
No return value |
Exceptions |
|
getFloatTrait |
Returns the computed value for the trait with the requested localName. |
Parameters |
|
Return value |
|
Exceptions |
|
setFloatTrait |
Sets the specified value for the trait with the given localName. |
Parameters |
|
No return value |
Exceptions |
|
getMatrixTrait |
Returns the computed value for the trait with the requested localName. |
Parameters |
|
Return value |
|
Exceptions |
|
setMatrixTrait |
Sets the specified value for the trait with the given localName. |
Parameters |
|
No return value |
Exceptions |
|
getRectTrait |
Returns the computed value for the trait with the requested localName. |
Parameters |
|
Return value |
|
Exceptions |
|
setRectTrait |
Sets the specified value for the trait with the given localName. |
Parameters |
|
No return value |
Exceptions |
|
getPathTrait |
Returns the computed value for the trait with the requested localName. |
Parameters |
|
Return value |
|
Exceptions |
|
setPathTrait |
Sets the specified value for the trait with the given localName. |
Parameters |
|
No return value |
Exceptions |
|
getRGBColorTrait |
Returns the computed value for the trait with the requested localName. |
Parameters |
|
Return value |
|
Exceptions |
|
setRGBColorTrait |
Sets the specified value for the trait with the given localName. |
Parameters |
|
No return value |
Exceptions |
|
This interface provides a way to traverse elements in the DOM tree. It is needed mainly because SVG Tiny DOM does not expose character data Nodes. Each element in SVG Tiny document tree implements this interface. This applies to elements in the foreign namespaces as well.
interface ElementTraversal { readonly attribute Element firstElementChild; readonly attribute Element lastElementChild; readonly attribute Element nextElementSibling; readonly attribute Element previousElementSibling; };
SVGElement
is the base interface used by
all elements in the SVG namespace.
An element's id can be set only if it does not already have an id. DOMException with error code NO_MODIFICATION_ALLOWED_ERR is raised if an attempt is made to change an existing id. Elements with non-null id can be inserted, but cannot be removed from the DOM tree (see removeChild).
interface SVGElement : dom::Element, ElementTraversal, events::EventTarget, TraitAccess { attribute DOMString id; // raises (DOMException) on setting };
SVGLocatableElement
is the base interface
used by all graphics and container elements in the SVG
namespace.
interface SVGLocatableElement : SVGElement, SVGLocatable { };
SVGAnimationElement
is the base interface
used by all animation elements in the SVG namespace.
interface SVGAnimationElement : SVGElement, smil::ElementTimeControl { };
SVGSVGElement
provides an API to access
APIs corresponding to the <svg> element
The DOM attributes currentScale, currentRotate and currentTranslate are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].[cos(currentRotate) sin(currentRotate) -sin(currentRotate cos(currentRotate) 0 0]. If "magnification" is enabled (i.e., zoomAndPan="magnify"), then the effect is as if an extra transformation were placed at the outermost level on the SVG document fragment (i.e., outside the outermost 'svg' element).
interface SVGSVGElement : SVGLocatableElement { attribute float currentScale; // raises (DOMException) on setting attribute float currentRotate; // raises (DOMException) on setting readonly attribute SVGPoint currentTranslate; readonly attribute SVGRect viewport; void pauseAnimations(); void unpauseAnimations(); boolean animationsPaused(); float getCurrentTime(); void setCurrentTime( in float seconds ); SVGMatrix createSVGMatrixComponents( float a, float b, float c, float d, float e, float f ); SVGRect createSVGRect(); SVGPath createSVGPath(); SVGRGBColor createSVGRGBColor( in unsigned long red, in unsigned long green, in unsigned long blue ) raises(SVGException); };
The position and size of the viewport (implicit or explicit) that corresponds to this 'svg' element. When the user agent is actually rendering the content, then the position and size values represent the actual values when rendering. The position and size values are unitless values in the coordinate system of the parent element. If no parent element exists (i.e., 'svg' element represents the root of the document tree), if this SVG document is embedded as part of another document (e.g., via the HTML 'object' element), then the position and size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout, then unitless values represent pixel units for the current CSS or XSL viewport, as described in the CSS2 specification.) If the parent element does not have a coordinate system, then the user agent should provide reasonable default values for this attribute.
The object itself and its contents are both readonly.
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised
on an attempt to change the value of
a readonly attribute.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised
on an attempt to change the value of
a readonly attribute.
|
boolean | Boolean indicating whether this SVG document fragment is in a paused state. |
float | The current time in seconds. |
in float seconds | The new current time in seconds relative to the start time for the current SVG document fragment. |
Interface used to set up event initializers, typically at document load time.
The EventListenerInitializer interface needs to be implemented by scripts written in Java (or other compiled languages). It is called when code is loaded and can be bound to a document.
interface EventListenerInitializer { void initializeEventListeners(dom::Document doc); };
The use of this interface in the Java environment, with jar files and manifests, is not yet defined.
The table below shows the list of attributes and properties that Tiny DOM implementations must support. Each light gray section lists one or multiple elements for which the subsequent attributes or properties apply. Each attribute row lists the allowed getter and setter (s). This table is not normative.
Property |
Trait
Getter |
Trait
Setter |
|
---|---|---|---|
<svg>, <rect>, <circle>, <ellipse>, <line>, <path>, <g>, <image>, <text>, and <a> | |||
color |
getRGBColorTrait |
setTrait [inherit] setRGBColorTrait [SVGRGBColor] |
|
display |
getTrait |
setTrait [inline | none | inherit ] | |
fill |
getRGBColorTrait |
setRGBColorTrait [null |
SVGRGBColor] setTrait(none | currentColor | inherit) |
|
fill-rule |
getTrait |
setTrait(nonzero | evenodd | inherit) | |
stroke | getRGBColorTrait [null, SVGRGBColor] | setRGBColorTrait [null |
SVGRGBColor] setTrait(none | currentColor | inherit) |
|
stroke-dashoffset | getFloatTrait | setTrait [inherit] setFloatTrait |
|
stroke-linecap | getTrait [butt | round | square] | setTrait [butt | round | square | inherit] | |
stroke-linejoin | getTrait [miter | round | bevel ] | setTrait [miter | round | bevel | inherit] | |
stroke-miterlimit | getFloatTrait [ value >= 1] | setTrait [inherit] setFloatTrait [value >= 1] |
|
stroke-width | getFloatTrait [value >= 0] | setTrait [inherit] setFloatTrait [value >= 0] |
|
visibility | getTrait [visible | hidden | collapse] | setTrait [visible | hidden | collapse | inherit] | |
<svg>, <text>, <g>,
<a> |
|||
font-familly |
getTrait [single, computed
font-family value] |
setTrait [same syntax as font-family
attribute] |
|
font-size |
getFloatTrait [value >=
0] |
setFloatTrait [value >= 0] setTrait [inherit] |
|
font-style |
getTrait [normal | italic | oblique ] | setTrait [normal | italic | oblique | inherit] | |
font-weight |
getTrait [100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 ] |
setTrait [normal | bold | bolder |
lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit] |
|
text-anchor |
getTrait [start | middle |
end] |
setTrait [start | middle | end |
inherit ] |
|
|
|||
Attribute |
Trait
Getter |
Trait
Setter |
|
<rect>, <circle>, <ellipse>, <line>, <path>, <g>, <image>, <text>, and <a> | |||
transform |
getMatrixTrait |
setMatrixTrait |
|
<circle> |
|||
cx |
getFloatTrait |
setFloatTrait |
|
cy |
getFloatTrait |
setFloatTrait |
|
r |
getFloatTrait [ value >=
0] |
setFloatTrait [value >=
0] |
|
<ellipse> |
|||
cx |
getFloatTrait |
setFloatTrait |
|
cy |
getFloatTrait |
setFloatTrait |
|
rx |
getFloatTrait [value >=
0] |
setFloatTrait [value >=
0] |
|
ry |
getFloatTrait [value >=
0] |
setFloatTrait [value >=
0] |
|
<path> (path-length is
not supported) |
|||
d |
getPathTrait [non null
value] |
setPathTrait [non null
value] |
|
<rect> |
|||
height |
getFloatTrait [ value >=
0] |
setFloatTrait [ value >=
0] |
|
width |
getFloatTrait [ value >= 0] | setFloatTrait [ value >= 0] | |
x |
getFloatTrait |
setFloatTrait |
|
y |
getFloatTrait |
setFloatTrait |
|
rx |
getFloatTrait [value >= 0] | setFloatTrait [value >= 0] | |
ry |
getFloatTrait [value >=
0] |
setFloatTrait [value >=
0] |
|
<image> |
|||
x |
getFloatTrait |
setFloatTrait |
|
y |
getFloatTrait |
setFloatTrait |
|
width |
getFloatTrait [value >=
0] |
setFloatTrait [value >=
0] |
|
height |
getFloatTrait [value >=
0] |
setFloatTrait [value >=
0] |
|
xlink:href |
getTrait NS[absolute URI, factoring
in xml:base] |
setTraitNS [non local-URI
value] |
|
<a> |
|||
target |
getTrait |
setTrait |
|
xlink:href |
getTraitNS[absolute URI, factoring
in xml:base] |
setTraitNS |
|
<text> (Notes: For 'x' and 'y', it is only possible to provide floating point scalar values; an array of x or y values is not supported. 'rotate' attribute is not supported.) |
|||
x |
getFloatTrait |
setFloatTrait |
|
y |
getFloatTrait |
setFloatTrait |
|
#text |
getTrait [not null] |
setTrait [not null] |
|
<svg> |
|||
version |
Readonly, throws DOMException of
type NO_MODIFICATION_ALLOWED_ERR |
getTrait |
|
baseProfile |
Readonly, throws DOMException of
type NO_MODIFICATION_ALLOWED_ERR |
getTrait |
|
viewBox |
setRectTrait |
getRectTrait |
|
zoomAndPan |
setTrait [disable |
magnify] |
getTrait [disable |
magnify] |
|
<line> |
|||
x1 |
setFloatTrait |
getFloatTrait |
|
x2 |
setFloatTrait |
getFloatTrait |
|
y1 |
setFloatTrait |
getFloatTrait |
|
y2 |
setFloatTrait |
getFloatTrait |
pragmas { java.jni.api.name="org.w3c.dom"; core.package.vendor="W3C"; core.package.name="SVG Tiny"; core.package.id="svgt"; }; [ comment="subsetted DOM Core"; java.jni.api.name="org.w3c.dom"; ] module dom { exception DOMException { unsigned short code; }; interface Document; typedef string DOMString; // ExceptionCode const unsigned short INDEX_SIZE_ERR = 1; const unsigned short HIERARCHY_REQUEST_ERR = 3; const unsigned short WRONG_DOCUMENT_ERR = 4; const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; const unsigned short NOT_FOUND_ERR = 8; const unsigned short NOT_SUPPORTED_ERR = 9; const unsigned short INVALID_MODIFICATION_ERR = 13; const unsigned short INVALID_ACCESS_ERR = 15; const unsigned short TYPE_MISMATCH_ERR = 17; interface Node { readonly attribute Node parentNode; readonly attribute DOMString namespaceURI; readonly attribute DOMString localName; Node insertBefore(in Node newChild, in Node refChild) raises(DOMException); Node removeChild(in Node oldChild) raises(DOMException); Node appendChild(in Node newChild) raises(DOMException); }; interface Element : Node { }; interface Document : Node { readonly attribute Element documentElement; Element createElementNS(in DOMString namespaceURI, in DOMString qualifiedName) raises(DOMException); Element getElementById(in DOMString elementId); }; }; module events { typedef dom::DOMString DOMString; interface EventListener; interface Event; interface EventTarget { void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture); void removeEventListener(in DOMString type, in EventListener listener, in boolean useCapture); }; interface EventListener { void handleEvent(in Event evt); }; interface Event { readonly attribute DOMString type; readonly attribute EventTarget currentTarget; }; interface MouseEvent : Event { readonly attribute long screenX; readonly attribute long screenY; readonly attribute long clientX; readonly attribute long clientY; readonly attribute unsigned short button; }; }; module smil { interface ElementTimeControl { boolean beginElementAt( in float offset ); boolean endElementAt( in float offset ); }; }; module svg { typedef dom::DOMString DOMString; typedef dom::DOMException DOMException; typedef dom::Document Document; typedef dom::Element Element; interface SVGSVGElement; interface SVGMatrix; exception SVGException { unsigned short code; }; // SVGExceptionCode const unsigned short SVG_INVALID_VALUE_ERR = 1; const unsigned short SVG_MATRIX_NOT_INVERTABLE = 2; interface SVGRect { attribute float x; attribute float y; attribute float width; attribute float height; }; interface SVGPoint { attribute float x; attribute float y; }; interface SVGMatrix { float getComponent(in unsigned long index) raises(dom::DOMException); SVGMatrix multiply( in SVGMatrix secondMatrix ); SVGMatrix inverse() raises( SVGException ); SVGMatrix translate( in float x, in float y ); SVGMatrix scale( in float scaleFactor ); SVGMatrix rotate( in float angle ); }; interface SVGPath { const unsigned short MOVE_TO = 0x4d; // 'M' const unsigned short LINE_TO = 0x4C; // 'L' const unsigned short CURVE_TO = 0x43;// 'C' const unsigned short QUAD_TO = 0x51; // 'Q' const unsigned short CLOSE = 0x5a; // 'Z' readonly attribute unsigned long numberOfSegments; unsigned short getSegment( in unsigned long index ) raises(dom::DOMException); float getSegmentParam( in unsigned long cmdIndex, in unsigned long paramIndex ) raises(dom::DOMException); void moveTo( float x, float y ); void lineTo( float x, float y ); void quadTo( float x1, float y1, float x2, float y2 ); void curveTo( float x1, float y1, float x2, float y2, float x3, float y3 ); void close(); }; interface SVGRGBColor { readonly attribute unsigned long red; readonly attribute unsigned long green; readonly attribute unsigned long blue; }; interface SVGLocatable { SVGRect getBBox(); SVGMatrix getScreenCTM(); SVGRect getScreenBBox(); }; interface TraitAccess { DOMString getTrait( in DOMString name ) raises (DOMException); DOMString getTraitNS( in DOMString namespaceURI, in DOMString name ) raises (DOMException); float getFloatTrait( in DOMString name ) raises (DOMException); SVGMatrix getMatrixTrait( in DOMString name ) raises (DOMException); SVGRect getRectTrait( in DOMString name ) raises (DOMException); SVGPath getPathTrait( in DOMString name ) raises (DOMException); SVGRGBColor getRGBColorTrait( in DOMString name ) raises (DOMException); void setTrait( in DOMString name, in DOMString value ) raises (DOMException); void setTraitNS( in DOMString namespaceURI, in DOMString name, in DOMString value ) raises (DOMException); void setFloatTrait( in DOMString name, in float value ) raises (DOMException); void setMatrixTrait( in DOMString name, in SVGMatrix matrix ) raises (DOMException); void setRectTrait( in DOMString name, in SVGRect rect ) raises (DOMException); void setPathTrait( in DOMString name, in SVGPath path ) raises (DOMException); void setRGBColorTrait( in DOMString name, in SVGRGBColor color ) raises (DOMException); }; interface ElementTraversal { readonly attribute Element firstElementChild; readonly attribute Element lastElementChild; readonly attribute Element nextElementSibling; readonly attribute Element previousElementSibling; }; interface SVGElement : dom::Element, ElementTraversal, events::EventTarget, TraitAccess { attribute DOMString id; // raises (DOMException) on setting }; interface SVGLocatableElement : SVGElement, SVGLocatable { }; interface SVGAnimationElement : SVGElement, smil::ElementTimeControl { }; interface SVGSVGElement : SVGLocatableElement { attribute float currentScale; // raises (DOMException) on setting attribute float currentRotate; // raises (DOMException) on setting readonly attribute SVGPoint currentTranslate; readonly attribute SVGRect viewport; void pauseAnimations(); void unpauseAnimations(); boolean animationsPaused(); float getCurrentTime(); void setCurrentTime( in float seconds ); SVGMatrix createSVGMatrixComponents( float a, float b, float c, float d, float e, float f ); SVGRect createSVGRect(); SVGPath createSVGPath(); SVGRGBColor createSVGRGBColor( in unsigned long red, in unsigned long green, in unsigned long blue ) raises(SVGException); }; interface EventListenerInitializer { void initializeEventListeners(dom::Document doc); }; };