XMLReader XMLReader 클래스

(PHP 5 >= 5.1.0, PHP 7, PHP 8)


소개

XMLReader 확장은 XML 풀 파서입니다. 판독기는 문서 스트림에서 앞으로 이동하고 도중에 각 노드에서 멈추는 커서 역할을 합니다.


클래스 개요

                  
class XMLReader {

  /* Constants */
  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;

  /* Properties */
  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;

  /* Methods */
  public close(): bool
  public expand(?DOMNode $baseNode = null): DOMNode|false
  public getAttribute(string $name): ?string
  public getAttributeNo(int $index): ?string
  public getAttributeNs(string $name, string $namespace): ?string
  public getParserProperty(int $property): bool
  public isValid(): bool
  public lookupNamespace(string $prefix): ?string
  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 $name = null): bool
  public static open(string $uri, ?string $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 $filename): bool
  public setRelaxNGSchemaSource(?string $source): bool
  public setSchema(?string $filename): bool
  public static XML(string $source, ?string $encoding = null, int $flags = 0): bool|XMLReader
}
                  
                

Properties

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 node
XMLReader::ENTITY_REF
엔티티 참조 노드
XMLReader::ENTITY
엔티티 선언 노드
XMLReader::PI
처리 명령 노드
XMLReader::COMMENT
댓글 노드
XMLReader::DOC
문서 노드
XMLReader::DOC_TYPE
문서 유형 노드
XMLReader::DOC_FRAGMENT
문서 조각 노드
XMLReader::NOTATION
표기법 노드
XMLReader::WHITESPACE
Whitespace node
XMLReader::SIGNIFICANT_WHITESPACE
중요한 공백 노드
XMLReader::END_ELEMENT
End Element
XMLReader::END_ENTITY
최종 개체
XMLReader::XML_DECLARATION
XML 선언 노드

XMLReader 파서 옵션

XMLReader::LOADDTD
DTD를 로드하지만 유효성을 검사하지 않습니다.
XMLReader::DEFAULTATTRS
DTD 및 기본 속성을 로드하지만 유효성을 검사하지 않습니다.
XMLReader::VALIDATE
DTD 로드 및 구문 분석 중 유효성 검사
XMLReader::SUBST_ENTITIES
엔티티 대체 및 참조 확장

목차