+2003-10-25 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * DTDValidatingReader.cs : Now it handles whitespace entity as
+ significant.
+ * XmlConvert.cs : As to NIST testcases, exponential support on single
+ and double floating point numbers.
+ * XmlValidatingReader.cs : If it IsDefault, then line number and line
+ position returns 0.
+
2003-10-25 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* DTDReader.cs,
bool isSignificantWhitespace;
bool isWhitespace;
bool isText;
+ bool nextMaybeSignificantWhitespace;
// This field is used to get properties and to raise events.
XmlValidatingReader validatingReader;
isWhitespace = false;
isSignificantWhitespace = false;
isText = false;
+ nextMaybeSignificantWhitespace = false;
bool b = ReadContent () || currentTextValue != null;
if (!b && this.missingIDReferences.Count > 0) {
private bool ReadContent ()
{
if (nextEntityReader != null) {
+ nextMaybeSignificantWhitespace = true;
if (DTD == null || DTD.EntityDecls [reader.Name] == null)
throw new XmlException ("Entity '" + reader.Name + "' was not declared.");
entityReaderStack.Push (reader);
return false;
}
+ bool dontResetTextType = false;
+
switch (reader.NodeType) {
case XmlNodeType.XmlDeclaration:
if (GetAttribute ("standalone") == "yes")
case XmlNodeType.SignificantWhitespace:
if (!isText)
isSignificantWhitespace = true;
+ dontResetTextType = true;
goto case XmlNodeType.Text;
case XmlNodeType.Text:
isText = true;
- isWhitespace = isSignificantWhitespace = false;
+ if (!dontResetTextType) {
+ isWhitespace = isSignificantWhitespace = false;
+ }
// If no schema specification, then skip validation.
if (currentAutomata == null)
break;
if (elem != null && !elem.IsMixedContent && !elem.IsAny) {
HandleError (String.Format ("Current element {0} does not allow character data content.", elementStack.Peek () as string),
XmlSeverityType.Error);
- // FIXME: validation recovery code here.
currentAutomata = previousAutomata;
}
if (validatingReader.EntityHandling == EntityHandling.ExpandEntities) {
}
break;
case XmlNodeType.Whitespace:
+ if (nextMaybeSignificantWhitespace) {
+ currentTextValue = reader.Value;
+ nextMaybeSignificantWhitespace = false;
+ goto case XmlNodeType.SignificantWhitespace;
+ }
if (!isText && !isSignificantWhitespace)
isWhitespace = true;
if (validatingReader.EntityHandling == EntityHandling.ExpandEntities) {
// Dwivedi, Ajay kumar (Adwiv@Yahoo.com)
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
// Alan Tam Siu Lung (Tam@SiuLung.com)
-// Atsushi Enomoto (ginga@kit.h-ho.ne.jp)
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
static string encodedColon;
static string [] datetimeFormats;
+ static NumberStyles floatStyle;
static XmlConvert ()
{
+ floatStyle = NumberStyles.AllowCurrencySymbol |
+ NumberStyles.AllowExponent |
+ NumberStyles.AllowDecimalPoint;
encodedColon = "_x003A_";
datetimeFormats = new string[] {
// dateTime
public static Decimal ToDecimal(string s)
{
- return Decimal.Parse(s, NumberFormatInfo.InvariantInfo);
+ return Decimal.Parse(s, CultureInfo.InvariantCulture);
}
-
+
public static double ToDouble(string s)
{
if (s == "INF") return System.Double.PositiveInfinity;
if (s == "-INF") return System.Double.NegativeInfinity;
if (s == "NaN") return System.Double.NaN;
- return Double.Parse(s, CultureInfo.InvariantCulture);
+ return Double.Parse (s, floatStyle);
}
public static Guid ToGuid(string s)
if (s == "INF") return System.Single.PositiveInfinity;
if (s == "-INF") return System.Single.NegativeInfinity;
if (s == "NaN") return System.Single.NaN;
- return Single.Parse(s, CultureInfo.InvariantCulture);
+ return Single.Parse(s, floatStyle);
}
public static string ToString(Guid value)
{
- return value.ToString("D",CultureInfo.InvariantCulture);
+ return value.ToString("D", CultureInfo.InvariantCulture);
}
public static string ToString(int value)
public static string ToString(Decimal value)
{
- return value.ToString(CultureInfo.InvariantCulture);
+ return value.ToString (CultureInfo.InvariantCulture);
}
[CLSCompliant (false)]
int IXmlLineInfo.LineNumber {
get {
+ if (IsDefault)
+ return 0;
IXmlLineInfo info = validatingReader as IXmlLineInfo;
return info != null ? info.LineNumber : 0;
}
int IXmlLineInfo.LinePosition {
get {
+ if (IsDefault)
+ return 0;
IXmlLineInfo info = validatingReader as IXmlLineInfo;
return info != null ? info.LinePosition : 0;
}