1\name{print.XMLAttributeDef}
2\alias{print.XMLAttributeDef}
3\alias{print.XMLCDataNode}
4\alias{print.XMLElementContent}
5\alias{print.XMLElementDef}
6\alias{print.XMLEntity}
7\alias{print.XMLEntityRef}
8\alias{print.XMLNode}
9\alias{print.XMLTextNode}
10\alias{print.XMLComment}
11\alias{print.XMLOrContent}
12\alias{print.XMLSequenceContent}
13\alias{print.XMLProcessingInstruction}
14\title{Methods for displaying XML objects}
15\description{
16 These different methods attempt to provide a convenient
17way to display R objects representing XML elements
18when they are printed in the usual manner on
19the console, files, etc. via the \code{\link{print}}
20function.
21Each typically outputs its contents in the way
22that they would appear in an XML document.
23}
24\usage{
25\method{print}{XMLNode}(x, ..., indent= "", tagSeparator = "\n")
26\method{print}{XMLComment}(x, ..., indent = "", tagSeparator = "\n")
27\method{print}{XMLTextNode}(x, ..., indent = "", tagSeparator = "\n")
28\method{print}{XMLCDataNode}(x, ..., indent="", tagSeparator = "\n")
29\method{print}{XMLProcessingInstruction}(x, ..., indent="", tagSeparator = "\n")
30\method{print}{XMLAttributeDef}(x, ...)
31\method{print}{XMLElementContent}(x, ...)
32\method{print}{XMLElementDef}(x, ...)
33\method{print}{XMLEntity}(x, ...)
34\method{print}{XMLEntityRef}(x, ..., indent= "", tagSeparator = "\n")
35\method{print}{XMLOrContent}(x, ...)
36\method{print}{XMLSequenceContent}(x, ...)
37}
38\arguments{
39  \item{x}{the XML object to be displayed}
40  \item{...}{additional arguments for controlling the output from
41  print. Currently unused.}
42  \item{indent}{a prefix that is emitted before the node to indent it relative to its
43    parent and child nodes. This is appended with a space at each
44    succesive level of the tree.
45    If no indentation is desired (e.g. when \code{\link{xmlTreeParse}}
46    is called with \code{trim} and \code{ignoreBlanks}
47    being \code{FALSE}) and \code{TRUE} respectively,
48    one can pass the value \code{FALSE} for this \code{indent} argument.
49  }
50  \item{tagSeparator}{when printing nodes, successive nodes and children
51    are by default displayed on new lines for easier reading.
52    One can specify a string for this argument to control how the
53    elements are separated in the output.  The primary purpose of this
54    argument is to allow no space between the elements, i.e. a value of \code{""}.
55  }
56}
57\value{
58 Currently, \code{NULL}.
59}
60\references{\url{http://www.w3.org}, \url{http://www.omegahat.net/RSXML}}
61\author{Duncan Temple Lang}
62
63\seealso{
64\code{\link{xmlTreeParse}}
65}
66\note{We could make the node classes self describing with information
67  about whether \code{ignoreBlanks} was \code{TRUE} or \code{FALSE} and
68  if trim was TRUE or FALSE.
69  This could then be used to determine the appropriate values for
70  \code{indent} and \code{tagSeparator}. Adding an S3 class element
71  would allow this to be done without the addition of an excessive
72  number of classes.
73}
74\examples{
75  fileName <- system.file("exampleData", "event.xml", package ="XML")
76
77     # Example of how to get faithful copy of the XML.
78  doc = xmlRoot(xmlTreeParse(fileName, trim = FALSE, ignoreBlanks = FALSE))
79  print(doc, indent = FALSE, tagSeparator = "")
80
81     # And now the default mechanism
82  doc = xmlRoot(xmlTreeParse(fileName))
83  print(doc)
84}
85\keyword{IO}
86\keyword{file}
87
88