module Web.Willow.DOM
(
Tree ( .. )
, emptyTree
, Node ( .. )
, NodeType ( .. )
, nodeType
, QuirksMode ( .. )
, ElementParams ( .. )
, emptyElementParams
, ElementName
, ElementPrefix
, AttributeMap
, fromAttrList
, toAttrList
, insertAttribute
, BasicAttribute
, AttributeParams ( .. )
, emptyAttributeParams
, AttributeName
, AttributeValue
, AttributePrefix
, DocumentTypeParams ( .. )
, emptyDocumentTypeParams
, DoctypeName
, DoctypePublicId
, DoctypeSystemId
, Namespace
, htmlNamespace
, mathMLNamespace
, svgNamespace
, xlinkNamespace
, xmlNamespace
, xmlnsNamespace
) where
import qualified Data.HashMap.Strict as M
import qualified Data.Text as T
data Tree = Tree
{ Tree -> Node
node :: Node
, Tree -> [Tree]
children :: [Tree]
}
deriving ( Tree -> Tree -> Bool
(Tree -> Tree -> Bool) -> (Tree -> Tree -> Bool) -> Eq Tree
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Tree -> Tree -> Bool
$c/= :: Tree -> Tree -> Bool
== :: Tree -> Tree -> Bool
$c== :: Tree -> Tree -> Bool
Eq, Int -> Tree -> ShowS
[Tree] -> ShowS
Tree -> String
(Int -> Tree -> ShowS)
-> (Tree -> String) -> ([Tree] -> ShowS) -> Show Tree
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Tree] -> ShowS
$cshowList :: [Tree] -> ShowS
show :: Tree -> String
$cshow :: Tree -> String
showsPrec :: Int -> Tree -> ShowS
$cshowsPrec :: Int -> Tree -> ShowS
Show, ReadPrec [Tree]
ReadPrec Tree
Int -> ReadS Tree
ReadS [Tree]
(Int -> ReadS Tree)
-> ReadS [Tree] -> ReadPrec Tree -> ReadPrec [Tree] -> Read Tree
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Tree]
$creadListPrec :: ReadPrec [Tree]
readPrec :: ReadPrec Tree
$creadPrec :: ReadPrec Tree
readList :: ReadS [Tree]
$creadList :: ReadS [Tree]
readsPrec :: Int -> ReadS Tree
$creadsPrec :: Int -> ReadS Tree
Read )
emptyTree :: Tree
emptyTree :: Tree
emptyTree = Tree :: Node -> [Tree] -> Tree
Tree
{ node :: Node
node = QuirksMode -> Node
Document QuirksMode
NoQuirks
, children :: [Tree]
children = []
}
data Node
= Text T.Text
| T.Text
| DocumentType DocumentTypeParams
| Element ElementParams
| Attribute AttributeParams
| DocumentFragment
| Document QuirksMode
deriving ( Node -> Node -> Bool
(Node -> Node -> Bool) -> (Node -> Node -> Bool) -> Eq Node
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Node -> Node -> Bool
$c/= :: Node -> Node -> Bool
== :: Node -> Node -> Bool
$c== :: Node -> Node -> Bool
Eq, Int -> Node -> ShowS
[Node] -> ShowS
Node -> String
(Int -> Node -> ShowS)
-> (Node -> String) -> ([Node] -> ShowS) -> Show Node
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Node] -> ShowS
$cshowList :: [Node] -> ShowS
show :: Node -> String
$cshow :: Node -> String
showsPrec :: Int -> Node -> ShowS
$cshowsPrec :: Int -> Node -> ShowS
Show, ReadPrec [Node]
ReadPrec Node
Int -> ReadS Node
ReadS [Node]
(Int -> ReadS Node)
-> ReadS [Node] -> ReadPrec Node -> ReadPrec [Node] -> Read Node
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Node]
$creadListPrec :: ReadPrec [Node]
readPrec :: ReadPrec Node
$creadPrec :: ReadPrec Node
readList :: ReadS [Node]
$creadList :: ReadS [Node]
readsPrec :: Int -> ReadS Node
$creadsPrec :: Int -> ReadS Node
Read )
nodeType :: Node -> Maybe NodeType
nodeType :: Node -> Maybe NodeType
nodeType Text{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
TextNode
nodeType Comment{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
CommentNode
nodeType DocumentType{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
DocumentTypeNode
nodeType Element{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
ElementNode
nodeType Attribute{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
AttributeNode
nodeType DocumentFragment{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
DocumentFragmentNode
nodeType Document{} = NodeType -> Maybe NodeType
forall a. a -> Maybe a
Just NodeType
DocumentNode
data QuirksMode
= NoQuirks
| LimitedQuirks
| FullQuirks
deriving ( QuirksMode -> QuirksMode -> Bool
(QuirksMode -> QuirksMode -> Bool)
-> (QuirksMode -> QuirksMode -> Bool) -> Eq QuirksMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QuirksMode -> QuirksMode -> Bool
$c/= :: QuirksMode -> QuirksMode -> Bool
== :: QuirksMode -> QuirksMode -> Bool
$c== :: QuirksMode -> QuirksMode -> Bool
Eq, Eq QuirksMode
Eq QuirksMode
-> (QuirksMode -> QuirksMode -> Ordering)
-> (QuirksMode -> QuirksMode -> Bool)
-> (QuirksMode -> QuirksMode -> Bool)
-> (QuirksMode -> QuirksMode -> Bool)
-> (QuirksMode -> QuirksMode -> Bool)
-> (QuirksMode -> QuirksMode -> QuirksMode)
-> (QuirksMode -> QuirksMode -> QuirksMode)
-> Ord QuirksMode
QuirksMode -> QuirksMode -> Bool
QuirksMode -> QuirksMode -> Ordering
QuirksMode -> QuirksMode -> QuirksMode
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: QuirksMode -> QuirksMode -> QuirksMode
$cmin :: QuirksMode -> QuirksMode -> QuirksMode
max :: QuirksMode -> QuirksMode -> QuirksMode
$cmax :: QuirksMode -> QuirksMode -> QuirksMode
>= :: QuirksMode -> QuirksMode -> Bool
$c>= :: QuirksMode -> QuirksMode -> Bool
> :: QuirksMode -> QuirksMode -> Bool
$c> :: QuirksMode -> QuirksMode -> Bool
<= :: QuirksMode -> QuirksMode -> Bool
$c<= :: QuirksMode -> QuirksMode -> Bool
< :: QuirksMode -> QuirksMode -> Bool
$c< :: QuirksMode -> QuirksMode -> Bool
compare :: QuirksMode -> QuirksMode -> Ordering
$ccompare :: QuirksMode -> QuirksMode -> Ordering
$cp1Ord :: Eq QuirksMode
Ord, Int -> QuirksMode
QuirksMode -> Int
QuirksMode -> [QuirksMode]
QuirksMode -> QuirksMode
QuirksMode -> QuirksMode -> [QuirksMode]
QuirksMode -> QuirksMode -> QuirksMode -> [QuirksMode]
(QuirksMode -> QuirksMode)
-> (QuirksMode -> QuirksMode)
-> (Int -> QuirksMode)
-> (QuirksMode -> Int)
-> (QuirksMode -> [QuirksMode])
-> (QuirksMode -> QuirksMode -> [QuirksMode])
-> (QuirksMode -> QuirksMode -> [QuirksMode])
-> (QuirksMode -> QuirksMode -> QuirksMode -> [QuirksMode])
-> Enum QuirksMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: QuirksMode -> QuirksMode -> QuirksMode -> [QuirksMode]
$cenumFromThenTo :: QuirksMode -> QuirksMode -> QuirksMode -> [QuirksMode]
enumFromTo :: QuirksMode -> QuirksMode -> [QuirksMode]
$cenumFromTo :: QuirksMode -> QuirksMode -> [QuirksMode]
enumFromThen :: QuirksMode -> QuirksMode -> [QuirksMode]
$cenumFromThen :: QuirksMode -> QuirksMode -> [QuirksMode]
enumFrom :: QuirksMode -> [QuirksMode]
$cenumFrom :: QuirksMode -> [QuirksMode]
fromEnum :: QuirksMode -> Int
$cfromEnum :: QuirksMode -> Int
toEnum :: Int -> QuirksMode
$ctoEnum :: Int -> QuirksMode
pred :: QuirksMode -> QuirksMode
$cpred :: QuirksMode -> QuirksMode
succ :: QuirksMode -> QuirksMode
$csucc :: QuirksMode -> QuirksMode
Enum, QuirksMode
QuirksMode -> QuirksMode -> Bounded QuirksMode
forall a. a -> a -> Bounded a
maxBound :: QuirksMode
$cmaxBound :: QuirksMode
minBound :: QuirksMode
$cminBound :: QuirksMode
Bounded, Int -> QuirksMode -> ShowS
[QuirksMode] -> ShowS
QuirksMode -> String
(Int -> QuirksMode -> ShowS)
-> (QuirksMode -> String)
-> ([QuirksMode] -> ShowS)
-> Show QuirksMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QuirksMode] -> ShowS
$cshowList :: [QuirksMode] -> ShowS
show :: QuirksMode -> String
$cshow :: QuirksMode -> String
showsPrec :: Int -> QuirksMode -> ShowS
$cshowsPrec :: Int -> QuirksMode -> ShowS
Show, ReadPrec [QuirksMode]
ReadPrec QuirksMode
Int -> ReadS QuirksMode
ReadS [QuirksMode]
(Int -> ReadS QuirksMode)
-> ReadS [QuirksMode]
-> ReadPrec QuirksMode
-> ReadPrec [QuirksMode]
-> Read QuirksMode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QuirksMode]
$creadListPrec :: ReadPrec [QuirksMode]
readPrec :: ReadPrec QuirksMode
$creadPrec :: ReadPrec QuirksMode
readList :: ReadS [QuirksMode]
$creadList :: ReadS [QuirksMode]
readsPrec :: Int -> ReadS QuirksMode
$creadsPrec :: Int -> ReadS QuirksMode
Read )
type BasicAttribute = (AttributeName, AttributeValue)
type AttributePrefix = T.Text
type AttributeName = T.Text
type AttributeValue = T.Text
data AttributeParams = AttributeParams
{ AttributeParams -> Maybe AttributePrefix
attrPrefix :: Maybe AttributePrefix
, AttributeParams -> AttributePrefix
attrName :: AttributeName
, AttributeParams -> Maybe AttributePrefix
attrNamespace :: Maybe Namespace
, AttributeParams -> AttributePrefix
attrValue :: AttributeValue
}
deriving ( AttributeParams -> AttributeParams -> Bool
(AttributeParams -> AttributeParams -> Bool)
-> (AttributeParams -> AttributeParams -> Bool)
-> Eq AttributeParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeParams -> AttributeParams -> Bool
$c/= :: AttributeParams -> AttributeParams -> Bool
== :: AttributeParams -> AttributeParams -> Bool
$c== :: AttributeParams -> AttributeParams -> Bool
Eq, Int -> AttributeParams -> ShowS
[AttributeParams] -> ShowS
AttributeParams -> String
(Int -> AttributeParams -> ShowS)
-> (AttributeParams -> String)
-> ([AttributeParams] -> ShowS)
-> Show AttributeParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeParams] -> ShowS
$cshowList :: [AttributeParams] -> ShowS
show :: AttributeParams -> String
$cshow :: AttributeParams -> String
showsPrec :: Int -> AttributeParams -> ShowS
$cshowsPrec :: Int -> AttributeParams -> ShowS
Show, ReadPrec [AttributeParams]
ReadPrec AttributeParams
Int -> ReadS AttributeParams
ReadS [AttributeParams]
(Int -> ReadS AttributeParams)
-> ReadS [AttributeParams]
-> ReadPrec AttributeParams
-> ReadPrec [AttributeParams]
-> Read AttributeParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeParams]
$creadListPrec :: ReadPrec [AttributeParams]
readPrec :: ReadPrec AttributeParams
$creadPrec :: ReadPrec AttributeParams
readList :: ReadS [AttributeParams]
$creadList :: ReadS [AttributeParams]
readsPrec :: Int -> ReadS AttributeParams
$creadsPrec :: Int -> ReadS AttributeParams
Read )
emptyAttributeParams :: AttributeParams
emptyAttributeParams :: AttributeParams
emptyAttributeParams = AttributeParams :: Maybe AttributePrefix
-> AttributePrefix
-> Maybe AttributePrefix
-> AttributePrefix
-> AttributeParams
AttributeParams
{ attrPrefix :: Maybe AttributePrefix
attrPrefix = Maybe AttributePrefix
forall a. Maybe a
Nothing
, attrName :: AttributePrefix
attrName = AttributePrefix
T.empty
, attrNamespace :: Maybe AttributePrefix
attrNamespace = Maybe AttributePrefix
forall a. Maybe a
Nothing
, attrValue :: AttributePrefix
attrValue = AttributePrefix
T.empty
}
type ElementPrefix = T.Text
type ElementName = T.Text
data ElementParams = ElementParams
{ ElementParams -> Maybe AttributePrefix
elementPrefix :: Maybe ElementPrefix
, ElementParams -> AttributePrefix
elementName :: ElementName
, ElementParams -> Maybe AttributePrefix
elementNamespace :: Maybe Namespace
, ElementParams -> AttributeMap
elementAttributes :: AttributeMap
}
deriving ( ElementParams -> ElementParams -> Bool
(ElementParams -> ElementParams -> Bool)
-> (ElementParams -> ElementParams -> Bool) -> Eq ElementParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ElementParams -> ElementParams -> Bool
$c/= :: ElementParams -> ElementParams -> Bool
== :: ElementParams -> ElementParams -> Bool
$c== :: ElementParams -> ElementParams -> Bool
Eq, Int -> ElementParams -> ShowS
[ElementParams] -> ShowS
ElementParams -> String
(Int -> ElementParams -> ShowS)
-> (ElementParams -> String)
-> ([ElementParams] -> ShowS)
-> Show ElementParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ElementParams] -> ShowS
$cshowList :: [ElementParams] -> ShowS
show :: ElementParams -> String
$cshow :: ElementParams -> String
showsPrec :: Int -> ElementParams -> ShowS
$cshowsPrec :: Int -> ElementParams -> ShowS
Show, ReadPrec [ElementParams]
ReadPrec ElementParams
Int -> ReadS ElementParams
ReadS [ElementParams]
(Int -> ReadS ElementParams)
-> ReadS [ElementParams]
-> ReadPrec ElementParams
-> ReadPrec [ElementParams]
-> Read ElementParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ElementParams]
$creadListPrec :: ReadPrec [ElementParams]
readPrec :: ReadPrec ElementParams
$creadPrec :: ReadPrec ElementParams
readList :: ReadS [ElementParams]
$creadList :: ReadS [ElementParams]
readsPrec :: Int -> ReadS ElementParams
$creadsPrec :: Int -> ReadS ElementParams
Read )
emptyElementParams :: ElementParams
emptyElementParams :: ElementParams
emptyElementParams = ElementParams :: Maybe AttributePrefix
-> AttributePrefix
-> Maybe AttributePrefix
-> AttributeMap
-> ElementParams
ElementParams
{ elementPrefix :: Maybe AttributePrefix
elementPrefix = Maybe AttributePrefix
forall a. Maybe a
Nothing
, elementName :: AttributePrefix
elementName = AttributePrefix
T.empty
, elementNamespace :: Maybe AttributePrefix
elementNamespace = Maybe AttributePrefix
forall a. Maybe a
Nothing
, elementAttributes :: AttributeMap
elementAttributes = AttributeMap
forall k v. HashMap k v
M.empty
}
type AttributeMap = M.HashMap (Maybe Namespace, AttributeName) (Maybe AttributePrefix, AttributeValue)
packAttr
:: (Maybe Namespace, AttributeName)
-> (Maybe AttributePrefix, AttributeValue)
-> AttributeParams
packAttr :: (Maybe AttributePrefix, AttributePrefix)
-> (Maybe AttributePrefix, AttributePrefix) -> AttributeParams
packAttr (Maybe AttributePrefix
ns, AttributePrefix
n) (Maybe AttributePrefix
p, AttributePrefix
v) = AttributeParams
emptyAttributeParams
{ attrNamespace :: Maybe AttributePrefix
attrNamespace = Maybe AttributePrefix
ns
, attrName :: AttributePrefix
attrName = AttributePrefix
n
, attrPrefix :: Maybe AttributePrefix
attrPrefix = Maybe AttributePrefix
p
, attrValue :: AttributePrefix
attrValue = AttributePrefix
v
}
unpackAttr
:: AttributeParams
-> ((Maybe Namespace, AttributeName), (Maybe AttributePrefix, AttributeValue))
unpackAttr :: AttributeParams
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
unpackAttr AttributeParams
d = ((AttributeParams -> Maybe AttributePrefix
attrNamespace AttributeParams
d, AttributeParams -> AttributePrefix
attrName AttributeParams
d), (AttributeParams -> Maybe AttributePrefix
attrPrefix AttributeParams
d, AttributeParams -> AttributePrefix
attrValue AttributeParams
d))
toAttrList :: AttributeMap -> [AttributeParams]
toAttrList :: AttributeMap -> [AttributeParams]
toAttrList = (((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
-> AttributeParams)
-> [((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))]
-> [AttributeParams]
forall a b. (a -> b) -> [a] -> [b]
map (((Maybe AttributePrefix, AttributePrefix)
-> (Maybe AttributePrefix, AttributePrefix) -> AttributeParams)
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
-> AttributeParams
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (Maybe AttributePrefix, AttributePrefix)
-> (Maybe AttributePrefix, AttributePrefix) -> AttributeParams
packAttr) ([((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))]
-> [AttributeParams])
-> (AttributeMap
-> [((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))])
-> AttributeMap
-> [AttributeParams]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AttributeMap
-> [((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))]
forall k v. HashMap k v -> [(k, v)]
M.toList
fromAttrList :: [AttributeParams] -> AttributeMap
fromAttrList :: [AttributeParams] -> AttributeMap
fromAttrList = [((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))]
-> AttributeMap
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
M.fromList ([((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))]
-> AttributeMap)
-> ([AttributeParams]
-> [((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))])
-> [AttributeParams]
-> AttributeMap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AttributeParams
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix)))
-> [AttributeParams]
-> [((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))]
forall a b. (a -> b) -> [a] -> [b]
map AttributeParams
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
unpackAttr
insertAttribute :: AttributeParams -> AttributeMap -> AttributeMap
insertAttribute :: AttributeParams -> AttributeMap -> AttributeMap
insertAttribute AttributeParams
d = ((Maybe AttributePrefix, AttributePrefix)
-> (Maybe AttributePrefix, AttributePrefix)
-> AttributeMap
-> AttributeMap)
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
-> AttributeMap
-> AttributeMap
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (Maybe AttributePrefix, AttributePrefix)
-> (Maybe AttributePrefix, AttributePrefix)
-> AttributeMap
-> AttributeMap
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
M.insert (((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
-> AttributeMap -> AttributeMap)
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
-> AttributeMap
-> AttributeMap
forall a b. (a -> b) -> a -> b
$ AttributeParams
-> ((Maybe AttributePrefix, AttributePrefix),
(Maybe AttributePrefix, AttributePrefix))
unpackAttr AttributeParams
d
type DoctypeName = T.Text
type DoctypePublicId = T.Text
type DoctypeSystemId = T.Text
data DocumentTypeParams = DocumentTypeParams
{ DocumentTypeParams -> AttributePrefix
documentTypeName :: DoctypeName
, DocumentTypeParams -> AttributePrefix
documentTypePublicId :: DoctypePublicId
, DocumentTypeParams -> AttributePrefix
documentTypeSystemId :: DoctypeSystemId
}
deriving ( DocumentTypeParams -> DocumentTypeParams -> Bool
(DocumentTypeParams -> DocumentTypeParams -> Bool)
-> (DocumentTypeParams -> DocumentTypeParams -> Bool)
-> Eq DocumentTypeParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentTypeParams -> DocumentTypeParams -> Bool
$c/= :: DocumentTypeParams -> DocumentTypeParams -> Bool
== :: DocumentTypeParams -> DocumentTypeParams -> Bool
$c== :: DocumentTypeParams -> DocumentTypeParams -> Bool
Eq, Int -> DocumentTypeParams -> ShowS
[DocumentTypeParams] -> ShowS
DocumentTypeParams -> String
(Int -> DocumentTypeParams -> ShowS)
-> (DocumentTypeParams -> String)
-> ([DocumentTypeParams] -> ShowS)
-> Show DocumentTypeParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentTypeParams] -> ShowS
$cshowList :: [DocumentTypeParams] -> ShowS
show :: DocumentTypeParams -> String
$cshow :: DocumentTypeParams -> String
showsPrec :: Int -> DocumentTypeParams -> ShowS
$cshowsPrec :: Int -> DocumentTypeParams -> ShowS
Show, ReadPrec [DocumentTypeParams]
ReadPrec DocumentTypeParams
Int -> ReadS DocumentTypeParams
ReadS [DocumentTypeParams]
(Int -> ReadS DocumentTypeParams)
-> ReadS [DocumentTypeParams]
-> ReadPrec DocumentTypeParams
-> ReadPrec [DocumentTypeParams]
-> Read DocumentTypeParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentTypeParams]
$creadListPrec :: ReadPrec [DocumentTypeParams]
readPrec :: ReadPrec DocumentTypeParams
$creadPrec :: ReadPrec DocumentTypeParams
readList :: ReadS [DocumentTypeParams]
$creadList :: ReadS [DocumentTypeParams]
readsPrec :: Int -> ReadS DocumentTypeParams
$creadsPrec :: Int -> ReadS DocumentTypeParams
Read )
emptyDocumentTypeParams :: DocumentTypeParams
emptyDocumentTypeParams :: DocumentTypeParams
emptyDocumentTypeParams = DocumentTypeParams :: AttributePrefix
-> AttributePrefix -> AttributePrefix -> DocumentTypeParams
DocumentTypeParams
{ documentTypeName :: AttributePrefix
documentTypeName = AttributePrefix
T.empty
, documentTypePublicId :: AttributePrefix
documentTypePublicId = AttributePrefix
T.empty
, documentTypeSystemId :: AttributePrefix
documentTypeSystemId = AttributePrefix
T.empty
}
data NodeType
= ElementNode
| AttributeNode
| TextNode
| CDataSectionNode
| EntityReferenceNode
| EntityNode
| ProcessingInstructionNode
|
| DocumentNode
| DocumentTypeNode
| DocumentFragmentNode
| NotationNode
deriving ( NodeType -> NodeType -> Bool
(NodeType -> NodeType -> Bool)
-> (NodeType -> NodeType -> Bool) -> Eq NodeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeType -> NodeType -> Bool
$c/= :: NodeType -> NodeType -> Bool
== :: NodeType -> NodeType -> Bool
$c== :: NodeType -> NodeType -> Bool
Eq, Eq NodeType
Eq NodeType
-> (NodeType -> NodeType -> Ordering)
-> (NodeType -> NodeType -> Bool)
-> (NodeType -> NodeType -> Bool)
-> (NodeType -> NodeType -> Bool)
-> (NodeType -> NodeType -> Bool)
-> (NodeType -> NodeType -> NodeType)
-> (NodeType -> NodeType -> NodeType)
-> Ord NodeType
NodeType -> NodeType -> Bool
NodeType -> NodeType -> Ordering
NodeType -> NodeType -> NodeType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NodeType -> NodeType -> NodeType
$cmin :: NodeType -> NodeType -> NodeType
max :: NodeType -> NodeType -> NodeType
$cmax :: NodeType -> NodeType -> NodeType
>= :: NodeType -> NodeType -> Bool
$c>= :: NodeType -> NodeType -> Bool
> :: NodeType -> NodeType -> Bool
$c> :: NodeType -> NodeType -> Bool
<= :: NodeType -> NodeType -> Bool
$c<= :: NodeType -> NodeType -> Bool
< :: NodeType -> NodeType -> Bool
$c< :: NodeType -> NodeType -> Bool
compare :: NodeType -> NodeType -> Ordering
$ccompare :: NodeType -> NodeType -> Ordering
$cp1Ord :: Eq NodeType
Ord, NodeType
NodeType -> NodeType -> Bounded NodeType
forall a. a -> a -> Bounded a
maxBound :: NodeType
$cmaxBound :: NodeType
minBound :: NodeType
$cminBound :: NodeType
Bounded, Int -> NodeType -> ShowS
[NodeType] -> ShowS
NodeType -> String
(Int -> NodeType -> ShowS)
-> (NodeType -> String) -> ([NodeType] -> ShowS) -> Show NodeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeType] -> ShowS
$cshowList :: [NodeType] -> ShowS
show :: NodeType -> String
$cshow :: NodeType -> String
showsPrec :: Int -> NodeType -> ShowS
$cshowsPrec :: Int -> NodeType -> ShowS
Show, ReadPrec [NodeType]
ReadPrec NodeType
Int -> ReadS NodeType
ReadS [NodeType]
(Int -> ReadS NodeType)
-> ReadS [NodeType]
-> ReadPrec NodeType
-> ReadPrec [NodeType]
-> Read NodeType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeType]
$creadListPrec :: ReadPrec [NodeType]
readPrec :: ReadPrec NodeType
$creadPrec :: ReadPrec NodeType
readList :: ReadS [NodeType]
$creadList :: ReadS [NodeType]
readsPrec :: Int -> ReadS NodeType
$creadsPrec :: Int -> ReadS NodeType
Read )
instance Enum NodeType where
fromEnum :: NodeType -> Int
fromEnum NodeType
ElementNode = Int
1
fromEnum NodeType
AttributeNode = Int
2
fromEnum NodeType
TextNode = Int
3
fromEnum NodeType
CDataSectionNode = Int
4
fromEnum NodeType
EntityReferenceNode = Int
5
fromEnum NodeType
EntityNode = Int
6
fromEnum NodeType
ProcessingInstructionNode = Int
7
fromEnum NodeType
CommentNode = Int
8
fromEnum NodeType
DocumentNode = Int
9
fromEnum NodeType
DocumentTypeNode = Int
10
fromEnum NodeType
DocumentFragmentNode = Int
11
fromEnum NodeType
NotationNode = Int
12
toEnum :: Int -> NodeType
toEnum Int
1 = NodeType
ElementNode
toEnum Int
2 = NodeType
AttributeNode
toEnum Int
3 = NodeType
TextNode
toEnum Int
4 = NodeType
CDataSectionNode
toEnum Int
5 = NodeType
EntityReferenceNode
toEnum Int
6 = NodeType
EntityNode
toEnum Int
7 = NodeType
ProcessingInstructionNode
toEnum Int
8 = NodeType
CommentNode
toEnum Int
9 = NodeType
DocumentNode
toEnum Int
10 = NodeType
DocumentTypeNode
toEnum Int
11 = NodeType
DocumentFragmentNode
toEnum Int
12 = NodeType
NotationNode
toEnum Int
_ = String -> NodeType
forall a. HasCallStack => String -> a
error String
"Web.Willow.DOM.NodeType.toEnum: invalid index"
{-# DEPRECATED EntityReferenceNode, EntityNode, NotationNode "historical" #-}
type Namespace = T.Text
htmlNamespace :: Namespace
htmlNamespace :: AttributePrefix
htmlNamespace = String -> AttributePrefix
T.pack String
"http://www.w3.org/1999/xhtml"
mathMLNamespace :: Namespace
mathMLNamespace :: AttributePrefix
mathMLNamespace = String -> AttributePrefix
T.pack String
"http://www.w3.org/1998/Math/MathML"
svgNamespace :: Namespace
svgNamespace :: AttributePrefix
svgNamespace = String -> AttributePrefix
T.pack String
"http://www.w3.org/2000/svg"
xlinkNamespace :: Namespace
xlinkNamespace :: AttributePrefix
xlinkNamespace = String -> AttributePrefix
T.pack String
"http://www.w3.org/1999/xlink"
xmlNamespace :: Namespace
xmlNamespace :: AttributePrefix
xmlNamespace = String -> AttributePrefix
T.pack String
"http://www.w3.org/XML/1998/namespace"
xmlnsNamespace :: Namespace
xmlnsNamespace :: AttributePrefix
xmlnsNamespace = String -> AttributePrefix
T.pack String
"http://www.w3.org/2000/xmlns/"