<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I don't understand. What is the bug?</div><div><br></div><div>That xmerl crashes on malformed input sounds like a feature to me, not a bug.<br><br>-- <div>Anthony Ramine</div></div><div><br>Le 31 oct. 2013 à 05:01, Constantin Malikov <<a href="mailto:kostiamalikov@gmail.com">kostiamalikov@gmail.com</a>> a écrit :<br><br></div><blockquote type="cite"><div><div dir="ltr">


        
        
        
        


<p style="margin-bottom:0cm" lang="en">Hello , friends. I want to
tell you about a bug in Erlang:<br><br>
</p>
<p style="margin-bottom:0cm" lang="en">       I have a trouble with
validating xml document by xsd schema in case of</p>
<p style="margin-bottom:0cm" lang="en">one of the attribute have
incorrect record in the xml document. I attached simple sample, where
you can see this problem. To run it, compile xml_attribute_test.erl
and invoke “invalid_xml_test” method.</p>
<p style="margin-bottom:0cm" lang="en">       You can see the error
message:<br>_________________________________________________________________<br>**
exception error: no function clause matching 
</p>
<p style="margin-bottom:0cm" lang="en">                   
xmerl_scan:scan_att_value("a>\n    <rule>\n       
<result>\n            <continue
context=\"ctx_megaco_local_in\"/>\n            <!--
continue context=\"ctx_megaco_local_in\"/ -->\n       
</result>\n    </rule>\n</context>\n", 
</p>
<p style="margin-bottom:0cm" lang="en">                             
               
{xmerl_scanner,undefined,no,prolog,[],undefined,internal, 
</p>
<p style="margin-bottom:0cm" lang="en">                             
                               true,false,false,49173,false,false, 
</p>
<p style="margin-bottom:0cm" lang="en">                             
                              
"/home/konstantin/erlang/tasks/diffR15B02/xml_invalid_attribute_test",
</p>
<p style="margin-bottom:0cm" lang="en">                             
                              
undefined,[],file_name_unknown,off,[],preserve, 
</p>
<p style="margin-bottom:0cm" lang="en">                             
                              
#Fun<xmerl_scan.0.5757651>,#Fun<xmerl_scan.1.5757651>, 
</p>
<p style="margin-bottom:0cm" lang="en">                             
                              
#Fun<xmerl_scan.2.5757651>,#Fun<xmerl_scan.3.5757651>, 
</p>
<p style="margin-bottom:0cm" lang="en">                             
                              
#Fun<xmerl_scan.4.5757651>,#Fun<xmerl_scan.5.5757651>, 
</p>
<p style="margin-bottom:0cm" lang="en">                             
                               #Fun<xmerl_scan.6.5757651>,...},
</p>
<p style="margin-bottom:0cm" lang="en">                             
                'CDATA') (xmerl_scan.erl, line 2343) 
</p>
<p style="margin-bottom:0cm" lang="en">     in function 
xmerl_scan:scan_element/12 (xmerl_scan.erl, line 2147) 
</p>
<p style="margin-bottom:0cm" lang="en">     in call from
xmerl_scan:scan_document/2 (xmerl_scan.erl, line 571) 
</p>
<p style="margin-bottom:0cm" lang="en">     in call from
xmerl_scan:string/2 (xmerl_scan.erl, line 287) 
</p>
<p style="margin-bottom:0cm" lang="en">     in call from
xml_attribute_test:read_xml/1 (xml_attribute_test.erl, line 13) 
</p>
<p style="margin-bottom:0cm" lang="en">     in call from
xml_attribute_test:invalid_xml_test/0 (xml_attribute_test.erl, line
17)
<br>________________________________________________________________<br><br>
</p>
<p style="margin-bottom:0cm"><span lang="en">How can i see, in  the
xmerl_</span><span lang="en">scan.erl module, </span><span lang="en">scan_att_value
metod</span><span lang="en">. </span><span lang="en">No function for
processing incorrect attribute record.</span></p>
<p style="margin-bottom:0cm" lang="en"><br>
</p>
<p style="margin-bottom:0cm"><span lang="en">Tested by Erlang 1</span><span lang="en">6</span><span lang="en">B02,
xmerl </span><span lang="en">1.3.4 </span><span lang="en">and R15B02,
xmerl
1.3.2.</span><span lang="en"><br><br>_______________________ctx_megaco.xml____________________________<br><?
xml version = "1.0"?><br><context
digit=a><br>    <rule><br>        <result><br>            <continue
context="ctx_megaco_local_in"/><br>            <!
- Continue context = "ctx_megaco_local_in" / -><br>        </
result><br>    </ rule><br></
context><br>________________________________________________________________<br><br>_________________________ecss_routing.xsd__________________________<br><?
xml version = "1.0" encoding = "UTF- 8" ?
><br><xs:schema
xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"><br>  <br>  <xs:element
name="context"><br>    <xs:complexType><br>      <xs:sequence><br>        <xs:element
name="rule"><br>          <xs:complexType><br>            <xs:sequence><br>              <xs:element
name="result"><br>                <xs:complexType><br>                  <xs:choice><br>                    <xs:element
name="incomplete" type="xs:string"/><br>                    <!
- xs: element name = "no_route" type = "nullType"
/ -><br>                    <xs:element
name="continue" type="continueType"/><br>                  </
xs: choice><br>                </
xs: complexType><br>              </
xs: element><br>            </
xs: sequence><br>          </
xs: complexType><br>        </
xs: element><br>      </ xs:
sequence><br>    </ xs: complexType><br>  </
xs: element><br> <br>  <xs:complexType
name="continueType"><br>    <xs:attribute
name="context" type="xs:string"/><br>  </
xs: complexType><br></ xs:
schema><br>________________________________________________________________<br><br>_______________________xml_attribute_test.erl__________________________<br><br>-module
(xml_attribute_test).<br><br>-export ([<br>         invalid_xml_test
/ 0<br>        ]).<br><br>read_xml
(FileName) -><br>    {ok, Schema} = xmerl_xsd:
process_schema ("ecss_routing.xsd"),<br>    {ok,
BXml} = file: read_file (FileName),<br>    Xml =
erlang: binary_to_list (BXml),<br>    {XmerXml,
_} = xmerl_scan: string (Xml),<br>    xmerl_xsd:
validate (XmerXml, Schema).<br><br>invalid_xml_test () -><br>    Result
= read_xml ("ctx_megaco.xml"),<br>    io:
format ("~ p ~ n",
[Result]).<br>________________________________________________________________<br><br></span><span lang="en">I
can offer the option of a patch that fixes this problem. The person
who is responsible for supporting ssh has the discretion to take it
as it is, or can make own fix.</span></p>
<p style="margin-bottom:0cm" lang="en">________________________________________________________________</p>
<p style="margin-bottom:0cm" lang="en">---
xmerl-1.3.2/src/xmerl_scan.erl  2013-10-26 14:25:25.000000000 
</p>
<p style="margin-bottom:0cm" lang="en">+++
xmerl-1.3.2.1/src/xmerl_scan.erl        2013-10-26 13:03:42.000000000 
</p>
<p style="margin-bottom:0cm" lang="en">@@ -2373,13 +2373,16 @@ 
</p>
<p style="margin-bottom:0cm" lang="en"> scan_att_value([H|T],
S0,'CDATA'=AT) when H == $"; H == $' -> 
</p>
<p style="margin-bottom:0cm" lang="en">     ?bump_col(1), 
</p>
<p style="margin-bottom:0cm" lang="en">     scan_att_chars(T, S, H,
[],[], AT,false); 
</p>
<p style="margin-bottom:0cm" lang="en"> scan_att_value([H|T],
S0,AttType) when H == $"; H == $' -> 
</p>
<p style="margin-bottom:0cm" lang="en">     ?bump_col(1), 
</p>
<p style="margin-bottom:0cm" lang="en">     {T1,S1,IsNorm} =
normalize(T,S,false), 
</p>
<p style="margin-bottom:0cm" lang="en">-    scan_att_chars(T1, S1,
H, [],[], AttType,IsNorm). 
</p>
<p style="margin-bottom:0cm" lang="en">+    scan_att_chars(T1, S1,
H, [],[], AttType,IsNorm); 
</p>
<p style="margin-bottom:0cm" lang="en">+%% EltexPatch: prevent
function_clause exception 
</p>
<p style="margin-bottom:0cm" lang="en">+scan_att_value([H|_], S0,
_AttType) -> 
</p>
<p style="margin-bottom:0cm" lang="en">+    ?fatal({unexpected_char,
H}, S0). 
</p>
<p style="margin-bottom:0cm" lang="en"> 
</p>
<p style="margin-bottom:0cm" lang="en">
scan_att_chars([],S=#xmerl_scanner{continuation_fun=F},H,Acc,TmpAcc,AT,IsNorm)->
</p>
<p style="margin-bottom:0cm" lang="en">     ?dbg("cont()...~n",
[]), 
</p>
<p style="margin-bottom:0cm" lang="en">     F(fun(MoreBytes, S1) ->
</p>
<p style="margin-bottom:0cm" lang="en">            
scan_att_chars(MoreBytes, S1, H, Acc,TmpAcc,AT,IsNorm) 
</p>
<p style="margin-bottom:0cm" lang="en">       end,</p>
<p style="margin-bottom:0cm" lang="en">________________________________________________________________</p>
<p style="margin-bottom:0cm" lang="en"><br>
</p>
<p style="margin-bottom:0cm"><span lang="en">With best regards</span><span lang="en">,</span></p>
<p style="margin-bottom:0cm" lang="en">Malikov Constantin, software
developer, Eltex.</p>

</div>
</div></blockquote><blockquote type="cite"><div><xml_invalid_attribute.tar.gz></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>erlang-bugs mailing list</span><br><span><a href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a></span><br><span><a href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a></span><br></div></blockquote></body></html>