Commits

ma...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed 9d4df03

Updated Changes
Allowed making the docs in make dist, rather than at Makefile.PL run-time

  • Participants
  • Parent commits cceab6d

Comments (0)

Files changed (6)

 Revision history for Perl extension XML::LibXSLT.
 
+0.92
+    - Many segfault and other bug fixes
+    - More DOM API methods added
+
 0.91
     - Removed from XML::LibXSLT distribution
     - Added DOM API (phish)
 DEATH
 }
 
-# have_library("xml2", "ghttp_get_header_names");
-
-print "creating POD files\n";
-
-system($^X, "example/xml2pod.pl");
-
 WriteMakefile(
     'NAME'	=> 'XML::LibXML',
     'VERSION_FROM' => 'LibXML.pm', # finds $VERSION
     'AUTHOR'    => 'Matt Sergeant',
     'ABSTRACT'  => 'Interface to Gnome libxml2 xml parsing and DOM library',
     'OBJECT'    => '$(O_FILES)', # add the DOM extensions to libxml2
+    'dist'      => { PREOP => "$^X example/xml2pod.pl" },
     %config,
 );
 

File example/xml2pod.pl

 #!/usr/bin/perl -w
 use XML::LibXML;
+use File::Path;
+use File::Basename;
 
 # (c) 2001 christian p. glahn
 
   # print the data to a separated POD File
   my $filename = $node->getAttribute("name");
   $filename =~ s/::/\//g;
