1% This file is part of the Attempto Parsing Engine (APE).
    2% Copyright 2008-2013, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch).
    3%
    4% The Attempto Parsing Engine (APE) is free software: you can redistribute it and/or modify it
    5% under the terms of the GNU Lesser General Public License as published by the Free Software
    6% Foundation, either version 3 of the License, or (at your option) any later version.
    7%
    8% The Attempto Parsing Engine (APE) is distributed in the hope that it will be useful, but WITHOUT
    9% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
   10% PURPOSE. See the GNU Lesser General Public License for more details.
   11%
   12% You should have received a copy of the GNU Lesser General Public License along with the Attempto
   13% Parsing Engine (APE). If not, see http://www.gnu.org/licenses/.
   14
   15
   16:- module(xmlterm_to_xmlatom, [
   17		xmlterm_to_xmlatom/2, % +XMLTerm, -XMLAtom
   18		xmlterm_to_xmlatom/3  % +XMLTerm, +Options, -XMLAtom
   19	]).

XML term to XML atom converter

author
- Tobias Kuhn
- Kaarel Kaljurand
version
- 2008-03-26 */
 xmlterm_to_xmlatom(+XMLTerm, -XMLAtom) is det
 xmlterm_to_xmlatom(+XMLTerm, +Options, -XMLAtom) is det
Transforms the term representation of an XML structure (using element/3) into an atom.
Arguments:
XMLTerm- is an XML document as SWI's XML term
Options- is a list of options for xml_write/3
XMLAtom- is an XML document as an atom
   38xmlterm_to_xmlatom(XMLTerm, XMLAtom) :-
   39	xmlterm_to_xmlatom(XMLTerm, [], XMLAtom).
   40
   41xmlterm_to_xmlatom(XMLTerm, Options, XMLAtom) :-
   42	new_memory_file(MemHandle),
   43	open_memory_file(MemHandle, write, S),
   44	xml_write(S, XMLTerm, Options),
   45	close(S),
   46	memory_file_to_atom(MemHandle, XMLAtom)