packages feed

xml-types 0.1.2 → 0.1.3

raw patch · 2 files changed

+26/−13 lines, 2 files

Files

Data/XML/Types.hs view
@@ -62,6 +62,7 @@ import Data.Text.Lazy (Text) import qualified Data.Text.Lazy as T import Data.String (IsString, fromString)+import Data.Function (on)  data Document = Document 	{ documentPrologue :: Prologue@@ -81,7 +82,7 @@ 	{ instructionTarget :: Text 	, instructionData :: Text 	}-	deriving (Show, Eq)+	deriving (Show, Eq, Ord)  data Miscellaneous 	= MiscInstruction Instruction@@ -113,11 +114,6 @@ 	| ContentEntity Text 	deriving (Show, Eq) --- | The 'Eq' instance for 'Name' ignores prefixes.------ The 'IsString' instance for 'Name' allows entry using Clark notation;--- see <http://www.jclark.com/xml/xmlns.htm> and--- <http://infohost.nmt.edu/tcc/help/pubs/pylxml/etree-QName.html> data Name = Name 	{ nameLocalName :: Text 	, nameNamespace :: Maybe Text@@ -125,13 +121,20 @@ 	} 	deriving (Show) --- Ignore prefixes when comparing names+-- | Ignores prefixes instance Eq Name where-	x == y = and-		[ nameLocalName x == nameLocalName y-		, nameNamespace x == nameNamespace y-		]+	(==) = (==) `on` (\x -> (nameNamespace x, nameLocalName x)) +-- | Ignores prefixes+--+-- Since 0.1.3+instance Ord Name where+	compare = compare `on` (\x -> (nameNamespace x, nameLocalName x))++-- | Supports Clark notation; see <http://www.jclark.com/xml/xmlns.htm> and+-- <http://infohost.nmt.edu/tcc/help/pubs/pylxml/etree-QName.html>+--+-- Since 0.1.2 instance IsString Name where 	fromString "" = Name T.empty Nothing Nothing 	fromString full@('{':rest) = case break (== '}') rest of@@ -155,10 +158,14 @@ 	} 	deriving (Show, Eq) +-- | Since 0.1.3+instance Ord Doctype where+	compare = compare `on` (\x -> (doctypeName x, doctypeExternalID x))+ data ExternalID 	= SystemID Text 	| PublicID Text Text-	deriving (Show, Eq)+	deriving (Show, Eq, Ord)  data InternalSubset = InternalSubset 	-- TODO@@ -167,6 +174,8 @@ -- | Some XML processing tools are incremental, and work in terms of events -- rather than node trees. Defining the event type here, even though it won't -- be useful to most users, allows these packages to interoperate more easily.+--+-- Since: 0.1.1 data Event 	= EventBeginDocument 	| EventEndDocument@@ -199,6 +208,10 @@  elementChildren :: Element -> [Element] elementChildren = elementNodes >=> isElement++-- | Since 0.1.3+elementContent :: Element -> [Content]+elementContent = elementNodes >=> isContent  nodeChildren :: Node -> [Node] nodeChildren = isElement >=> elementNodes
xml-types.cabal view
@@ -1,5 +1,5 @@ name: xml-types-version: 0.1.2+version: 0.1.3 synopsis: Basic types for representing XML license: MIT license-file: license.txt