C# Class PurplePen.XmlInput

A class to help with XML input.
Inheritance: IDisposable
Show file Open project: petergolde/PurplePen Class Usage Examples

Public Properties

Property Type Description
Reader System.Xml.XmlTextReader

Public Methods

Method Description
BadXml ( string message ) : void

Throw an exception indicating the file format was wrong.

CheckElement ( string elementName ) : void

Check that we're at the given element name.

Dispose ( ) : void

Finish the file and close it.

FindSubElement ( bool first ) : bool
GetAttributeBool ( string name ) : bool
GetAttributeBool ( string name, bool defValue ) : bool
GetAttributeColor ( string name, SpecialColor defValue ) : SpecialColor
GetAttributeFloat ( string name ) : float
GetAttributeFloat ( string name, float defValue ) : float
GetAttributeInt ( string name ) : int
GetAttributeInt ( string name, int defValue ) : int
GetAttributeString ( string name ) : string
GetAttributeString ( string name, string defValue ) : string
GetContentBase64 ( ) : MemoryStream
GetContentString ( ) : string
MoveToContent ( ) : void

Move to the next content node.

Read ( ) : bool

Read to next content node.

Skip ( ) : void

Skip children of the current node.

XmlInput ( TextReader reader, string filename ) : System

Create an XmlInput to read XML from a TextReader.

XmlInput ( string filename ) : System

Create an XmlInput to read XML from a particular file.

Method Details

BadXml() public method

Throw an exception indicating the file format was wrong.
public BadXml ( string message ) : void
message string Message, with String.Format style fill-ins.
return void

CheckElement() public method

Check that we're at the given element name.
public CheckElement ( string elementName ) : void
elementName string
return void

Dispose() public method

Finish the file and close it.
public Dispose ( ) : void
return void

FindSubElement() public method

public FindSubElement ( bool first ) : bool
first bool
return bool

GetAttributeBool() public method

public GetAttributeBool ( string name ) : bool
name string
return bool

GetAttributeBool() public method

public GetAttributeBool ( string name, bool defValue ) : bool
name string
defValue bool
return bool

GetAttributeColor() public method

public GetAttributeColor ( string name, SpecialColor defValue ) : SpecialColor
name string
defValue SpecialColor
return SpecialColor

GetAttributeFloat() public method

public GetAttributeFloat ( string name ) : float
name string
return float

GetAttributeFloat() public method

public GetAttributeFloat ( string name, float defValue ) : float
name string
defValue float
return float

GetAttributeInt() public method

public GetAttributeInt ( string name ) : int
name string
return int

GetAttributeInt() public method

public GetAttributeInt ( string name, int defValue ) : int
name string
defValue int
return int

GetAttributeString() public method

public GetAttributeString ( string name ) : string
name string
return string

GetAttributeString() public method

public GetAttributeString ( string name, string defValue ) : string
name string
defValue string
return string

GetContentBase64() public method

public GetContentBase64 ( ) : MemoryStream
return System.IO.MemoryStream

GetContentString() public method

public GetContentString ( ) : string
return string

MoveToContent() public method

Move to the next content node.
public MoveToContent ( ) : void
return void

Read() public method

Read to next content node.
public Read ( ) : bool
return bool

Skip() public method

Skip children of the current node.
public Skip ( ) : void
return void

XmlInput() public method

Create an XmlInput to read XML from a TextReader.
public XmlInput ( TextReader reader, string filename ) : System
reader TextReader
filename string
return System

XmlInput() public method

Create an XmlInput to read XML from a particular file.
public XmlInput ( string filename ) : System
filename string
return System

Property Details

Reader public property

public XmlTextReader,System.Xml Reader
return System.Xml.XmlTextReader