-  print("writing file: lib/${filename}.pod\n");
-  open FILE , "> lib/${filename}.pod" ||
+  print("writing file: XML-LibXML-${XML::LibXML::VERSION}/lib/${filename}.pod\n");
+  mkpath([dirname("XML-LibXML-${XML::LibXML::VERSION}/lib/${filename}.pod")]);
+  open FILE , "> XML-LibXML-${XML::LibXML::VERSION}/lib/${filename}.pod" ||
     do{
       warn "cannot open file...\n"; 
       return ; # don't proceed if there is no open descriptor

File lib/XML/LibXML/Document.pod

 
   use XML::LibXML::Document;
 
-  $dom = XML::LibXML::Document->new( $version, $encoding )
+  $dom = XML::LibXML::Document->new( $version, $encoding );
   $dom = XML::LibXML::Document->createDocument( $version, $encoding );
-  $docstring = $dom->toString();
+  $strEncoding = $doc->getEncoding();
+  $strVersion = $doc->getVersion();
+  $bool = $doc->isEqual( $other_doc );
+  $docstring = $dom->toString([$format]);
   $bool = $dom->is_valid();
   $root = $dom->getDocumentElement($name, $namespace );
   $dom->setDocumentElement( $root );
 sometimes it is needed, to create a Document from scratch. The
 provides functions that are conform to the DOM Core naming
 style.
+It is suggested, allways to create a node unbound of a document.
+There is no need of really including the node to the document, but
+since the node is once bound to a document, it is quite save that
+all strings have the correct encoding. If an unbound textnode with
+an iso encoded string is created (e.g. with $CLASS->new()), the
+I<toString> function may not return the expected result.
+This seems like a limitation as long UTF8 encoding is ashured. If
+iso encoded strings come into play it is much saver to use the
+node creation functions of B<XML::LibXML::Document>.
 
 =head2 Methods
 
   <?xml version="your version" encoding="your encoding"?>
 
 
+Both parameter are optional. The default value for B<$version> is I<1.0> , of course. If the B<$encoding> parameter is not set,
+the encoding will be left unset, which means UTF8 is implied.
+The parameter less call of B<createDocument> wil result the following code:
+
+  
+  <?xml version="1.0"?>
+
+
+=item B<getEncoding>
+
+returns the encoding string of the document
+
+=item B<getVersion>
+
+returns the version string of the document
+
+=item B<isEqual>
+
+returns TRUE (1) if documents refer to the same documentstructure,
+otherwise FALSE (0) is returned.
+
 =item B<toString>
 
 B<toString> is a deparsing function, so the DOM Tree can
 be translated into a string, ready for output.
+The optional B<$format> parameter sets the indenting of the output. This parameter is expected to be an I<integer> value,
+that specifies the number of linebreaks for each node.
+For more information about the formatted output check the documentation
+of I<xmlDocDumpFormatMemory> in I<libxml2/tree.h> .
 
 =item B<is_valid>
 

File lib/XML/LibXML/Element.pod

   $node->removeAttribute( $aname );
   @nodes = $node->getElementsByTagName($tagname);
   $node->appendWellBalancedChunk( $chunk )
-  $node->appendTextNode( $PCDATA )
+  $node->appendText( $PCDATA );
+  $node->appendTextNode( $PCDATA );
+  $node->appendTextChild( $childname , $PCDATA )
 
 =head1 DESCRIPTION
 
 
 =item B<getElementsByTagName>
 
-The function gives direct access to all childnodes of the current node with the same tagname. It makes things a lot easier if you need to handle big datasets.
+The function gives direct access to all childnodes of the current
+node with the same tagname. It makes things a lot easier if you
+need to handle big datasets.
 
 =item B<appendWellBalancedChunk>
 
 Sometimes it is nessecary to append a string coded XML Tree to a node. B<appendWellBalancedChunk> will do the trick for you.
 But this is only done if the String is I<well-balanced> .
 
+=item B<appendText>
+
+alias for appendTextNode().
+
 =item B<appendTextNode>
 
 This wrapper function lets you add a string directly to an element
 node.
 
+=item B<appendTextChild>
+
+Somewhat similar with I<appendTextNode> : It lets you set an
+Element, that contains only a I<text node> directly by
+specifying the name and the text content.
+
 =back
 
 =head1 SEE ALSO

File lib/XML/LibXML/Node.pod

   use XML::LibXML::Node;
 
   $name = $node->getName();
+  $bool = $node->isEqual( $other_node );
   $content = $node->getData()
   $type = $node->getType();
   $node->unbindNode()
   @nodes = $node->findnodes( $xpath_statement );
   @children = $node->getChildnodes();
   $xmlstring = $node->toString();
+  $document->importNode( $node [, $move] );
 
 =head1 DESCRIPTION
 
 
 Returns the node's name
 
+=item B<isEqual>
+
+returns TRUE (1) if documents refer to the same nodestructure,
+otherwise FALSE (0) is returned.
+
 =item B<getData>
 
 If the node has any content (such as stored in a I<text
 B<cloneNode> creates a copy of I<$node> . Wether $deep
 is set to 1 (true) the function will copy all childnodes as
 well. If $deep is 0 only the current node will be copied.
-By now the function is not aware about the CLASS that is
-blessed to the node to copy, therefor all CLASS specific
-functions will not be accesseble any more :-(
 
 =item B<getParentNode>
 
 
 =item B<setOwnerDocument>
 
-This function binds a node to another DOM. This method unbinds the node first, if it is allready bound to another document.
+This function binds a node to another DOM. This method unbinds the
+node first, if it is allready bound to another document.
 
 =item B<insertBefore>
 
 
 =item B<getChildnodes>
 
-B<getChildnodes> implements a more intuitive interface to the childnodes of the current node. It enables you to pass all children directly to a I<map> or I<grep> .
+B<getChildnodes> implements a more intuitive interface to the
+childnodes of the current node. It enables you to pass all
+children directly to a I<map> or I<grep> .
 
 =item B<toString>
 
 This is the equivalent to I<XML::LibXML::Document::toString> for
 a single node. This means a node and all its childnodes will be dumped into the result string. There is no formating implemented yet, which may cause an unreadable output.
 
+=item B<importNode>
+
+B<THIS FUNCTION IS NOT IMPLEMENTED YET> If a node is not part of a document, it can be imported to another
+document. As specified in DOM Level 2 Specification the Node will
+not be altered or removed from its original document by default. ( I<$node->cloneNode(1)> will get called implicitly). Sometimes it is nessecary to I<move> a node between
+documents. In such a case the node will not be copied, but removed
+from the original document.
+
 =back
 
 =head1 SEE ALSO