Skip to content

Commit fea600b

Browse files
committed
Merge branch 'maint'
2 parents b76c08a + 0ddb74a commit fea600b

File tree

9 files changed

+233
-2
lines changed

9 files changed

+233
-2
lines changed

lib/xmerl/src/xmerl_xsd.erl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,6 +2622,9 @@ check_element_type(XML=[#xmlText{}|_],
26222622
{ResolvedType,_} = resolve({simple_or_complex_Type,BT},S),
26232623
check_element_type(XML,ResolvedType,Env,Block,S,Checked);
26242624

2625+
check_element_type(_C, optional_text, _Env, _Block, S, _Checked) ->
2626+
{[], [], S};
2627+
26252628
%% single schema object
26262629
check_element_type(XML=[_H|_],
26272630
#schema_complex_type{name=Name,block=Bl,content=C},
@@ -3057,12 +3060,16 @@ allow_empty_content([{extension,{_BT,_CM=[]}}]) ->
30573060
true;
30583061
allow_empty_content([{_,{_,{0,_}}}|Rest]) ->
30593062
allow_empty_content(Rest);
3063+
allow_empty_content([{any,{_,{0,_},_}}|Rest]) ->
3064+
allow_empty_content(Rest);
30603065
allow_empty_content([{_,{Content,_}}|Rest]) ->
30613066
case allow_empty_content(Content) of
30623067
true ->
30633068
allow_empty_content(Rest);
30643069
_ -> false
30653070
end;
3071+
allow_empty_content([optional_text|Rest]) ->
3072+
allow_empty_content(Rest);
30663073
allow_empty_content(_) ->
30673074
false.
30683075

@@ -3915,6 +3922,8 @@ is_optional(G={group,_},S) ->
39153922
{#schema_group{content=[CM]},_} ->
39163923
is_optional(CM,S)
39173924
end;
3925+
is_optional(optional_text,_) ->
3926+
true;
39183927
is_optional(_,_) ->
39193928
false.
39203929

lib/xmerl/test/xmerl_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export(Config) ->
311311
{ok, B} = file:read_file(TestFile),
312312
ok.
313313

314-
export_cdata(Config) ->
314+
export_cdata(_Config) ->
315315
InData = <<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
316316
<doc>
317317
<a>Test...</a>

lib/xmerl/test/xmerl_xsd_SUITE.erl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ groups() ->
6868
sis2, state2file_file2state, union]},
6969
{ticket_tests, [],
7070
[ticket_6910, ticket_7165, ticket_7190, ticket_7288,
71-
ticket_7736, ticket_8599, ticket_9410]},
71+
ticket_7736, ticket_8599, ticket_9410, ticket_19792]},
7272
{facets, [],
7373
[length, minLength, maxLength, pattern, enumeration,
7474
whiteSpace, maxInclusive, maxExclusive, minExclusive,
@@ -972,6 +972,22 @@ ticket_9410(Config) ->
972972
file:set_cwd(datadir_join(Config,[".."])),
973973
{ok, _S} = xmerl_xsd:process_schema("xmerl_xsd_SUITE_data/small.xsd").
974974

975+
976+
ticket_19792(Config) ->
977+
{ok, S} = xmerl_xsd:process_schema(datadir_join(Config,["ticket_19792.xsd"])),
978+
{E0,_} = xmerl_scan:file(datadir_join(Config,["ticket_19792_0.xml"])),
979+
{{xmlElement,file,file,_,_,_,_,_,_,_,_,_},_GlobalState1} = xmerl_xsd:validate(E0, S),
980+
{E1,_} = xmerl_scan:file(datadir_join(Config,["ticket_19792_1.xml"])),
981+
{{xmlElement,file,file,_,_,_,_,_,_,_,_,_},_GlobalState1} = xmerl_xsd:validate(E1, S),
982+
{E2,_} = xmerl_scan:file(datadir_join(Config,["ticket_19792_2.xml"])),
983+
{{xmlElement,file,file,_,_,_,_,_,_,_,_,_},_GlobalState2} = xmerl_xsd:validate(E2, S),
984+
{E3,_} = xmerl_scan:file(datadir_join(Config,["ticket_19792_3.xml"])),
985+
{{xmlElement,file,file,_,_,_,_,_,_,_,_,_},_GlobalState3} = xmerl_xsd:validate(E3, S),
986+
{E4,_} = xmerl_scan:file(datadir_join(Config,["ticket_19792_4.xml"])),
987+
{{xmlElement,file,file,_,_,_,_,_,_,_,_,_},_GlobalState4} = xmerl_xsd:validate(E4, S),
988+
ok.
989+
990+
975991
%%======================================================================
976992
%% Support Functions
977993
%%======================================================================
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
%%
4+
%% %CopyrightBegin%
5+
%%
6+
%% SPDX-License-Identifier: Apache-2.0
7+
%%
8+
%% Copyright Ericsson AB 2025. All Rights Reserved.
9+
%%
10+
%% Licensed under the Apache License, Version 2.0 (the "License");
11+
%% you may not use this file except in compliance with the License.
12+
%% You may obtain a copy of the License at
13+
%%
14+
%% http://www.apache.org/licenses/LICENSE-2.0
15+
%%
16+
%% Unless required by applicable law or agreed to in writing, software
17+
%% distributed under the License is distributed on an "AS IS" BASIS,
18+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
%% See the License for the specific language governing permissions and
20+
%% limitations under the License.
21+
%%
22+
%% %CopyrightEnd%
23+
-->
24+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
25+
<xs:element name="file">
26+
<xs:complexType>
27+
<xs:sequence>
28+
<xs:element ref="body"/>
29+
</xs:sequence>
30+
</xs:complexType>
31+
</xs:element>
32+
33+
<xs:element name="sequenceNumber" type="xs:unsignedShort"/>
34+
35+
<xs:element name="body">
36+
<xs:complexType>
37+
<xs:sequence>
38+
<xs:element ref="sequenceNumber"/>
39+
<xs:element ref="description"/>
40+
</xs:sequence>
41+
</xs:complexType>
42+
</xs:element>
43+
44+
<xs:element name="description">
45+
<xs:complexType mixed="true">
46+
<xs:sequence>
47+
<xs:any minOccurs="0"/>
48+
</xs:sequence>
49+
</xs:complexType>
50+
</xs:element>
51+
</xs:schema>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
%%
4+
%% %CopyrightBegin%
5+
%%
6+
%% SPDX-License-Identifier: Apache-2.0
7+
%%
8+
%% Copyright Ericsson AB 2025. All Rights Reserved.
9+
%%
10+
%% Licensed under the Apache License, Version 2.0 (the "License");
11+
%% you may not use this file except in compliance with the License.
12+
%% You may obtain a copy of the License at
13+
%%
14+
%% http://www.apache.org/licenses/LICENSE-2.0
15+
%%
16+
%% Unless required by applicable law or agreed to in writing, software
17+
%% distributed under the License is distributed on an "AS IS" BASIS,
18+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
%% See the License for the specific language governing permissions and
20+
%% limitations under the License.
21+
%%
22+
%% %CopyrightEnd%
23+
-->
24+
<file>
25+
<body>
26+
<sequenceNumber>100</sequenceNumber>
27+
<description></description>
28+
</body>
29+
</file>
30+
31+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
%%
4+
%% %CopyrightBegin%
5+
%%
6+
%% SPDX-License-Identifier: Apache-2.0
7+
%%
8+
%% Copyright Ericsson AB 2025. All Rights Reserved.
9+
%%
10+
%% Licensed under the Apache License, Version 2.0 (the "License");
11+
%% you may not use this file except in compliance with the License.
12+
%% You may obtain a copy of the License at
13+
%%
14+
%% http://www.apache.org/licenses/LICENSE-2.0
15+
%%
16+
%% Unless required by applicable law or agreed to in writing, software
17+
%% distributed under the License is distributed on an "AS IS" BASIS,
18+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
%% See the License for the specific language governing permissions and
20+
%% limitations under the License.
21+
%%
22+
%% %CopyrightEnd%
23+
-->
24+
<file>
25+
<body>
26+
<sequenceNumber>100</sequenceNumber>
27+
<description>teststring</description>
28+
</body>
29+
</file>
30+
31+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
%%
4+
%% %CopyrightBegin%
5+
%%
6+
%% SPDX-License-Identifier: Apache-2.0
7+
%%
8+
%% Copyright Ericsson AB 2025. All Rights Reserved.
9+
%%
10+
%% Licensed under the Apache License, Version 2.0 (the "License");
11+
%% you may not use this file except in compliance with the License.
12+
%% You may obtain a copy of the License at
13+
%%
14+
%% http://www.apache.org/licenses/LICENSE-2.0
15+
%%
16+
%% Unless required by applicable law or agreed to in writing, software
17+
%% distributed under the License is distributed on an "AS IS" BASIS,
18+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
%% See the License for the specific language governing permissions and
20+
%% limitations under the License.
21+
%%
22+
%% %CopyrightEnd%
23+
-->
24+
<file>
25+
<body>
26+
<sequenceNumber>100</sequenceNumber>
27+
<description>teststring<sequenceNumber>100</sequenceNumber></description>
28+
</body>
29+
</file>
30+
31+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
%%
4+
%% %CopyrightBegin%
5+
%%
6+
%% SPDX-License-Identifier: Apache-2.0
7+
%%
8+
%% Copyright Ericsson AB 2025. All Rights Reserved.
9+
%%
10+
%% Licensed under the Apache License, Version 2.0 (the "License");
11+
%% you may not use this file except in compliance with the License.
12+
%% You may obtain a copy of the License at
13+
%%
14+
%% http://www.apache.org/licenses/LICENSE-2.0
15+
%%
16+
%% Unless required by applicable law or agreed to in writing, software
17+
%% distributed under the License is distributed on an "AS IS" BASIS,
18+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
%% See the License for the specific language governing permissions and
20+
%% limitations under the License.
21+
%%
22+
%% %CopyrightEnd%
23+
-->
24+
<file>
25+
<body>
26+
<sequenceNumber>100</sequenceNumber>
27+
<description><sequenceNumber>100</sequenceNumber>teststring</description>
28+
</body>
29+
</file>
30+
31+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
%%
4+
%% %CopyrightBegin%
5+
%%
6+
%% SPDX-License-Identifier: Apache-2.0
7+
%%
8+
%% Copyright Ericsson AB 2025. All Rights Reserved.
9+
%%
10+
%% Licensed under the Apache License, Version 2.0 (the "License");
11+
%% you may not use this file except in compliance with the License.
12+
%% You may obtain a copy of the License at
13+
%%
14+
%% http://www.apache.org/licenses/LICENSE-2.0
15+
%%
16+
%% Unless required by applicable law or agreed to in writing, software
17+
%% distributed under the License is distributed on an "AS IS" BASIS,
18+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
%% See the License for the specific language governing permissions and
20+
%% limitations under the License.
21+
%%
22+
%% %CopyrightEnd%
23+
-->
24+
<file>
25+
<body>
26+
<sequenceNumber>100</sequenceNumber>
27+
<description>teststring<sequenceNumber>100</sequenceNumber>teststring</description>
28+
</body>
29+
</file>
30+
31+

0 commit comments

Comments
 (0)