diff options
author | Tobias Schlager <[email protected]> | 2015-08-11 16:33:26 +0200 |
---|---|---|
committer | Tobias Schlager <[email protected]> | 2015-08-11 16:33:26 +0200 |
commit | 22f4e79f312b88d81f00c414230076bbc68769af (patch) | |
tree | 3e09c7f65bbda8f0cac38c20cdebef5aba4c49b7 /lib/xmerl/test/xmerl_xsd_SUITE.erl | |
parent | 98647fcc1632f60871adee20031e294e5d5b6eb0 (diff) | |
download | otp-22f4e79f312b88d81f00c414230076bbc68769af.tar.gz otp-22f4e79f312b88d81f00c414230076bbc68769af.tar.bz2 otp-22f4e79f312b88d81f00c414230076bbc68769af.zip |
Remove built-in definition of xml.xsd from xmerl
Removes the built-in definitions of http://www.w3.org/2001/xml.xsd from
the xmerl_xsd module. xmerl_xsd does load the definitions of the above
schema into its processing table during initialization. This leads to
the inability to process XSD schemas that properly import xml.xsd (as
suggested in xml.xsd itself).
Furthermore, the definitions are loaded from a binary containing the
corresponding terms in Erlang external term format. Since this is not
refactoring safe the intended functionality already broke long ago
(prior to github import) because some of the record definitions did
change in releases older than R13B03.
To sum up, the current code does not do anything useful because the
built-in definitions from the binary can't be used due to incompatible
records. Thus, this fix is not backwards incompatible. The change also
adds two new test cases covering common use-cases when using 'xml:'
types in custom schemas.
Diffstat (limited to 'lib/xmerl/test/xmerl_xsd_SUITE.erl')
-rw-r--r-- | lib/xmerl/test/xmerl_xsd_SUITE.erl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/xmerl/test/xmerl_xsd_SUITE.erl b/lib/xmerl/test/xmerl_xsd_SUITE.erl index 101fbcd50f..92c8287782 100644 --- a/lib/xmerl/test/xmerl_xsd_SUITE.erl +++ b/lib/xmerl/test/xmerl_xsd_SUITE.erl @@ -41,7 +41,8 @@ groups() -> [{group, primitive_datatypes}, {group, derived_datatypes}]}, {validation_tests, [], - [{group, xmlSchemaPrimerExamples}, + [{group, xmlXsdAndExample}, + {group, xmlSchemaPrimerExamples}, {group, miscXMLexamples}]}, {primitive_datatypes, [], [string, boolean, decimal, float, double, duration, @@ -55,6 +56,8 @@ groups() -> negativeInteger, long, int, short, byte, nonNegativeInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte, positiveInteger]}, + {xmlXsdAndExample, [], + [xml_xsd, xml_lang_attr]}, {xmlSchemaPrimerExamples, [], [po, po1, po2, ipo, ipo_redefine, '4Q99']}, {miscXMLexamples, [], @@ -863,6 +866,19 @@ compare_duration(_Config) -> ?line indefinite = xmerl_xsd_type:compare_durations("P5M","P153D"), ?line lt = xmerl_xsd_type:compare_durations("P5M","P154D"). +xml_xsd(suite) -> []; +xml_xsd(Config) -> + DataDir = ?config(data_dir, Config), + Options = [{fetch_path, [DataDir]}], + {ok, _} = xmerl_xsd:process_schema("xml.xsd", Options). + +xml_lang_attr(suite) -> []; +xml_lang_attr(Config) -> + DataDir = ?config(data_dir, Config), + {Element, _} = xmerl_scan:file(filename:join([DataDir, "book.xml"])), + Options = [{fetch_path, [DataDir]}], + {ok, Schema} = xmerl_xsd:process_schema("book.xsd", Options), + {Element, _} = xmerl_xsd:validate(Element, Schema). po(suite) -> []; po(Config) -> |