Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 12294

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>XMLReader functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="函数参考"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="xmlrpc_set_type"
HREF="function.xmlrpc-set-type.html"><LINK
REL="NEXT"
TITLE="XMLReader::close"
HREF="function.xmlreader-close.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="reference"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.xmlrpc-set-type.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.xmlreader-close.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.xmlreader"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>CLXXXI. XMLReader functions</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN242196"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="xmlreader.intro"
>简介</A
></H1
><P
>&#13;     The XMLReader extension is an XML Pull parser. The reader acts as a 
     cursor going forward on the document stream and stopping at each node 
     on the way.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="xmlreader.installation"
>安装</A
></H1
><P
>&#13;   The XMLReader extension is available in PECL as of PHP 5.0.0 and is 
   included and enabled as of PHP 5.1.0 by default. It can be enabled
   by adding the argument <CODE
CLASS="option"
>--enable-xmlreader</CODE
>
   (or <CODE
CLASS="option"
>--with-xmlreader</CODE
> before 5.1.0)
   to your configure line. The <A
HREF="ref.libxml.html"
>libxml</A
>
   extension is required.
  </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="xmlreader.classes"
>预定义类</A
></H1
><P
>&#13;    </P
><DIV
CLASS="section"
><H2
CLASS="section"
><A
NAME="xmlreader.class.xmlreader"
><B
CLASS="classname"
>XMLReader</B
></A
></H2
><P
>&#13;      </P
><DIV
CLASS="section"
><H3
CLASS="section"
><A
NAME="xmlreader.class.xmlreader.methods"
>方法</A
></H3
><P
></P
><UL
><LI
><P
><A
HREF="function.xmlreader-close.html"
>XMLReader::close</A
> - Close the XMLReader input</P
></LI
><LI
><P
><A
HREF="function.xmlreader-expand.html"
>XMLReader::expand</A
> - Export current node to a DOM node</P
></LI
><LI
><P
><A
HREF="function.xmlreader-getattribute.html"
>XMLReader::getAttribute</A
> - Get value of attribute by name</P
></LI
><LI
><P
><A
HREF="function.xmlreader-getattributeno.html"
>XMLReader::getAttributeNo</A
> - Get value of attribute by position</P
></LI
><LI
><P
><A
HREF="function.xmlreader-getattributens.html"
>XMLReader::getAttributeNs</A
> - Get value of attribute by name and URI</P
></LI
><LI
><P
><A
HREF="function.xmlreader-getparserproperty.html"
>XMLReader::getParserProperty</A
> - Indicates if parser property is set or not</P
></LI
><LI
><P
><A
HREF="function.xmlreader-isvalid.html"
>XMLReader::isValid</A
> - Indicates if document is valid</P
></LI
><LI
><P
><A
HREF="function.xmlreader-lookupnamespace.html"
>XMLReader::lookupNamespace</A
> - Get URI for prefix in scope of node</P
></LI
><LI
><P
><A
HREF="function.xmlreader-movetoattribute.html"
>XMLReader::moveToAttribute</A
> - Positions reader on named attribute</P
></LI
><LI
><P
><A
HREF="function.xmlreader-movetoattributeno.html"
>XMLReader::moveToAttributeNo</A
> - Positions reader on attribute by index</P
></LI
><LI
><P
><A
HREF="function.xmlreader-movetoattributens.html"
>XMLReader::moveToAttributeNs</A
> - Position reader on attribute by name and URI</P
></LI
><LI
><P
><A
HREF="function.xmlreader-movetoelement.html"
>XMLReader::moveToElement</A
> - Move to parent element of current attribute node</P
></LI
><LI
><P
><A
HREF="function.xmlreader-movetofirstattribute.html"
>XMLReader::moveToFirstAttribute</A
> - Move to first attribute of node</P
></LI
><LI
><P
><A
HREF="function.xmlreader-movetonextattribute.html"
>XMLReader::moveToNextAttribute</A
> - Move to next attribute of node</P
></LI
><LI
><P
><A
HREF="function.xmlreader-next.html"
>XMLReader::next</A
> - Move to next element skipping children</P
></LI
><LI
><P
><A
HREF="function.xmlreader-open.html"
>XMLReader::open</A
> - Set URI to be parsed</P
></LI
><LI
><P
><A
HREF="function.xmlreader-read.html"
>XMLReader::read</A
> - Move to next node in stream</P
></LI
><LI
><P
><A
HREF="function.xmlreader-setparserproperty.html"
>XMLReader::setParserProperty</A
> - Set parser property</P
></LI
><LI
><P
><A
HREF="function.xmlreader-setrelaxngschema.html"
>XMLReader::setRelaxNGSchema</A
> - Set URI of RelaxNG schema to validate against</P
></LI
><LI
><P
><A
HREF="function.xmlreader-setrelaxngschemasource.html"
>XMLReader::setRelaxNGSchemaSource</A
> - Set string containing RelaxNG schema to validate against</P
></LI
><LI
><P
><A
HREF="function.xmlreader-xml.html"
>XMLReader::XML</A
> - Set string of data to be parsed</P
></LI
></UL
></DIV
><DIV
CLASS="section"
><H3
CLASS="section"
><A
NAME="xmlreader.class.xmlreader.properties"
>属性</A
></H3
><DIV
CLASS="table"
><A
NAME="AEN242281"
></A
><P
><B
>表 1. </B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><COL><THEAD
><TR
><TH
>Name</TH
><TH
>Type</TH
><TH
>Read-only</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>attributeCount</TD
><TD
>int</TD
><TD
>yes</TD
><TD
>The number of attributes on the node</TD
></TR
><TR
><TD
>baseURI</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The base URI of the node</TD
></TR
><TR
><TD
>depth</TD
><TD
>int</TD
><TD
>yes</TD
><TD
>Depth of the node in the tree starting at 0</TD
></TR
><TR
><TD
>hasAttributes</TD
><TD
>bool</TD
><TD
>yes</TD
><TD
>Indicates if node has attributes</TD
></TR
><TR
><TD
>hasValue</TD
><TD
>bool</TD
><TD
>yes</TD
><TD
>Indicates if node has a text value</TD
></TR
><TR
><TD
>isDefault</TD
><TD
>bool</TD
><TD
>yes</TD
><TD
>Indicates if attribute is defaulted from DTD</TD
></TR
><TR
><TD
>isEmptyElement</TD
><TD
>bool</TD
><TD
>yes</TD
><TD
>Indicates if node is an empty element tag</TD
></TR
><TR
><TD
>localName</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The local name of the node</TD
></TR
><TR
><TD
>name</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The qualified name of the node</TD
></TR
><TR
><TD
>namespaceURI</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The URI of the namespace associated with the node</TD
></TR
><TR
><TD
>nodeType</TD
><TD
>int</TD
><TD
>yes</TD
><TD
>The node type for the node</TD
></TR
><TR
><TD
>prefix</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The prefix of the namespace associated with the node</TD
></TR
><TR
><TD
>value</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The text value of the node</TD
></TR
><TR
><TD
>xmlLang</TD
><TD
>string</TD
><TD
>yes</TD
><TD
>The xml:lang scope which the node resides</TD
></TR
></TBODY
></TABLE
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="xmlreader.constants"
>预定义常量</A
></H1
><P
>以下常量由本扩展模块定义,因此只有在本扩展模块被编译到
PHP 中,或者在运行时被动态加载后才有效。</P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>警告</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>&#13;    XMLReader uses class constants since PHP 5.1. Prior releases use global
    constants in the form <TT
