XMLTextDocument: XML Text Documents

Description Usage Arguments Value See Also Examples

View source: R/doc.R

Description

Create XML text documents.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
XMLTextDocument(x = xml_missing(),
                author = character(0),
                datetimestamp = as.POSIXlt(Sys.time(), tz = "GMT"),
                description = character(0),
                heading = character(0),
                id = character(0),
                language = character(0),
                origin = character(0),
                ...,
                meta = NULL)

Arguments

x

An XMLDocument.

author

a character or an object of class person giving the author names.

datetimestamp

an object of class POSIXt or a character string giving the creation date/time information. If a character string, exactly one of the ISO 8601 formats defined by https://www.w3.org/TR/NOTE-datetime should be used. See parse_ISO_8601_datetime in package NLP for processing such date/time information.

description

a character giving a description.

heading

a character giving the title or a short heading.

id

a character giving a unique identifier.

language

a character giving the language (preferably as IETF language tags, see language in package NLP).

origin

a character giving information on the source and origin.

...

user-defined document metadata tag-value pairs.

meta

a named list or NULL (default) giving all metadata. If set all other metadata arguments are ignored.

Value

An object inheriting from XMLTextDocument and TextDocument.

See Also

TextDocument for basic information on the text document infrastructure employed by package tm.

Examples

1
2
3
4
5
6
7
xml <- system.file("extdata", "order-doc.xml", package = "xml2")
(xtd <- XMLTextDocument(xml2::read_xml(xml),
                        heading = "XML text document",
                        id = xml,
                        language = "en"))
content(xtd)
meta(xtd)

Example output

Loading required package: NLP
<<XMLTextDocument>>
Metadata:  7
{xml_document}
<purchaseOrder orderDate="1999-10-20" xmlns="http://tempuri.org/po.xsd">
[1] <shipTo country="US">\n  <name>Alice Smith</name>\n  <street>123 Maple St ...
[2] <billTo country="US">\n  <name>Robert Smith</name>\n  <street>8 Oak Avenu ...
[3] <comment>Hurry, my lawn is going wild!</comment>
[4] <items>\n  <item partNum="872-AA">\n    <productName>Lawnmower</productNa ...
  author       : character(0)
  datetimestamp: 2018-12-07 11:17:23
  description  : character(0)
  heading      : XML text document
  id           : /usr/lib/R/site-library/xml2/extdata/order-doc.xml
  language     : en
  origin       : character(0)

tm documentation built on April 7, 2021, 3:01 a.m.