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

Commit 8514222

Browse files
committed
XMLProcessor: Support namespaces
1 parent 76cdab5 commit 8514222

File tree

4 files changed

+325
-119
lines changed

4 files changed

+325
-119
lines changed

components/DataLiberation/EntityReader/EPubEntityReader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private function parse_manifest() {
141141
return false;
142142
}
143143

144-
$full_path = $xml->get_attribute( 'full-path' );
144+
$full_path = $xml->get_attribute_by_qualified_name( 'full-path' );
145145
if ( ! $full_path ) {
146146
return false;
147147
}
@@ -161,13 +161,13 @@ private function parse_manifest() {
161161
);
162162
while ( $xml->next_tag() ) {
163163
$parsed_entry = array();
164-
$keys = $xml->get_attribute_names_with_prefix( '' );
164+
$keys = $xml->get_attribute_qualified_names_with_prefix( '' );
165165
foreach ( $keys as $key ) {
166-
$parsed_entry[ $key ] = $xml->get_attribute( $key );
166+
$parsed_entry[ $key ] = $xml->get_attribute_by_qualified_name( $key );
167167
}
168168
if ( $xml->matches_breadcrumbs( array( 'metadata', '*' ) ) ) {
169169
$parsed['metadata'][] = array(
170-
'tag' => $xml->get_tag(),
170+
'tag' => $xml->get_qualified_tag(),
171171
'attributes' => $parsed_entry,
172172
);
173173
} elseif ( $xml->matches_breadcrumbs( array( 'manifest', 'item' ) ) ) {

components/DataLiberation/EntityReader/WXREntityReader.php

Lines changed: 6 additions & 6 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_tag();
662+
$tag = $this->xml->get_qualified_tag();
663663
/**
664664
* Custom adjustment: the Accessibility WXR file uses a non-standard
665665
* wp:wp_author tag.
@@ -732,16 +732,16 @@ private function read_next_entity() {
732732
*/
733733
if ( $this->xml->is_tag_opener() ) {
734734
$this->last_opener_attributes = array();
735-
$names = $this->xml->get_attribute_names_with_prefix( '' );
735+
$names = $this->xml->get_attribute_qualified_names_with_prefix( '' );
736736
foreach ( $names as $name ) {
737-
$this->last_opener_attributes[ $name ] = $this->xml->get_attribute( $name );
737+
$this->last_opener_attributes[ $name ] = $this->xml->get_attribute_by_qualified_name( $name );
738738
}
739739
$this->text_buffer = '';
740740

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_tag(), static::KNOWN_SITE_OPTIONS )
744+
array_key_exists( $this->xml->get_qualified_tag(), 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_tag(), static::KNOWN_SITE_OPTIONS ) ) {
851+
if ( ! array_key_exists( $this->xml->get_qualified_tag(), 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_tag() ],
857+
'option_name' => static::KNOWN_SITE_OPTIONS[ $this->xml->get_qualified_tag() ],
858858
'option_value' => $this->text_buffer,
859859
);
860860
$this->emit_entity();

0 commit comments

Comments
 (0)