summaryrefslogtreecommitdiff
path: root/lib/xmerl/include
diff options
context:
space:
mode:
authorErlang/OTP <otp@erlang.org>2009-11-20 14:54:40 +0000
committerErlang/OTP <otp@erlang.org>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/xmerl/include
downloaderlang-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/xmerl/include')
-rwxr-xr-xlib/xmerl/include/xmerl.hrl236
-rwxr-xr-xlib/xmerl/include/xmerl_xlink.hrl26
-rw-r--r--lib/xmerl/include/xmerl_xpath.hrl30
-rw-r--r--lib/xmerl/include/xmerl_xsd.hrl194
4 files changed, 486 insertions, 0 deletions
diff --git a/lib/xmerl/include/xmerl.hrl b/lib/xmerl/include/xmerl.hrl
new file mode 100755
index 0000000000..7bb3f4de9b
--- /dev/null
+++ b/lib/xmerl/include/xmerl.hrl
@@ -0,0 +1,236 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%% Contributor(s):
+%% <michael.remond@IDEALX.com>: suggested #xmlDocument{}
+%%
+%%----------------------------------------------------------------------
+%% #0. BASIC INFORMATION
+%%----------------------------------------------------------------------
+%% File: xmerl.hrl
+%% Author : Ulf Wiger <ulf.wiger@ericsson.com>
+%% Date : 00-09-22
+%% Description : Record and macro definitions for xmerl
+%%----------------------------------------------------------------------
+
+
+
+%% records generated by the scanner
+%% --------------------------------
+
+%% XML declaration
+-record(xmlDecl,{
+ vsn, % string() XML version
+ encoding, % string() Character encoding
+ standalone, % (yes | no)
+ attributes % [#xmlAttribute()] Other attributes than above
+ }).
+
+%% Attribute
+-record(xmlAttribute,{
+ name, % atom()
+ expanded_name=[],% atom() | {string(),atom()}
+ nsinfo = [], % {Prefix, Local} | []
+ namespace = [], % inherits the element's namespace
+ parents = [], % [{atom(),integer()}]
+ pos, % integer()
+ language = [], % inherits the element's language
+ value, % IOlist() | atom() | integer()
+ normalized % atom() one of (true | false)
+ }).
+
+%% namespace record
+-record(xmlNamespace,{
+ default = [],
+ nodes = []
+ }).
+
+%% namespace node - i.e. a {Prefix, URI} pair
+%% TODO: these are not currently used?? /RC
+-record(xmlNsNode,{
+ prefix,
+ uri = []
+ }).
+
+%% XML Element
+%% content = [#xmlElement()|#xmlText()|#xmlPI()|#xmlComment()|#xmlDecl()]
+-record(xmlElement,{
+ name, % atom()
+ expanded_name = [], % string() | {URI,Local} | {"xmlns",Local}
+ nsinfo = [], % {Prefix, Local} | []
+ namespace=#xmlNamespace{},
+ parents = [], % [{atom(),integer()}]
+ pos, % integer()
+ attributes = [], % [#xmlAttribute()]
+ content = [],
+ language = "", % string()
+ xmlbase="", % string() XML Base path, for relative URI:s
+ elementdef=undeclared % atom(), one of [undeclared | prolog | external | element]
+ }).
+
+%% plain text
+%% IOlist = [char() | binary () | IOlist]
+-record(xmlText,{
+ parents = [], % [{atom(),integer()}]
+ pos, % integer()
+ language = [],% inherits the element's language
+ value, % IOlist()
+ type = text % atom() one of (text|cdata)
+ }).
+
+%% plain text
+-record(xmlComment,{
+ parents = [], % [{atom(),integer()}]
+ pos, % integer()
+ language = [], % inherits the element's language
+ value % IOlist()
+ }).
+
+%% processing instruction
+-record(xmlPI,{
+ name, % atom()
+ pos, % integer()
+ value % IOlist()
+ }).
+
+-record(xmlDocument,{
+ content
+ }).
+
+
+%% XPATH (xmerl_xpath, xmerl_pred_funcs) records
+
+-record(xmlContext, {
+ axis_type = forward,
+ context_node,
+ context_position = 1,
+ nodeset = [],
+ bindings = [],
+ functions = [],
+ namespace = [],
+ whole_document
+ }).
+
+-record(xmlNode, {
+ type = element,
+ node,
+ parents = [],
+ pos = 1
+ }).
+
+-record(xmlObj, {
+ type,
+ value
+ }).
+
+-record(xmerl_fun_states, {event,
+ hook,
+ rules,
+ fetch,
+ cont}).
+
+
+%% scanner state record
+-record(xmerl_scanner,{
+ encoding=undefined, % undefined | string() Character set used, default is UTF-8
+ standalone = no,
+% prolog =continue,
+ environment = prolog, % atom(), (prolog | element)
+ declarations = [], % [{Name, Attrs}]
+ doctype_name,
+ doctype_DTD = internal, % internal | DTDId
+ rules,
+ keep_rules = false, % delete (ets) tab if false
+ namespace_conformant = false, % true | false
+ xmlbase, % string() Current Base path, for relative URI:s
+ xmlbase_cache, % string() Cached Base path
+ fetch_path=[], % [string()] List with additional, user
+ % defined, paths
+ filename=file_name_unknown,
+ validation = off, %% off (default) | dtd | schema (true, false are obsolete)
+ schemaLocation = [],
+ space = preserve,
+ event_fun,
+ hook_fun,
+ acc_fun,
+ fetch_fun,
+ close_fun,
+ continuation_fun,
+ rules_read_fun,
+ rules_write_fun,
+ rules_delete_fun,
+ user_state,
+ fun_states = #xmerl_fun_states{},
+ entity_references=[],
+ text_decl=false,
+ quiet=false, % bool() Set to true will print no error messages
+ col = 1,
+ line = 1,
+ common_data = []
+ }).
+
+
+
+
+%% scanner events
+
+%% event : start | end
+-record(xmerl_event, {
+ event,
+ line,
+ col,
+ pos,
+ data
+ }).
+
+
+
+%% useful scanner macros
+%% ---------------------
+
+-define(space, 32).
+-define(cr, 13).
+-define(lf, 10).
+-define(tab, 9).
+%% whitespace consists of 'space', 'carriage return', 'line feed' or 'tab'
+-define(whitespace(H), H==?space ; H==?cr ; H==?lf ; H==?tab).
+
+%% non-caharacters according to Unicode: 16#ffff and 16#fffe
+-define(non_character(H1,H2), H1==16#ff,H2==16#fe;H1==16#ff,H2==16#ff).
+
+-define(non_ascii(H), list(H),hd(H)>=128;integer(H),H>=128).
+
+-define(strip1, {_, T1, S1} = strip(T, S)).
+-define(strip2, {_, T2, S2} = strip(T1, S1)).
+-define(strip3, {_, T3, S3} = strip(T2, S2)).
+-define(strip4, {_, T4, S4} = strip(T3, S3)).
+-define(strip5, {_, T5, S5} = strip(T4, S4)).
+-define(strip6, {_, T6, S6} = strip(T5, S5)).
+-define(strip7, {_, T7, S7} = strip(T6, S6)).
+-define(strip8, {_, T8, S8} = strip(T7, S7)).
+-define(strip9, {_, T9, S9} = strip(T8, S8)).
+-define(strip10, {_, T10, S10} = strip(T9, S9)).
+
+-define(condstrip1, {_, T1, S1} = condstrip(T, S, false)).
+-define(condstrip2, {_, T2, S2} = condstrip(T1,S1,false)).
+-define(condstrip3, {_, T3, S3} = condstrip(T2,S2,false)).
+-define(condstrip4, {_, T4, S4} = condstrip(T3,S3,false)).
+
+-define(bump_col(N),
+ ?dbg("bump_col(~p), US = ~p~n", [N, S0#xmerl_scanner.user_state]),
+ S = S0#xmerl_scanner{col = S0#xmerl_scanner.col + N}).
diff --git a/lib/xmerl/include/xmerl_xlink.hrl b/lib/xmerl/include/xmerl_xlink.hrl
new file mode 100755
index 0000000000..375e244c23
--- /dev/null
+++ b/lib/xmerl/include/xmerl_xlink.hrl
@@ -0,0 +1,26 @@
+
+
+
+%% The following is a brief summary of the element types (columns) on
+%% which the global attributes are allowed:
+%%
+%% simple extended locator arc resource title
+%% type X X X X X X
+%% href X X
+%% role X X X X
+%% title X X X X
+%% show X X X
+%% actuate X X X
+%% from X
+%% to X
+%%
+-record(xlink, {
+ type, % simple | extended | locator | arc | resource | title
+ href,
+ role
+ title,
+ show,
+ actuate,
+ from,
+ to
+ }).
diff --git a/lib/xmerl/include/xmerl_xpath.hrl b/lib/xmerl/include/xmerl_xpath.hrl
new file mode 100644
index 0000000000..fc4eeb3c66
--- /dev/null
+++ b/lib/xmerl/include/xmerl_xpath.hrl
@@ -0,0 +1,30 @@
+%%% The contents of this file are subject to the Erlang Public License,
+%%% Version 1.0, (the "License"); you may not use this file except in
+%%% compliance with the License. You may obtain a copy of the License at
+%%% http://www.erlang.org/license/EPL1_0.txt
+%%%
+%%% Software distributed under the License is distributed on an "AS IS"
+%%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%%% the License for the specific language governing rights and limitations
+%%% under the License.
+%%%
+%%% The Original Code is xmerl-0.19
+%%%
+%%% The Initial Developer of the Original Code is Ericsson Telecom
+%%% AB. Portions created by Ericsson are Copyright (C), 1998, Ericsson
+%%% Telecom AB. All Rights Reserved.
+%%%
+%%% Contributor(s):
+%%%
+%%%----------------------------------------------------------------------
+%%% #0. BASIC INFORMATION
+%%%----------------------------------------------------------------------
+%%% File: xmerl.hrl
+%%% Author : Ulf Wiger <ulf.wiger@ericsson.com>
+%%% Date : 00-09-22
+%%% Description : Record and macro definitions for xmerl_xpath
+%%%----------------------------------------------------------------------
+
+-record(state, {context = #xmlContext{},
+ acc = []}).
+
diff --git a/lib/xmerl/include/xmerl_xsd.hrl b/lib/xmerl/include/xmerl_xsd.hrl
new file mode 100644
index 0000000000..b527accc8c
--- /dev/null
+++ b/lib/xmerl/include/xmerl_xsd.hrl
@@ -0,0 +1,194 @@
+%%% The contents of this file are subject to the Erlang Public License,
+%%% Version 1.0, (the "License"); you may not use this file except in
+%%% compliance with the License. You may obtain a copy of the License at
+%%% http://www.erlang.org/license/EPL1_0.txt
+%%%
+%%% Software distributed under the License is distributed on an "AS IS"
+%%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%%% the License for the specific language governing rights and limitations
+%%% under the License.
+%%%
+%%%
+%%% The Initial Developer of the Original Code is Ericsson Telecom
+%%% AB. Portions created by Ericsson are Copyright (C), 1998, Ericsson
+%%% Telecom AB. All Rights Reserved.
+%%%-------------------------------------------------------------------
+
+%%% File : xmerl_xsd.hrl
+%%% Author : Bertil Karlsson <bertil@finrod>
+%%% Description :
+%%%
+%%% Created : 20 Jan 2006 by Bertil Karlsson <bertil@finrod>
+%%%-------------------------------------------------------------------
+
+%%-define(DEBUG,ok).
+
+-ifdef(DEBUG).
+-define(debug(_Fmt_,_Args_),ok=io:format("~p: " ++ _Fmt_, [?LINE|_Args_])).
+-else.
+-define(debug(_Fmt_,_Args_),no_debug).
+-endif.
+
+-define(XSD_NAMESPACE,'http://www.w3.org/2001/XMLSchema').
+-define(XSD_INSTANCE_NAMESPACE,'http://www.w3.org/2001/XMLSchema-instance').
+
+-record(xsd_state,{
+ schema_name,
+ vsn,
+ schema_preprocessed=false,
+ xsd_base,
+ xml_options=[],
+ scope=[],
+ schemaLocations=[],
+ elementFormDefault=unqualified,
+ attributeFormDefault=unqualified,
+ localElementsNamespace,
+ targetNamespace,
+ namespace_nodes=[{"xml",'http://www.w3.org/XML/1998/namespace'}],
+ global_namespace_nodes=[],
+ checked_namespace_nodes=[{"xml",[],'http://www.w3.org/XML/1998/namespace'}],
+ table,
+ tab2file=false, %% for debuging of abstract syntax
+ redefine=false,
+ finalDefault, %% undefined | '#all' | [atom()]
+ %% atom() -> extension |
+ %% restriction | list | union
+ blockDefault,
+ fetch_fun,
+ fetch_path=[],
+ num_el=0,
+ global_element_source=[],
+ keyrefs=[],
+ 'IDs'=[],
+ substitutionGroups=[],
+ derived_types=[],
+ unchecked_references=[],
+ circularity_stack=[],
+ circularity_disallowed=[],
+ errors=[]
+ }).
+-record(schema,{
+ elementFormDefault,
+ attributeFormDefault,
+ targetNamespace,
+ blockDefault=[],
+ finalDefault=[],
+ id,
+ content=[]
+ }).
+-record(schema_element,{
+ name, %% QName
+ type, %% name of derived type or built-in type
+ resolved=false,
+ substitutionGroup,
+ uniqueness, %% list() initiates in element_content for element
+ key, %% list() initiates in element_content for element
+ scope,
+ form, %% unqualified | qualified
+ id,
+ occurance={1,1}, %% {minOccurs,maxOccurs}
+ value_constraint, %% undefined | {default,Value} | {fixed,Value}
+ nillable=false, %% true | false
+ abstract=false, %% true | false
+ block=[],
+ final=[]
+ }).
+-record(schema_simple_type,{
+ name,
+ scope,
+ base_type,
+ resolved=false,
+ final=[],
+ id,
+ facets=[],
+ variety=atomic, %% atomic | list | union
+ content
+ }).
+-record(schema_complex_type,{
+ name,
+ base_type,
+ resolved=false,
+ scope,
+ derivation,
+ final=[], %% controls derivation by types
+ id,
+ block=[], %% prevents using of derived types in instance
+%% mixed=false,
+ abstract=false,
+ content_type='element-only',%% mixed | 'element-only'
+ complexity, %% undefined | simple | complex
+ attributes=[],
+ content=[],
+ prohibited
+ }).
+-record(schema_attribute,{
+ name,
+ type,
+ resolved=false,
+ scope,
+%% required=false,
+ use=optional, %% optional | required | prohibited
+ default,
+ fixed,
+ form, %% qualified | unqualified
+ id
+ }).
+-record(schema_attribute_group,{
+ name,
+ id,
+ ref, %% in this case no name or content
+ content=[]
+ }).
+-record(schema_anyAttribute,{
+ id,
+ processContents = strict,
+ namespace,
+ scope
+ }).
+-record(schema_group,{
+ name,
+ id,
+ ref, %% in this case no name or content
+ content=[],
+ occurance={1,1}
+ }).
+-record(schema_extension,{
+ base,
+ id,
+ content=[]
+ }).
+-record(schema_restriction,{
+ base,
+ id,
+ content=[]
+ }).
+-record(schema_list,{
+ id,
+ itemType
+ }).
+-record(id_constraint,{
+ category,% unique | key | keyref
+ id,
+ name,
+ refer, % only if type is keyref
+ type, %% This must be a simple type. Obtained by the
+ %% selector/fields
+ selector,
+ fields, %% list()
+ key_sequence
+ }).
+
+
+%% content model records, used in the static structure of what is
+%% allowed for a schema.
+%% chain, represents a series of ordered objects, some of whom may be
+%% optional.
+%% alterantive, a collection of objects of which only one is choosen.
+-record(chain,{
+ content,
+ occurance={1,1}
+ }).
+-record(alternative,{
+ content,
+ occurance={0,1}
+ }).