diff options
author | xue <> | 2006-06-15 18:18:47 +0000 |
---|---|---|
committer | xue <> | 2006-06-15 18:18:47 +0000 |
commit | 6c0154fb4e292ad22667e618f598a37cc5f9d524 (patch) | |
tree | 925b51622b8f054d203050cd673eb48a24035c3c /framework/Xml | |
parent | c8919fa9fc845ab7f3c6701b6de08c8cd042ec30 (diff) |
Merge from 3.0 branch till 1166.
Diffstat (limited to 'framework/Xml')
-rw-r--r-- | framework/Xml/TXmlDocument.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php index ab4b0b7a..0d766c68 100644 --- a/framework/Xml/TXmlDocument.php +++ b/framework/Xml/TXmlDocument.php @@ -229,6 +229,42 @@ class TXmlElement extends TComponent * 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: + * <code> + * $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; + * </code> + * The above code represents the following XML string: + * <code> + * <?xml version="1.0" encoding="utf-8"?> + * <Root> + * <Proc Name="xxxx"> + * <Query ID="xxxx"> + * <Attr Name="aaa">1</Attr> + * <Attr Name="bbb">1</Attr> + * </Query> + * </Proc> + * </Root> + * </code> + * * @author Qiang Xue <qiang.xue@gmail.com> * @version $Revision: $ $Date: $ * @package System.Xml |