Php/docs/class.xmlreader

提供:Dev Guides
< Php
移動先:案内検索

(PHP 5 >= 5.1.0, PHP 7)

はじめに

XMLReader 拡張モジュールは、プル型の XML パーサです。ドキュメント ストリーム内をカーソル風に進んでいき、その途中の各ノードで立ち止まります。


クラス概要


XMLReader {

/* 定数 */

const int NONE = 0

const int ELEMENT = 1

const int ATTRIBUTE = 2

const int TEXT = 3

const int CDATA = 4

const int ENTITY_REF = 5

const int ENTITY = 6

const int PI = 7

const int COMMENT = 8

const int DOC = 9

const int DOC_TYPE = 10

const int DOC_FRAGMENT = 11

const int NOTATION = 12

const int WHITESPACE = 13

const int SIGNIFICANT_WHITESPACE = 14

const int END_ELEMENT = 15

const int END_ENTITY = 16

const int XML_DECLARATION = 17

const int LOADDTD = 1

const int DEFAULTATTRS = 2

const int VALIDATE = 3

const int SUBST_ENTITIES = 4

/* プロパティ */

public readonly int $attributeCount

public readonly string $baseURI

public readonly int $depth

public readonly bool $hasAttributes

public readonly bool $hasValue

public readonly bool $isDefault

public readonly bool $isEmptyElement

public readonly string $localName

public readonly string $name

public readonly string $namespaceURI

public readonly int $nodeType

public readonly string $prefix

public readonly string $value

public readonly string $xmlLang

/* メソッド */

public close ( ) : bool

public expand ([ DOMNode|null $baseNode = null ] ) : DOMNode|false

public getAttribute ( string $name ) : string|null

public getAttributeNo ( int $index ) : string|null

public getAttributeNs ( string $name , string $namespace ) : string|null

public getParserProperty ( int $property ) : bool

public isValid ( ) : bool

public lookupNamespace ( string $prefix ) : string|null

public moveToAttribute ( string $name ) : bool

public moveToAttributeNo ( int $index ) : bool

public moveToAttributeNs ( string $name , string $namespace ) : bool

public moveToElement ( ) : bool

public moveToFirstAttribute ( ) : bool

public moveToNextAttribute ( ) : bool

public next ([ string|null $name = null ] ) : bool

public static open ( string $uri [, string|null $encoding = null [, int $flags = 0 ]] ) : bool|XMLReader

public read ( ) : bool

public readInnerXml ( ) : string

public readOuterXml ( ) : string

public readString ( ) : string

public setParserProperty ( int $property , bool $value ) : bool

public setRelaxNGSchema ( string|null $filename ) : bool

public setRelaxNGSchemaSource ( string|null $source ) : bool

public setSchema ( string|null $filename ) : bool

XML ( string $source [, string|null $encoding = null [, int $flags = 0 ]] ) : bool|XMLReader

}

プロパティ

attributeCount
ノード上の属性の数
baseURI
ノードのベース URI
depth
ツリー内でのノードの階層 (0 から数える)
hasAttributes
ノードが属性を保持しているかどうか
hasValue
ノードがテキストの値を保持しているかどうか
isDefault
属性が DTD のデフォルトかどうか
isEmptyElement
ノードが空要素のタグかどうか
localName
ノードのローカル名
name
ノードの限定名
namespaceURI
ノードに関連付けられた名前空間の URI
nodeType
ノードの型
prefix
ノードに関連付けられた名前空間のプレフィックス
value
ノードのテキスト値
xmlLang
ノードが存在する xml:lang スコープ


定義済み定数

XMLReader ノード型

XMLReader::NONE
ノード型なし
XMLReader::ELEMENT
開始要素
XMLReader::ATTRIBUTE
属性ノード
XMLReader::TEXT
テキストノード
XMLReader::CDATA
CDATA ノード
XMLReader::ENTITY_REF
エンティティ参照ノード
XMLReader::ENTITY
エンティティ宣言ノード
XMLReader::PI
処理命令 (Processing Instruction) ノード
XMLReader::COMMENT
コメントノード
XMLReader::DOC
文書ノード
XMLReader::DOC_TYPE
文書型ノード
XMLReader::DOC_FRAGMENT
文書片ノード
XMLReader::NOTATION
記法ノード
XMLReader::WHITESPACE
Whitespace ノード
XMLReader::SIGNIFICANT_WHITESPACE
Significant Whitespace ノード
XMLReader::END_ELEMENT
終了要素
XMLReader::END_ENTITY
終了エンティティ
XMLReader::XML_DECLARATION
XML 宣言ノード


XMLReader パーサオプション

XMLReader::LOADDTD
DTD を読み込むが、妥当性は検証しない
XMLReader::DEFAULTATTRS
DTD およびデフォルト属性を読み込むが、妥当性は検証しない
XMLReader::VALIDATE
DTD を読み込み、パース時に妥当性を検証する
XMLReader::SUBST_ENTITIES
エンティティを参照で置き換える


目次