xml_parse

(PHP 4, PHP 5, PHP 7, PHP 8)

xml_parseStart parsing an XML document

Beschreibung

xml_parse(XMLParser $parser, string $data, bool $is_final = false): int

xml_parse() parses an XML document. The handlers for the configured events are called as many times as necessary.

Parameter-Liste

parser

A reference to the XML parser to use.

data

Chunk of data to parse. A document may be parsed piece-wise by calling xml_parse() several times with new data, as long as the is_final parameter is set and true when the last data is parsed.

is_final

If set and true, data is the last piece of data sent in this parse.

Rückgabewerte

Returns 1 on success or 0 on failure.

For unsuccessful parses, error information can be retrieved with xml_get_error_code(), xml_error_string(), xml_get_current_line_number(), xml_get_current_column_number() and xml_get_current_byte_index().

Hinweis:

Some errors (such as entity errors) are reported at the end of the data, thus only if is_final is set and true.

Changelog

Version Beschreibung
8.0.0 parser erwartet nun eine XMLParser-Instanz; vorher wurde eine Ressource erwartet.

Beispiele

Beispiel #1 Chunked parsing of large XML documents

This example shows how large XML documents can be read and parsed in chunks, so that it not necessary to keep the whole document in memory. Error handling is omitted for brevity.

<?php
$stream 
fopen('large.xml''r');
$parser xml_parser_create();
// set up the handlers here
while (($data fread($stream16384))) {
    
xml_parse($parser$data); // parse the current chunk
}
xml_parse($parser''true); // finalize parsing
xml_parser_free($parser);
fclose($stream);

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Logindaten mit Adressdaten verknüpfen

Yes, this is definitely possible and makes sense with the two tables. You can link the user to their address by using a foreign key, like account_ ...

Geschrieben von thomashuis am 02.09.2025 17:08:44
Forum: PHP Developer Forum
Ein data POST via Curl funktioniert nicht.

Ja, ich lasse mir teilweise Code von KI generieren und nutze dafür vor allem GitHub Copilot und ChatGPT, wobei ich den Output immer nochmal manue ...

Geschrieben von coeddie11 am 28.08.2025 10:45:33
Forum: PHP Developer Forum
Sortieren?!

Ich denke mal du meinst das so (Beispiel): ID, Name, PLZ, Wohnort etc. stehen in der DB: 1 Ute Steingräber 12345 Dödelsheim 2 Mark Zimmermann ...

Geschrieben von wilsonbarnes am 25.08.2025 09:28:12
Forum: PHP Developer Forum
Einfache Diashow

Habe jetzt die Lösung gefunden. Jetzt auch mit Beschreibung unter dem jeweiligen Bild var aktuell = 0; var bilder=["bild1.jpg","bild2.jpg","b ...

Geschrieben von Mr_Frost am 22.08.2025 10:36:41
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS