symantic-xml-2.0.0.20200523: test/RelaxNG/Whatever.hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module RelaxNG.Whatever where
import Data.Function (($), (.))
import Data.Maybe (Maybe(..))
import Text.Show (Show)
import GHC.Generics (Generic)
import qualified Data.Text.Lazy as TL
import Symantic.XML as XML
import Symantic.XML.RelaxNG as RelaxNG
schema =
namespace Nothing xmlns_whatever <.>
namespace (Just "xsd") "http://www/w3/org/2001/XMLSchema-datatypes" <.>
whatever
xmlns_whatever :: Namespace
xmlns_whatever = "2020/whatever.rnc"
elem = element . QName xmlns_whatever
attr n = attribute (QName "" n) text
newtype Whatever
= Whatever
{ whatever_a :: TL.Text
} deriving (Generic, Show)
whatever =
define "root" $
adt @Whatever $
elem "root" $
namespace Nothing xmlns_whatever <.>
namespace (Just "whatever") xmlns_whatever <.>
attr "a" <.>
elem "child" (
namespace (Just "what") xmlns_whatever <.>
elem "sub-child" (
namespace Nothing xmlns_empty <.>
empty
)
)