-- hexpat, a Haskell wrapper for expat-- Copyright (C) 2008 Evan Martin <martine@danga.com>-- Copyright (C) 2009 Stephen Blackheath <http://blacksapphire.com/antispam>-- | In the default representation, qualified tag and attribute names such as-- \<abc:hello\> are represented just as a string containing a colon, e.g.-- \"abc:hello\".---- This module provides functionality to handle these more intelligently, splitting-- all tag and attribute names into their Prefix and LocalPart components.moduleText.XML.Expat.Qualified(QName(..),QNode,QNodes,QAttributes,mkQName,mkAnQName,toQualified,fromQualified)whereimportText.XML.Expat.NodeClassimportText.XML.Expat.TreeimportControl.Parallel.StrategiesimportData.Monoid-- | A qualified name.---- Qualified names have two parts, a prefix and a local part. The local part-- is the name of the tag. The prefix scopes that name to a particular-- group of legal tags.---- The prefix will usually be associated with a namespace URI. This is usually-- achieved by using xmlns attributes to bind prefixes to URIs.dataQNametext=QName{qnPrefix::Maybetext,qnLocalPart::!text}deriving(Eq,Show)instanceNFDatatext=>NFData(QNametext)wherernf(QNamepreloc)=rnf(pre,loc)-- | DEPRECATED: Use [QNode text] instead.---- Type shortcut for nodes where qualified names are used for tags{-# DEPRECATED QNodes "use [QNode text] instead" #-}typeQNodestext=[Node(QNametext)text]-- | Type shortcut for a single node where qualified names are used for tagstypeQNodetext=Node(QNametext)text-- | Type shortcut for attributes with qualified namestypeQAttributestext=Attributes(QNametext)text-- | Make a new QName from a prefix and localPart.mkQName::text->text->QNametextmkQNameprefixlocalPart=QName(Justprefix)localPart-- | Make a new QName with no prefix.mkAnQName::text->QNametextmkAnQNamelocalPart=QNameNothinglocalParttoQualified::(NodeClassnc,GenericXMLStringtext)=>nctexttext->nc(QNametext)texttoQualified=mapAllTagsqualwherequalident=casegxBreakOn':'identof(prefix,_local)|not(gxNullString_local)&&gxHead_local==':'->QName(Justprefix)(gxTail_local)_->QNameNothingidentfromQualified::(NodeClassnc,GenericXMLStringtext)=>nc(QNametext)text->nctexttextfromQualified=mapAllTagstagwheretag(QName(Justprefix)local)=prefix`mappend`gxFromChar':'`mappend`localtag(QNameNothinglocal)=local