現在の位置: ホーム> 関数カテゴリ一覧> xml_get_current_column_number

xml_get_current_column_number

XMLパーサーの現在の列番号を取得します
名前:xml_get_current_column_number
カテゴリ:XMLパーサー
対応言語:php
一言説明:XMLパーサーから現在の列番号を返します。

定義と使用法

xml_get_current_column_number()関数は、xmlパーサーの現在の列番号を返します。

エラーが発生したら、XMLパーサーのエラー説明、行番号、および列番号を返します。

 <?php
//無効なXMLファイル
$ xmlfile = 'test.xml' ;
$ xmlparser = xml_parser_create ( ) ;

//ファイルを開き、データを読み取ります
$ fp = fopen ( $ xmlfile 、 'r' ) ;
while ( $ xmldata = fread ( $ fp 、 4096 ) ) {
  //データブロックを分析します
  if ( ! xml_parse ( $ xmlparser 、 $ xmldata 、 feof ( $ fp ) ) ) {
    die (印刷「エラー:」
    。 XML_ERROR_STRING ( XML_GET_ERROR_CODE ( $ XMLPARSER ) )
    。 "<br> line:"
    。 xml_get_current_line_number ( $ xmlparser )
    。 「<br>列:」
    。 xml_get_current_column_number ( $ xmlparser )
    。 "<br>" ) ;
  }
}
xml_parser_free ( $ xmlparser ) ;
?>

上記のコードの出力は次のとおりです。

エラー:不一致のタグ
ライン: 5
列: 41

文法

xml_get_current_column_number (パーサー
パラメーター 説明する
パーサー 必須。使用するXMLパーサーを指定します。
類似の関数
人気記事(にんききじ)