diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 | 
| commit | 4538829ab86b5a1cd4e845e7eab165029c9d6d46 (patch) | |
| tree | bbadf39aed0610c8f8f7b41fefff47773b8ac205 /xsd/examples/cxx/parser/mixed | |
| parent | 23d41842168ac1a1580111b9c5c73500ceee3d57 (diff) | |
| parent | aad5ad9bf0c02aa4e79bc6b7d6c934612fff4026 (diff) | |
Update upstream source from tag 'upstream/4.2.0'
Update to upstream version '4.2.0'
with Debian dir 1b38df7bbcf313223de3c50107ac0255090fe647
Diffstat (limited to 'xsd/examples/cxx/parser/mixed')
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/README | 49 | ||||
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/anchor.hxx | 33 | ||||
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/driver.cxx | 100 | ||||
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/makefile | 107 | ||||
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/text.map | 6 | ||||
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/text.xml | 17 | ||||
| -rw-r--r-- | xsd/examples/cxx/parser/mixed/text.xsd | 28 | 
7 files changed, 0 insertions, 340 deletions
| diff --git a/xsd/examples/cxx/parser/mixed/README b/xsd/examples/cxx/parser/mixed/README deleted file mode 100644 index 23ace6f..0000000 --- a/xsd/examples/cxx/parser/mixed/README +++ /dev/null @@ -1,49 +0,0 @@ -This example shows how to handle raw, "type-less content" such as -mixed content models, anyType/anySimpleType, and any/anyAttribute -in the C++/Parser mapping. - -In this example we use mixed content model to describe text -with embedded links, e.g., - -    This paragraph talks about <a href="uri">time</a>. - -The example transforms such text into plain text with -references, e.g., - -    This paragraph talks about time[0]. - -    [0] uri - -The example consists of the following files: - -text.xsd -  XML Schema which describes "text with links" instance -  documents. - -text.xml -  Sample XML instance document. - -anchor.hxx -  Anchor type that captures the information about a link. - -text.map -  Type map. It maps XML Schema anchor types defined in -  text.xsd to C++ anchor class defined in anchor.hxx. - -text-pskel.hxx -text-pskel.cxx -  Parser skeletons generated by XSD from text.xsd and -  text.map. - -driver.cxx -  A parser implementation and a driver for the example. The -  parser implementation prints the transformed text to STDOUT. -  The driver first constructs a parser instance from the parser -  implementation mentioned above and a couple of predefined -  parsers for the XML Schema built-in types. In then invokes -  this parser instance to parse the input file. - -To run the example on the sample XML instance document simply -execute: - -$ ./driver text.xml diff --git a/xsd/examples/cxx/parser/mixed/anchor.hxx b/xsd/examples/cxx/parser/mixed/anchor.hxx deleted file mode 100644 index 3adc90b..0000000 --- a/xsd/examples/cxx/parser/mixed/anchor.hxx +++ /dev/null @@ -1,33 +0,0 @@ -// file      : examples/cxx/parser/mixed/anchor.hxx -// copyright : not copyrighted - public domain - -#ifndef ANCHOR_HXX -#define ANCHOR_HXX - -#include <string> - -struct anchor -{ -  anchor (const std::string& text, const std::string& uri) -      : uri_ (uri), text_ (text) -  { -  } - -  const std::string& -  text () const -  { -    return text_; -  } - -  const std::string& -  uri () const -  { -    return uri_; -  } - -private: -  std::string uri_; -  std::string text_; -}; - -#endif // ANCHOR_HXX diff --git a/xsd/examples/cxx/parser/mixed/driver.cxx b/xsd/examples/cxx/parser/mixed/driver.cxx deleted file mode 100644 index 3f3cc65..0000000 --- a/xsd/examples/cxx/parser/mixed/driver.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// file      : examples/cxx/parser/mixed/driver.cxx -// copyright : not copyrighted - public domain - -#include <string> -#include <vector> -#include <iostream> - -#include "anchor.hxx" -#include "text-pskel.hxx" - -using namespace std; - -struct anchor_pimpl: anchor_pskel, xml_schema::string_pimpl -{ -  virtual void -  href (const std::string& uri) -  { -    uri_ = uri; -  } - -  virtual anchor -  post_anchor () -  { -    return anchor (post_string (), uri_); -  } - -private: -  std::string uri_; -}; - - -struct text_pimpl: text_pskel -{ -  virtual void -  a (const anchor& a) -  { -    cout << a.text () << "[" << anchors_.size () << "]"; -    anchors_.push_back (a); -  } - -  virtual void -  _any_characters (const xml_schema::ro_string& s) -  { -    cout << s; -  } - -  virtual void -  post_text () -  { -    for (anchors::const_iterator i (anchors_.begin ()); -         i != anchors_.end (); -         ++i) -    { -      cout << "[" << i - anchors_.begin () << "] " << i->uri () << endl; -    } -  } - -private: -  typedef vector<anchor> anchors; -  anchors anchors_; -}; - - -int -main (int argc, char* argv[]) -{ -  if (argc != 2) -  { -    cerr << "usage: " << argv[0] << " text.xml" << endl; -    return 1; -  } - -  try -  { -    // Construct the parser. -    // -    xml_schema::string_pimpl string_p; -    anchor_pimpl anchor_p; -    text_pimpl text_p; - -    anchor_p.href_parser (string_p); -    text_p.a_parser (anchor_p); - -    xml_schema::document doc_p (text_p, "text"); - -    text_p.pre (); -    doc_p.parse (argv[1]); -    text_p.post_text (); -  } -  catch (const xml_schema::exception& e) -  { -    cerr << e << endl; -    return 1; -  } -  catch (const std::ios_base::failure&) -  { -    cerr << argv[1] << ": unable to open or read failure" << endl; -    return 1; -  } -} diff --git a/xsd/examples/cxx/parser/mixed/makefile b/xsd/examples/cxx/parser/mixed/makefile deleted file mode 100644 index acf8aed..0000000 --- a/xsd/examples/cxx/parser/mixed/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file      : examples/cxx/parser/mixed/makefile -# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC -# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := text.xsd -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver   := $(out_base)/driver -install  := $(out_base)/.install -dist     := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean    := $(out_base)/.clean - - -# Import. -# -$(call import,\ -  $(scf_root)/import/libxerces-c/stub.make,\ -  l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen  := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --type-map $(src_base)/text.map -$(gen): $(out_root)/xsd/xsd $(src_base)/text.map - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): -	$(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) -	$(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) -	$(call install-data,$(src_base)/text.xsd,$(install_doc_dir)/xsd/$(path)/text.xsd) -	$(call install-data,$(src_base)/text.xml,$(install_doc_dir)/xsd/$(path)/text.xml) -	$(call install-data,$(src_base)/text.map,$(install_doc_dir)/xsd/$(path)/text.map) -	$(call install-data,$(src_base)/anchor.hxx,$(install_doc_dir)/xsd/$(path)/anchor.hxx) - -$(dist-common): -	$(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) -	$(call install-data,$(src_base)/text.xsd,$(dist_prefix)/$(path)/text.xsd) -	$(call install-data,$(src_base)/text.xml,$(dist_prefix)/$(path)/text.xml) -	$(call install-data,$(src_base)/text.map,$(dist_prefix)/$(path)/text.map) -	$(call install-data,$(src_base)/anchor.hxx,$(dist_prefix)/$(path)/anchor.hxx) - -$(dist): $(dist-common) -	$(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) -	$(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) -	$(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean                                 \ -  $(addsuffix .cxx.clean,$(obj))                            \ -  $(addsuffix .cxx.clean,$(dep))                            \ -  $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/xsd/examples/cxx/parser/mixed/text.map b/xsd/examples/cxx/parser/mixed/text.map deleted file mode 100644 index 85971c4..0000000 --- a/xsd/examples/cxx/parser/mixed/text.map +++ /dev/null @@ -1,6 +0,0 @@ -# file      : examples/cxx/parser/mixed/text.map -# copyright : not copyrighted - public domain - -include "anchor.hxx"; - -anchor ::anchor; diff --git a/xsd/examples/cxx/parser/mixed/text.xml b/xsd/examples/cxx/parser/mixed/text.xml deleted file mode 100644 index bfdc881..0000000 --- a/xsd/examples/cxx/parser/mixed/text.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> - -<!-- - -file      : examples/cxx/parser/text/text.xml -copyright : not copyrighted - public domain - ---> - -<text xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -      xsi:noNamespaceSchemaLocation="text.xsd"> -       -The first paragraph of this text talks about <a href="http://en.wikipedia.org/wiki/time">time</a>. -   -And this paragraph talks about <a href="http://en.wikipedia.org/wiki/space">space</a>. - -</text> diff --git a/xsd/examples/cxx/parser/mixed/text.xsd b/xsd/examples/cxx/parser/mixed/text.xsd deleted file mode 100644 index 92e300c..0000000 --- a/xsd/examples/cxx/parser/mixed/text.xsd +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> - -<!-- - -file      : examples/cxx/parser/mixed/text.xsd -copyright : not copyrighted - public domain - ---> - -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - -  <xsd:complexType name="anchor"> -    <xsd:simpleContent> -      <xsd:extension base="xsd:string"> -        <xsd:attribute name="href" type="xsd:string" use="required"/> -      </xsd:extension> -    </xsd:simpleContent> -  </xsd:complexType> - -  <xsd:complexType name="text" mixed="true"> -    <xsd:sequence> -      <xsd:element name="a" type="anchor" minOccurs="0" maxOccurs="unbounded"/> -    </xsd:sequence> -  </xsd:complexType> - -  <xsd:element name="text" type="text"/> - -</xsd:schema> | 
