jp.crestmuse.cmx.filewrappers
クラス NodeInterface

java.lang.Object
  上位を拡張 jp.crestmuse.cmx.filewrappers.NodeInterface
直系の既知のサブクラス:
AbstractHeaderNodeInterface, ByteArrayNodeInterface, DeviationInstanceWrapper.Control, DeviationInstanceWrapper.ExtraNote, DeviationInstanceWrapper.MissNote, DeviationInstanceWrapper.NoteDeviation, MIDIXMLWrapper.MIDIEvent, MIDIXMLWrapper.Track, MPEG7Wrapper.Audio, MPEG7Wrapper.AudioD, MPEG7Wrapper.AudioDS, MPEG7Wrapper.Description, MPEG7Wrapper.Model, MPEG7Wrapper.MultimediaContent, MPEG7Wrapper.ScalableSeries, MusicXMLWrapper.DirectionType, MusicXMLWrapper.Measure, MusicXMLWrapper.MusicData, MusicXMLWrapper.Notations, MusicXMLWrapper.Part, MusicXMLWrapper.StartStopElement, Peaks, SCCXMLWrapper.Annotation, SCCXMLWrapper.HeaderElement, SCCXMLWrapper.Note, SCCXMLWrapper.Part, TimeSeriesNodeInterface, WAVXMLWrapper.DataChunk, WAVXMLWrapper.FmtChunk

public abstract class NodeInterface
extends java.lang.Object

The abstract class NodeInterface is the common superclass of classes that provide interfaces for accessing XML nodes.

抽象クラスNodeInterfaceは, XMLドキュメント内のノードに アクセスするためのインターフェースを提供するクラスの共通基底クラスです.

典型的な使いかたとしては, ファイルラッパ(CMXFileWrapperのサブクラス)内に, 対応するXMLフォーマットの仕様に合わせて, 各要素へのアクセスをサポートする クラスをこのクラスのサブクラスとして, またファイルラッパの内部クラスとして 定義します. たとえば, MusicXMLWrapperクラスにはNoteというクラスがあり, これがMusicXMLフォーマットのnote要素へのアクセスをサポートします. NoteクラスはMusicXMLWrapperの内部クラスで, NodeInterfaceクラスの サブクラスとなっています.

バージョン:
0.20.000
作成者:
Tetsuro Kitahara

コンストラクタの概要
protected NodeInterface(org.w3c.dom.Node node)
          Constructs an node interface for the specified node.
 
メソッドの概要
protected static java.lang.String getAttribute(org.w3c.dom.Node node, java.lang.String attrkey)
           
 java.lang.String getAttribute(java.lang.String key)
           
protected static double getAttributeDouble(org.w3c.dom.Node node, java.lang.String attrkey)
           
 double getAttributeDouble(java.lang.String key)
           
protected static int getAttributeInt(org.w3c.dom.Node node, java.lang.String attrkey)
           
 int getAttributeInt(java.lang.String key)
           
 java.lang.String getAttributeNS(java.lang.String key, java.lang.String namespace)
           
protected  org.w3c.dom.Node getChildByTagName(java.lang.String tagname)
          Returns the child node with the specified tag name.
protected  org.w3c.dom.Node getChildByTagNameNS(java.lang.String tagname, java.lang.String ns)
           
protected  org.w3c.dom.NodeList getChildNodes()
          Returns all the child nodes すべての子ノードを返します.
 java.lang.String getChildText(java.lang.String tagname)
          Returns the text that a child with the specified tag name has.
 double getChildTextDouble(java.lang.String tagname)
          Returns the text that a child with the specified tag name has as a real number.
 int getChildTextInt(java.lang.String tagname)
          Returns the text that a child with the specified tag name has as an integer.
protected  org.w3c.dom.Node getFirstChild()
           
protected  org.w3c.dom.Node getLastChild()
           
 java.lang.String getNodeName()
          Returns the name of the node wrapped by this object.
protected abstract  java.lang.String getSupportedNodeName()
          Returns the node name supported by the class.
 java.lang.String getText()
           
protected static java.lang.String getText(org.w3c.dom.Node node)
           
