PrintNode

From Svg wiki

return_string = printNode( node )
node any XML node from your SVG document, printNode will then return a string of the node and all children
return_string variable which receives and contains the returned value from printNode

Works just like .xml in MSXML.


From the Adobe SVG Forums:

Method printNode

Synopsis:

string printNode(dom::Node node)

Convert given XML node to string representation. There are several limitations in this process, mostly inherent in XML itself:

  • Empty text nodes are not preserved it most cases
  • Several contiguous text nodes will look like a single text node
  • Unless explicitly specified, namespaces of elements and attributes are represented purely by prefix, which does not necesserily match the actual Namespace

Note: the same serialization method is used as in "Copy SVG" menu item implementation.

printNode equivalent in Mozilla/Firefox

unfortunatly the printNode function is not implemented in mozilla/firefox native svg implementation. but its quite simple to provide the same functionallity with native object, here is how you do it:


function printNode(node){
  var serializer = new XMLSerializer();
  var xml = serializer.serializeToString(node);
  return xml
}