~singpolyma/xml-types-haskell

8955be32038a4027dc06a0af35113ed9d6b6c375 — John Millikin 11 years ago b2eb749
Better support for doctype declarations
1 files changed, 18 insertions(+), 6 deletions(-)

M Data/XML/Types.hs
M Data/XML/Types.hs => Data/XML/Types.hs +18 -6
@@ 39,7 39,8 @@ module Data.XML.Types
	-- ** Doctypes
	, Doctype (..)
	, ExternalID (..)
	, InternalSubset
	, DoctypeNode (..)
	, Declaration
	
	-- ** Incremental processing
	, Event (..)


@@ 152,11 153,10 @@ instance IsString Name where
data Doctype = Doctype
	{ doctypeName :: Text
	, doctypeExternalID :: Maybe ExternalID
	, doctypeInternalSubsets :: [InternalSubset]
	, doctypeNodes :: [DoctypeNode]
	}
	deriving (Show, Eq)

-- | Since 0.1.3
instance Ord Doctype where
	compare = compare `on` (\x -> (doctypeName x, doctypeExternalID x))



@@ 165,8 165,18 @@ data ExternalID
	| PublicID Text Text
	deriving (Show, Eq, Ord)

data InternalSubset = InternalSubset
	-- TODO
data DoctypeNode
	= DoctypeDeclaration Declaration
	| DoctypeInstruction Instruction
	| DoctypeComment Text
	deriving (Show, Eq)

-- TODO
data Declaration
	= DeclareElement Text
	| DeclareAttributeList Text
	| DeclareEntity Text
	| DeclareNotation Text
	deriving (Show, Eq)

-- | Some XML processing tools are incremental, and work in terms of events


@@ 177,8 187,10 @@ data InternalSubset = InternalSubset
data Event
	= EventBeginDocument
	| EventEndDocument
	| EventBeginDoctype Text (Maybe ExternalID)
	| EventDeclaration Declaration
	| EventEndDoctype
	| EventInstruction Instruction
	| EventDoctype Doctype
	| EventBeginElement Name (M.Map Name [Content])
	| EventEndElement Name
	| EventContent Content