Anonymous avatar Anonymous committed 5047076

- fix POD synopsis: start_push (incorrect) vs init_push (correct)
- allow text and entity reference nodes to be appended as a children of an attribute

Comments (0)

Files changed (4)

     else {
         eval { $retval = $self->_end_push( $self->{CONTEXT}, $restore ); };
     }
+    my $err = $@;
     delete $self->{CONTEXT};
-    my $err = $@;
     if ( $err ) {
         chomp $err unless ref $err;
         croak( $err );
 
                 <variablelist>
                     <varlistentry>
-                        <term>start_push</term>
+                        <term>init_push</term>
 
                         <listitem>
                             <funcsynopsis>
-                                <funcsynopsisinfo>$parser-&gt;start_push();</funcsynopsisinfo>
+                                <funcsynopsisinfo>$parser-&gt;init_push();</funcsynopsisinfo>
                             </funcsynopsis>
 
                             <para>Initializes the push parser.</para>
                                 <funcsynopsisinfo>$parser-&gt;push(@data);</funcsynopsisinfo>
                             </funcsynopsis>
 
-                            <para>This function pushes the data stored inside the array to libxml2's parser. Each entry in @data must be a normal scalar!</para>
+                            <para>This function pushes the data stored inside the array to libxml2's parser. Each entry in @data must be a normal scalar! This method can be called repeatedly.</para>
                         </listitem>
                     </varlistentry>
 
 int
 domTestHierarchy(xmlNodePtr cur, xmlNodePtr refNode) 
 {
-    if ( !refNode || !cur || cur->type == XML_ATTRIBUTE_NODE ) {
+    if ( !refNode || !cur ) {
         return 0;
     }
+    if (cur->type == XML_ATTRIBUTE_NODE) {
+      switch ( refNode->type ){
+      case XML_TEXT_NODE:
+      case XML_ENTITY_REF_NODE:
+        return 1;
+        break;
+      default:
+        return 0;
+        break;
+      }
+    }
 
     switch ( refNode->type ){
     case XML_ATTRIBUTE_NODE:
 
 use Test;
 
-BEGIN { plan tests => 137 };
+BEGIN { plan tests => 138 };
 use XML::LibXML;
 use XML::LibXML::Common qw(:libxml);
 
    ok($@, qr/HIERARCHY_REQUEST_ERR/);   	
 }
 
+{
+   my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
+   my $attr = $doc->createAttribute('test','bar');
+   my $ent = $doc->createEntityReference('foo');
+   my $text = $doc->createTextNode('baz');
+   $attr->appendChild($ent);
+   $attr->appendChild($text);
+   ok($attr->toString() eq ' test="bar&foo;baz"');
+}
+
 { 
   for my $obj (qw(Document DocumentFragment Comment CDATASection PI Text)) { 
     
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.