Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.

Commit 44cf981

Browse files
committed
Support namespaces in all methods
1 parent 8c0dcdc commit 44cf981

File tree

8 files changed

+501
-426
lines changed

8 files changed

+501
-426
lines changed

components/DataLiberation/EntityReader/EPubEntityReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private function parse_manifest() {
167167
}
168168
if ( $xml->matches_breadcrumbs( array( 'metadata', '*' ) ) ) {
169169
$parsed['metadata'][] = array(
170-
'tag' => $xml->get_local_tag_name(),
170+
'tag' => $xml->get_tag_local_name(),
171171
'attributes' => $parsed_entry,
172172
);
173173
} elseif ( $xml->matches_breadcrumbs( array( 'manifest', 'item' ) ) ) {

components/DataLiberation/EntityReader/WXREntityReader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ private function read_next_entity() {
659659
$this->last_xml_cursor_outside_of_entity = $this->xml->get_reentrancy_cursor();
660660
}
661661

662-
$tag = $this->xml->get_local_tag_name();
662+
$tag = $this->xml->get_tag_local_name();
663663
/**
664664
* Custom adjustment: the Accessibility WXR file uses a non-standard
665665
* wp:wp_author tag.
@@ -741,7 +741,7 @@ private function read_next_entity() {
741741
$is_site_option_opener = (
742742
count( $this->xml->get_breadcrumbs() ) === 3 &&
743743
$this->xml->matches_breadcrumbs( array( 'rss', 'channel', '*' ) ) &&
744-
array_key_exists( $this->xml->get_local_tag_name(), static::KNOWN_SITE_OPTIONS )
744+
array_key_exists( $this->xml->get_tag_local_name(), static::KNOWN_SITE_OPTIONS )
745745
);
746746
if ( $is_site_option_opener ) {
747747
$this->last_xml_byte_offset_outside_of_entity = $this->xml->get_token_byte_offset_in_the_input_stream();
@@ -848,13 +848,13 @@ private function read_next_entity() {
848848
* @return bool Whether a site_option entity was emitted.
849849
*/
850850
private function parse_site_option() {
851-
if ( ! array_key_exists( $this->xml->get_local_tag_name(), static::KNOWN_SITE_OPTIONS ) ) {
851+
if ( ! array_key_exists( $this->xml->get_tag_local_name(), static::KNOWN_SITE_OPTIONS ) ) {
852852
return false;
853853
}
854854

855855
$this->entity_type = 'site_option';
856856
$this->entity_data = array(
857-
'option_name' => static::KNOWN_SITE_OPTIONS[ $this->xml->get_local_tag_name() ],
857+
'option_name' => static::KNOWN_SITE_OPTIONS[ $this->xml->get_tag_local_name() ],
858858
'option_value' => $this->text_buffer,
859859
);
860860
$this->emit_entity();

components/XML/Tests/XMLProcessorTest.php

Lines changed: 202 additions & 201 deletions
Large diffs are not rendered by default.

components/XML/XMLAttributeToken.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class XMLAttributeToken {
2525
*
2626
* @var string
2727
*/
28-
public $name;
28+
public $qualified_name;
2929

3030
/**
3131
* Attribute value.
@@ -102,8 +102,8 @@ class XMLAttributeToken {
102102
* @param string $namespace Namespace.
103103
*
104104
*/
105-
public function __construct( $name, $value_start, $value_length, $start, $length, $namespace_prefix=null, $local_name=null, $namespace=null ) {
106-
$this->name = $name;
105+
public function __construct( $qualified_name, $value_start, $value_length, $start, $length, $namespace_prefix=null, $local_name=null, $namespace=null ) {
106+
$this->qualified_name = $qualified_name;
107107
$this->value_starts_at = $value_start;
108108
$this->value_length = $value_length;
109109
$this->start = $start;

components/XML/XMLElement.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,9 @@ public function __construct( $local_name, $namespace_prefix, $namespace, $namesp
6868
$this->namespaces_in_scope = $namespaces_in_scope;
6969
$this->qualified_name = $namespace_prefix ? $namespace_prefix . ':' . $local_name : $local_name;
7070
}
71+
72+
public function get_full_name() {
73+
return $this->namespace ? '{' . $this->namespace . '}' . $this->local_name : $this->local_name;
74+
}
7175

7276
}

0 commit comments

Comments
 (0)