CLASS="constant"
><B
>XMLREADER_ELEMENT</B
></TT
>.
   </P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="table"
><A
NAME="AEN242367"
></A
><P
><B
>表 2. XMLReader Node Types</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Constant</TH
><TH
>Value</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::NONE</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>0</TD
><TD
>No node type</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::ELEMENT</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>1</TD
><TD
>Start element</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::ATTRIBUTE</B
></TT
> 
      (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>2</TD
><TD
>Attribute node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::TEXT</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>3</TD
><TD
>Text node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::CDATA</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>4</TD
><TD
>CDATA node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::ENTITY_REF</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>5</TD
><TD
>Entity Reference node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::ENTITY</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>6</TD
><TD
>Entity Declaration node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::PI</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>7</TD
><TD
>Processing Instruction node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::COMMENT</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>8</TD
><TD
>Comment node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::DOC</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>9</TD
><TD
>Document node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::DOC_TYPE</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>10</TD
><TD
>Document Type node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::DOC_FRAGMENT</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>11</TD
><TD
>Document Fragment node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::NOTATION</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>12</TD
><TD
>Notation node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::WHITESPACE</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>13</TD
><TD
>Whitespace node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::SIGNIFICANT_WHITESPACE</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>14</TD
><TD
>Significant Whitespace node</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::END_ELEMENT</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>15</TD
><TD
>End Element</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::END_ENTITY</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>16</TD
><TD
>End Entity</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::XML_DECLARATION</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>17</TD
><TD
>XML Declaration node</TD
></TR
></TBODY
></TABLE
></DIV
><DIV
CLASS="table"
><A
NAME="AEN242484"
></A
><P
><B
>表 3. XMLReader Parser Options</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Constant</TH
><TH
>Value</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::LOADDTD</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>1</TD
><TD
>Load DTD but do not validate</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::DEFAULTATTRS</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>2</TD
><TD
>Load DTD and default attributes but do not validate</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::VALIDATE</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>3</TD
><TD
>Load DTD and validate while parsing</TD
></TR
><TR
><TD
>&#13;       <TT
CLASS="constant"
><B
>XMLReader::SUBST_ENTITIES</B
></TT
>
       (<A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>)
      </TD
><TD
>4</TD
><TD
>Substitute entities and expand references</TD
></TR
></TBODY
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>目录</B
></DT
><DT
><A
HREF="function.xmlreader-close.html"
>XMLReader::close</A
>&nbsp;--&nbsp;Close the XMLReader input</DT
><DT
><A
HREF="function.xmlreader-expand.html"
>XMLReader::expand</A
>&nbsp;--&nbsp;Returns a copy of the current node as a DOM object</DT
><DT
><A
HREF="function.xmlreader-getattribute.html"
>XMLReader::getAttribute</A
>&nbsp;--&nbsp;Get the value of a named attribute</DT
><DT
><A
HREF="function.xmlreader-getattributeno.html"
>XMLReader::getAttributeNo</A
>&nbsp;--&nbsp;Get the value of an attribute by index</DT
><DT
><A
HREF="function.xmlreader-getattributens.html"
>XMLReader::getAttributeNs</A
>&nbsp;--&nbsp;Get the value of an attribute by localname and URI</DT
><DT
><A
HREF="function.xmlreader-getparserproperty.html"
>XMLReader::getParserProperty</A
>&nbsp;--&nbsp;
   Indicates if specified property has been set
  </DT
><DT
><A
HREF="function.xmlreader-isvalid.html"
>XMLReader::isValid</A
>&nbsp;--&nbsp;Indicates if the parsed document is valid</DT
><DT
><A
HREF="function.xmlreader-lookupnamespace.html"
>XMLReader::lookupNamespace</A
>&nbsp;--&nbsp;Lookup namespace for a prefix</DT
><DT
><A
HREF="function.xmlreader-movetoattribute.html"
>XMLReader::moveToAttribute</A
>&nbsp;--&nbsp;Move cursor to a named attribute</DT
><DT
><A
HREF="function.xmlreader-movetoattributeno.html"
>XMLReader::moveToAttributeNo</A
>&nbsp;--&nbsp;Move cursor to an attribute by index</DT
><DT
><A
HREF="function.xmlreader-movetoattributens.html"
>XMLReader::moveToAttributeNs</A
>&nbsp;--&nbsp;Move cursor to a named attribute</DT
><DT
><A
HREF="function.xmlreader-movetoelement.html"
>XMLReader::moveToElement</A
>&nbsp;--&nbsp;Position cursor on the parent Element of current Attribute</DT
><DT
><A
HREF="function.xmlreader-movetofirstattribute.html"
>XMLReader::moveToFirstAttribute</A
>&nbsp;--&nbsp;Position cursor on the first Attribute</DT
><DT
><A
HREF="function.xmlreader-movetonextattribute.html"
>XMLReader::moveToNextAttribute</A
>&nbsp;--&nbsp;Position cursor on the next Attribute</DT
><DT
><A
HREF="function.xmlreader-next.html"
>XMLReader::next</A
>&nbsp;--&nbsp;Move cursor to next node skipping all subtrees</DT
><DT
><A
HREF="function.xmlreader-open.html"
>XMLReader::open</A
>&nbsp;--&nbsp;Set the URI containing the XML to parse</DT
><DT
><A
HREF="function.xmlreader-read.html"
>XMLReader::read</A
>&nbsp;--&nbsp;Move to next node in document</DT
><DT
><A
HREF="function.xmlreader-setparserproperty.html"
>XMLReader::setParserProperty</A
>&nbsp;--&nbsp;Set or Unset parser options</DT
><DT
><A
HREF="function.xmlreader-setrelaxngschema.html"
>XMLReader::setRelaxNGSchema</A
>&nbsp;--&nbsp;Set the filename or URI for a RelaxNG Schema</DT
><DT
><A
HREF="function.xmlreader-setrelaxngschemasource.html"
>XMLReader::setRelaxNGSchemaSource</A
>&nbsp;--&nbsp;Set the data containing a RelaxNG Schema</DT
><DT
><A
HREF="function.xmlreader-xml.html"
>XMLReader::XML</A
>&nbsp;--&nbsp;Set the data containing the XML to parse</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.xmlrpc-set-type.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.xmlreader-close.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>xmlrpc_set_type</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>XMLReader::close</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>