1 // file : XMLSchema/Writer.hpp
2 // author : Boris Kolpackov <boris@dre.vanderbilt.edu>
3 #ifndef XMLSCHEMA_WRITER_HPP
4 #define XMLSCHEMA_WRITER_HPP
8 #include <ace/XML_Utils/XSCRT/Writer.hpp>
10 #include <ace/XML_Utils/XMLSchema/Types.hpp>
11 #include <ace/XML_Utils/XMLSchema/Traversal.hpp>
19 template <typename T
, typename C
>
20 struct FundamentalType
: Traversal::Traverser
<T
>,
21 virtual XSCRT::Writer
<C
>
23 FundamentalType (XSCRT::XML::Element
<C
>& e
)
24 : XSCRT::Writer
<C
> (e
)
28 using XSCRT::Writer
<C
>::top_
;
29 using XSCRT::Writer
<C
>::attr_
;
34 using namespace XSCRT::XML
;
36 std::basic_ostringstream
<C
> os
;
40 if (Attribute
<C
>* a
= attr_ ())
46 top_().value (os
.str ());
54 Traversal::Traverser
<T
>::traverse (t
);
63 struct FundamentalType
<XSCRT::FundamentalType
<bool>, C
> :
64 Traversal::Traverser
<XSCRT::FundamentalType
<bool> >,
65 virtual XSCRT::Writer
<C
>
67 FundamentalType (XSCRT::XML::Element
<C
> &e
)
68 : XSCRT::Writer
<C
> (e
)
72 using XSCRT::Writer
<C
>::top_
;
73 using XSCRT::Writer
<C
>::attr_
;
76 traverse (XSCRT::FundamentalType
<bool> const &o
)
78 using namespace XSCRT::XML
;
80 std::basic_ostringstream
<C
> os
;
91 if (Attribute
<C
>* a
= attr_ ())
97 top_().value (os
.str ());
103 traverse (XSCRT::FundamentalType
<bool> &t
)
105 Traversal::Traverser
<XSCRT::FundamentalType
<bool> >::traverse (t
);
114 template <typename C
>
115 struct IDREF
: Traversal::Traverser
<XMLSchema::IDREF
<C
> >,
116 virtual XSCRT::Writer
<C
>
118 IDREF (XSCRT::XML::Element
<C
>& e
)
119 : XSCRT::Writer
<C
> (e
)
125 typename
Traversal::Traverser
<XMLSchema::IDREF
<C
> >::Type
const& o
)
127 using namespace XSCRT::XML
;
129 if (Attribute
<C
>* a
= XSCRT::Writer
<C
>::attr_ ())
135 XSCRT::Writer
<C
>::top_().value (o
.id ());
142 traverse (typename
Traversal::Traverser
<XMLSchema::IDREF
<C
> >::Type
&o
)
144 Traversal::Traverser
<XMLSchema::IDREF
<C
> >::traverse (o
);
154 #endif // XMLSCHEMA_WRITER_HPP