summaryrefslogtreecommitdiff
path: root/tests/cxx/tree/dom-association
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cxx/tree/dom-association')
-rw-r--r--tests/cxx/tree/dom-association/dom-parse.cxx95
-rw-r--r--tests/cxx/tree/dom-association/dom-parse.hxx23
-rw-r--r--tests/cxx/tree/dom-association/driver.cxx71
-rw-r--r--tests/cxx/tree/dom-association/makefile91
-rw-r--r--tests/cxx/tree/dom-association/output0
-rw-r--r--tests/cxx/tree/dom-association/test.xml7
-rw-r--r--tests/cxx/tree/dom-association/test.xsd12
7 files changed, 0 insertions, 299 deletions
diff --git a/tests/cxx/tree/dom-association/dom-parse.cxx b/tests/cxx/tree/dom-association/dom-parse.cxx
deleted file mode 100644
index 0d26d02..0000000
--- a/tests/cxx/tree/dom-association/dom-parse.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-// file : tests/cxx/tree/dom-association/dom-parse.cxx
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#include "dom-parse.hxx"
-
-#include <istream>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp> // chLatin_*
-#include <xercesc/framework/Wrapper4InputSource.hpp>
-
-#include <xsd/cxx/xml/sax/std-input-source.hxx>
-#include <xsd/cxx/xml/dom/bits/error-handler-proxy.hxx>
-
-#include <xsd/cxx/tree/exceptions.hxx>
-#include <xsd/cxx/tree/error-handler.hxx>
-
-using namespace xercesc;
-namespace xml = xsd::cxx::xml;
-namespace tree = xsd::cxx::tree;
-
-XSD_DOM_AUTO_PTR<DOMDocument>
-parse (std::istream& is,
- const std::string& id,
- bool validate)
-{
- const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull};
-
- // Get an implementation of the Load-Store (LS) interface.
- //
- DOMImplementation* impl (
- DOMImplementationRegistry::getDOMImplementation (ls_id));
-
- XSD_DOM_AUTO_PTR<DOMLSParser> parser (
- impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
-
- DOMConfiguration* conf (parser->getDomConfig ());
-
- // Discard comment nodes in the document.
- //
- conf->setParameter (XMLUni::fgDOMComments, false);
-
- // Enable datatype normalization.
- //
- conf->setParameter (XMLUni::fgDOMDatatypeNormalization, true);
-
- // Do not create EntityReference nodes in the DOM tree. No
- // EntityReference nodes will be created, only the nodes
- // corresponding to their fully expanded substitution text
- // will be created.
- //
- conf->setParameter (XMLUni::fgDOMEntities, false);
-
- // Perform namespace processing.
- //
- conf->setParameter (XMLUni::fgDOMNamespaces, true);
-
- // Do not include ignorable whitespace in the DOM tree.
- //
- conf->setParameter (XMLUni::fgDOMElementContentWhitespace, false);
-
- // Enable/Disable validation.
- //
- conf->setParameter (XMLUni::fgDOMValidate, validate);
- conf->setParameter (XMLUni::fgXercesSchema, validate);
- conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false);
-
- // Xerces-C++ 3.1.0 is the first version with working multi import
- // support.
- //
-#if _XERCES_VERSION >= 30100
- conf->setParameter (XMLUni::fgXercesHandleMultipleImports, true);
-#endif
-
- // We will release the DOM document ourselves.
- //
- conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- // Set error handler.
- //
- tree::error_handler<char> eh;
- xml::dom::bits::error_handler_proxy<char> ehp (eh);
- conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-
- // Prepare input stream.
- //
- xml::sax::std_input_source isrc (is, id);
- Wrapper4InputSource wrap (&isrc, false);
-
- XSD_DOM_AUTO_PTR<DOMDocument> doc (parser->parse (&wrap));
-
- eh.throw_if_failed<tree::parsing<char> > ();
-
- return doc;
-}
diff --git a/tests/cxx/tree/dom-association/dom-parse.hxx b/tests/cxx/tree/dom-association/dom-parse.hxx
deleted file mode 100644
index c1c9326..0000000
--- a/tests/cxx/tree/dom-association/dom-parse.hxx
+++ /dev/null
@@ -1,23 +0,0 @@
-// file : tests/cxx/tree/dom-association/dom-parse.hxx
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#ifndef DOM_PARSE
-#define DOM_PARSE
-
-#include <string>
-#include <iosfwd>
-
-#include <xercesc/dom/DOMDocument.hpp>
-
-#include <xsd/cxx/xml/dom/auto-ptr.hxx>
-
-// Parse an XML document from the standard input stream with an
-// optional resource id. Resource id is used in diagnostics as
-// well as to locate schemas referenced from inside the document.
-//
-XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
-parse (std::istream& is,
- const std::string& id,
- bool validate);
-
-#endif // DOM_PARSE
diff --git a/tests/cxx/tree/dom-association/driver.cxx b/tests/cxx/tree/dom-association/driver.cxx
deleted file mode 100644
index 44343a3..0000000
--- a/tests/cxx/tree/dom-association/driver.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-// file : tests/cxx/tree/dom-association/driver.cxx
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-// Test DOM association/ownership.
-//
-
-#include <memory> // std::auto_ptr/unique_ptr
-#include <fstream>
-#include <iostream>
-
-#include <xercesc/dom/DOM.hpp>
-
-#include "dom-parse.hxx"
-#include "test.hxx"
-
-using namespace std;
-using namespace test;
-using namespace xercesc;
-
-int
-main (int argc, char* argv[])
-{
- if (argc != 2)
- {
- cerr << "usage: " << argv[0] << " test.xml" << endl;
- return 1;
- }
-
- int r (0);
-
- XMLPlatformUtils::Initialize ();
-
- try
- {
- ifstream ifs;
- ifs.exceptions (ifstream::badbit | ifstream::failbit);
- ifs.open (argv[1]);
-
- DOMDocument* ptr;
-
-#ifdef XSD_CXX11
- xml_schema::dom::unique_ptr<DOMDocument> doc (parse (ifs, argv[1], true));
- ptr = doc.get ();
- unique_ptr<type> r (
- root (std::move (doc),
- xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
-#else
- xml_schema::dom::auto_ptr<DOMDocument> doc (parse (ifs, argv[1], true));
- ptr = doc.get ();
- auto_ptr<type> r (
- root (doc,
- xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
-#endif
-
- assert (doc.get () == 0);
- assert (r->_node ()->getOwnerDocument () == ptr);
- }
- catch (xml_schema::exception const& e)
- {
- cerr << e << endl;
- r = 1;
- }
- catch (const std::ios_base::failure&)
- {
- cerr << argv[1] << ": unable to open or read failure" << endl;
- r = 1;
- }
-
- XMLPlatformUtils::Terminate ();
- return r;
-}
diff --git a/tests/cxx/tree/dom-association/makefile b/tests/cxx/tree/dom-association/makefile
deleted file mode 100644
index 6c1f44c..0000000
--- a/tests/cxx/tree/dom-association/makefile
+++ /dev/null
@@ -1,91 +0,0 @@
-# file : tests/cxx/tree/dom-association/makefile
-# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
-
-xsd := test.xsd
-cxx := driver.cxx dom-parse.cxx
-
-obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o))
-dep := $(obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-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)
-
-# Define XSD_CXX11 since we include libxsd headers directly.
-#
-$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
-ifeq ($(cxx_standard),c++11)
-$(obj) $(dep): cpp_options += -DXSD_CXX11
-endif
-
-genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): xsd := $(out_root)/xsd/xsd
-$(gen): xsd_options += --generate-ostream
-$(gen): $(out_root)/xsd/xsd
-
-$(call include-dep,$(dep),$(obj),$(gen))
-
-# Convenience alias for default target.
-#
-$(out_base)/: $(driver)
-
-
-# Test.
-#
-$(test): driver := $(driver)
-$(test): $(driver) $(src_base)/test.xml $(src_base)/output
- $(call message,test $$1,$$1 $(src_base)/test.xml | diff -u $(src_base)/output -,$(driver))
-
-# Clean.
-#
-$(clean): $(driver).o.clean \
- $(addsuffix .cxx.clean,$(obj)) \
- $(addsuffix .cxx.clean,$(dep)) \
- $(addprefix $(out_base)/,$(xsd:.xsd=.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)
-
-ifdef cxx_standard
-$(gen): xsd_options += --std $(cxx_standard)
-$(call include,$(scf_root)/xsd/tree/xsd-cxx.make)
-endif
-
-
-# Dependencies.
-#
-$(call import,$(src_root)/xsd/makefile)
diff --git a/tests/cxx/tree/dom-association/output b/tests/cxx/tree/dom-association/output
deleted file mode 100644
index e69de29..0000000
--- a/tests/cxx/tree/dom-association/output
+++ /dev/null
diff --git a/tests/cxx/tree/dom-association/test.xml b/tests/cxx/tree/dom-association/test.xml
deleted file mode 100644
index 624a80c..0000000
--- a/tests/cxx/tree/dom-association/test.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<t:root xmlns:t="test"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="test test.xsd">
-
- <a>a</a>
-
-</t:root>
diff --git a/tests/cxx/tree/dom-association/test.xsd b/tests/cxx/tree/dom-association/test.xsd
deleted file mode 100644
index 07bebc7..0000000
--- a/tests/cxx/tree/dom-association/test.xsd
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
-
- <complexType name="type">
- <sequence>
- <element name="a" type="string"/>
- </sequence>
- </complexType>
-
- <element name="root" type="t:type"/>
-
-</schema>