XML agent description
Purpose
The XML agent (ag_xml) is used to access to create XML documents from
YCP data structures and also read XML files into YCP.
It is part of YaST2 SCR, the system configuration repository,
used to access configuration data on the target system. The general
SCR API allows Read() and Execute() access to get and
change data.
Implementation
The agent is implemented using the libxml2 library.
Note: The complete development documentation is available in the
autodocs/ directory.
Interface for XML-agent
The interface is implemented as a SCR agent with the usual Read()
and Execute() interfaces (no Write). The path prefix used is
Restrictions, limits and future enhancements
...
See the TODO.txt file for the current status of support
and also for the list of possible future enhancements.
Read options
To read an XML file into ycp, the following syntax is required:
string Read(.xml,"file_name");
string Read(.xml.string,"<?xml version='1.0'?>...");
string Read(.xml.error_message); contains the error string from the xml parser.
It should be used when the agent did not return content.
A reset happens before a new XML parsing starts.
Execute options
To write an XML file from ycp, the following syntax is required:
Execute(.xml,$[<options map>], $[ycp data]);
string Execute(.xml.string,$[<options map>], $[ycp data]);
The options map contains the following data:
- "CDATA": A List containing sections that should be treated as CDATA (i.e. source code)
- "DocType": Document Type
- "rootElement": Root Element of the XML document
- "SystemID": still not supported
- "PublicID": still not supported
- "fileName": filename in which the data should be stored (as XML)
- "NameSpace": still not supported
Anas Nashif <nashif@suse.de>