|
Revision 111, 1.6 kB
(checked in by mido, 18 years ago)
|
|
pridana knihovna XSD (a jeji chlebodarkyne XERCES), v ramci Win32 zprovoznen priklad tests/test_xsd_hello.cxx
|
| Line | |
|---|
| 1 | // file : xsd/cxx/xml/elements.txx |
|---|
| 2 | // author : Boris Kolpackov <boris@codesynthesis.com> |
|---|
| 3 | // copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC |
|---|
| 4 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file |
|---|
| 5 | |
|---|
| 6 | namespace xsd |
|---|
| 7 | { |
|---|
| 8 | namespace cxx |
|---|
| 9 | { |
|---|
| 10 | namespace xml |
|---|
| 11 | { |
|---|
| 12 | // properties |
|---|
| 13 | // |
|---|
| 14 | |
|---|
| 15 | template <typename C> |
|---|
| 16 | void properties<C>:: |
|---|
| 17 | schema_location (const std::basic_string<C>& ns, |
|---|
| 18 | const std::basic_string<C>& loc) |
|---|
| 19 | { |
|---|
| 20 | if (ns.empty () || loc.empty ()) |
|---|
| 21 | throw argument (); |
|---|
| 22 | |
|---|
| 23 | if (!schema_location_.empty ()) |
|---|
| 24 | schema_location_ += C (' '); |
|---|
| 25 | |
|---|
| 26 | schema_location_ += ns + C (' ') + loc; |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | template <typename C> |
|---|
| 30 | void properties<C>:: |
|---|
| 31 | no_namespace_schema_location (const std::basic_string<C>& loc) |
|---|
| 32 | { |
|---|
| 33 | if (loc.empty ()) |
|---|
| 34 | throw argument (); |
|---|
| 35 | |
|---|
| 36 | if (!no_namespace_schema_location_.empty ()) |
|---|
| 37 | no_namespace_schema_location_ += C (' '); |
|---|
| 38 | |
|---|
| 39 | no_namespace_schema_location_ += loc; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | // |
|---|
| 44 | // |
|---|
| 45 | |
|---|
| 46 | template <typename C> |
|---|
| 47 | std::basic_string<C> |
|---|
| 48 | prefix (const std::basic_string<C>& n) |
|---|
| 49 | { |
|---|
| 50 | std::size_t i (0); |
|---|
| 51 | |
|---|
| 52 | while (i < n.length () && n[i] != ':') |
|---|
| 53 | ++i; |
|---|
| 54 | |
|---|
| 55 | return std::basic_string<C> (n, i == n.length () ? i : 0, i); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | template <typename C> |
|---|
| 59 | std::basic_string<C> |
|---|
| 60 | uq_name (const std::basic_string<C>& n) |
|---|
| 61 | { |
|---|
| 62 | std::size_t i (0); |
|---|
| 63 | |
|---|
| 64 | while (i < n.length () && n[i] != ':') |
|---|
| 65 | ++i; |
|---|
| 66 | |
|---|
| 67 | return std::basic_string<C> ( |
|---|
| 68 | n.c_str () + (i == n.length () ? 0 : i + 1)); |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | } |
|---|
| 72 | } |
|---|