summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--documentation/xsd.132
-rw-r--r--documentation/xsd.xhtml27
-rw-r--r--xsd/cxx/elements.cxx5
-rw-r--r--xsd/cxx/elements.hxx6
-rw-r--r--xsd/cxx/parser/elements.cxx2
-rw-r--r--xsd/cxx/parser/elements.hxx1
-rw-r--r--xsd/cxx/parser/generator.cxx8
-rw-r--r--xsd/cxx/parser/name-processor.cxx11
-rw-r--r--xsd/cxx/parser/validator.cxx7
-rw-r--r--xsd/cxx/tree/counter.cxx6
-rw-r--r--xsd/cxx/tree/counter.hxx4
-rw-r--r--xsd/cxx/tree/elements.cxx2
-rw-r--r--xsd/cxx/tree/elements.hxx1
-rw-r--r--xsd/cxx/tree/generator.cxx6
-rw-r--r--xsd/cxx/tree/name-processor.cxx10
-rw-r--r--xsd/cxx/tree/validator.cxx6
17 files changed, 66 insertions, 72 deletions
diff --git a/NEWS b/NEWS
index 01f7463..58512d4 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,10 @@ Version 3.3.0
component issuing the warning. F - compiler frontend, D - compiler
driver, P - C++/Parser mapping, T - C++/Tree mapping.
+ * Strings used to match regular expression supplied with the
+ --namespace-regex and --anonymous-regex options now include the file
+ component for the schema being compiled.
+
C++/Tree
* New option, --generate-element-type, triggers generation of types
diff --git a/documentation/xsd.1 b/documentation/xsd.1
index 021f76a..743f1af 100644
--- a/documentation/xsd.1
+++ b/documentation/xsd.1
@@ -198,23 +198,19 @@ expressions are applied to a string in the form
.I filename namespace
-For example,
-
-.B XMLSchema.xsd http://www.w3.org/2001/XMLSchema
-
-The
-.I filename
-for the current translation unit is empty. For example, if you have file
+For example, if you have file
.B hello.xsd
with namespace
.B http://example.com/hello
and you run
.B xsd
-on this file, then the string in question would be:
+on this file, then the string in question will be:
-.B \ http://example.com/hello
+.B hello.xsd. http://example.com/hello
-Note the leading space.
+For the built-in XML Schema namespace the string is:
+
+.B XMLSchema.xsd http://www.w3.org/2001/XMLSchema
The following three steps are performed for each regular expression until
the match is found:
@@ -582,26 +578,12 @@ in the form
.I filename namespace xpath
-For example,
+For instance:
.B hello.xsd http://example.com/hello element
.B hello.xsd http://example.com/hello type/element
-The
-.I filename
-for the current translation unit is empty. For example, if you have file
-.B hello.xsd
-with namespace
-.B http://example.com/hello
-and you run
-.B xsd
-on this file, then the string in question would be:
-
-.B \ http://example.com/hello element
-
-Note the leading space.
-
As an example, the following expression makes all the derived
names start with capital letters. This could be useful when
your naming convention requires type names to start with
diff --git a/documentation/xsd.xhtml b/documentation/xsd.xhtml
index 99c19b0..1f1c5f8 100644
--- a/documentation/xsd.xhtml
+++ b/documentation/xsd.xhtml
@@ -172,19 +172,16 @@
<p><code><i>filename</i> <i>namespace</i></code></p>
- <p>For example,</p>
-
- <p><code><b>XMLSchema.xsd http://www.w3.org/2001/XMLSchema</b></code></p>
-
- <p>The <code><i>filename</i></code> for the current translation unit
- is empty. For example, if you have file <code><b>hello.xsd</b></code>
+ <p>For example, if you have file <code><b>hello.xsd</b></code>
with namespace <code><b>http://example.com/hello</b></code> and you run
<code><b>xsd</b></code> on this file, then the string in question
- would be:</p>
+ will be:</p>
- <p><code>&nbsp;<b>http://example.com/hello</b></code></p>
+ <p><code><b>hello.xsd. http://example.com/hello</b></code></p>
- <p>Note the leading space.</p>
+ <p>For the built-in XML Schema namespace the string is:</p>
+
+ <p><code><b>XMLSchema.xsd http://www.w3.org/2001/XMLSchema</b></code></p>
<p>The following three steps are performed for each regular expression
until the match is found:</p>
@@ -517,21 +514,11 @@
<p><code><i>filename</i> <i>namespace</i> <i>xpath</i></code></p>
- <p>For example,</p>
+ <p>For instance:</p>
<p><code><b>hello.xsd http://example.com/hello element</b></code></p>
<p><code><b>hello.xsd http://example.com/hello type/element</b></code></p>
- <p>The <code><i>filename</i></code> for the current translation unit
- is empty. For example, if you have file <code><b>hello.xsd</b></code>
- with namespace <code><b>http://example.com/hello</b></code> and you run
- <code><b>xsd</b></code> on this file, then the string in question
- would be:</p>
-
- <p><code>&nbsp;<b>http://example.com/hello element</b></code></p>
-
- <p>Note the leading space.</p>
-
<p>As an example, the following expression makes all the derived
names start with capital letters. This could be useful when
your naming convention requires type names to start with
diff --git a/xsd/cxx/elements.cxx b/xsd/cxx/elements.cxx
index 9b84e2c..29603ae 100644
--- a/xsd/cxx/elements.cxx
+++ b/xsd/cxx/elements.cxx
@@ -113,6 +113,7 @@ namespace CXX
Context::
Context (std::wostream& o,
SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
StringLiteralMap const* string_literal_map_,
NarrowString const& char_type__,
NarrowString const& char_encoding__,
@@ -128,6 +129,7 @@ namespace CXX
Containers::Vector<NarrowString> const& reserved_name)
: os (o),
schema_root (root),
+ schema_path (schema_path_),
char_type (char_type_),
char_encoding (char_encoding_),
L (L_),
@@ -139,6 +141,7 @@ namespace CXX
inst_exp (inst_exp_),
inl (inl_),
ns_mapping_cache (ns_mapping_cache_),
+ schema_path_ (path),
xs_ns_ (0),
char_type_ (char_type__),
char_encoding_ (char_encoding__),
@@ -307,6 +310,8 @@ namespace CXX
if (s.names_begin () != s.names_end ())
path = u.path ();
}
+ else
+ path = schema_path;
String pair;
diff --git a/xsd/cxx/elements.hxx b/xsd/cxx/elements.hxx
index afc8229..59938c5 100644
--- a/xsd/cxx/elements.hxx
+++ b/xsd/cxx/elements.hxx
@@ -148,6 +148,7 @@ namespace CXX
public:
Context (std::wostream& o,
SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
StringLiteralMap const* custom_literals_map,
NarrowString const& char_type__,
NarrowString const& char_encoding__,
@@ -166,6 +167,7 @@ namespace CXX
Context (Context& c)
: os (c.os),
schema_root (c.schema_root),
+ schema_path (c.schema_path),
char_type (c.char_type),
char_encoding (c.char_encoding),
L (c.L),
@@ -193,6 +195,7 @@ namespace CXX
Context (Context& c, std::wostream& o)
: os (o),
schema_root (c.schema_root),
+ schema_path (c.schema_path),
char_type (c.char_type),
char_encoding (c.char_encoding),
L (c.L),
@@ -337,6 +340,7 @@ namespace CXX
std::wostream& os;
SemanticGraph::Schema& schema_root;
+ SemanticGraph::Path const& schema_path;
String& char_type;
String& char_encoding;
@@ -355,6 +359,8 @@ namespace CXX
MappingCache& ns_mapping_cache;
private:
+ SemanticGraph::Path const schema_path_;
+
SemanticGraph::Namespace* xs_ns_;
String char_type_;
diff --git a/xsd/cxx/parser/elements.cxx b/xsd/cxx/parser/elements.cxx
index 399553a..392bf16 100644
--- a/xsd/cxx/parser/elements.cxx
+++ b/xsd/cxx/parser/elements.cxx
@@ -41,6 +41,7 @@ namespace CXX
Context::
Context (std::wostream& o,
SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
CLI::Options const& ops,
StringLiteralMap const* map,
Regex const* he,
@@ -48,6 +49,7 @@ namespace CXX
Regex const* hie)
: CXX::Context (o,
root,
+ path,
map,
ops.value<CLI::char_type> (),
ops.value<CLI::char_encoding> (),
diff --git a/xsd/cxx/parser/elements.hxx b/xsd/cxx/parser/elements.hxx
index 58e3c63..ca766f6 100644
--- a/xsd/cxx/parser/elements.hxx
+++ b/xsd/cxx/parser/elements.hxx
@@ -38,6 +38,7 @@ namespace CXX
public:
Context (std::wostream&,
SemanticGraph::Schema&,
+ SemanticGraph::Path const& path,
CLI::Options const&,
StringLiteralMap const*,
Regex const* hxx_expr,
diff --git a/xsd/cxx/parser/generator.cxx b/xsd/cxx/parser/generator.cxx
index b4cc0d1..60d2785 100644
--- a/xsd/cxx/parser/generator.cxx
+++ b/xsd/cxx/parser/generator.cxx
@@ -715,7 +715,7 @@ namespace CXX
String xns;
{
- Context ctx (std::wcerr, schema, ops, 0, 0, 0, 0);
+ Context ctx (std::wcerr, schema, file_path, ops, 0, 0, 0, 0);
xns = ctx.xs_ns_name ();
}
@@ -1160,6 +1160,7 @@ namespace CXX
{
Context ctx (hxx,
schema,
+ file_path,
ops,
&string_literal_map,
&hxx_expr,
@@ -1253,6 +1254,7 @@ namespace CXX
{
Context ctx (ixx,
schema,
+ file_path,
ops,
&string_literal_map,
&hxx_expr,
@@ -1315,6 +1317,7 @@ namespace CXX
{
Context ctx (cxx,
schema,
+ file_path,
ops,
&string_literal_map,
&hxx_expr,
@@ -1385,6 +1388,7 @@ namespace CXX
{
Context ctx (hxx_impl,
schema,
+ file_path,
ops,
&string_literal_map,
&hxx_expr,
@@ -1419,6 +1423,7 @@ namespace CXX
{
Context ctx (cxx_impl,
schema,
+ file_path,
ops,
&string_literal_map,
&hxx_expr,
@@ -1441,6 +1446,7 @@ namespace CXX
{
Context ctx (cxx_driver,
schema,
+ file_path,
ops,
&string_literal_map,
&hxx_expr,
diff --git a/xsd/cxx/parser/name-processor.cxx b/xsd/cxx/parser/name-processor.cxx
index 9573ca8..3bc616e 100644
--- a/xsd/cxx/parser/name-processor.cxx
+++ b/xsd/cxx/parser/name-processor.cxx
@@ -34,10 +34,11 @@ namespace CXX
public:
Context (CLI::Options const& ops,
SemanticGraph::Schema& root,
- SemanticGraph::Path const& file,
+ SemanticGraph::Path const& path,
StringLiteralMap const* map)
: CXX::Context (std::wcerr,
root,
+ path,
map,
ops.value<CLI::char_type> (),
ops.value<CLI::char_encoding> (),
@@ -51,11 +52,8 @@ namespace CXX
ops.value<CLI::include_regex_trace> (),
ops.value<CLI::generate_inline> (),
ops.value<CLI::reserved_name> ()),
- schema_path_ (file),
skel_suffix_ (ops.value<CLI::skel_type_suffix> ()),
impl_suffix_ (ops.value<CLI::impl_type_suffix> ()),
- schema (root),
- schema_path (schema_path_),
impl (ops.value<CLI::generate_noop_impl> () ||
ops.value<CLI::generate_print_impl> () ||
ops.value<CLI::generate_test_driver> ()),
@@ -69,8 +67,6 @@ namespace CXX
protected:
Context (Context& c)
: CXX::Context (c),
- schema (c.schema),
- schema_path (c.schema_path),
impl (c.impl),
skel_suffix (c.skel_suffix),
impl_suffix (c.impl_suffix),
@@ -98,15 +94,12 @@ namespace CXX
}
private:
- SemanticGraph::Path const schema_path_;
String const skel_suffix_;
String const impl_suffix_;
Cult::Containers::Map<String, NameSet> global_type_names_;
public:
- SemanticGraph::Schema& schema;
- SemanticGraph::Path const& schema_path;
Boolean const impl;
String const& skel_suffix;
String const& impl_suffix;
diff --git a/xsd/cxx/parser/validator.cxx b/xsd/cxx/parser/validator.cxx
index 2ca1d69..d70e333 100644
--- a/xsd/cxx/parser/validator.cxx
+++ b/xsd/cxx/parser/validator.cxx
@@ -24,10 +24,11 @@ namespace CXX
{
public:
ValidationContext (SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
CLI::Options const& options,
const WarningSet& disabled_warnings,
Boolean& valid_)
- : Context (std::wcerr, root, options, 0, 0, 0, 0),
+ : Context (std::wcerr, root, path, options, 0, 0, 0, 0),
disabled_warnings_ (disabled_warnings),
disabled_warnings_all_ (false),
valid (valid_),
@@ -552,12 +553,12 @@ namespace CXX
Boolean Validator::
validate (CLI::Options const& options,
SemanticGraph::Schema& root,
- SemanticGraph::Path const&,
+ SemanticGraph::Path const& path,
Boolean gen_driver,
const WarningSet& disabled_warnings)
{
Boolean valid (true);
- ValidationContext ctx (root, options, disabled_warnings, valid);
+ ValidationContext ctx (root, path, options, disabled_warnings, valid);
//
//
diff --git a/xsd/cxx/tree/counter.cxx b/xsd/cxx/tree/counter.cxx
index d2a5c10..9254226 100644
--- a/xsd/cxx/tree/counter.cxx
+++ b/xsd/cxx/tree/counter.cxx
@@ -236,10 +236,12 @@ namespace CXX
}
Counts Counter::
- count (CLI::Options const& options, SemanticGraph::Schema& tu)
+ count (CLI::Options const& options,
+ SemanticGraph::Schema& tu,
+ SemanticGraph::Path const& path)
{
Counts counts;
- Context ctx (std::wcerr, tu, options, counts, false, 0, 0, 0, 0);
+ Context ctx (std::wcerr, tu, path, options, counts, false, 0, 0, 0, 0);
Traversal::Schema schema;
Traversal::Sources sources;
diff --git a/xsd/cxx/tree/counter.hxx b/xsd/cxx/tree/counter.hxx
index 85e9ec7..726de47 100644
--- a/xsd/cxx/tree/counter.hxx
+++ b/xsd/cxx/tree/counter.hxx
@@ -19,7 +19,9 @@ namespace CXX
Counter (); // Dummy ctor, helps with long symbols on HP-UX.
Counts
- count (CLI::Options const& options, SemanticGraph::Schema&);
+ count (CLI::Options const&,
+ SemanticGraph::Schema&,
+ SemanticGraph::Path const&);
};
}
}
diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx
index d9615ac..31e0c08 100644
--- a/xsd/cxx/tree/elements.cxx
+++ b/xsd/cxx/tree/elements.cxx
@@ -36,6 +36,7 @@ namespace CXX
Context::
Context (std::wostream& o,
SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
CLI::Options const& ops,
Counts const& counts_,
Boolean generate_xml_schema__,
@@ -45,6 +46,7 @@ namespace CXX
Regex const* ie)
: CXX::Context (o,
root,
+ path,
map,
ops.value<CLI::char_type> (),
ops.value<CLI::char_encoding> (),
diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx
index 0af42c9..1caf378 100644
--- a/xsd/cxx/tree/elements.hxx
+++ b/xsd/cxx/tree/elements.hxx
@@ -114,6 +114,7 @@ namespace CXX
public:
Context (std::wostream& o,
SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
CLI::Options const& ops,
Counts const& counts_,
Boolean generate_xml_schema,
diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx
index f81a8f4..012a1fd 100644
--- a/xsd/cxx/tree/generator.cxx
+++ b/xsd/cxx/tree/generator.cxx
@@ -847,7 +847,7 @@ namespace CXX
Counts counts;
{
Counter counter;
- counts = counter.count (ops, schema);
+ counts = counter.count (ops, schema, file_path);
/*
wcerr << "global type count: " << counts.global_types << endl;
@@ -1195,6 +1195,7 @@ namespace CXX
{
Context ctx (fwd,
schema,
+ file_path,
ops,
counts,
generate_xml_schema,
@@ -1310,6 +1311,7 @@ namespace CXX
{
Context ctx (hxx,
schema,
+ file_path,
ops,
counts,
generate_xml_schema,
@@ -1464,6 +1466,7 @@ namespace CXX
{
Context ctx (ixx,
schema,
+ file_path,
ops,
counts,
generate_xml_schema,
@@ -1597,6 +1600,7 @@ namespace CXX
Context ctx (os,
schema,
+ file_path,
ops,
counts,
generate_xml_schema,
diff --git a/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx
index c90433f..1949c5d 100644
--- a/xsd/cxx/tree/name-processor.cxx
+++ b/xsd/cxx/tree/name-processor.cxx
@@ -43,10 +43,11 @@ namespace CXX
Counts const& counts,
Boolean generate_xml_schema,
SemanticGraph::Schema& root,
- SemanticGraph::Path const& file,
+ SemanticGraph::Path const& path,
StringLiteralMap const& map)
: Tree::Context (std::wcerr,
root,
+ path,
options,
counts,
generate_xml_schema,
@@ -54,8 +55,6 @@ namespace CXX
0,
0,
0),
- schema_path_ (file),
- schema_path (schema_path_),
global_type_names (global_type_names_),
global_element_names (global_element_names_),
type_regex (type_regex_),
@@ -270,7 +269,6 @@ namespace CXX
protected:
Context (Context& c)
: Tree::Context (c),
- schema_path (c.schema_path),
global_type_names (c.global_type_names),
global_element_names (c.global_element_names),
type_regex (c.type_regex),
@@ -518,8 +516,6 @@ namespace CXX
}
private:
- SemanticGraph::Path const schema_path_;
-
Cult::Containers::Map<String, NameSet> global_type_names_;
Cult::Containers::Map<String, NameSet> global_element_names_;
@@ -538,8 +534,6 @@ namespace CXX
RegexVector element_type_regex_;
public:
- SemanticGraph::Path const& schema_path;
-
Cult::Containers::Map<String, NameSet>& global_type_names;
Cult::Containers::Map<String, NameSet>& global_element_names;
diff --git a/xsd/cxx/tree/validator.cxx b/xsd/cxx/tree/validator.cxx
index 057e617..1f05e65 100644
--- a/xsd/cxx/tree/validator.cxx
+++ b/xsd/cxx/tree/validator.cxx
@@ -26,6 +26,7 @@ namespace CXX
{
public:
ValidationContext (SemanticGraph::Schema& root,
+ SemanticGraph::Path const& path,
CLI::Options const& options,
const WarningSet& disabled_warnings,
Counts const& counts,
@@ -33,6 +34,7 @@ namespace CXX
Boolean& valid_)
: Context (std::wcerr,
root,
+ path,
options,
counts,
generate_xml_schema,
@@ -528,13 +530,13 @@ namespace CXX
Boolean Validator::
validate (CLI::Options const& options,
SemanticGraph::Schema& schema,
- SemanticGraph::Path const&,
+ SemanticGraph::Path const& path,
const WarningSet& disabled_warnings,
Counts const& counts)
{
Boolean valid (true);
ValidationContext ctx (
- schema, options, disabled_warnings, counts, false, valid);
+ schema, path, options, disabled_warnings, counts, false, valid);
//
//