XMLReader

目次

XMLReader クラス

はじめに

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

クラス概要

XMLReader
/* 定数 */
public const int XMLReader::NONE;
public const int XMLReader::ELEMENT;
public const int XMLReader::ATTRIBUTE;
public const int XMLReader::TEXT;
public const int XMLReader::CDATA;
public const int XMLReader::ENTITY_REF;
public const int XMLReader::ENTITY;
public const int XMLReader::PI;
public const int XMLReader::COMMENT;
public const int XMLReader::DOC;
public const int XMLReader::DOC_TYPE;
public const int XMLReader::DOC_FRAGMENT;
public const int XMLReader::NOTATION;
public const int XMLReader::WHITESPACE;
public const int XMLReader::SIGNIFICANT_WHITESPACE;
public const int XMLReader::END_ELEMENT;
public const int XMLReader::END_ENTITY;
public const int XMLReader::XML_DECLARATION;
public const int XMLReader::LOADDTD;
public const int XMLReader::DEFAULTATTRS;
public const int XMLReader::VALIDATE;
public const int XMLReader::SUBST_ENTITIES;
/* プロパティ */
public int $attributeCount;
public string $baseURI;
public int $depth;
public bool $hasAttributes;
public bool $hasValue;
public bool $isDefault;
public bool $isEmptyElement;
public string $localName;
public string $name;
public string $namespaceURI;
public int $nodeType;
public string $prefix;
public string $value;
public string $xmlLang;
/* メソッド */
public true close()
public DOMNodefalse expand(DOMNodenull $baseNode = null)
public stringnull getAttribute(string $name)
public stringnull getAttributeNo(int $index)
public stringnull getAttributeNs(string $name, string $namespace)
public bool getParserProperty(int $property)
public bool isValid()
public stringnull lookupNamespace(string $prefix)
public bool moveToAttribute(string $name)
public bool moveToAttributeNo(int $index)
public bool moveToAttributeNs(string $name, string $namespace)
public bool moveToElement()
public bool moveToFirstAttribute()
public bool moveToNextAttribute()
public bool next(stringnull $name = null)
public static boolXMLReader open(string $uri, stringnull $encoding = null, int $flags = 0)
public bool read()
public string readInnerXml()
public string readOuterXml()
public string readString()
public bool setParserProperty(int $property, bool $value)
public bool setRelaxNGSchema(stringnull $filename)
public bool setRelaxNGSchemaSource(stringnull $source)
public bool setSchema(stringnull $filename)
public static boolXMLReader XML(string $source, stringnull $encoding = null, int $flags = 0)

プロパティ

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

エンティティを参照で置き換える