aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/erl_docgen/priv/xsl/db_eix.xsl180
-rw-r--r--lib/erl_docgen/priv/xsl/db_man.xsl104
-rw-r--r--lib/erl_docgen/priv/xsl/db_pdf.xsl21
-rw-r--r--lib/erl_docgen/priv/xsl/db_pdf_params.xsl2
-rw-r--r--lib/xmerl/src/xmerl_scan.erl21
-rw-r--r--lib/xmerl/src/xmerl_xsd.erl6
-rw-r--r--lib/xmerl/test/xmerl_SUITE.erl23
7 files changed, 262 insertions, 95 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl
index 4545322bc2..7a648ddfd7 100644
--- a/lib/erl_docgen/priv/xsl/db_eix.xsl
+++ b/lib/erl_docgen/priv/xsl/db_eix.xsl
@@ -22,10 +22,16 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<xsl:output method="text" encoding="UTF-8" indent="no"/>
+ <xsl:param name="specs_file" select="''"/>
+ <xsl:variable name="i" select="document($specs_file)"></xsl:variable>
+
+
<!-- Book -->
<xsl:template match="/book">
<xsl:text>%% &#10;%% Search data file for </xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/>
@@ -50,9 +56,7 @@
<xsl:template match="erlref">
<xsl:text>{"</xsl:text><xsl:value-of select="module"/><xsl:text>.html", {function, {"</xsl:text><xsl:value-of select="$appname"/>
<xsl:text>", "</xsl:text><xsl:value-of select="module"/><xsl:text>"}},&#10;[&#10;</xsl:text>
- <xsl:apply-templates select="funcs">
- <xsl:with-param name="mod" select="module"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="funcs"/>
<xsl:text>]}.&#10;</xsl:text>
<xsl:text>{"</xsl:text><xsl:value-of select="module"/><xsl:text>.html", {module, "</xsl:text>
<xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="module"/><xsl:text>"]}.&#10;</xsl:text>
@@ -62,9 +66,7 @@
<xsl:template match="cref">
<xsl:text>{"</xsl:text><xsl:value-of select="lib"/><xsl:text>.html", {function, {"</xsl:text><xsl:value-of select="$appname"/>
<xsl:text>", "</xsl:text><xsl:value-of select="lib"/><xsl:text>"}}, [&#10;</xsl:text>
- <xsl:apply-templates select="funcs">
- <xsl:with-param name="mod" select="lib"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="funcs"/>
<xsl:text>]}.&#10;</xsl:text>
<xsl:text>{"</xsl:text><xsl:value-of select="lib"/><xsl:text>.html", {clib, "</xsl:text>
<xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="lib"/><xsl:text>"]}.&#10;</xsl:text>
@@ -91,69 +93,157 @@
<!-- Funcs -->
<xsl:template match="funcs">
- <xsl:param name="mod"/>
<xsl:variable name="lastfuncsblock">
<xsl:value-of select="position() = last()"/>
</xsl:variable>
<xsl:apply-templates select="func/name">
- <xsl:with-param name="mod" select="$mod"/>
<xsl:with-param name="lastfuncsblock" select="$lastfuncsblock"/>
</xsl:apply-templates>
</xsl:template>
+ <xsl:template match="name">
+ <xsl:param name="lastfuncsblock"/>
+ <xsl:choose>
+ <!-- @arity is mandatory when referring to a specification -->
+ <xsl:when test="string-length(@arity) > 0">
+ <xsl:call-template name="spec_name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="err">
+ <xsl:param name="f"/>
+ <xsl:param name="m"/>
+ <xsl:param name="n"/>
+ <xsl:param name="a"/>
+ <xsl:param name="s"/>
+ <xsl:message terminate="yes">
+ Error <xsl:if test="$f != ''">in <xsl:value-of select ="$f"/>:</xsl:if>
+ <xsl:if test="$m != ''"><xsl:value-of select ="$m"/>:</xsl:if>
+ <xsl:value-of select="$n"/>
+ <xsl:if test="$a != ''">/<xsl:value-of
+ select ="$a"/></xsl:if>: <xsl:value-of select="$s"/>
+ </xsl:message>
+ </xsl:template>
+ <xsl:template name="find_spec">
+ <xsl:variable name="curModule" select="ancestor::erlref/module"/>
+ <xsl:variable name="mod" select="@mod"/>
+ <xsl:variable name="name" select="@name"/>
+ <xsl:variable name="arity" select="@arity"/>
+ <xsl:variable name="clause_i" select="@clause_i"/>
+ <xsl:variable name="spec0" select=
+ "$i/specs/module[@name=$curModule]/spec
+ [name=$name and arity=$arity
+ and (string-length($mod) = 0 or module = $mod)]"/>
+ <xsl:variable name="spec" select="$spec0[string-length($clause_i) = 0
+ or position() = $clause_i]"/>
- <xsl:template match="name">
- <xsl:param name="mod"/>
+ <xsl:if test="count($spec) != 1">
+ <xsl:variable name="why">
+ <xsl:choose>
+ <xsl:when test="count($spec) > 1">ambiguous spec</xsl:when>
+ <xsl:when test="count($spec) = 0">unknown spec</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="err">
+ <xsl:with-param name="f" select="$curModule"/>
+ <xsl:with-param name="m" select="$mod"/>
+ <xsl:with-param name="n" select="$name"/>
+ <xsl:with-param name="a" select="$arity"/>
+ <xsl:with-param name="s" select="$why"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:copy-of select="$spec"/>
+ </xsl:template>
+
+
+ <xsl:template name="spec_name">
+ <xsl:param name="lastfuncsblock"/>
+ <xsl:variable name="fname" select="@name"/>
+ <xsl:variable name="arity" select="@arity"/>
+ <xsl:variable name="spec0">
+ <xsl:call-template name="find_spec"/>
+ </xsl:variable>
+ <xsl:variable name="spec" select="exsl:node-set($spec0)/spec"/>
+
+ <xsl:variable name="tmpstring">
+ <xsl:value-of select="substring-before($spec/contract/clause/head, ' ->')"/>
+ </xsl:variable>
+
+ <xsl:text> {"</xsl:text><xsl:value-of select="$fname"/>
+ <xsl:text>", "</xsl:text><xsl:value-of select="$tmpstring"/>
+ <xsl:text>", "</xsl:text><xsl:value-of select="$fname"/>
+ <xsl:text>-</xsl:text><xsl:value-of select="$arity"/><xsl:text>"}</xsl:text>
+
+ <xsl:choose>
+ <xsl:when test="($lastfuncsblock = 'true') and (position() = last())">
+ <xsl:text>&#10;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>,&#10;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+
+ <xsl:template name="name">
<xsl:param name="lastfuncsblock"/>
<xsl:variable name="tmpstring">
<xsl:value-of select="substring-before(substring-after(., '('), '->')"/>
- </xsl:variable>
+ </xsl:variable>
+
<xsl:variable name="ustring">
<xsl:choose>
- <xsl:when test="string-length($tmpstring) > 0">
- <xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="$tmpstring"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="substring-after(., '(')"/>
- </xsl:call-template>
- </xsl:otherwise>
+ <xsl:when test="string-length($tmpstring) > 0">
+ <xsl:call-template name="remove-paren">
+ <xsl:with-param name="string" select="$tmpstring"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="remove-paren">
+ <xsl:with-param name="string" select="substring-after(., '(')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
</xsl:choose>
- </xsl:variable>
+ </xsl:variable>
+
<xsl:variable name="arity">
<xsl:call-template name="calc-arity">
- <xsl:with-param name="string" select="substring-before($ustring, ')')"/>
- <xsl:with-param name="no-of-pars" select="0"/>
+ <xsl:with-param name="string" select="substring-before($ustring, ')')"/>
+ <xsl:with-param name="no-of-pars" select="0"/>
</xsl:call-template>
- </xsl:variable>
+ </xsl:variable>
+
<xsl:variable name="fname">
<xsl:choose>
- <xsl:when test="ancestor::cref">
- <xsl:value-of select="substring-before(nametext, '(')"/>
- </xsl:when>
- <xsl:when test="ancestor::erlref">
- <xsl:variable name="fname1">
- <xsl:value-of select="substring-before(., '(')"/>
- </xsl:variable>
- <xsl:variable name="fname2">
- <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($fname2) > 0">
- <xsl:value-of select="$fname2"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$fname1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
+ <xsl:when test="ancestor::cref">
+ <xsl:value-of select="substring-before(nametext, '(')"/>
+ </xsl:when>
+ <xsl:when test="ancestor::erlref">
+ <xsl:variable name="fname1">
+ <xsl:value-of select="substring-before(., '(')"/>
+ </xsl:variable>
+ <xsl:variable name="fname2">
+ <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($fname2) > 0">
+ <xsl:value-of select="$fname2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fname1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
</xsl:choose>
- </xsl:variable>
+ </xsl:variable>
+
<xsl:text> {"</xsl:text><xsl:value-of select="$fname"/>
<xsl:text>", "</xsl:text><xsl:value-of select="$fname"/>
<xsl:text>(</xsl:text><xsl:value-of select="normalize-space($tmpstring)"/>
diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl
index 8db4714249..c7efced3d2 100644
--- a/lib/erl_docgen/priv/xsl/db_man.xsl
+++ b/lib/erl_docgen/priv/xsl/db_man.xsl
@@ -25,12 +25,12 @@
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
- <xsl:preserve-space elements="code pre"/>
+ <xsl:preserve-space elements="code pre p"/>
<xsl:strip-space elements="*"/>
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<!-- Start of Dialyzer type/spec tags. See also the templates
- matching "name" and "seealso"
+ matching "name", "seealso" and "br"
-->
<!-- Note: specs data for *one* module (as opposed to html and pdf) -->
@@ -137,8 +137,8 @@
(there is no spec with more than one clause) -->
<xsl:if test="count($clause/guard) > 0 or count($type) > 0">
<xsl:text>&#10;.RS</xsl:text>
- <xsl:text>&#10;.TP</xsl:text>
- <xsl:text>&#10;Types</xsl:text>
+ <xsl:text>&#10;.TP 3</xsl:text>
+ <xsl:text>&#10;Types:&#10;</xsl:text>
<xsl:choose>
<xsl:when test="$output_subtypes">
@@ -223,10 +223,13 @@
<xsl:for-each select="$subtype">
<xsl:variable name="tname" select="typename"/>
- <xsl:text>&#10;</xsl:text>
- <xsl:apply-templates select="string"/>
- <xsl:text>&#10;.br</xsl:text>
- <xsl:apply-templates select="$type_desc[@variable = $tname]"/>
+ <xsl:variable name="string" select="string"/>
+ <xsl:if test="string-length($string) > 0">
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates select="$string"/>
+ <xsl:text>&#10;.br</xsl:text>
+ <xsl:apply-templates select="$type_desc[@variable = $tname]"/>
+ </xsl:if>
</xsl:for-each>
</xsl:template>
@@ -319,8 +322,7 @@
</xsl:template>
<xsl:template match="typehead">
- <xsl:text>&#10;.nf&#10;</xsl:text>
- <xsl:text>&#10;.B&#10;</xsl:text>
+ <xsl:text>&#10;.nf&#10;&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;.br</xsl:text>
<xsl:text>&#10;.fi</xsl:text>
@@ -345,6 +347,13 @@
<xsl:text>&#10;.br</xsl:text>
</xsl:template>
+ <!-- The name of data types -->
+ <xsl:template match="marker">
+ <xsl:if test="string-length(.) != 0">
+ <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
<!-- Used both in <datatype> and in <func>! -->
<xsl:template match="anno">
<xsl:variable name="curModule" select="ancestor::erlref/module"/>
@@ -465,13 +474,13 @@
<xsl:text>&#10;.TP 2&#10;</xsl:text>
<xsl:text>*&#10;</xsl:text>
<xsl:apply-templates/>
- <xsl:text>&#10;.LP&#10;</xsl:text>
+ <xsl:text>&#10;.LP</xsl:text>
</xsl:template>
<xsl:template match="taglist">
<xsl:text>&#10;.RS 2</xsl:text>
<xsl:apply-templates select="tag|item"/>
- <xsl:text>&#10;.RE&#10;</xsl:text>
+ <xsl:text>&#10;.RE</xsl:text>
</xsl:template>
<xsl:template match="taglist/tag">
@@ -494,7 +503,7 @@
</xsl:when>
<xsl:otherwise>
<xsl:text>&#10;.RS 2</xsl:text>
- <xsl:text>&#10;.LP&#10;&#10;.LP&#10;</xsl:text>
+ <xsl:text>&#10;.LP&#10;</xsl:text>
<xsl:value-of select="$content"/>
<xsl:text>&#10;.RE</xsl:text>
</xsl:otherwise>
@@ -529,7 +538,16 @@
</xsl:template>
<xsl:template match="br">
- <xsl:text>&#10;.br&#10;</xsl:text>
+ <xsl:choose>
+ <xsl:when test="ancestor::head">
+ <!-- The header of Dialyzer specs.
+ .B makes next line appear in bold face -->
+ <xsl:text>&#10;.B&#10;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>&#10;.br&#10;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="c">
@@ -547,17 +565,17 @@
<!-- Code -->
<xsl:template match="code">
<xsl:text>&#10;.LP&#10;</xsl:text>
- <xsl:text>&#10;.nf&#10;</xsl:text>
+ <xsl:text>.nf&#10;</xsl:text>
<xsl:apply-templates/>
- <xsl:text>&#10;.fi&#10;</xsl:text>
+ <xsl:text>&#10;.fi</xsl:text>
</xsl:template>
<!-- Pre -->
<xsl:template match="pre">
<xsl:text>&#10;.LP&#10;</xsl:text>
- <xsl:text>&#10;.nf&#10;</xsl:text>
+ <xsl:text>.nf&#10;</xsl:text>
<xsl:apply-templates/>
- <xsl:text>&#10;.fi&#10;</xsl:text>
+ <xsl:text>&#10;.fi</xsl:text>
</xsl:template>
@@ -715,8 +733,8 @@
<!-- The case where @name != 0 is taken care of in "type_name" -->
<xsl:if test="string-length(@name) = 0 and string-length(@variable) = 0">
<xsl:text>&#10;.RS</xsl:text>
- <xsl:text>&#10;.TP</xsl:text>
- <xsl:text>&#10;Types</xsl:text>
+ <xsl:text>&#10;.TP 3</xsl:text>
+ <xsl:text>&#10;Types:&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;.RE</xsl:text>
</xsl:if>
@@ -788,7 +806,36 @@
<!-- Replace ' by \&' ans . by \&. -->
<xsl:template match="text()">
<xsl:variable name="startstring">
- <xsl:value-of select="normalize-space()"/><xsl:text> </xsl:text>
+ <xsl:value-of select="normalize-space()"/>
+ </xsl:variable>
+ <!-- 'C' is just any character but whitespace -->
+ <xsl:variable name="tmp" select="normalize-space(concat('C',.,'C'))"/>
+ <xsl:variable name="space_before">
+ <xsl:choose>
+ <!-- '<p>A<marker id="swamp"/> swamp</p>' does not work; instead:
+ '<p>A <marker id="swamp"/>swamp</p>' -->
+ <xsl:when test="starts-with($tmp, 'C ')
+ and not (string(preceding-sibling::*[position()=1]) = ''
+ and parent::p)">
+ <!-- and not (position() = 1 and parent::p)"> -->
+ <xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="space_after">
+ <xsl:choose>
+ <xsl:when test="substring($tmp, string-length($tmp)-1,1) = ' '
+ and $startstring != ''
+ and not (position() = last() and parent::p)">
+ <xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
<xsl:variable name="rep1">
<xsl:call-template name="replace-string">
@@ -804,11 +851,16 @@
<xsl:with-param name="with" select="&quot;\&amp;&apos;&quot;" />
</xsl:call-template>
</xsl:variable>
- <xsl:call-template name="replace-string">
- <xsl:with-param name="text" select="$rep2" />
- <xsl:with-param name="replace" select="&quot;.&quot;" />
- <xsl:with-param name="with" select="&quot;\&amp;.&quot;" />
- </xsl:call-template>
+ <xsl:variable name="reply">
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$rep2" />
+ <xsl:with-param name="replace" select="&quot;.&quot;" />
+ <xsl:with-param name="with" select="&quot;\&amp;.&quot;" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$space_before"/>
+ <xsl:value-of select="$reply"/>
+ <xsl:value-of select="$space_after"/>
</xsl:template>
<!-- Template replace-string is borrowed at http://www.dpawson.co.uk/xsl/sect2/replace.html -->
diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl
index 35f6349f70..48a7a026c1 100644
--- a/lib/erl_docgen/priv/xsl/db_pdf.xsl
+++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl
@@ -732,22 +732,23 @@
<xsl:template name="bookmarks1">
<xsl:param name="entries"/>
<xsl:if test="$entries != ''">
+ <xsl:for-each select="$entries">
- <fo:bookmark internal-destination="{generate-id(/book/parts/part)}"
- starting-state="hide">
- <fo:bookmark-title>User's Guide</fo:bookmark-title>
-
- <xsl:for-each select="$entries">
+ <fo:bookmark internal-destination="{generate-id(header/title)}"
+ starting-state="hide">
+ <fo:bookmark-title><xsl:value-of select="header/title"/></fo:bookmark-title>
+
<xsl:call-template name="bookmarks2">
<xsl:with-param name="entries"
select="chapter[header/title]"/>
</xsl:call-template>
- </xsl:for-each>
-
- </fo:bookmark>
+
+ </fo:bookmark>
+ </xsl:for-each>
</xsl:if>
</xsl:template>
+
<xsl:template name="bookmarks2">
<xsl:param name="entries"/>
<xsl:for-each select="$entries">
@@ -934,9 +935,9 @@
<xsl:template match="part">
<xsl:variable name="partnum"><xsl:number level="any" from="book" count="part|application"/></xsl:variable>
- <fo:block xsl:use-attribute-sets="h1" id="{generate-id()}">
+ <fo:block xsl:use-attribute-sets="h1" id="{generate-id(header/title)}">
<xsl:value-of select="$partnum"/>&#160;&#160;&#160;
- <xsl:text>User's Guide</xsl:text>
+ <xsl:value-of select="header/title"/>
</fo:block>
<xsl:apply-templates select="description">
diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
index 3dfecf8b74..d2f0350cf1 100644
--- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
+++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
@@ -29,7 +29,7 @@
<!-- Fixed strings -->
<xsl:variable name="companyname"><xsl:value-of select="/book/header/copyright/holder"/></xsl:variable>
- <xsl:variable name="copyright">Copyright &#169; <xsl:value-of select="/book/header/copyright/year[1]"/><xsl:text>-</xsl:text><xsl:value-of select="substring-after(substring-after($gendate, ' '), ' ')"/></xsl:variable>
+ <xsl:variable name="copyright">Copyright &#169; <xsl:value-of select="/book/header/copyright/year[1]"/><xsl:text>-</xsl:text><xsl:value-of select="substring-after(normalize-space(substring-after($gendate, ' ')), ' ')"/></xsl:variable>
<!-- FIXME: remove when appendix creation has been fixed -->
<!-- xsl:variable name="appendix_title"-->
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index e598c5f56d..25c6547497 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -2074,10 +2074,10 @@ scan_element(T, S, Pos, Name, StartL, StartC, Attrs, Lang, Parents,
{AttName, NamespaceInfo, T1, S1} = scan_name(T, S),
{T2, S2} = scan_eq(T1, S1),
{AttType,_DefaultDecl} = get_att_type(S2,AttName,Name),
- {AttValue, T3, S3,IsNorm} = scan_att_value(T2, S2, AttType),
+ {AttValue, T3a, S3a,IsNorm} = scan_att_value(T2, S2, AttType),
%% check_default_value(S3,DefaultDecl,AttValue),
NewNS = check_namespace(AttName, NamespaceInfo, AttValue, NS),
- wfc_whitespace_betw_attrs(hd(T3),S3),
+ {T3,S3} = wfc_whitespace_betw_attrs(T3a,S3a),
?strip4,
AttrPos = case Attrs of
[] ->
@@ -3284,12 +3284,17 @@ wfc_legal_char(Ch,S) ->
end.
-wfc_whitespace_betw_attrs(WS,_S) when ?whitespace(WS) ->
- ok;
-wfc_whitespace_betw_attrs($/,_S) ->
- ok;
-wfc_whitespace_betw_attrs($>,_S) ->
- ok;
+wfc_whitespace_betw_attrs([WS |_]=L,S) when ?whitespace(WS) ->
+ {L,S};
+wfc_whitespace_betw_attrs([$/ |_]=L,S) ->
+ {L,S};
+wfc_whitespace_betw_attrs([$> |_]=L,S) ->
+ {L,S};
+wfc_whitespace_betw_attrs([],S=#xmerl_scanner{continuation_fun = F}) ->
+ ?dbg("cont()...~n", []),
+ F(fun(MoreBytes, S1) -> wfc_whitespace_betw_attrs(MoreBytes, S1) end,
+ fun(S1) -> ?fatal(unexpected_end, S1) end,
+ S);
wfc_whitespace_betw_attrs(_,S) ->
?fatal({whitespace_required_between_attributes},S).
diff --git a/lib/xmerl/src/xmerl_xsd.erl b/lib/xmerl/src/xmerl_xsd.erl
index 50c0a79016..dfdc6138ef 100644
--- a/lib/xmerl/src/xmerl_xsd.erl
+++ b/lib/xmerl/src/xmerl_xsd.erl
@@ -355,9 +355,9 @@ initiate_state(Opts,Schema) ->
XSDBase = filename:dirname(Schema),
{{state,S},RestOpts}=new_state(Opts),
S2 = create_tables(S),
- S3 = initiate_state2(S2#xsd_state{schema_name = Schema, xsd_base=XSDBase,
- fetch_fun = fun fetch/2},
- RestOpts).
+ initiate_state2(S2#xsd_state{schema_name = Schema, xsd_base=XSDBase,
+ fetch_fun = fun fetch/2},
+ RestOpts).
initiate_state2(S,[]) ->
S;
diff --git a/lib/xmerl/test/xmerl_SUITE.erl b/lib/xmerl/test/xmerl_SUITE.erl
index 0c809dbcb6..94c38d4d48 100644
--- a/lib/xmerl/test/xmerl_SUITE.erl
+++ b/lib/xmerl/test/xmerl_SUITE.erl
@@ -58,7 +58,7 @@ groups() ->
{ticket_tests, [],
[ticket_5998, ticket_7211, ticket_7214, ticket_7430,
ticket_6873, ticket_7496, ticket_8156, ticket_8697,
- ticket_9411]},
+ ticket_9411, ticket_9457]},
{app_test, [], [{xmerl_app_test, all}]},
{appup_test, [], [{xmerl_appup_test, all}]}].
@@ -588,7 +588,26 @@ ticket_9411(Config) ->
?line {E, _} = xmerl_scan:string(Xml),
?line {E, _} = xmerl_xsd:validate(E, Schema).
-
+ticket_9457(suite) -> [];
+ticket_9457(doc) ->
+ ["Test that xmerl_scan handles continuation correct when current input runs out at the end of an attribute value"];
+ticket_9457(Config) ->
+ Opts = [{continuation_fun, fun ticket_9457_cont/3, start}, {space, normalize}],
+ ?line {E, _} = xmerl_scan:string([], Opts).
+
+ticket_9457_cont(Continue, Exception, GlobalState) ->
+ case xmerl_scan:cont_state(GlobalState) of
+ start ->
+ G1 = xmerl_scan:cont_state(next, GlobalState),
+ Bytes = "<?xml version=\"1.0\" ?>\r\n<item a=\"b\"",
+ Continue(Bytes, G1);
+ next ->
+ G1 = xmerl_scan:cont_state(last, GlobalState),
+ Bytes = ">blah</item>\r\n",
+ Continue(Bytes, G1);
+ _ ->
+ Exception(GlobalState)
+ end.
%%======================================================================
%% Support Functions