# Class DaliExampleReader

java.lang.Object
uk.ac.starlink.vo.DaliExampleReader

public class DaliExampleReader extends Object
Extracts DaliExample objects from a document. The document is probably XHTML with RDFa markup.

Instances of this class are not thread-safe.

Since:
  12 May 2015
Author:
  Mark Taylor
See Also:
  - DALI v1.0 sec 2.3

## Constructor Summary

Constructors
Constructor
Description
`DaliExampleReader()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`DaliExample`
`createExample(Element exEl, URL docUrl)`
Creates an example from a given DOM element.
`static void`
`main(String[] args)`
Reports basic information about the examples in a document at a URL supplied on the command line.
`List<Tree<DaliExample>>`
`readExamples(URL url)`
Reads a list of examples from a document at a given URL.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DaliExampleReader

public DaliExampleReader()
Constructor.

## Method Details

### readExamples

public List<Tree<DaliExample>> readExamples(URL url) throws IOException
Reads a list of examples from a document at a given URL. The result may be a hierarchical tree if continuation nodes are present in the document.

Any fragment identifier on the URL is ignored.

Parameters:
  `url` - location of examples document
Returns:
  list of examples
Throws:
  `IOException`

### createExample

public DaliExample createExample(Element exEl, URL docUrl) throws IOException
Creates an example from a given DOM element.

Parameters:
  `exEl` - element node with DALI RDFa example content
  `docUrl` - base URL of host document
Returns:
  example object
Throws:
  `IOException`

### main

public static void main(String[] args) throws IOException
Reports basic information about the examples in a document at a URL supplied on the command line.

Throws:
  `IOException`