Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

isXMLString

Facilities for working with XML strings


Description

These functions and classes are used to represent and parse a string whose content is known to be XML. xml allows us to mark a character vector as containing XML, i.e. of class XMLString.

xmlParseString is a convenience routine for converting an XML string into an XML node/tree.

isXMLString is examines a strings content and heuristically determines whether it is XML.

Usage

isXMLString(str)
xmlParseString(content, doc = NULL, namespaces = RXMLNamespaces,
                clean = TRUE, addFinalizer = NA) 
xml(x)

Arguments

str,x,content

the string containing the XML material.

doc

if specified, an XMLInternalDocument object which is used to "house" the new nodes. Specifically, when the nodes are created, they are made as part of this document. This may not be as relevant now with the garbage collection being done at a node and document level. But it still potentially of some value.

namespaces

a character vector giving the URIs for the XML namespaces which are to be removed if clean is TRUE.

clean

a logical value that controls whether namespaces are removed after the document is parsed..

addFinalizer

a logical value or identifier for a C routine that controls whether we register finalizers on the intenal node.

Value

isXMLString returns a logical value.

xmlParseString returns an object of class XMLInternalElementNode.

xml returns an object of class XMLString identifying the text as XML.

Author(s)

Dncan Temple Lang

See Also

Examples

isXMLString("a regular string < 20 characters long")
 isXMLString("<a><b>c</b></a>")

 xmlParseString("<a><b>c</b></a>")

  # We can lie!
 isXMLString(xml("foo"))

XML

Tools for Parsing and Generating XML Within R and S-Plus

v3.99-0.10
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>), Tomas Kalibera [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.