property-list-0.0.1.0: XML property list parser

Data.PropertyList.Xml

Synopsis

Documentation

data Plist Source

DtdToHaskell-generated type representing XML trees that match the PropertyList-1.0 dtd. This is an opaque representation of a structurally-sound property list which might still contain invalid data. End users should never need to use this type, but if they do, it can be manipulated with the constructors and deconstructors in Data.PropertyList.Algebra.

readXmlPlist :: String -> Either String PlistSource

Try to parse a string as an XML property list.

showXmlPlist :: Plist -> StringSource

Render a Plist to a String as an XML property list.

readXmlPlistFromFile :: FilePath -> IO (Either String Plist)Source

Try to parse a Plist from an XML property-list file.

writeXmlPlistToFile :: FilePath -> Plist -> IO ()Source

Try to write a Plist to an XML property-list file.

type PlistItem = OneOf9 Array Data Date Dict AReal AInteger AString True FalseSource

PlistItem is nearly equivalent to Plist - the difference is that it discards information about where in the tree the item is (a Plist represents the whole XML tree starting from the root). This is a "slightly-less-opaque" type, but still isn't really intended for consumption by end users.

plistToPlistItem :: Plist -> PlistItemSource

Convert a Plist to a PlistItem, discarding the root element and any attributes that element may have had.

plistItemToPlist :: PlistItem -> PlistSource

Convert a PlistItem to a Plist, giving it a root element with no attributes.

data UnparsedPlistItem Source

A representation of values that were structurally sound in the property list file but the contents of which couldn't be interpreted as what they claimed to be. The result of the initial parse phase will typically be a PartialPropertyList UnparsedPlistItem, and if the whole plist was parsed properly will contain no actual values of this type.

unparsedPlistItemToPlistItem :: UnparsedPlistItem -> PlistItemSource

Take the unparsed data from an UnparsedPlistItem and wrap it in the appropriate PlistItem constructor.

readXmlPropertyList :: FilePath -> Either String PropertyListSource

Read a property list from a String in the xml1 format. If parsing fails, returns a description of the problem in the Left result.

readXmlPropertyListFromFile :: FilePath -> IO PropertyListSource

Read a property list from a file in the xml1 format. If parsing fails, calls fail.

readXmlPartialPropertyList :: (PListCoalgebra f PlistItem, TerminalPList f pl) => String -> Either String plSource

Read an XML propertylist from a String in the xml1 plist format to a propertylist type which is terminal for the liftings supported by PlistItem (such as PartialPropertyList UnparsedPlistItem or PartialPropertyList PlistItem).

showXmlPropertyList :: (InitialPList f pl, PListAlgebra f PlistItem) => pl -> StringSource

Render a propertylist to a String in the xml1 plist format from any initial propertylist type (which includes PropertyList, PartialPropertyList UnparsedPlistItem, and PartialPropertyList PlistItem).

readXmlPartialPropertyListFromFile :: (PListCoalgebra f PlistItem, TerminalPList f pl) => FilePath -> IO (Either String pl)Source

Read an XML propertylist from a file in the xml1 plist format to a propertylist type which is terminal for the liftings supported by PlistItem (such as PartialPropertyList UnparsedPlistItem or PartialPropertyList PlistItem).

writeXmlPropertyListToFile :: (InitialPList f pl, PListAlgebra f PlistItem) => FilePath -> pl -> IO ()Source

Output a propertylist to a file in the xml1 plist format from any initial propertylist type (which includes PropertyList, PartialPropertyList UnparsedPlistItem, and PartialPropertyList PlistItem).