1.1では,文書オブジェクトにアクセスしそれらを操作するためのオブジェクト及びインタフェースの集合を定義する。1.1で規定する機能(コア 機能)は,ソフトウェア開発者及びウェブスクリプト作成者が,適合する製品の内部で構文解析されたHTML及びXMLの内容にアクセスしそれらを操作できるのに十分なものとする。DOMコアAPIは,DOM API呼出しだけを使って,Documentオブジェクトを生成し存在させることも可能とする。Documentのロード及びそれの永続的な保存は,DOM APIを実装する製品に委ねることとする。
Document object
using only DOM API calls; loading a Document and saving it
persistently is left to the product that implements the DOM
API.
DOMは,他の更に特殊化されたインタフェースも実装するNodeオブジェクトの階層として,文書を表現する。ノードのある型は,様々な型の 子 ノードをもってよく,ノードのその他の型は,文書構造においてそれよりも下位に何ももつことができない葉ノードとなる。XML及びHTMLに対して,そのノード型,及びそれらが子供としてどのノード型をもってよいかを,次に示す。
Node objects that
also implement other, more specialized interfaces. Some types of
nodes may have child
nodes of various types, and others are leaf nodes that cannot have
anything below them in the document structure. For XML and HTML,
the node types, and which node types they may have as children, are
as follows:
Document --
Element (最大でも1個),ProcessingInstruction,Comment,DocumentType (最大でも1個)DocumentFragment --
Element,ProcessingInstruction,Comment,Text,CDATASection,EntityReferenceDocumentType --
子供なしEntityReference --
Element,ProcessingInstruction,Comment,Text,CDATASection,EntityReferenceElement --
Element,Text,Comment,ProcessingInstruction,CDATASection,EntityReferenceAttr --
Text,EntityReferenceProcessingInstruction --
子供なしComment --
子供なしText --
子供なしCDATASection --
子供なしEntity --
Element,ProcessingInstruction,Comment,Text,CDATASection,EntityReferenceNotation --
子供なしDocument -- Element (maximum of
one), ProcessingInstruction,
Comment, DocumentType
(maximum of one)DocumentFragment --
Element, ProcessingInstruction,
Comment, Text, CDATASection, EntityReferenceDocumentType
-- no childrenEntityReference -- Element, ProcessingInstruction,
Comment, Text, CDATASection, EntityReferenceElement -- Element, Text, Comment, ProcessingInstruction,
CDATASection, EntityReferenceAttr -- Text, EntityReferenceProcessingInstruction
-- no childrenComment --
no childrenText -- no
childrenCDATASection
-- no childrenEntity -- Element, ProcessingInstruction,
Comment, Text, CDATASection, EntityReferenceNotation -- no
childrenDOMは,Nodeの子供又はElementインタフェースのgetElementsByTagNameメソッドが返す element 要素といった順序付きリストを扱うためにNodeListインタフェースも規定する。さらに,Elementの属性などの名前属性が参照するノードの順序なし集合を扱うためにNamedNodeMapも規定する。DOMにおける NodeListオブジェクト及びNamedNodeMapオブジェクトは,活性化している(live)とする。すなわち,元となる文書構造への変更は,すべての関連するNodeListオブジェクト及びNamedNodeMapオブジェクトに反映される。例えば,DOM利用者がElementの子供を含むNodeListオブジェクトを得て,それに続いて,その 要素 に子供を更に追加する(,子供を削除する,又は子供を修正する)場合,それらの変更は,利用者側でそれ以上のことをしなくとも,自動的にNodeListに反映される。同様に,木のNodeへの変更は,NodeList及びNamedNodeMapにおけるそのNodeへのすべての参照に反映される。
NodeList interface
to handle ordered lists of Nodes, such as the
children of a Node, or the elements returned by
the getElementsByTagName method of the Element interface,
and also a NamedNodeMap
interface to handle unordered sets of nodes referenced by their
name attribute, such as the attributes of an Element. NodeList and NamedNodeMap
objects in the DOM are live; that is, changes to the
underlying document structure are reflected in all relevant NodeList and NamedNodeMap
objects. For example, if a DOM user gets a NodeList object
containing the children of an Element, then
subsequently adds more children to that element (or removes
children, or modifies them), those changes are automatically
reflected in the NodeList, without
further action on the user's part. Likewise, changes to a Node in the tree
are reflected in all references to that Node in NodeList and NamedNodeMap
objects.
Textインタフェース,Commentインタフェース及びCDATASectionインタフェースは,すべて,CharacterDataインタフェースから継承される。
Text, Comment, and CDATASection all
inherit from the CharacterData
interface.
この規定が定義するAPIの大部分は,クラスではなく インタフェース とする。これは,実装には,定義された名前及び規定された操作をもつメソッドの開示だけが必要とされ,直接にそのインタフェースに対応するクラスの実装は必要とはされないことを意味する。これによって,それ自体のデータ構造をもつ既存アプリケーションの上に,又は異なるクラス階層をもつ新しいアプリケーションの上に,薄い張り板を張るようにDOM APIを実装することが可能になる。このことは,構成される必要がある基盤となるオブジェクトがDOMインタフェースと関係をほとんどもたなくともよいので,Java又はC++の意味での通常のコンストラクタは,DOMオブジェクトを生成するために使用できないことも意味する。この問題に対するオブジェクト指向設計での従来の解は,様々なインタフェースを実装するオブジェクトのインスタンスを複数生成する ファクトリ(factory) メソッドを定義することである。インタフェース"X"を実装するオブジェクトは,Documentインタフェースの"createX()"メソッドによって生成される。この理由は,すべてのDOMオブジェクトは,特定の文書の文脈中で活性化(live)していることによる。
Document interface;
this is because all DOM objects live in the context of a specific
Document.
DOM水準2のAPIは,DOMImplementationオブジェクトを生成する標準的な方法を定義 しない。すなわち,DOM実装は,これらのDOMインタフェースをブートストラップする独自の方法を提供しなければならない。他のすべてのオブジェクトは,そこから構築できる。
DOMImplementation
objects; DOM implementations must provide some proprietary way of
bootstrapping these DOM interfaces, and then all other objects can
be built from there.
コアDOM APIは,一般利用者のスクリプト言語,及び主として専門家のプログラマが使用するより挑戦的な言語の両方を含む,広範囲な言語との互換性をもつ設計がなされている。したがって,DOM APIは,多様なメモリ管理方式に渡って動作する必要がある。すなわち,メモリ管理を利用者に全く見せない言語への束縛,すなわち,明示的なコンストラクタを提供するが,未使用メモリを自動的に回収するための自動ガベジコレクション機構を提供する言語(特にJava)への束縛から,オブジェクトメモリを明示的に割り当て,それが使用されている場所を追跡し,再使用のためにそれを明示的に解放することを一般にプログラマに要求する言語(特にC及びC++)への束縛までの様々な方式で動作する必要がある。これらのプラットフォームに渡って一貫性のあるAPIを保証するために,DOMは,メモリ管理の問題に言及せず,代わりに,この問題を実装に任せる。(ECMAScript及びJavaのために)DOM APIが定義する明示的な言語束縛は,いずれも,メモリ管理メソッドを必要としないが,他の言語(特にC又はC++)に対するDOM束縛は,そのサポートを必要としてもよい。これらの拡張は,DOM APIを特定の言語に適合させる者の責任とし,DOM作業グループの責任とはしない。
短く,形式的ではなく,内部矛盾がなく,同様のAPIの利用者に馴染み深い属性名及びメソッド名をもつことはよいことだが,その名前が,DOM実装がサポートする既存のAPIにおける名前と衝突することは望ましくない。さらに,OMG IDL及びECMAScriptの両方とも,異なる名前空間を用いて名前のあいまい性を解消する能力に致命的な限界をもっており,これが,短く,馴染み深い名前の名前衝突を避けることを困難にしている。そこで,DOMでの名前は,すべての環境に渡って一意とするために,長く,記述的になる傾向にある。
ECMAScript have significant
limitations in their ability to disambiguate names from different
namespaces that make it difficult to avoid naming conflicts with
short, familiar names. So, DOM names tend to be long and
descriptive in order to be unique across all environments.
作業グループは,様々な用語を用いて内部的に矛盾しないように心掛けもした。ただし,これらの用語は,他のAPIで共通的な区別がなされているとは限らないこともある。例えば,DOM APIは,メソッドが構造モデルを変更する場合にメソッド名"remove(取り除く。名詞は除去。)"を使用し,メソッドが構造モデルの内部の何かを消し去る場合にメソッド名"delete(削除する。名詞は削除。)"を使用する。削除されたものは返されない。取り除かれたものは,それを返すことに意味がある場合には,返されることもある。
DOMコア API は,XML文書又はHTML文書へのインタフェースの二つの幾分異なる集合を表現する。それらは, 継承 の階層を用いる"オブジェクト指向"アプローチを表現するインタフェースと,(Java及びC言語に類似した他の言語における)キャスト又は COM 環境での問合せインタフェース呼出しを要求することなしにNodeインタフェース経由ですべての操作を行えるようにする"単純化された"ビューとの二つとする。これらの操作は,Java及びCOMでは幾分高価なものとなるが,DOMは,性能が重要となる環境で使用してもよい。そこで,Nodeインタフェースを使うだけで重要な機能を可能にできるようにする。 継承 階層を"すべてをNodeとする"DOMへのアプローチよりも理解しやすいとする利用者も多いので,よりオブジェクト指向的な API を好む利用者のために,より高位の完全なインタフェースもサポートする。
Node interface
without requiring casts (in Java and other C-like languages) or
query interface calls in COM environments. These
operations are fairly expensive in Java and COM, and the DOM may be
used in performance-critical environments, so we allow significant
functionality using just the Node interface.
Because many other users will find the inheritance
hierarchy easier to understand than the "everything is a Node" approach to
the DOM, we also support the full higher-level interfaces for those
who prefer a more object-oriented API.
実際には,このことは, API にある程度の冗長性が存在することを意味する。(DOM2の)作業グループは," 継承 "のアプローチをAPIの基本的なビューとし,Nodeに関する機能の完全な集合を利用者が利用してもよい"余分な"機能と考えている。しかし,そのことは,オブジェクト指向解析が示す他のインタフェース上のメソッドの必要性がなくなるわけではない。もちろん,オブジェクト指向解析がNodeインタフェース上のものと同一な属性又はメソッドを与える場合には,完全に冗長なものを規定はしない。このようにして,Nodeインタフェース上に一般的なnodeName属性が存在する場合であっても,Elementインタフェース上にtagName属性が存在する。これらの二つの属性は,同じ値を含まなければならないが,DOM API には満足を与えなければならない異なる利用者がいるので,両方をサポートすることには価値がある。
Node to be "extra"
functionality that users may employ, but that does not eliminate
the need for methods on other interfaces that an object-oriented
analysis would dictate. (Of course, when the O-O analysis yields an
attribute or method that is identical to one on the Node
interface, we don't specify a completely redundant one.) Thus, even
though there is a generic nodeName attribute on the Node
interface, there is still a tagName attribute on the
Element
interface; these two attributes must contain the same value, but
the it is worthwhile to support both, given the different
constituencies the DOM API must satisfy.
DOMString型
DOMString type
相互運用性を確実にするために,DOMは,次を規定する。
DOMStringを符号化しなければならない。
DOMStringでは二つの16ビット単位(高位サロゲート及び低位サロゲート)に対応する場合があってもよい。
DOMString using UTF-16
(defined in [Unicode] and Amendment 1 of [ISO/IEC
10646]).DOMString (a high
surrogate and a low surrogate).
備考
DOMは,文字型の名前をDOMStringと定義しているが,(言語)束縛では異なる名前を使用してもよい。例えばJavaに対しては,DOMStringはString型に束縛される。これは,その符号化としてUTF-16を使用することによる。
備考
2000年8月の時点で,OMG IDL規定([OMGIDL])は,wstring型を含んでいた。しかし,その定義は,文字の幅(バイト数)及び符号化の決定を折衝に依存するので,DOM API の相互運用性基準を満たさなかった。
DOMTimeStamp型
DOMTimeStamp
type
相互運用性を確実にするために,DOMは,次を規定する。
DOMTimeStampは,ミリ秒の数を表現する。
DOMTimeStamp
represents a number of milliseconds.
typedef unsigned long long DOMTimeStamp;
備考
DOMは,型DOMTimeStampを使用するが,(言語)束縛では異なる型を使用してもよい。例えばJavaに対しては,DOMTimeStampは,long型に束縛される。ECMAScriptでは,integer型の範囲があまりにも小さいので,TimeStampは,Date型に束縛される。
DOMTimeStamp,
bindings may use different types. For example for Java, DOMTimeStamp is
bound to the long type. In ECMAScript,
TimeStamp is bound to the Date type
because the range of the integer type is too
small.
DOMは,文字列の照合(マッチ,matching)を示す多くのインタフェースをもつ。HTMLプロセサは,一般に,要素 などの名前を大文字に(非常にまれに小文字に)正規化すると仮定する。一方で,XMLは明示的に大文字・小文字を区別する。DOMの目的のためには,文字列照合は,DOMStringの 16ビット単位 のバイナリ 比較 によってそのまま実行される。さらに,DOMは,あらゆる大文字・小文字の正規化は,DOM構造が構築される 前に,プロセサで行われると仮定する。
DOMString. In addition,
the DOM assumes that any case normalizations take place in the
processor, before the DOM structures are built.
備考 大文字・小文字の正規化に加えて,テキストに対して適用できる付加的な正規化が存在する。W3Cの国際化作業グループでは,どの正規化が必要か,それらをどこで適用するのがよいかを正確に定義することを検討している。W3Cの国際化作業グループは,早い段階で正規化を要求することを期待している。このことは,DOMに読み込まれるデータは,既に正規化されていると仮定することを意味する。この場合,DOM及びその上に構築されるアプリケーションだけが,テキストが変更された場合にテキストは正規化された状態を維持していることを保証しなければならない。詳細については,[Charmod]を参照すること。
DOM水準2は,XML名前空間[Namespaces]をサポートする。これは,DOM水準1の幾つかのインタフェースを強化し,名前空間に関連する 要素 及び属性を生成し操作できるようにすることによって行われる。
DOMに関する限り,XML名前空間 を宣言するために使用する特殊な属性が,今のところ開示されており,他の属性と同様に操作できる。しかし,ノードは,生成されると,永久に 名前空間URI に束縛される。その結果,DOMを使って文書内でノードを移動させても,決して,名前空間接頭辞 にも名前空間URIにも変化は生じない。同様に,名前空間接頭辞及び名前空間URIをもつノードを生成したりノードの名前空間接頭辞を変更しても,適切なXML名前空間を宣言するためにいかなる特殊な属性の追加,削除又は修正が生じることはない。名前空間の妥当性検証は強制されない。DOMアプリケーションの責任とする。特に,接頭辞と名前空間URIとの間の対応付けは強制されないので,一般に,結果として生じる文書は単純には直列化できない。例えば,アプリケーションは,文書を直列化する場合には,使用しているすべての名前空間を宣言しなければならないかもしれない。
DOM水準2は,いかなるURIの正規化又は正準化も実行しない。DOMに与えられたURIは,(例えば,空白などの文字が正しく別扱いされているなどに関して)妥当と仮定され,字句的な検査は実行されない。絶対URI参照は,文字列として扱われ,文字ごとに比較される。相対名前空間URI参照を取り扱う方法は定義しない。相互運用性を確実にするために,絶対名前空間URI参照(すなわち,方式名及びコロンで始まるURI参照)だけを使用するのが望ましい。DOMは字句的な検査を行わないので,DOM水準2のメソッドでは,空文字列は現実の名前空間URIとして扱われることに注意すること。アプリケーションは,名前空間をもつことを望まない場合には,メソッドに対する名前空間URIパラメタとして値nullを使用しなければならない。
null as the namespaceURI parameter for
methods if they wish to have no namespace.
備考 DOMにおいて,すべての名前空間宣言属性は,定義によって,名前空間URI"http://www.w3.org/2000/xmlns/"に束縛される。これらは,名前空間接頭辞 又は 修飾された名前 を"xmlns"とする属性とする。この標準情報(TR)の原規定の作成時には,これはXML名前空間規定[Namespaces]の一部ではないが,将来の版では含まれる予定になっている。
名前空間をもたない文書の中では,EntityReferenceノードの 子 リストは,常に,対応するEntityの子リストと同じとする。これは,実体が束縛されていない 名前空間接頭辞 を含む文書では正しくない。それらの場合には,対応するEntityReferenceノードの 子孫 が,実体参照が存在する場所に依存して,異なる 名前空間URI に束縛されてよい。DOMではノードは常に同じ名前空間URIに束縛され続けるので,それらEntityReferenceノードを移動させることが,直列化できない文書を生じる可能性もある。このことは,DocumentインタフェースのDOM水準1のcreateEntityReferenceメソッドを,それら実体に対応する実体参照を生成するために使用する場合にも正しい。これは,返されたEntityReferenceの 子孫 は束縛されていないことによる。DOM水準2は,名前空間接頭辞を解決する機構をサポートしない。これらすべての理由のために,それら実体及び実体参照は,使用しないか,又は非常に注意して使用することが望ましい。DOMの将来の水準には,これらを取り扱うための追加のサポートを含まれるかもしれない。
EntityReference node
is always the same as that of the corresponding Entity. This is not
true in a document where an entity contains unbound namespace
prefixes. In such a case, the descendants of the
corresponding EntityReference nodes
may be bound to different namespace URIs,
depending on where the entity references are. Also, because, in the
DOM, nodes always remain bound to the same namespace URI, moving
such EntityReference nodes
can lead to documents that cannot be serialized. This is also true
when the DOM Level 1 method createEntityReference of
the Document
interface is used to create entity references that correspond to
such entities, since the descendants of the
returned EntityReference are
unbound. The DOM Level 2 does not support any mechanism to resolve
namespace prefixes. For all of these reasons, use of such entities
and entity references should be avoided or used with extreme care.
A future Level of the DOM may include some additional support for
handling these.
DocumentインタフェースのcreateElementNS及びcreateAttributeNSといった新しいメソッドは,名前空間を意識したアプリケーションが使用することを意図している。名前空間を使用しない単純なアプリケーションは,createElement及びcreateAttributeといったDOM水準1のメソッドを使用できる。この方法で生成される要素及び属性は,名前空間接頭辞,名前空間URI又は局所名をもたない。
createElementNS and
createAttributeNS of the Document interface,
are meant to be used by namespace aware applications. Simple
applications that do not use namespaces can use the DOM Level 1
methods, such as createElement and
createAttribute. Elements and attributes created in
this way do not have any namespace prefix, namespace URI, or local
name.
備考
DOM水準1のメソッドは,名前空間を無視する。そのために,名前空間を扱わない場合にはこれらのメソッドを使用するのは安全だが,それらと新しいものとを同時に使用することは避けたほうがよい。DOM水準1のメソッドだけが,それらのnodeNameによって属性ノードを識別する。これに対して,名前空間に関係するDOM水準2のメソッドは,それらのnamespaceURI及びlocalNameによって属性ノードを識別する。この基本的な違いのために,メソッドの両方の集合を混合することは,予測できない結果を生じる可能性がある。特に,setAttributeNSを使うと, 要素 は,同じnodeNameをもつが異なるnamespaceURIをもつ二つ(以上)の属性をもつかもしれない。そのnodeNameを用いてgetAttributeを呼び出すと,これら属性のどれかが返される。その結果は,実装に依存する。同様に,setAttributeNodeを使うと,異なるnodeNamesをもつが同じprefix及びnamespaceURIをもつ二つ(以上)の属性をもつかもしれない。この場合,getAttributeNodeNSは,実装に依存する方法で,どちらかの属性を返す。これらの場合に保証されるのは,そのnodeNameによって名前付けされた項目にアクセスするすべてのメソッドが,その同じ項目にアクセスし,そのURI及び局所名によってノードにアクセスするすべてのメソッドが,その同じノードにアクセスする,ということだけになる。例えば,setAttribute及びsetAttributeNSは,getAttribute及びgetAttributeNSがそれぞれ返すノードに影響する。
nodeName. On the contrary, the DOM
Level 2 methods related to namespaces, identify attribute nodes by
their namespaceURI and localName. Because
of this fundamental difference, mixing both sets of methods can
lead to unpredictable results. In particular, using
setAttributeNS, an element may have two
attributes (or more) that have the same nodeName, but
different namespaceURIs. Calling
getAttribute with that nodeName could
then return any of those attributes. The result depends on the
implementation. Similarly, using setAttributeNode, one
can set two attributes (or more) that have different
nodeNames but the same prefix and
namespaceURI. In this case
getAttributeNodeNS will return either attribute, in an
implementation dependent manner. The only guarantee in such cases
is that all methods that access a named item by its
nodeName will access the same item, and all methods
which access a node by its URI and local name will access the same
node. For instance, setAttribute and
setAttributeNS affect the node that
getAttribute and getAttributeNS,
respectively, return.
1.2におけるインタフェースは,基礎的 と考えられ,特に指定されない限り,すべてのHTML DOM実装[DOM Level 2 HTML]を含む,DOMのすべての適合する実装によって完全に実装されなければならない。
DOMアプリケーションは,DOMImplementationインタフェースのhasFeature(feature, version)メソッドを,パラメタ値を(それぞれ)"Core"及び"2.0"として使用して,このモジュールが実装によってサポートされているかどうかを決定してもよい。DOM水準2に適合する実装,すなわちDOM水準2モジュールは,コアモジュールに適合しなければならない。この規定の 適合性 についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "Core" and "2.0" (respectively) to
determine whether or not this module is supported by the
implementation. Any implementation that conforms to DOM Level 2 or
a DOM Level 2 module must conform to the Core module. Please refer
to additional information about
conformance in this specification.
DOM操作は,"例外的な"状況でだけ,すなわち,(論理的な理由,データの損失,又は実装が不安定になったといういずれかの理由のために,)操作が実行できない場合にだけ,例外を挙げる。一般に,DOMメソッドは,NodeListを使用しているときの範囲外エラーといった,通常の処理中の状況で特定のエラー値を返す。
NodeList.
実装は,他の状況下では他の例外を挙げるほうがよい。例えば,null引数を渡された場合には,実装は,実装依存の例外を挙げることが望ましい。
null argument
is passed.
例外の概念をサポートしない言語及びオブジェクトシステムも存在する。それらシステムに対しては,そのシステム固有のエラー報告機構を使用して例外条件を示してもよい。例えば,メソッドが,対応するメソッド記述の中にリストとして示されているコードと同様のエラーコードを返す(言語)束縛があってもよい。
exception DOMException {
unsigned short code;
};
// ExceptionCode
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
const unsigned short NO_DATA_ALLOWED_ERR = 6;
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 INUSE_ATTRIBUTE_ERR = 10;
// Introduced in DOM Level 2:
const unsigned short INVALID_STATE_ERR = 11;
// Introduced in DOM Level 2:
const unsigned short SYNTAX_ERR = 12;
// Introduced in DOM Level 2:
const unsigned short INVALID_MODIFICATION_ERR = 13;
// Introduced in DOM Level 2:
const unsigned short NAMESPACE_ERR = 14;
// Introduced in DOM Level 2:
const unsigned short INVALID_ACCESS_ERR = 15;
発生したエラーの型を示す整数。
備考 他の数値コードは,潜在的な将来の使用のためにW3Cで予約されている。
DOMSTRING_SIZE_ERRHIERARCHY_REQUEST_ERRINDEX_SIZE_ERRINUSE_ATTRIBUTE_ERRINVALID_ACCESS_ERR,DOM水準2で導入
INVALID_CHARACTER_ERRINVALID_MODIFICATION_ERR,DOM水準2で導入
INVALID_STATE_ERR,DOM水準2で導入
NAMESPACE_ERR,DOM水準2で導入
NOT_FOUND_ERRNOT_SUPPORTED_ERRNO_DATA_ALLOWED_ERRNO_MODIFICATION_ALLOWED_ERRSYNTAX_ERR,DOM水準2で導入
WRONG_DOCUMENT_ERR
DOMImplementationインタフェースは,文書オブジェクトモデルのあらゆる特定のインスタンスに独立な操作を実行するために多くのメソッドを提供する。
DOMImplementation interface provides a number
of methods for performing operations that are independent of any
particular instance of the document object model.
interface DOMImplementation {
boolean hasFeature(in DOMString feature,
in DOMString version);
// Introduced in DOM Level 2:
DocumentType createDocumentType(in DOMString qualifiedName,
in DOMString publicId,
in DOMString systemId)
raises(DOMException);
// Introduced in DOM Level 2:
Document createDocument(in DOMString namespaceURI,
in DOMString qualifiedName,
in DocumentType doctype)
raises(DOMException);
};
createDocument,DOM水準2で導入
Documentオブジェクトを生成する。HTML専用のDOM実装は,このメソッドを実装する必要はない。
Document object of the
specified type with its document element. HTML-only DOM
implementations do not need to implement this method.
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのqualifiedName
qualifiedName of type DOMString
DocumentTypeのdoctype
doctype of type DocumentType
null。
doctypeがnullでない場合,そのNode.ownerDocument属性は,生成されている文書に設定される。
null.doctype is not null, its Node.ownerDocument
attribute is set to the document being created.|
INVALID_CHARACTER_ERR: 指定された修飾された名前が不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character.
NAMESPACE_ERR:
NAMESPACE_ERR: Raised if the
qualifiedName is
malformed, if the qualifiedName has a prefix and the
namespaceURI is null, or if the
qualifiedName has a prefix that is "xml" and the
namespaceURI is different from "http://www.w3.org/XML/1998/namespace"
[Namespaces].
WRONG_DOCUMENT_ERR:
WRONG_DOCUMENT_ERR: Raised if
doctype has already
been used with a different document or was created from a different
implementation.
|
createDocumentType,DOM水準2で導入
DocumentTypeノードを生成する。実体宣言及び記法は利用可能としない。実体参照拡張及びデフォルト属性追加は出現しない。DOMの将来の版では,DocumentTypeを与える方法を提供することが期待されている。
DocumentType node.
Entity declarations and notations are not made available. Entity
reference expansions and default attribute additions do not occur.
It is expected that a future version of the DOM will provide a way
for populating a DocumentType.DOMStringのqualifiedName
qualifiedName of type DOMString
DOMStringのpublicId
publicId of type DOMString
DOMStringのsystemId
systemId of type DOMString
|
|
|
INVALID_CHARACTER_ERR: 指定された修飾された名前が不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character.
NAMESPACE_ERR:
NAMESPACE_ERR: Raised if the
qualifiedName is
malformed.
|
hasFeatureDOMStringのfeature
feature of type DOMString
DOMStringのversion
version of type DOMString
trueを返す。
true.|
|
機能が指定された版で実装されている場合には, true if the feature is implemented in the specified
version, false otherwise.
|
DocumentFragmentは,"軽量の"又は"最小の"Documentとする。文書の木の一部を抽出できたり,文書の新しい素片を生成できたりして欲しいということは,非常によくあることである。切取りなどの利用者命令を実装したり,素片を動かすことによって文書を再編成することを想像してみる。それら素片を保持できるオブジェクトをもつことが望ましく,この目的のためにNodeを使用するのは極めて自然である。Documentオブジェクトがこの役割を果すことができるのは正しいが,Documentオブジェクトは,基礎となる実装に依存して,潜在的には重いオブジェクトになる可能性がある。これを行うために本当に必要なものは,軽量のオブジェクトである。DocumentFragmentは,そうしたオブジェクトとする。
DocumentFragment is a "lightweight" or "minimal" Document object. It is
very common to want to be able to extract a portion of a document's
tree or to create a new fragment of a document. Imagine
implementing a user command like cut or rearranging a document by
moving fragments around. It is desirable to have an object which
can hold such fragments and it is quite natural to use a Node for
this purpose. While it is true that a Document object could
fulfill this role, a Document object can
potentially be a heavyweight object, depending on the underlying
implementation. What is really needed for this is a very
lightweight object. DocumentFragment is such an
object.
さらに,他のNodeの子供としてノードを挿入するなどの,様々な操作には,引数としてDocumentFragmentオブジェクトを取ってもよい。これは,DocumentFragmentのすべての子ノードがこのノードの子リストに移動するという結果を生じる。
Node -- may take
DocumentFragment objects as arguments; this results in
all the child nodes of the DocumentFragment being
moved to the child list of this node.
DocumentFragmentノードの子供は,文書の構造を定義するあらゆる部分木の最上位を表現する0個以上のノードになる。DocumentFragmentノードは,整形式のXML文書 である必要はない。(ただし,それらは,複数の最上位ノードをもつことができる整形式のXML解析対象実体に課せられた規則に従う必要はある。)例えば,DocumentFragmentはただ一つの子だけをもつかもしれないし,その子ノードはTextノードになってもよい。それら構造モデルは,HTML文書も整形式XML文書も表現しない。
DocumentFragment node are zero or
more nodes representing the tops of any sub-trees defining the
structure of the document. DocumentFragment nodes do
not need to be well-formed XML
documents (although they do need to follow the rules
imposed upon well-formed XML parsed entities, which can have
multiple top nodes). For example, a DocumentFragment
might have only one child and that child node could be a Text node. Such a
structure model represents neither an HTML document nor a
well-formed XML document.
DocumentFragmentがDocument(又は実際には子供をとってもよい任意の他のNode)に挿入される場合には,DocumentFragmentそれ自体ではなくDocumentFragmentの子供が,Nodeに挿入される。このことは,利用者が 兄弟 のノードを生成したい場合に,DocumentFragmentを非常に役立つものとする。すなわち,DocumentFragmentは,これらノードの親として動作し,その結果として,利用者は,Nodeインタフェースからの,insertBefore及びappendChildといった標準的なメソッドを利用できるようになる。
DocumentFragment is inserted into a Document (or indeed
any other Node
that may take children) the children of the
DocumentFragment and not the
DocumentFragment itself are inserted into the Node. This makes
the DocumentFragment very useful when the user wishes
to create nodes that are siblings; the
DocumentFragment acts as the parent of these nodes so
that the user can use the standard methods from the Node
interface, such as insertBefore and
appendChild.
interface DocumentFragment : Node {
};
Documentインタフェースは,HTML文書又はXML文書の全体を表現する。概念的には,それは,文書木の ルート であって,文書のデータへの基本的なアクセスを提供する。
Document interface represents the entire HTML
or XML document. Conceptually, it is the root of the document
tree, and provides the primary access to the document's data.
要素,テキストノード,注釈,処理命令などはDocumentの内容の外部には存在できないので,Documentインタフェースは,これらオブジェクトを生成するために必要なファクトリ(工場)メソッドも含む。生成されるNodeオブジェクトは,ownerDocument属性をもつが,この属性は,要素などが内部に生成された内容をもつDocumentとその要素などを関連付けている。
Document,
the Document interface also contains the factory
methods needed to create these objects. The Node objects
created have a ownerDocument attribute which
associates them with the Document within whose context
they were created.
interface Document : Node {
readonly attribute DocumentType doctype;
readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
Element createElement(in DOMString tagName)
raises(DOMException);
DocumentFragment createDocumentFragment();
Text createTextNode(in DOMString data);
Comment createComment(in DOMString data);
CDATASection createCDATASection(in DOMString data)
raises(DOMException);
ProcessingInstruction createProcessingInstruction(in DOMString target,
in DOMString data)
raises(DOMException);
Attr createAttribute(in DOMString name)
raises(DOMException);
EntityReference createEntityReference(in DOMString name)
raises(DOMException);
NodeList getElementsByTagName(in DOMString tagname);
// Introduced in DOM Level 2:
Node importNode(in Node importedNode,
in boolean deep)
raises(DOMException);
// Introduced in DOM Level 2:
Element createElementNS(in DOMString namespaceURI,
in DOMString qualifiedName)
raises(DOMException);
// Introduced in DOM Level 2:
Attr createAttributeNS(in DOMString namespaceURI,
in DOMString qualifiedName)
raises(DOMException);
// Introduced in DOM Level 2:
NodeList getElementsByTagNameNS(in DOMString namespaceURI,
in DOMString localName);
// Introduced in DOM Level 2:
Element getElementById(in DOMString elementId);
};
DocumentTypeのdoctype,読取り専用
doctype of type DocumentType,
readonly
DocumentType参照)。文書型宣言をもたないXML文書と同様にHTML文書に対しては,これはnullを返す。DOM水準2は,文書型宣言の編集はサポートしない。docTypeは,insertNode又はremoveNodeといったNodeインタフェースから継承されたメソッドの使用を通した場合を含むいかなる方法でも,警告されることはできない。
DocumentType)
associated with this document. For HTML documents as well as XML
documents without a document type declaration this returns
null. The DOM Level 2 does not support editing the
Document Type Declaration. docType cannot be altered
in any way, including through the use of methods inherited from the
Node interface,
such as insertNode or removeNode.ElementのdocumentElement,読取り専用
documentElement of type Element,
readonly
tagNameを"HTML"とする要素とする。
DOMImplementationのimplementation,読取り専用
implementation of type DOMImplementation,
readonly
DOMImplementationオブジェクト。DOMアプリケーションは,複数の実装からのオブジェクトを使用してもよい。
DOMImplementation
object that handles this document. A DOM application may use
objects from multiple implementations.createAttributeAttrを生成する。Attrインスタンスは,setAttributeNodeメソッドを使ってElement上に設定できることに注意すること。
createAttributeNSメソッドを使用する。
Attr of the given
name. Note that the Attr instance can
then be set on an Element using the
setAttributeNode method.createAttributeNS method.
|
INVALID_CHARACTER_ERR: 指定された名前が不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.
|
createAttributeNS,DOM水準2で導入
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのqualifiedName
qualifiedName of type DOMString
|
次の属性をもつ新しい
A new
Attr object with the
following attributes:
|
|
INVALID_CHARACTER_ERR: 指定された修飾された名前が不正な文字を含んでいる場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character.
NAMESPACE_ERR:
NAMESPACE_ERR: Raised if the
qualifiedName is
malformed, if the qualifiedName has a prefix and the
namespaceURI is null, if the
qualifiedName has a prefix that is "xml" and the
namespaceURI is different from "http://www.w3.org/XML/1998/namespace",
or if the qualifiedName is "xmlns" and the
namespaceURI is different from "http://www.w3.org/2000/xmlns/".
|
createCDATASectionCDATASectionを生成する。
CDATASection node
whose value is the specified string.
DOMStringのdata
data of type DOMString
CDATASection内容に対するデータ。
CDATASection
contents.|
新しい
The new
CDATASection
object.
|
|
NOT_SUPPORTED_ERR: この文書がHTML文書の場合に,挙げられる。
NOT_SUPPORTED_ERR: Raised if this document is an HTML
document.
|
createCommentcreateDocumentFragmentDocumentFragmentオブジェクトを生成する。
DocumentFragment
object.
|
新しい
A new
DocumentFragment.
|
createElementElementを実装していることに注意すること。そのために,属性は,返されたオブジェクト上に直接に指定できる。Attrノードが,自動的に生成されその要素に添付される。createElementNSメソッドを使用すること。
Element interface,
so attributes can be specified directly on the returned
object.Attr nodes
representing them are automatically created and attached to the
element.createElementNS method.
DOMStringのtagName
tagName of type DOMString
tagNameパラメタを提供してよいが,DOM実装によって正準的な大文字の形式に対応付けられなければならない。
tagName parameter may be
provided in any case, but it must be mapped to the canonical
uppercase form by the DOM implementation.|
INVALID_CHARACTER_ERR: 指定された名前が不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.
|
createElementNS,DOM水準2で導入
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのqualifiedName
qualifiedName of type DOMString
|
次の属性をもつ新しい
A new
Element object with
the following attributes:
|
|
INVALID_CHARACTER_ERR: 指定された修飾された名前が不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character.
NAMESPACE_ERR:
NAMESPACE_ERR: Raised if the
qualifiedName is
malformed, if the qualifiedName has a prefix and the
namespaceURI is null, or if the
qualifiedName has a prefix that is "xml" and the
namespaceURI is different from "http://www.w3.org/XML/1998/namespace"
[Namespaces].
|
createEntityReferenceEntityReferenceオブジェクトを生成する。さらに,参照される実体が既知の場合には,EntityReferenceノードの子リストは,対応するEntityノードの子リストと同じとされる。
EntityReference
object. In addition, if the referenced entity is known, the child
list of the EntityReference node
is made the same as that of the corresponding Entity node.
備考
Entityノードの子孫が束縛されていない 名前空間接頭辞 をもつ場合には,生成されたEntityReferenceノードの対応する子孫も束縛されない。すなわち,そのnamespaceURIはnullとなる。DOM水準2は,名前空間接頭辞を解決するいかなる機構もサポートしない。
Entity node has an
unbound namespace
prefix, the corresponding descendant of the created EntityReference node
is also unbound; (its namespaceURI is
null). The DOM Level 2 does not support any mechanism
to resolve namespace prefixes.
|
新しい
The new
EntityReference
object.
|
|
INVALID_CHARACTER_ERR: 指定された名前が不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.
NOT_SUPPORTED_ERR: この文書がHTML文書の場合に,挙げられる。
NOT_SUPPORTED_ERR: Raised if this document is an HTML
document.
|
createProcessingInstructionProcessingInstructionを生成する。
ProcessingInstruction
node given the specified name and data strings.
|
新しい
The new
ProcessingInstruction
object.
|
|
INVALID_CHARACTER_ERR: 指定されたターゲットが不正な文字を含む場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified target contains
an illegal character.
NOT_SUPPORTED_ERR: この文書がHTML文書の場合に,挙げられる。
NOT_SUPPORTED_ERR: Raised if this document is an HTML
document.
|
createTextNodegetElementById,DOM水準2で導入getElementsByTagNamegetElementsByTagNameNS,DOM水準2で導入importNode,DOM水準2で導入parentNodeはnullとする。源となるノードは,元の文書から変更されたり取り除かれたりしない。このメソッドは,源となるノードの新しいコピーを生成する。
nodeName及びnodeTypeと同一の属性値,及び名前空間(prefix,localName及びnamespaceURI)に関係する属性をともなって,生成される。Node上のcloneNode操作におけるのと同様に,源となるノードは変更されない。
nodeTypeに適切な仕方でコピーされる。このコピーの際に,XML又はHTMLの源(となる文書)の素片がある文書から他の文書へとコピーされた場合には,期待される振る舞いを写し出す試みを行い,XMLの場合には,二つの文書が異なるDTDをもってよいということを認識する。次のリストに,ノードの各々型の詳細を示す。
Attrにおいて,ownerElement属性はnullに設定され,specifiedフラグはtrueに設定される。源となるAttrの 子孫 は,再帰的にインポートされ,その結果生じるノードは,対応する部分木を形成するために再び組み立てられる。
deepパラメタは,Attrノードには影響しないことに注意。それらのノードは,インポートされるときに,常にそれらとともにそれらの子供を運んでくる。
deepオプションがtrueに設定された場合,源となる要素の 子孫 は,再帰的にインポートされ,結果として生じるノードは,対応する部分木を形成するために再び組み立てられる。そうでない場合には,単に,空のDocumentFragmentを生成する。
Documentノードは,インポートできない。DocumentTypeノードは,インポートできない。Attrノードは,生成されたElementに添付される。デフォルト属性は,コピーされ ない。ただし,インポートされている文書がこの要素名に対してデフォルト属性を定義する場合には,それらが割り当てられる。importNodeのdeepパラメタがtrueに設定された場合,源となる要素の 子孫 は,再帰的にインポートされ,結果として生じるノードは,対応する部分木を形成するために再び組み立てられる。
Entityノードはインポートできるが,DOMの現在の公開された版では,DocumentTypeは読取り専用とする。これらインポートされたノードをDocumentTypeに追加する機能が,DOMの将来の版に追加されることが検討されることになっている。
publicId属性,systemId属性及びnotationName属性は,コピーされる。deep(深い)インポートが要求される場合,源となるEntityの 子孫 は,再帰的にインポートされ,結果として生じるノードは,部分木を形成するために再び組み立てられる。
deepインポートが要求されたとしても,EntityReferenceそれ自体だけがコピーされる。これは,インポート元の文書及びインポート先の文書が,実体を異なって定義しているかもしれないことによる。インポートされる文書がこの実体の名前に対して定義を提供する場合には,その値が割り当てられる。
Notationノードはインポートできるが,DOMの現在の公開された版では,DocumentTypeは,読取り専用とする。これらインポートされたノードをDocumentTypeに追加する機能は,DOMの将来の版に追加されることが検討されることになっている。
publicId属性及びsystemId属性は,コピーされる。
deepパラメタは,Notationノードには影響しないことに注意すること。これは,それらのノードが子供をもたないことによる。
target及びdataの値を,源となるノードのそれらの値からコピーする。
CharacterDataから継承されるこれら三つのノードは,data属性及びlength属性を,源となるノードのそれらの属性からコピーする。
NodeのimportedNodebooleanのdeeptrueの場合,指定されたノードの下の部分木を再帰的にインポートする。(値が)falseの場合,既に示したとおりに,そのノードそれ自体だけをインポートする。これは,Attrノード,EntityReferenceノード及びNotationノードには影響しない。
|
この |
|
NOT_SUPPORTED_ERR: インポートされるノードの型がサポートされていない場合に,挙げられる。 |
Nodeインタフェースは,文書オブジェクトモデル全体に対する主要なデータ型とする。それは,文書木の中の一つのノードを表現する。Nodeインタフェースを実装するすべてのオブジェクトは,子供を扱うためのメソッドを開示しているが,Nodeインタフェースを実装するすべてのオブジェクトが子供をもってよいわけではない。例えば,Textノードは,子供をもってはならず,そのようなノードに子供を追加すると,DOMExceptionが挙げられる。
nodeName属性,nodeValue属性及びattributes属性は,特定の派生したインタフェースに(下向きに)キャストすることなくノードで情報を得る機構として含まれる。特定のnodeTypeに対するこれらの属性の明らかな対応付け(例えば,Elementに対してはnodeValue,又はCommentに対してはattributes)が存在しない場合,これは,nullを返す。特殊化されたインタフェースが,重要な情報を取得し設定するために,付加的なより簡便性のある機構を含んでもよいことに注意すること。
interface Node {
// NodeType
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2;
const unsigned short TEXT_NODE = 3;
const unsigned short CDATA_SECTION_NODE = 4;
const unsigned short ENTITY_REFERENCE_NODE = 5;
const unsigned short ENTITY_NODE = 6;
const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
const unsigned short COMMENT_NODE = 8;
const unsigned short DOCUMENT_NODE = 9;
const unsigned short DOCUMENT_TYPE_NODE = 10;
const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
const unsigned short NOTATION_NODE = 12;
readonly attribute DOMString nodeName;
attribute DOMString nodeValue;
// raises(DOMException) on setting
// 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 NamedNodeMap attributes;
// Modified in DOM Level 2:
readonly attribute Document ownerDocument;
Node insertBefore(in Node newChild,
in Node refChild)
raises(DOMException);
Node replaceChild(in Node newChild,
in Node oldChild)
raises(DOMException);
Node removeChild(in Node oldChild)
raises(DOMException);
Node appendChild(in Node newChild)
raises(DOMException);
boolean hasChildNodes();
Node cloneNode(in boolean deep);
// Modified in DOM Level 2:
void normalize();
// Introduced in DOM Level 2:
boolean isSupported(in DOMString feature,
in DOMString version);
// Introduced in DOM Level 2:
readonly attribute DOMString namespaceURI;
// Introduced in DOM Level 2:
attribute DOMString prefix;
// raises(DOMException) on setting
// Introduced in DOM Level 2:
readonly attribute DOMString localName;
// Introduced in DOM Level 2:
boolean hasAttributes();
};
このノードがどの型のノードであるかを示す整数。
備考 200までの数値コードが,潜在的な将来の使用のために,W3Cに対して予約されている。
ATTRIBUTE_NODEAttrになっている。CDATA_SECTION_NODECDATASectionになっている。COMMENT_NODEComment。DOCUMENT_FRAGMENT_NODEDocumentFragmentになっている。DOCUMENT_NODEDocumentになっている。DOCUMENT_TYPE_NODEDocumentTypeになっている。ELEMENT_NODEElementになっている。ENTITY_NODEEntityになっている。ENTITY_REFERENCE_NODEEntityReferenceになっている。NOTATION_NODENotationになっている。PROCESSING_INSTRUCTION_NODEProcessingInstructionになっている。TEXT_NODETextノードになっている。nodeName,nodeValue及びattributesの値は,次のとおりに,ノード型に従って変化する。
| インタフェース | nodeName | nodeValue | attributes |
|---|---|---|---|
| Attr | 属性の名前 | 属性の値 | null |
| CDATASection | #cdata-section | CDATAセクションの内容 | null |
| Comment | #comment | 注釈の内容 | null |
| Document | #document | null | null |
| DocumentFragment | #document-fragment | null | null |
| DocumentType | 文書型名 | null | null |
| Element | タグ名 | null | NamedNodeMap |
| Entity | 実体名 | null | null |
| EntityReference | 参照された実体の名前 | null | null |
| Notation | 記法名 | null | null |
| ProcessingInstruction | ターゲット | ターゲットを除く内容全体 | null |
| Text | #text | テキストノードの内容 | null |
NamedNodeMapのattributes,読取り専用
Elementの場合には,このノードの属性を含むNamedNodeMap。そうでない場合には,null。
NodeListのchildNodes,読取り専用
NodeList。子供が存在しない場合には,これは,ノードを含まないNodeListになる。
NodeのfirstChild,読取り専用
nullを返す。
NodeのlastChild,読取り専用
nullを返す。
DOMStringのlocalName,読取り専用,DOM水準2で導入
ELEMENT_NODE及びATTRIBUTE_NODE以外の任意の型のノード,及びDocumentインタフェースからのcreateElementといったDOM水準1のメソッドを用いて生成されたノードに対しては,これは,常に,nullとする。
DOMStringのnamespaceURI,読取り専用,DOM水準2で導入
null。
ELEMENT_NODE及びATTRIBUTE_NODE以外の任意の型のノード,及びDocumentインタフェースからのcreateElementといったDOM水準1メソッドを用いて作成されたノードに対しては,常に,nullとする。
備考 XML名前空間 規定[Namespaces]に従うと,属性は,それが添付される要素からその名前空間を継承しない。属性が明示的に名前空間を与えられない場合には,単に,名前空間をもたないものとする。
NodeのnextSibling,読取り専用
nullを返す。
DOMStringのnodeName,読取り専用
unsigned shortのnodeType,読取り専用
DOMStringのnodeValue
nullと定義されている場合には,それを設定しても何の影響もない。
|
NO_MODIFICATION_ALLOWED_ERR: ノードが読取り専用の場合に,挙げられる。 |
|
DOMSTRING_SIZE_ERR: 実装プラットフォーム上での |
DocumentのownerDocument,読取り専用,DOM水準2で修正
Documentオブジェクト。これは,新しいノードを生成するために使用されるDocumentにもなっている。このノードが,Document,又はまだDocumentと共に使用されていないDocumentTypeの場合には,これは,nullとする。
NodeのparentNode,読取り専用
Attr,Document,DocumentFragment,Entity,及びNotationを除くすべてのノードは,親をもってもよい。しかし,ノードが生成されたばかりであって,まだ木に追加されていない場合,又は木から取り除かれた場合には,これは,nullとする。
DOMStringのprefix,DOM水準2で導入
null。
nodeName属性が変更される。適用可能な場合には,同様に,Elementインタフェース及びAttrインタフェースのtagName属性及びname属性も変更される。
namespaceURI及びlocalNameが変更されないことによる。
ELEMENT_NODE及びATTRIBUTE_NODE以外の任意の型のノード,及びDocumentインタフェースからのcreateElementといったDOM水準1メソッドを用いて生成されるノードに対しては,これは,常に,nullとする。
|
INVALID_CHARACTER_ERR: 指定された接頭辞が不正な文字を含む場合に,挙げられる。 NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。 NAMESPACE_ERR: 指定された |
NodeのpreviousSibling,読取り専用
nullを返す。
appendChildnewChildを追加する。newChildが木に既に存在する場合には,最初にそれが取り除かれる。
NodeのnewChild
DocumentFragmentオブジェクトの場合,文書素片の内容全体が,このノードの子リストに移動される。
|
追加されたノード。 |
|
HIERARCHY_REQUEST_ERR: このノードが WRONG_DOCUMENT_ERR: このノードを生成した文書とは異なる文書から NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。 |
cloneNodeparentNodeはnullとする。
Elementのクローンを作ることによって,すべての属性とその値をコピーする。これには,デフォルト化された属性を表現するためにXMLプロセサによって生成されたものも含まれる。しかし,このメソッドは,深い(deep)クローンでない場合には,それが含むテキストはコピーしない。これは,そのテキストは,子のTextノードに含まれることによる。Elementのクローン操作の一部としてクローンが作られるのとは対照的に,直接にAttributeのクローンを作る場合には,指定された属性が返される。すなわち,specifiedはtrueになる。その他の任意の型のノードのクローンを作ると,単純に,このノードのコピーが返される。
EntityReferenceのクローンの子供は,読取り専用 となることに注意すること。さらに,指定されなかったAttrノードのクローンが,指定される。Documentノード,DocumentTypeノード,Entityノード及びNotationノードのクローン化は,実装依存とする。
|
複製のノード。 |
hasAttributes,DOM水準2で導入
|
|
このノードが属性をもつ場合には, |
hasChildNodes|
|
このノードが子供をもつ場合には, |
insertBeforerefChildの前にnewChildノードを挿入する。refChildがnullの場合には,子供のリストの最後にnewChildを挿入する。
newChildがDocumentFragmentオブジェクトの場合には,その子供のすべてが,refChildの前に同じ順序で挿入される。newChildが既に木に存在する場合には,それは最初に取り除かれる。
|
挿入されるノード。 |
|
HIERARCHY_REQUEST_ERR: このノードが, WRONG_DOCUMENT_ERR: このノードを生成した文書とは異なる文書から NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,又は挿入されるノードの親が読取り専用の場合に,挙げられる。 NOT_FOUND_ERR: Raised if |
isSupported,DOM水準2で導入
DOMStringのfeature
DOMImplementation上のメソッドhasFeatureに渡すことのできる名前と同じ名前とする。
DOMStringのversion
trueを返すものとする。
|
|
指定された機能がこのノード上でサポートされている場合には, |
normalize,DOM水準2で修正
Nodeの下の部分木のあらゆる深さに存在するすべてのTextノードを,"正規"形式にする。ここで,正規形式とは,構造(例えば,要素,注釈,処理命令,CDATAセクション,及び実体参照)だけがTextノードを分離する形式のこととする。すなわち,隣接するTextノードも,空のTextノードも,存在しない。これは,文書のDOMによるビューが,保存され再ロードされても同じであることを保証するために使用可能であって,特定の文書木の構造に依存する操作(XPointer [XPointer]による検索など)を使用するのが望ましい場合に有用になる。
備考
文書がCDATASectionsを含む場合,正規化操作だけでは十分でないかもしれない。これは,XPointerが,TextノードとCDATASectionノードとを区別しないことによる。
removeChildoldChildで指示される子ノードを取り除き,それを返す。
NodeのoldChild|
取り除かれたノード。 |
|
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。 NOT_FOUND_ERR: |
replaceChildoldChildをnewChildで置き換え,oldChildノードを返す。
newChildがDocumentFragmentオブジェクトの場合,oldChildは,子供であるDocumentFragmentのすべてによって置き換えられ,同じ順番で挿入される。newChildがすでに木に存在する場合には,最初にそれが取り除かれる。
|
置き換えられたノード。 |
|
HIERARCHY_REQUEST_ERR: このノードが WRONG_DOCUMENT_ERR: このノードを生成した文書とは異なる文書から NO_MODIFICATION_ALLOWED_ERR: このノード又は新しいノードの親が読取り専用である場合に,挙げられる。 NOT_FOUND_ERR: |
NodeListインタフェースは,ノードの順序付きの集まりの抽象化を,この集まりの実装方法の定義又は制約なしに,提供する。DOMにおけるNodeListオブジェクトは, 活性化している 。
NodeListの中の項目は,0から始まる整数のインデクスを通してアクセス可能とする。
interface NodeList {
Node item(in unsigned long index);
readonly attribute unsigned long length;
};
unsigned longのlength,読取り専用
length-1(0及びlength-1を含む)とする。
NamedNodeMapインタフェースを実装するオブジェクトは,名前によってアクセス可能なノードの集まりを表現するために使用する。NamedNodeMapは,NodeListからは継承されないことに注意すること。すなわち,NamedNodeMapsは,特定の順序で維持されない。NamedNodeMapを実装するオブジェクトの中に含まれるオブジェクトは,順序を表すインデクスによってアクセスしてもよいが,これは,NamedNodeMapの内容を数える場合に都合がよいというだけであって,DOMがこれらのノードに順序を指定することを意味するわけではない。
DOMのNamedNodeMapオブジェクトは, 活性化している 。
interface NamedNodeMap {
Node getNamedItem(in DOMString name);
Node setNamedItem(in Node arg)
raises(DOMException);
Node removeNamedItem(in DOMString name)
raises(DOMException);
Node item(in unsigned long index);
readonly attribute unsigned long length;
// Introduced in DOM Level 2:
Node getNamedItemNS(in DOMString namespaceURI,
in DOMString localName);
// Introduced in DOM Level 2:
Node setNamedItemNS(in Node arg)
raises(DOMException);
// Introduced in DOM Level 2:
Node removeNamedItemNS(in DOMString namespaceURI,
in DOMString localName)
raises(DOMException);
};
unsigned longのlength,読取り専用
NamedNodeMapの中のノードの数。有効な子ノードのインデクスの範囲は,0〜length-1(0及びlength-1を含む)とする。
getNamedItem
getNamedItemNS,DOM水準2で導入
item
NamedNodeMapの中のindex番目の項目を返す。indexが,このNamedNodeMapのノードの数と等しい又は大きい場合には,nullを返す。
unsigned longのindex
NamedNodeMapへのインデクス。
|
この |
removeNamedItemNamedNodeMapが要素に添付された属性を含む場合,取り除かれた属性がデフォルト値をもつことが分かっているならば,直ちに,対応する名前空間URI,局所名,及び適用可能な場合には接頭辞とともに,そのデフォルト値を含む属性が出現する。
DOMStringのname
nodeName。
|
与えられた名前をもつノードが存在する場合,この |
|
NOT_FOUND_ERR: NO_MODIFICATION_ALLOWED_ERR: この |
removeNamedItemNS,DOM水準2で導入
NamedNodeMapが要素に添付された属性を含む場合,Nodeインタフェースのattributes属性によって返されるように,取り除かれた属性は,デフォルト値をもつと分かっていてもよい。その場合,直ちに,対応する名前空間URI,局所名,及び適用可能な場合には接頭辞とともに,そのデフォルト値を含む属性が出現する。
|
与えられた局所名及び名前空間URIをもつノードが存在する場合,この |
|
NOT_FOUND_ERR: 指定された NO_MODIFICATION_ALLOWED_ERR: この |
setNamedItemnodeName属性を使用してそのノードを追加する。その名前をもつノードが既にこのNamedNodeMapの中に存在する場合,新しいノードによって置き換えられる。
nodeName属性は,ノードを記憶しなければならないときに名前を引き出すために使用するので,ある型("特別な"文字列値をもつ型)の複数のノードは,名前が衝突するので,記憶できない。これは,ノードに別名を許すよりも望ましいと考えられる。
Nodeのarg
NamedNodeMapに記憶するノード。ノードは,その後,nodeName属性の値を使用してアクセス可能になる。
setNamedItemNS,DOM水準2で導入
setNamedItemNS introduced in DOM Level 2
namespaceURI及びlocalNameを使用してそのノードを追加する。その名前空間URI及び局所名をもつノードが既にこのNamedNodeMapの中に存在する場合には,新しいもので置き換える。
namespaceURI
and localName. If a node with that namespace URI and
that local name is already present in this map, it is replaced by
the new one.|
WRONG_DOCUMENT_ERR: この
WRONG_DOCUMENT_ERR: Raised if
arg was created from
a different document than the one that created this map.
NO_MODIFICATION_ALLOWED_ERR: この
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
INUSE_ATTRIBUTE_ERR: |
CharacterDataインタフェースは,DOMの文字データにアクセスするための属性及びメソッドの集合を用いて,Nodeを拡張する。明確化のために,この集合を,これら属性及びメソッドを使用する各オブジェクトにおいてではなく,ここで定義する。Textなどは,CharacterDataからインタフェースを継承するが,DOMオブジェクトは,CharacterDataに直接には対応しない。このインタフェースのすべてのoffsetは,0から開始する。
CharacterData interface extends Node with a set
of attributes and methods for accessing character data in the DOM.
For clarity this set is defined here rather than on each object
that uses these attributes and methods. No DOM objects correspond
directly to CharacterData, though Text and others do
inherit the interface from it. All offsets in this
interface start from 0.
DOMStringインタフェースで示すとおり,DOMにおけるテキスト文字列は,UTF-16で,すなわち,16ビット単位の列として,表現される。以下では,CharacterDataに関するインデクス付けが16ビット単位で行われることを示す必要がある場合にはいつでも,用語 16ビット単位 を使用する。
DOMString interface,
text strings in the DOM are represented in UTF-16, i.e. as a
sequence of 16-bit units. In the following, the term 16-bit units is
used whenever necessary to indicate that indexing on CharacterData
is done in 16-bit units.
interface CharacterData : Node {
attribute DOMString data;
// raises(DOMException) on setting
// raises(DOMException) on retrieval
readonly attribute unsigned long length;
DOMString substringData(in unsigned long offset,
in unsigned long count)
raises(DOMException);
void appendData(in DOMString arg)
raises(DOMException);
void insertData(in unsigned long offset,
in DOMString arg)
raises(DOMException);
void deleteData(in unsigned long offset,
in unsigned long count)
raises(DOMException);
void replaceData(in unsigned long offset,
in unsigned long count,
in DOMString arg)
raises(DOMException);
};
DOMStringのdata
CharacterDataノードに記憶されてもよいデータの総量に何らかの限界を課さなくともよい。しかし,実装の限界を示すことで,ノードのデータの全体が一つのDOMStringには入らないかもしれないということを意味してもよい。その場合,利用者は,適切な大きさの断片でデータを取り出すために,substringDataを呼び出してもよい。
CharacterData node.
However, implementation limits may mean that the entirety of a
node's data may not fit into a single DOMString. In such
cases, the user may call substringData to retrieve the
data in appropriately sized pieces.|
NO_MODIFICATION_ALLOWED_ERR: ノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is
readonly.
|
unsigned longのlength,読取り専用
length of type unsigned
long, readonly
data及び次に示すメソッドのsubstringDataを通じて利用可能な 16ビット単位 での(文字データの)数。これは値0を取ってもよい。すなわち,CharacterDataノードが空であってもよい。
data and the
substringData method below. This may have the value
zero, i.e., CharacterData nodes may be empty.appendDatadataは,元のdataと指定されたDOMStringとの連結へのアクセスを提供する。
data provides access
to the concatenation of data and the DOMString specified.
|
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
deleteDatadata及びlengthに,その変更が反映される。
unsigned longのoffset
offset of type
unsigned long
unsigned longのcount
count of type
unsigned long
offset及びcountの合計がlengthを超える場合には,offsetからデータの最後までのすべての16ビット単位が削除される。
offset and count exceeds
length then all 16-bit units from offset
to the end of the data are deleted.|
INDEX_SIZE_ERR: 指定された
INDEX_SIZE_ERR: Raised if the specified
offset is
negative or greater than the number of 16-bit units in
data, or if the specified count is
negative.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
insertData|
INDEX_SIZE_ERR: 指定された
INDEX_SIZE_ERR: Raised if the specified
offset is
negative or greater than the number of 16-bit units in
data.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
replaceDataunsigned longのoffset
offset of type
unsigned long
unsigned longのcount
count of type
unsigned long
offset及びcountの和がlengthを超える場合,データの最後までのすべての16ビット単位を置き換える。すなわち,その効果は,同じ範囲でremoveメソッドを呼び出しそれに続けてappendメソッドを起動することと同じとする。
offset and count exceeds
length, then all 16-bit units to the end of the data
are replaced; (i.e., the effect is the same as a
remove method call with the same range, followed by an
append method invocation).DOMStringのarg
arg of type DOMString
DOMString。
DOMString with which
the range must be replaced.|
INDEX_SIZE_ERR: 指定された
INDEX_SIZE_ERR: Raised if the specified
offset is
negative or greater than the number of 16-bit units in
data, or if the specified count is
negative.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
substringDataunsigned longのoffset
offset of type
unsigned long
unsigned longのcount
count of type
unsigned long
|
指定された部分文字列。
The specified substring. If the sum of
offset and
count exceeds the length, then all 16-bit
units to the end of the data are returned.
|
|
INDEX_SIZE_ERR: 指定された
INDEX_SIZE_ERR: Raised if the specified
offset is
negative or greater than the number of 16-bit units in
data, or if the specified count is
negative.
DOMSTRING_SIZE_ERR: テキストの指定された範囲が
DOMSTRING_SIZE_ERR: Raised if the specified range of text does
not fit into a
DOMString.
|
Attrインタフェースは,Elementオブジェクトにおける属性を表現する。通常は,属性に対する可能な値は,文書型定義において定義する。
Attr interface represents an attribute in an Element object.
Typically the allowable values for the attribute are defined in a
document type definition.
Attrオブジェクトは,Nodeインタフェースを継承するが,実際にはそれらが記述する要素の子ノードではないので,DOMでは,Attrオブジェクトを文書木の一部とは考えない。そこで,NodeのparentNode属性,previousSibling属性及びnextSibling属性は,Attrオブジェクトに対してnull値をもつ。DOMでは,属性は,それが関連する要素とは分離した識別性をもつのではなく要素の特性であるという見方をする。これによって,与えられた型のすべての要素と関連するデフォルト属性としての機能の実装が,より効率的になる。さらに,Attrノードは,DocumentFragmentの直接の子供でなくともよい。しかし,Attrノードは,DocumentFragment内に含まれるElementと関連することができる。結局のところ,DOMの利用者及び実装者は,AttrノードがNodeインタフェースを継承する他のオブジェクトと共通なものをもつが,それらは全く異なってもいるということに注意する必要がある。
Attr objects inherit the Node interface, but
since they are not actually child nodes of the element they
describe, the DOM does not consider them part of the document tree.
Thus, the Node attributes
parentNode, previousSibling, and
nextSibling have a null value for
Attr objects. The DOM takes the view that attributes
are properties of elements rather than having a separate identity
from the elements they are associated with; this should make it
more efficient to implement such features as default attributes
associated with all elements of a given type. Furthermore,
Attr nodes may not be immediate children of a DocumentFragment.
However, they can be associated with Element nodes
contained within a DocumentFragment. In
short, users and implementors of the DOM need to be aware that
Attr nodes have some things in common with other
objects inheriting the Node interface, but
they also are quite distinct.
属性の実効値は,次のとおりに決定される。この属性が明示的に値を割り当てられた場合には,その値が,属性の実効値となる。そうでない場合であって,この値に対して宣言が存在し,その宣言がデフォルト値を含んでいる場合には,そのデフォルト値が属性の実効値となる。これらいずれでもない場合には,属性は,明示的に追加されるまでは構造モデルのこの要素上には存在しないとする。Attrインスタンス上のnodeValue属性は,属性の値の文字列版を取り出すためにも使用できる。
nodeValue attribute on the Attr
instance can also be used to retrieve the string version of the
attribute's value(s).
属性の値に実体参照が含まれることが可能なXMLでは,Attrノードの子ノードは,(使用される場合には,)Textノード又はEntityReferenceノードのいずれかであってよい。EntityReferenceの記述を参照すること。DOMコアは属性の型を関知しないので,DTD又はスキーマが属性値を トークン化 された型をもつと宣言したとしても,すべての属性値を単純な文字列として扱う。
Attr node may be
either Text or
EntityReference
nodes (when these are in use; see the description of EntityReference for
discussion). Because the DOM Core is not aware of attribute types,
it treats all attribute values as simple strings, even if the DTD
or schema declares them as having tokenized types.
interface Attr : Node {
readonly attribute DOMString name;
readonly attribute boolean specified;
attribute DOMString value;
// raises(DOMException) on setting
// Introduced in DOM Level 2:
readonly attribute Element ownerElement;
};
DOMStringのname
ElementのownerElement,読取り専用,DOM水準2で導入
ownerElement of type Element, readonly,
introduced in DOM Level 2
Elementノード,又はこの属性が使用されていない場合にはnull。
booleanのspecified,読取り専用
specified of type
boolean, readonly
trueとする。そうでない場合には,falseとする。実装はこの属性に責任があるが利用者にはないことに注意すること。利用者が(結局はデフォルト値と同じ値をもつことになったとしても)属性の値を変更する場合には,specifiedフラッグは,自動的にtrueになる。属性をDTDからのデフォルト値として再指定するためには,利用者は,属性を削除しなければならない。実装は,新しい属性を,falseに設定されたspecified及び(存在する場合には)そのデフォルト値をもつとして,利用可能にする。
true; otherwise, it is
false. Note that the implementation is in charge of
this attribute, not the user. If the user changes the value of the
attribute (even if it ends up having the same value as the default
value) then the specified flag is automatically
flipped to true. To re-specify the attribute as the
default value from the DTD, the user must delete the attribute. The
implementation will then make a new attribute available with
specified set to false and the default
value (if one exists).specifiedをtrueとし,値はその割り当てられた値とする。
specifiedをfalseとし,値はDTDの中のデフォルト値とする。
ownerElement属性がnullの場合(これは,例えば,ちょうどその時に生成された,又は様々な取除き及びクローン化の操作によってnullに設定されたことによる。),specifiedはtrueとする。
specified is true, and the value is the
assigned value.specified is
false, and the value is the default value in the
DTD.ownerElement attribute is null
(i.e. because it was just created or was set to null
by the various removal and cloning operations)
specified is true.DOMStringのvalue
Elementインタフェース上のメソッドgetAttributeも参照すること。
getAttribute on the
Element
interface.Textノードを生成する。すなわち,XMLプロセサがマーク付けとして取り扱うあらゆる文字を,その代わりに,リテラルテキストとして取り扱う。Elementインタフェース上のメソッドsetAttributeも参照すること。
Text node with the
unparsed contents of the string. I.e. any characters that an XML
processor would recognize as markup are instead treated as literal
text. See also the method setAttribute on the Element
interface.|
NO_MODIFICATION_ALLOWED_ERR: ノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is
readonly.
|
Elementインタフェースは,HTML文書又はXML文書における 要素 を表現する。要素は,それに関連する属性をもってもよい。ElementインタフェースはNodeから継承されるので,一般的なNodeインタフェースの属性であるattributesを,一つの要素に対するすべての属性の集合を取り出すために使用してもよい。Elementインタフェースには,Attrオブジェクト又は属性のいずれかを名前によって取り出すためのメソッドが存在する。属性値に実体参照が含まれてもよいXMLでは,属性値を表現する恐らく幾分複雑な部分木を調べるために,Attrオブジェクトを取り出すことが望ましい。一方,すべての属性が単純な文字列値をもつHTMLでは,属性値を直接にアクセスするメソッドを, 簡便性 として安全に使用できる。
Element interface represents an element in an HTML or
XML document. Elements may have attributes associated with them;
since the Element interface inherits from Node, the generic
Node interface
attribute attributes may be used to retrieve the set
of all attributes for an element. There are methods on the
Element interface to retrieve either an Attr object by name
or an attribute value by name. In XML, where an attribute value may
contain entity references, an Attr object should
be retrieved to examine the possibly fairly complex sub-tree
representing the attribute value. On the other hand, in HTML, where
all attributes have simple string values, methods to directly
access an attribute value can safely be used as a convenience.
備考
DOM水準2では,メソッドnormalizeは,それが移動された場合には,Nodeインタフェースから継承される。
normalize
is inherited from the Node interface
where it was moved.
interface Element : Node {
readonly attribute DOMString tagName;
DOMString getAttribute(in DOMString name);
void setAttribute(in DOMString name,
in DOMString value)
raises(DOMException);
void removeAttribute(in DOMString name)
raises(DOMException);
Attr getAttributeNode(in DOMString name);
Attr setAttributeNode(in Attr newAttr)
raises(DOMException);
Attr removeAttributeNode(in Attr oldAttr)
raises(DOMException);
NodeList getElementsByTagName(in DOMString name);
// Introduced in DOM Level 2:
DOMString getAttributeNS(in DOMString namespaceURI,
in DOMString localName);
// Introduced in DOM Level 2:
void setAttributeNS(in DOMString namespaceURI,
in DOMString qualifiedName,
in DOMString value)
raises(DOMException);
// Introduced in DOM Level 2:
void removeAttributeNS(in DOMString namespaceURI,
in DOMString localName)
raises(DOMException);
// Introduced in DOM Level 2:
Attr getAttributeNodeNS(in DOMString namespaceURI,
in DOMString localName);
// Introduced in DOM Level 2:
Attr setAttributeNodeNS(in Attr newAttr)
raises(DOMException);
// Introduced in DOM Level 2:
NodeList getElementsByTagNameNS(in DOMString namespaceURI,
in DOMString localName);
// Introduced in DOM Level 2:
boolean hasAttribute(in DOMString name);
// Introduced in DOM Level 2:
boolean hasAttributeNS(in DOMString namespaceURI,
in DOMString localName);
};
DOMStringのtagName,読取り専用
<elementExample id="demo">
...
</elementExample> ,
tagNameは,値"elementExample"をもつ。これは,XMLでは,DOMのすべての操作と同様に大文字・小文字を保存することに注意すること。HTMLのDOMでは,元になるHTML文書の大文字・小文字とは関係なく,正準的な大文字形式で,HTML要素のtagNameを返す。
tagName has the value "elementExample".
Note that this is case-preserving in XML, as are all of the
operations of the DOM. The HTML DOM returns the
tagName of an HTML element in the canonical uppercase
form, regardless of the case in the source HTML document.getAttribute
getAttributeNS,DOM水準2で導入
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのlocalName
localName of type DOMString
getAttributeNodegetAttributeNodeNSメソッドを使用すること。
getAttributeNodeNS method.
getAttributeNodeNS,DOM水準2で導入
getAttributeNodeNS introduced in
DOM Level 2
Attrノードを取り出す。HTML専用DOM実装は,このメソッドを実装する必要はない。
Attr node by local
name and namespace URI. HTML-only DOM implementations do not need
to implement this method.
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのlocalName
localName of type DOMString
getElementsByTagNameElementのNodeListを,このElement木をあらかじめ決められた順序でたどって出会う順番に返す。
NodeList of all descendant
Elements with a given tag name, in the order in which
they are encountered in a preorder traversal of this
Element tree.
|
一致する
A list of matching
Element nodes.
|
getElementsByTagNameNS,DOM水準2で導入
getElementsByTagNameNS introduced in
DOM Level 2
ElementのNodeListを,このElement木をあらかじめ決められた順番でたどって出会う順番に返す。
NodeList of all the
descendant
Elements with a given local name and namespace URI in
the order in which they are encountered in a preorder traversal of
this Element tree.DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのlocalName
localName of type DOMString
hasAttribute,DOM水準2で導入
hasAttribute introduced in DOM Level 2
trueを返す。そうでない場合には,falseを返す。
true when an attribute
with a given name is specified on this element or has a default
value, false otherwise.
|
|
与えられた名前をもつ属性がこの要素上で指定されている又はデフォルト値をもつ場合には, true if an attribute with the given name is
specified on this element or has a default value,
false otherwise.
|
hasAttributeNS,DOM水準2で導入
hasAttributeNS introduced in DOM Level 2
trueを返す。そうでない場合には,falseを返す。HTML専用のDOM実装は,このメソッドを実装する必要はない。
true when an attribute
with a given local name and namespace URI is specified on this
element or has a default value, false otherwise.
HTML-only DOM implementations do not need to implement this method.
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのlocalName
localName of type DOMString
|
|
与えられた局所前及び名前空間URIをもつ属性がこの要素上で指定されている又はデフォルト値をもつ場合には, true if an attribute with the given local name and
namespace URI is specified or has a default value on this element,
false otherwise.
|
removeAttributeremoveAttributeNSメソッドを使用すること。
removeAttributeNS method.
|
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。 NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
removeAttributeNS,DOM水準2で導入
removeAttributeNS introduced in DOM Level 2
DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのlocalName
localName of type DOMString
|
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
removeAttributeNodeAttrがデフォルト値をもつ場合には,その属性は直ちに置き換えられる。置き換える属性は,適用可能な場合には,元の接頭辞だけでなく,同じ名前空間URI及び局所名をもつ。
Attr has
a default value it is immediately replaced. The replacing attribute
has the same namespace URI and local name, as well as the original
prefix, when applicable.
|
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
NOT_FOUND_ERR:
NOT_FOUND_ERR: Raised if
oldAttr is not an
attribute of the element.
|
setAttributevalueパラメタのものに変更される。この値は,単純な文字列とする。すなわち,設定される際に構文解析されない。そのために,(実体参照として認識される構文などの)マーク付けは,リテラルテキストとして取り扱われることになり,書き出される場合には,実装によって適切に別扱いされる必要がある。実体参照を含む属性値を割り当てるためには,利用者は,AttrノードをTextノード及びEntityReferenceノードを追加して生成し,適切な部分木を構築し,その値を属性の値として割り当てるためにsetAttributeNodeを使用しなければならない。
setAttributeNSメソッドを使用すること。
Attr node plus any
Text and EntityReference
nodes, build the appropriate subtree, and use
setAttributeNode to assign it as the value of an
attribute.setAttributeNS method.
|
INVALID_CHARACTER_ERR: 指定された名前が不正な文字を含んでいる場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
setAttributeNS,DOM水準2で導入
setAttributeNS introduced in DOM Level 2
qualifiedNameの接頭辞部分に変更され,その値はvalueパラメタに変更される。この値は,単純な文字列とする。すなわち,それは設定する際に構文解析されない。そのために,(実体参照として認識される構文などの)マーク付けは,リテラルテキストとして取り扱われることになり,書き出される場合には,実装によって適切に別扱いする必要がある。実体参照を含む属性値を割り当てるためには,利用者は,AttrノードをTextノード及びEntityReferenceノードを追加して生成し,適切な部分木を構築し,その値を属性の値として割り当てるためにsetAttributeNodeNS又はsetAttributeNodeを使用しなければならない。
qualifiedName, and its value is changed to be the
value parameter. This value is a simple string; it is
not parsed as it is being set. So any markup (such as syntax to be
recognized as an entity reference) is treated as literal text, and
needs to be appropriately escaped by the implementation when it is
written out. In order to assign an attribute value that contains
entity references, the user must create an Attr node plus any
Text and EntityReference
nodes, build the appropriate subtree, and use
setAttributeNodeNS or setAttributeNode to
assign it as the value of an attribute.DOMStringのnamespaceURI
namespaceURI of type DOMString
DOMStringのqualifiedName
qualifiedName of type DOMString
DOMStringのvalue
value of type DOMString
|
INVALID_CHARACTER_ERR: 指定された修飾された名前が不正な文字を含んでいる場合に,挙げられる。
INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
NAMESPACE_ERR:
NAMESPACE_ERR: Raised if the
qualifiedName is
malformed, if the qualifiedName has a prefix and the
namespaceURI is null, if the
qualifiedName has a prefix that is "xml" and the
namespaceURI is different from "http://www.w3.org/XML/1998/namespace",
or if the qualifiedName is "xmlns" and the
namespaceURI is different from "http://www.w3.org/2000/xmlns/".
|
setAttributeNodenodeName)をもつ属性が要素の中に既に存在する場合には,新しいものによって置き換えられる。
setAttributeNodeNSメソッドを使用すること。
nodeName) is already present in the
element, it is replaced by the new one.setAttributeNodeNS method.
|
WRONG_DOCUMENT_ERR:
WRONG_DOCUMENT_ERR: Raised if
newAttr was created
from a different document than the one that created the
element.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
INUSE_ATTRIBUTE_ERR:
INUSE_ATTRIBUTE_ERR: Raised if
newAttr is already
an attribute of another Element object. The DOM user
must explicitly clone Attr nodes to re-use
them in other elements.
|
setAttributeNodeNS,DOM水準2で導入
setAttributeNodeNS introduced in
DOM Level 2
|
If the
newAttr attribute replaces an existing
attribute with the same local name and namespace URI,
the replaced Attr node is
returned, otherwise null is returned.
|
|
WRONG_DOCUMENT_ERR:
WRONG_DOCUMENT_ERR: Raised if
newAttr was created
from a different document than the one that created the
element.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
INUSE_ATTRIBUTE_ERR:
INUSE_ATTRIBUTE_ERR: Raised if
newAttr is already
an attribute of another Element object. The DOM user
must explicitly clone Attr nodes to re-use
them in other elements.
|
Textインタフェースは,CharacterDataから継承され,Element又はAttrの(XMLでは 文字データ という)テキストデータを表現する。要素の内容の内部にマーク付けが存在しない場合には,テキストは,その要素の唯一の子であってTextインタフェースを実装する単一のオブジェクトの中に含まれる。マーク付けが存在する場合には,その要素の子供のリストを形成する,(要素,注釈などの) 情報項目 のノード及びTextノードに構文解析される。
Text interface inherits from CharacterData and
represents the textual content (termed character
data in XML) of an Element or Attr. If there is no
markup inside an element's content, the text is contained in a
single object implementing the Text interface that is
the only child of the element. If there is markup, it is parsed
into the information
items (elements, comments, etc.) and Text
nodes that form the list of children of the element.
文書が最初にDOM経由で利用可能とされるとき,テキストの各ブロックに対してただ一つのTextノードが存在する。利用者は,マーク付けを介在させることなしに,与えられた要素の内容を表現するTextノードを隣接して生成してよいが,XML又はHTMLではこれらノード間での分離を表現する方法がないこと気付いていることが望ましい。それら分離は,DOMによる編集操作中に(一般には)存続しない。Node上のnormalize()メソッドは,それら隣接するTextオブジェクトを,テキストの各ブロックに対して単一のノードに併合する。
Text node for each block of text. Users may
create adjacent Text nodes that represent the contents
of a given element without any intervening markup, but should be
aware that there is no way to represent the separations between
these nodes in XML or HTML, so they will not (in general) persist
between DOM editing sessions. The normalize() method
on Node merges
any such adjacent Text objects into a single node for
each block of text.
interface Text : CharacterData {
Text splitText(in unsigned long offset)
raises(DOMException);
};
splitTextoffsetで二つのノードに分離する。ただし,分離した両方を 兄弟 として木の中で維持する。分離した後では,このノードは,offsetの位置までの内容のすべて含み,offsetの位置及びその後の内容のすべてを含む同じ型の新しいノードが返される。元のノードが親ノードをもっていた場合には,新しいノードは,元のノードの次の 兄弟 として挿入される。offsetがこのノードの長さに等しい場合には,新しいノードはデータをもたない。
offset, keeping both in the tree as siblings. After being
split, this node will contain all the content up to the
offset point. A new node of the same type, which
contains all the content at and after the offset
point, is returned. If the original node had a parent node, the new
node is inserted as the next sibling of the
original node. When the offset is equal to the length
of this node, the new node has no data.
unsigned longのoffset
offset of type
unsigned long
0から開始する。
|
このノードと同じ型の新しいノード。
The new node, of the same type as this node.
|
|
INDEX_SIZE_ERR: 指定されたオフセットが負数又は
INDEX_SIZE_ERR: Raised if the specified offset is negative or
greater than the number of 16-bit units in
data.
NO_MODIFICATION_ALLOWED_ERR: このノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
|
このインタフェースは,CharacterDataから継承され,注釈の内容,すなわち,'<!--'で開始され'-->'で終了されるそれらの間のすべての文字を表現する。これは,XMLにおける注釈の定義だが,実際的にはHTMLにおける注釈の定義にもなることに注意すること。ただし,HTMLツールが完全なSGML注釈の構造を実装していてもよい。
CharacterData and
represents the content of a comment, i.e., all the characters
between the starting '<!--' and ending
'-->'. Note that this is the definition of a
comment in XML, and, in practice, HTML, although some HTML tools
may implement the full SGML comment structure.
interface Comment : CharacterData {
};
1.3で定義するインタフェースは,DOMコア規定の一部を形成するが,HTMLだけを扱うDOM実装では,これらのインタフェースを開示するオブジェクトには決して出会うことがない。そのために,HTML専用のDOM実装[DOM Level 2 HTML]は,これらのインタフェースを実装するオブジェクトをもつ必要はない。
1.3で示されるインタフェースは,必須とはしない。DOMアプリケーションは,このモジュールが実装によってサポートされるかどうかを決定するために,DOMImplementationインタフェースのhasFeature(feature, version)メソッドを,パラメタ値を(それぞれ)"XML"及び"2.0"として使用してもよい。このモジュールを完全にサポートするためには,実装は,基礎インタフェースで定義された"コア"機能もサポートしなければならない。この規定における適合性についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "XML" and "2.0" (respectively) to
determine whether or not this module is supported by the
implementation. In order to fully support this module, an
implementation must also support the "Core" feature defined in Fundamental Interfaces. Please
refer to additional information about Conformance in this
specification.
CDATAセクションは,何もしない場合にマーク付けと見なされる文字を含むテキストのブロックを,別扱いするために使用する。CDATAセクションの中で認識される唯一の区切り子は,CDATAセクションを終端する"]]>"という文字列とする。CDATAセクションは,入れ子にはできない。その基本的な目的は,区切り子すべてを別扱いする必要なしに,XML素片などの素材を取り込むためとする。
TextノードのDOMString属性は,CDATAセクションが含むテキストを保持する。これは,CDATAセクションの外部で別扱いする必要がある文字を含んでも よく,直列化のために選択された文字符号化("charset")に依存して,CDATAセクションの一部として書き出すことが不可能な文字があるかもしれない,ということに注意すること。
DOMString
attribute of the Text node holds the
text that is contained by the CDATA section. Note that this
may contain characters that need to be escaped outside of
CDATA sections and that, depending on the character encoding
("charset") chosen for serialization, it may be impossible to write
out some characters as part of a CDATA section.
CDATASectionインタフェースは,Textインタフェースを通じてCharacterDataインタフェースから継承される。隣接するCDATASectionノードは,Nodeインタフェースのnormalizeメソッドを使用することによって併合されない。
CDATASection interface inherits from the CharacterData
interface through the Text interface.
Adjacent CDATASection nodes are not merged by use of
the normalize method of the Node interface.
備考
マーク付けはCDATASection内では認識されないので,文字の数値参照は,直列化の際に別扱い機構として使用できない。そのために,含まれる文字の幾つかが表現できない文字符号化を用いてCDATASectionを直列化する場合には,何らかの対応が必要となる。これに失敗すると,整形式のXMLを生成しないことがある。
直列化処理における一つの可能な解決は,その文字の前でCDATAセクションを終端し,文字参照又は実体参照を使用してその文字を出力し,そのテキストノードにおける更なる文字に対して新しいCDATAセクションを開始することである。しかし,コード変換ライブラリの中には,書出し時に,符号化から文字が抜けている場合にエラー又は例外を返さないものがあるので,直列化でデータが損なわれないことを保証するためには,作業がより困難になることがある点に注意すること。
CDATASection, character numeric references cannot be
used as an escape mechanism when serializing. Therefore, action
needs to be taken when serializing a CDATASection with
a character encoding where some of the contained characters cannot
be represented. Failure to do so would not produce well-formed
XML.
interface CDATASection : Text {
};
各Documentは,値がnull又はDocumentTypeオブジェクトのいずれかとなるdoctype属性をもつ。DOMコアにおけるDocumentTypeインタフェースは,文書に対して定義される実体のリストへのインタフェースを提供する。ただし,この標準情報(TR)の原規定の開発時には,名前空間の影響,及びDTD表現に関する様々なXMLスキーマの開発努力が明確には理解できていないので,それ以外のことはほとんど提供しない。
Document
has a doctype attribute whose value is either
null or a DocumentType object. The
DocumentType interface in the DOM Core provides an
interface to the list of entities that are defined for the
document, and little else because the effect of namespaces and the
various XML schema efforts on DTD representation are not clearly
understood as of this writing.
DOM水準2は,DocumentTypeノードの編集をサポートしない。
DocumentType nodes.
interface DocumentType : Node {
readonly attribute DOMString name;
readonly attribute NamedNodeMap entities;
readonly attribute NamedNodeMap notations;
// Introduced in DOM Level 2:
readonly attribute DOMString publicId;
// Introduced in DOM Level 2:
readonly attribute DOMString systemId;
// Introduced in DOM Level 2:
readonly attribute DOMString internalSubset;
};
NamedNodeMapのentities,読取り専用
entities of type NamedNodeMap,
readonly
NamedNodeMap。パラメタ実体は含まれない。重複は破棄される。次に例を示す。
NamedNodeMap
containing the general entities, both external and internal,
declared in the DTD. Parameter entities are not contained.
Duplicates are discarded. For example in:
<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> ]> <ex/>
fooとbarの最初の宣言とへのアクセスを提供するが,barの2番目の宣言又はbazへのアクセスは提供しない。このNamedNodeMapにおけるすべてのノードは,Entityインタフェースも実装する。
foo and the first
declaration of bar but not the second declaration of
bar or baz. Every node in this map also
implements the Entity
interface.entitiesは,決して変更できない。
entities cannot be altered in any way.DOMStringのinternalSubset,読取り専用,DOM水準2で導入
internalSubset of
type DOMString,
readonly, introduced in DOM Level 2
備考 返される実際の内容は,実装に利用可能な情報の量に依存する。これは,文書を構築するために使用するXMLプロセサを含む様々なパラメタに依存して,変化してよい。
DOMStringのname,読取り専用
DOCTYPEキーワードの直後の名前。
DOCTYPE keyword.NamedNodeMapのnotations,読取り専用
notations of type NamedNodeMap,
readonly
NamedNodeMap。重複は,破棄される。このNamedNodeMapにおけるすべてのノードは,Notationインタフェースも実装する。
NamedNodeMap
containing the notations declared in the DTD. Duplicates are
discarded. Every node in this map also implements the Notation
interface.notationsは,決して変更できない。
notations cannot be altered in any way.DOMStringのpublicId,読取り専用,DOM水準2で導入
DOMStringのsystemId,読取り専用,DOM水準2で導入
このインタフェースは,DTDの中で宣言された記法を表現する。記法は,名前によって解析対象外実体(XML 1.0規定[XML]の 4.7 を参照)のフォーマットを宣言するか,又は処理命令ターゲット(XML 1.0規定[XML]の 2.6 を参照)の形式的宣言のために使用されるかのいずれかとする。Nodeから継承されるnodeName属性は,記法の宣言された名前に設定される。
nodeName
attribute inherited from Node is set to the
declared name of the notation.
DOM水準1は,Notationノードの編集をサポートしない。そのために,このノードは 読取り専用 とする。
Notation
nodes; they are therefore readonly.
Notationノードは,親をもたない。
Notation node does not have any parent.
interface Notation : Node {
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
};
DOMStringのpublicId,読取り専用
nullとする。
null.DOMStringのsystemId,読取り専用
nullとする。
null.
このインタフェースは,XML文書の中の,解析対象実体又は解析対象外実体のいずれかを表現する。このことは,実体それ自体をモデル化するのであって実体宣言をモデル化する わけではない ことに注意すること。Entity宣言のモデル化は,DOM規定のより高位の水準に残されている。
Entity
declaration modeling has been left for a later Level of the DOM
specification.
Nodeから継承されるnodeName属性は,実体の名前を含む。
nodeName attribute that is inherited from Node contains the
name of the entity.
XMLプロセサは,構造モデルをDOMに渡す前に,完全に実体を展開することを選択してもよい。この場合,文書木にはEntityReferenceノードは存在しない。
EntityReference nodes
in the document tree.
XMLは,妥当性検証を行わないXMLプロセサが,外部サブセットで作成された又は外部パラメタ実体で宣言された実体宣言を読んで処理することを必須とはしない。このことは,外部サブセットで宣言された解析対象実体が,アプリケーションの幾つかの種類によって展開されなくともよく,その実体の置換値が利用可能でなくともよいことを意味する。置換値が利用可能な場合には,対応するEntityノードの子リストが,その置換テキストの構造を表現する。そうでない場合には,子リストは空とする。
Entity node's child list
represents the structure of that replacement text. Otherwise, the
child list is empty.
DOM水準2は,Entityノードの編集をサポートしない。利用者がEntityの内容に変更を行いたい場合には,すべての関係するEntityReferenceノードを,そのEntityの内容のクローンによって構造モデルの中で置き換えなければならず,望まれる変更は,代わりに,それらのクローンの各々に対して行わなければならない。Entityノード及びそれらのすべての 子孫 は, 読取り専用 とする。
Entity
nodes; if a user wants to make changes to the contents of an
Entity, every related EntityReference node
has to be replaced in the structure model by a clone of the
Entity's contents, and then the desired changes must
be made to each of those clones instead. Entity nodes
and all their descendants are readonly.
Entityノードは,親をもたない。
Entity node does not have any parent.
備考
実体が束縛されない 名前空間接頭辞 を含む場合には,Entityノード部分木の対応するノードのnamespaceURIは,nullとする。この実体を参照するEntityReferenceノードに対しても,それらがDocumentインタフェースのcreateEntityReferenceメソッドを使用して生成されている場合には,同じことがいえる。DOM水準2は,名前空間接頭辞を解決するいかなる機構もサポートしない。
namespaceURI of the corresponding
node in the Entity node subtree is null.
The same is true for EntityReference nodes
that refer to this entity, when they are created using the
createEntityReference method of the Document interface.
The DOM Level 2 does not support any mechanism to resolve namespace
prefixes.
interface Entity : Node {
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
readonly attribute DOMString notationName;
};
DOMStringのnotationName,読取り専用
notationName of type DOMString,
readonly
nullとする。
null.DOMStringのpublicId,読取り専用
nullとする。
null.DOMStringのsystemId,読取り専用
nullとする。
null.
実体参照が源となる文書に存在する場合,又は利用者が実体参照を挿入したい場合には,EntityReferenceオブジェクトを構造モデルの中に挿入してよい。文字参照及び事前定義された実体への参照は,HTMLプロセサ又はXMLプロセサによって展開されると考えられ,その結果,文字は,実体参照ではなくそれらのUnicodeでの等価なものによって表現されることに注意すること。さらに,XMLプロセサは,EntityReferenceオブジェクトを提供する代わりに,構造モデルを構築する際に実体への参照を完全に展開してもよい。それらオブジェクトを提供する場合には,与えられたEntityReferenceノードに対して,参照される実体を表現するEntityノードが存在しなくともよい。それらEntityノードが存在する場合には,EntityReferenceノードの部分木は,一般に,Entityノード部分木のコピーとなる。しかし,このことは,実体が束縛のない 名前空間接頭辞 を含む場合には,成立しなくともよい。それらの場合には,名前空間接頭辞の解決は,実体参照が存在する場所に依存するので,EntityReferenceノードの 子孫 は,異なる 名前空間URI に束縛されてもよい。
EntityReference objects may be inserted into the
structure model when an entity reference is in the source document,
or when the user wishes to insert an entity reference. Note that
character references and references to predefined entities are
considered to be expanded by the HTML or XML processor so that
characters are represented by their Unicode equivalent rather than
by an entity reference. Moreover, the XML processor may completely
expand references to entities while building the structure model,
instead of providing EntityReference objects. If it
does provide such objects, then for a given
EntityReference node, it may be that there is no Entity node
representing the referenced entity. If such an Entity exists, then
the subtree of the EntityReference node is in general
a copy of the Entity node subtree.
However, this may not be true when an entity contains an unbound namespace
prefix. In such a case, because the namespace prefix
resolution depends on where the entity reference is, the descendants of the
EntityReference node may be bound to different namespace
URIs.
Entityノードに関しては,EntityReferenceノード及びそのすべての 子孫 は, 読取り専用 とする。
interface EntityReference : Node {
};
ProcessingInstructionインタフェースは,プロセサ固有の情報を文書のテキストの中に保持する方法としてXMLで使用される"処理命令"を表現する。
ProcessingInstruction interface represents a
"processing instruction", used in XML as a way to keep
processor-specific information in the text of the document.
interface ProcessingInstruction : Node {
readonly attribute DOMString target;
attribute DOMString data;
// raises(DOMException) on setting
};
DOMStringのdata
?>のすぐ前の文字までとする。
?>.|
NO_MODIFICATION_ALLOWED_ERR: ノードが読取り専用の場合に,挙げられる。
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is
readonly.
|
DOMStringのtarget,読取り専用