PHP 클래스 Prado\Xml\TXmlDocument
TXmlDocument represents a DOM representation of an XML file.
Besides all properties and methods inherited from {@link TXmlElement},
you can load an XML file or string by {@link loadFromFile} or {@link loadFromString}.
You can also get the version and encoding of the XML document by
the Version and Encoding properties.
To construct an XML string, you may do the following:
$doc=new TXmlDocument('1.0','utf-8');
$doc->TagName='Root';
$proc=new TXmlElement('Proc');
$proc->setAttribute('Name','xxxx');
$doc->Elements[]=$proc;
$query=new TXmlElement('Query');
$query->setAttribute('ID','xxxx');
$proc->Elements[]=$query;
$attr=new TXmlElement('Attr');
$attr->setAttribute('Name','aaa');
$attr->Value='1';
$query->Elements[]=$attr;
$attr=new TXmlElement('Attr');
$attr->setAttribute('Name','bbb');
$attr->Value='1';
$query->Elements[]=$attr;
The above code represents the following XML string:
1
1
파일 보기
프로젝트 열기: pradosoft/prado
1 사용 예제들
공개 메소드들
보호된 메소드들
메소드 |
설명 |
|
buildElement ( $node ) : TXmlElement |
Recursively converts DOM XML nodes into TXmlElement |
|
메소드 상세
public __construct ( $version = '1.0', $encoding = '' ) |
$document = new TXmlDocument();
$document->TagName = 'root';
echo $document;
or
$document = new TXmlDocument();
$document->TagName = 'root';
$xml = (string)$document;
Recursively converts DOM XML nodes into TXmlElement
protected buildElement ( $node ) : TXmlElement |
리턴 |
TXmlElement |
the converted TXmlElement |
Loads and parses an XML document.
The version and encoding will be determined based on the parsing result.
Saves this XML document as an XML file.
Saves this XML document as an XML string