本文整理汇总了C#中XmlReader.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadString方法的具体用法?C# XmlReader.ReadString怎么用?C# XmlReader.ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getFunctionDocAndExample
protected string getFunctionDocAndExample(XmlReader reader)
{
//assumes doc is before example. Otherwise, could miss an example.
string strRes = "";
bool bFound = reader.ReadToDescendant("doc");
if (bFound) strRes += (unencodeXml(reader.ReadString()));
bFound = reader.ReadToNextSibling("example");
if (bFound) strRes += ("\r\n\r\nExample:\r\n" + unencodeXml(reader.ReadString()));
reader.Close();
return strRes;
}
示例2: ReadXml
public void ReadXml(XmlReader reader)
{
if (reader.LocalName != "icon" && !reader.ReadToDescendant("icon"))
throw new InvalidDataException();
XmlHelper.ParseXml(reader, new XmlParseSet
{
{"url", () => this.RelativeUrl = reader.ReadString()},
{"mimetype", () => this.MimeType = reader.ReadString()},
{"width", () => this.Width = reader.ReadElementContentAsInt()},
{"height", () => this.Height = reader.ReadElementContentAsInt()},
{"depth", () => this.Depth = reader.ReadElementContentAsInt()}
});
}
示例3: Deserialize
/// <summary>
/// Obtains the type and value of a parameter from an XML Error file.
/// </summary>
/// <param name="reader">XML Error file.</param>
/// <param name="parameter">Parameter to obtain.</param>
/// <returns>Parameter.</returns>
public static Parameter Deserialize(XmlReader reader, Parameter parameter)
{
if (reader.IsStartElement(DTD.Error.ErrorParams.TagErrorParam))
{
if (parameter == null)
{
parameter = new Parameter();
}
// Read Attributes of Node.
parameter.Key = reader.GetAttribute(DTD.Error.ErrorParams.TagKey);
switch (reader.GetAttribute(DTD.Error.ErrorParams.TagType))
{
case ResponseException.ErrorKey:
parameter.Type = ErrorParamType.Key;
break;
case ResponseException.ErrorLiteral:
parameter.Type = ErrorParamType.Literal;
break;
}
if (!reader.IsEmptyElement)
{
parameter.Text = reader.ReadString();
}
else
{
reader.Skip();
}
}
return parameter;
}
示例4: ReadXml
public override void ReadXml(XmlReader reader)
{
var isEmptyElement = reader.IsEmptyElement;
var packagePathHash = new FoxHash("packagePathHash");
packagePathHash.ReadXml(reader);
var archivePathHash = new FoxHash("archivePathHash");
archivePathHash.ReadXml(reader);
var nameInArchiveHash = new FoxHash("nameInArchiveHash");
nameInArchiveHash.ReadXml(reader);
var packagePath = reader.GetAttribute("packagePath");
var archivePath = reader.GetAttribute("archivePath");
var nameInArchive = reader.GetAttribute("nameInArchive");
PackagePathLiteral = new FoxStringLiteral(packagePath, packagePathHash);
ArchivePathLiteral = new FoxStringLiteral(archivePath, archivePathHash);
NameInArchiveLiteral = new FoxStringLiteral(nameInArchive, nameInArchiveHash);
reader.ReadStartElement("value");
if (isEmptyElement == false)
{
string value = reader.ReadString();
EntityHandle = value.StartsWith("0x")
? ulong.Parse(value.Substring(2, value.Length - 2), NumberStyles.AllowHexSpecifier)
: ulong.Parse(value);
reader.ReadEndElement();
}
}
示例5: ReadValidCertificates
Dictionary<string, List<CallerInfo>> ReadValidCertificates(XmlReader parser) {
var validCertificates = new Dictionary<string, List<CallerInfo>>();
try {
while (parser.Read()) {
if (parser.IsStartElement() && parser.Name == "signing_certificate") {
var name = parser[0];
var packageName = parser[2];
var isRelease = Convert.ToBoolean(parser[1]);
var certificate = parser.ReadString();
if (certificate != null)
certificate = certificate.Replace("\\s|\\n", "");
var info = new CallerInfo(name, packageName, isRelease, certificate);
List<CallerInfo> infos;
validCertificates.TryGetValue(certificate, out infos);
if (infos == null) {
infos = new List<CallerInfo>();
validCertificates.Add(certificate, infos);
}
LogHelper.Verbose(Tag, "Adding allowed caller: ", info.Name,
" package=", info.PackageName, " release=", info.Release,
" certificate=", certificate);
infos.Add(info);
}
}
} catch (XmlException e) {
LogHelper.Error(Tag, e, "Could not read allowed callers from XML.");
} catch (IOException e) {
LogHelper.Error(Tag, e, "Could not read allowed callers from XML.");
}
return validCertificates;
}
示例6: LoadLanguageSpecificSettings
protected override void LoadLanguageSpecificSettings(XmlReader xr)
{
while(xr.Read())
switch (xr.LocalName)
{
case "type":
try
{
OutputType = (OutputTypes)Convert.ToInt32(xr.ReadString());
}
catch { }
break;
case "isrelease":
IsRelease = xr.ReadString()=="true";
break;
case "dversion":
DMDVersion = (DVersion)Convert.ToInt32(xr.ReadString());
break;
case "libs":
var xr2 = xr.ReadSubtree();
while (xr2.Read())
{
if (xr2.LocalName == "lib")
LinkedLibraries.Add(xr2.ReadString());
}
break;
default: break;
}
}
示例7: Deserialize
//public static Oids.Oid Deserialize(XmlReader reader, Oids.Oid oid)
/// <summary>
/// Deserializes Oid from an XML stream.
/// </summary>
/// <param name="reader">XML stream.</param>
/// <returns>Oid.</returns>
public static Oids.Oid Deserialize(XmlReader reader)
{
Oids.Oid lResult = null;
if (reader.IsStartElement(DTD.TagOID))
{
string lClassName = reader.GetAttribute(DTD.OID.TagClass);
List<KeyValuePair<ModelType,object>> lFields = new List<KeyValuePair<ModelType,object>>();
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
do
{
#region Process tag <OID.Field>.
if (reader.IsStartElement(DTD.OID.TagOIDField))
{
if (!reader.IsEmptyElement)
{
ModelType lType = Convert.StringTypeToMODELType(reader.GetAttribute(DTD.OID.TagType));
lFields.Add(new KeyValuePair<ModelType, object>(lType, Convert.XmlToType(lType, reader.ReadString())));
}
else
{
throw new ArgumentException("Xml Reader have one OID.Field with empty Element.", "XmlReader reader");
}
}
#endregion Process tag <OID.Field>.
else
{
#region Process tag <?>
reader.Skip();
if (reader.NodeType == XmlNodeType.None)
{
break;
}
else
{
continue;
}
#endregion Process tag <?>
}
} while (reader.Read());
}
else
{
reader.Skip();
}
if(lClassName.Length > 0)
{
lResult = ServerConnection.CreateOid(lClassName,lFields);
}
}
else
{
throw new ArgumentException("Xml Reader don't have the OID in Start Element.", "XmlReader reader");
}
return lResult;
}
示例8: ReadXml
public void ReadXml(XmlReader reader)
{
if (reader.IsEmptyElement) {
reader.Read();
return;
}
reader.ReadStartElement("File");
FilePath = reader.ReadString();
reader.ReadEndElement();
}
示例9: ReadXml
public void ReadXml(XmlReader reader)
{
var isEmptyElement = reader.IsEmptyElement;
reader.ReadStartElement("value");
if (isEmptyElement == false)
{
Value = double.Parse(reader.ReadString(), CultureInfo.InvariantCulture);
reader.ReadEndElement();
}
}
示例10: ReadXml
public void ReadXml(XmlReader reader)
{
var isEmptyElement = reader.IsEmptyElement;
reader.ReadStartElement("value");
if (isEmptyElement == false)
{
Value = bool.Parse(reader.ReadString());
reader.ReadEndElement();
}
}
示例11: ReadXml
public void ReadXml(XmlReader reader)
{
var isEmptyElement = reader.IsEmptyElement;
reader.ReadStartElement("value");
if (isEmptyElement == false)
{
Value = ExtensionMethods.ParseFloatRoundtrip(reader.ReadString());
reader.ReadEndElement();
}
}
示例12: ReadContent
public static string ReadContent(XmlReader xr)
{
string rlt;
if (xr.NodeType != XmlNodeType.Element)
{
xr.MoveToElement();
}
rlt = xr.ReadString();
xr.MoveToElement();
return rlt;
}
示例13: XmlDocument
void IXmlSerializable.ReadXml (XmlReader reader)
{
XmlDocument doc = new XmlDocument ();
string str = reader.ReadString ();
try {
doc.LoadXml (str);
} catch {
doc.LoadXml (reader.ReadOuterXml ());
}
mFuncXmlNode = (XmlNode) (doc.DocumentElement);
}
示例14: ProcessChildNode
private static bool ProcessChildNode(XmlReader xmlTextReader, LogEntry entry)
{
switch (xmlTextReader.Name)
{
case "log4j:event":
return true;
case ("log4j:message"):
entry.Message = xmlTextReader.ReadString();
break;
case ("log4j:data"):
ProcessDataTag(xmlTextReader, entry);
break;
case ("log4j:throwable"):
entry.Throwable = xmlTextReader.ReadString();
break;
case ("log4j:locationInfo"):
SetLocationInfo(entry, xmlTextReader);
break;
}
return false;
}
示例15: Load
public void Load(XmlReader reader)
{
while (reader.Read()) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "ActionType": {
ActionType = reader.ReadString().ToEnum<Logic.Display.CharSprite.ActionType>();
break;
}
}
}
}
}