Your company here, and a link to your site. Click to find out more.

xmlcopy.3am - Man Page

Provides token reconstruction facilities to gawk-xml.


@include "xmlcopy"

result = XmlToken()

XmlSetAttribute(name, value)


The xmlcopy awk library adds the ability to reconstruct the current XML token. The token can be modified before reconstruction.

Token reconstruction


Returns an XML string that represents the current token. The token is reconstructed from the predefined variables XMLEVENT, XMLNAME, XMLATTR and $0. They can have the original current token values or user modified ones.


Writes an XML string that represents the current token, as returned by XmlToken().

Token modification

XmlSetAttribute(name, value)

Adds or replaces the (name, value) entry in XMLATTR. Adds name to $0 if not already in it.


Removes name from $0, so XmlToken() will ignore it. Keeps XMLATTR unchanged..


The xmlcopy library includes the xmlbase library. Its functionality is implicitly available.


When an XML declaration is reconstructed, the advertised encoding may not match the actual encoding.

See Also

XML Processing With gawk, xmlbase(3am), xmltree(3am), xmlsimple(3am), xmlwrite(3am).


Manuel Collado, m-collado@users.sourceforge.net.

Copying Permissions

Copyright (C) 2017, Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.


January 2017 GAWK Extension Library (gawkextlib) GNU Awk Extension Modules