XML (version 3.1-1)

parseDTD: Read a Document Type Definition (DTD)

Description

Represents the contents of a DTD as a user-level object containing the element and entity definitions.

Usage

parseDTD(extId, asText=FALSE, name="", isURL=FALSE, error = xmlErrorCumulator())

Arguments

Value

  • A list with two entries, one for the entities and the other for the elements defined within the DTD.
  • entitiesa named list of the entities defined in the DTD. Each entry is indexed by the name of the corresponding entity. Each is an object of class XMLEntity or alternatively XMLExternalEntity if the entity refers to an external definition. The fields of these types of objects are
    • name
    {the name of the entity by which users refer to it.} content{the expanded value or definition of the entity} original{the value of the entity, but with references to other entities not expanded, but maintained in symbolic form.}

item

  • elements
  • type
  • contents
  • attributes
  • name
  • type
  • defaultType
  • defaultValue

code

XMLAttributeDef

itemize

  • name

WARNING

Errors in the DTD are stored as warnings for programmatic access.

Details

Parses and converts the contents of the DTD in the specified file into a user-level object containing all the information about the DTD.

References

http://www.w3.org

See Also

xmlTreeParse, WritingXML.html in the distribution.

Examples

Run this code
dtdFile <- system.file("exampleData", "foo.dtd",package="XML")
 parseDTD(dtdFile)

txt <- readLines(dtdFile)
txt <- paste(txt,  collapse="")
d <- parseDTD(txt, asText=TRUE)


url <- "http://www.omegahat.org/XML/DTDs/DatasetByRecord.dtd"
 d <- parseDTD(url, asText=FALSE)

Run the code above in your browser using DataLab