module Xml (
DtdName(..),
FromXml(..),
+ FromXmlFk(..),
parse_opts,
pickle_unpickle,
unpickleable )
-- System imports.
import Control.Exception ( SomeException(..), catch )
+import Database.Groundhog.Core ( DefaultKey )
import Text.XML.HXT.Core (
(>>>),
(/>),
from_xml :: a -> Db a
+-- | Some database types cannot be constructed from the XML type
+-- alone; they must be supplied a foreign key to a parent object
+-- first. Members of this class can be converted from an XML
+-- representation to a database representation in this manner.
+--
+class FromXmlFk a where
+ -- | Each instance @a@ must declare its associated database type @DbFk a@.
+ type DbFk a :: *
+
+ -- | The type of our parent object, i.e. to the type to whom our
+ -- foreign key will point.
+ type Parent a :: *
+
+ -- | The function that produces a @DbFk a@ out of an @a@ and a foreign
+ -- key.
+ from_xml_fk :: a -> DefaultKey (Parent a) -> DbFk a
+
+
-- | Represents the DTD filename (\"SYSTEM\") part of the DOCTYPE
-- definition.
newtype DtdName = DtdName String