protected static double getTextDouble(org.w3c.dom.Node node)
           
protected static int getTextInt(org.w3c.dom.Node node)
           
protected static boolean hasAttribute(org.w3c.dom.Node node, java.lang.String attrkey)
           
 boolean hasAttribute(java.lang.String key)
           
protected static boolean hasChild(java.lang.String tagname, org.w3c.dom.Node node)
           
protected  org.w3c.dom.Node node()
          Returns the node wrapped by this object.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

NodeInterface

protected NodeInterface(org.w3c.dom.Node node)

Constructs an node interface for the specified node. When the specified node is not supported, UnsupportedNodeException is thrown.

指定されたノードに対するノードインターフェースを生成します. 指定されたノードがサポートされていない場合, UnsupportedNodeExceptionがスローされます.

例外:
UnsupportedNodeException - when the specified node is not supported.
メソッドの詳細

node

protected final org.w3c.dom.Node node()

Returns the node wrapped by this object.

このオブジェクトがラップするノードを返します. 現在のところこのメソッドはpublicとなっていますが, publicにすべきかは 議論のあるところで, 今後変更される場合があります. (試験的にprotectedに変更しています)


getSupportedNodeName

protected abstract java.lang.String getSupportedNodeName()

Returns the node name supported by the class. Please override this method in a subclass.

このオブジェクトがサポートするノード名を返します. このメソッドはサブクラスでオーバーライドしてください.


getNodeName

public final java.lang.String getNodeName()

Returns the name of the node wrapped by this object.

このオブジェクトがラップしているノード名を返します.


getChildText

public final java.lang.String getChildText(java.lang.String tagname)

Returns the text that a child with the specified tag name has.

指定されたタグ名の子が持つテキストを返します.


getChildTextInt

public final int getChildTextInt(java.lang.String tagname)

Returns the text that a child with the specified tag name has as an integer.

指定されたタグ名の子が持つテキストを整数値として返します.


getChildTextDouble

public final double getChildTextDouble(java.lang.String tagname)

Returns the text that a child with the specified tag name has as a real number.

指定されたタグ名の子が持つテキストを実数値として返します.


getText

public final java.lang.String getText()

hasAttribute

public boolean hasAttribute(java.lang.String key)

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String key,
                                       java.lang.String namespace)

getAttribute

public java.lang.String getAttribute(java.lang.String key)

getAttributeInt

public int getAttributeInt(java.lang.String key)

getAttributeDouble

public double getAttributeDouble(java.lang.String key)

getChildNodes

protected final org.w3c.dom.NodeList getChildNodes()

Returns all the child nodes

すべての子ノードを返します.


getFirstChild

protected final org.w3c.dom.Node getFirstChild()

getLastChild

protected final org.w3c.dom.Node getLastChild()

getChildByTagName

protected final org.w3c.dom.Node getChildByTagName(java.lang.String tagname)

Returns the child node with the specified tag name.

指定されたタグ名の子ノードを返します.


getChildByTagNameNS

protected final org.w3c.dom.Node getChildByTagNameNS(java.lang.String tagname,
                                                     java.lang.String ns)

hasChild

protected static boolean hasChild(java.lang.String tagname,
                                  org.w3c.dom.Node node)

getText

protected static java.lang.String getText(org.w3c.dom.Node node)

getTextInt

protected static final int getTextInt(org.w3c.dom.Node node)
                               throws java.lang.NullPointerException
例外:
java.lang.NullPointerException

getTextDouble

protected static final double getTextDouble(org.w3c.dom.Node node)
                                     throws java.lang.NullPointerException
例外:
java.lang.NullPointerException

hasAttribute

protected static final boolean hasAttribute(org.w3c.dom.Node node,
                                            java.lang.String attrkey)

getAttribute

protected static final java.lang.String getAttribute(org.w3c.dom.Node node,
                                                     java.lang.String attrkey)

getAttributeInt

protected static final int getAttributeInt(org.w3c.dom.Node node,
                                           java.lang.String attrkey)

getAttributeDouble

protected static final double getAttributeDouble(org.w3c.dom.Node node,
                                                 java.lang.String attrkey)