Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog

## v1.0.1 (2025-02-20)
- Minor documentation updates and fixes.

## v1.0.0 (2025-02-20)
- Initial release of `neoncitylights/xml` library.
2 changes: 2 additions & 0 deletions src/Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Neoncitylights\Xml;

/**
* A text encoding of an XML document
*
* @see https://www.php.net/manual/en/xml.encoding.php
*/
enum Encoding: string {
Expand Down
2 changes: 2 additions & 0 deletions src/ErrorCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Neoncitylights\Xml;

/**
* An error code returned from an XML parser
*
* @see https://www.php.net/manual/en/xml.constants.php
*/
enum ErrorCode: int {
Expand Down
2 changes: 2 additions & 0 deletions src/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Neoncitylights\Xml;

/**
* Options for configuring an XML parser
*
* @see https://www.php.net/manual/en/xml.constants.php
*/
enum Option: int {
Expand Down
10 changes: 6 additions & 4 deletions src/XmlNativeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use XMLParser;

/**
* A lightweight wrapper around PHP's native XML API.
*/
class XmlNativeParser {
public readonly XMLParser $parser;

Expand All @@ -28,7 +31,6 @@ public static function new( ?Encoding $encoding = null ): self {
*/
public static function newWithNamespace(
?Encoding $encoding = null,

?string $separator = ':',
): self {
return new XmlNativeParser( \xml_parser_create_ns(
Expand Down Expand Up @@ -135,7 +137,7 @@ public function getCaseFolding(): bool {

/**
* Retrieve the parser option value of
* `XML_OPTION_SKIP_TAG_START`.
* `XML_OPTION_SKIP_TAGSTART`.
*/
public function getSkipTagStart(): int {
return $this->getOption( Option::SkipTagStart );
Expand Down Expand Up @@ -180,7 +182,7 @@ public function setCaseFolding( bool $value ): bool {
}

/**
* Sets the parser option of `XML_OPTION_SKIP_WHITE`.
* Sets the parser option of `XML_OPTION_SKIP_TAGSTART`.
*
* @return bool Returns a boolean for whether or not
* setting the option was a success.
Expand Down Expand Up @@ -307,7 +309,7 @@ public function onProcessingInstruction( callable|null $handler ): true {
*
* Internally calls `xml_set_start_namespace_decl_handler()`.
*
* @param (callable(XmlDocumentParser, string): void)|null $handler
* @param (callable(string): void)|null $handler
* @return true Always returns true
*/
public function onStartNamespaceDecl( callable|null $handler ): true {
Expand Down