bool notNull;
string xmlValue;
- public static readonly SqlXml Null;
public SqlXml ()
{
notNull = false;
while (len > 0) {
// Read may return anything from 0 to bufSize.
int n = value.Read(bytes, 0, bufSize);
- sb.Append (Encoding.ASCII.GetString (bytes, 0, n));
+ sb.Append (Encoding.Unicode.GetString (bytes, 0, n));
// The end of the file is reached.
if (n==0)
notNull = false;
xmlValue = null;
} else {
- value.MoveToContent ();
- xmlValue = value.ReadOuterXml();
+ if (value.Read ()) {
+ value.MoveToContent ();
+ xmlValue = value.ReadOuterXml();
+ } else
+ xmlValue = String.Empty;
notNull = true;
}
}
public XmlReader CreateReader ()
{
- if (notNull)
- return XmlTextReader.Create (new StringReader (xmlValue));
- else
- return null;
+ if (notNull) {
+ XmlReaderSettings xs = new XmlReaderSettings ();
+ xs.ConformanceLevel = ConformanceLevel.Fragment;
+ return XmlTextReader.Create (new StringReader (xmlValue), xs);
+ } else
+ throw new SqlNullValueException ();
}
[MonoTODO]