本文整理汇总了C#中System.Xml.XmlReader.ReadContentAsString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadContentAsString方法的具体用法?C# XmlReader.ReadContentAsString怎么用?C# XmlReader.ReadContentAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadContentAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Mass
public Mass(Model model, XmlReader xml) : base(model,xml) {//throws Exception {
//super(model, xml);
//foreach(XmlAttribute attribute in xml.Attributes)
//{
//string key = attribute.Name;
if (xml.MoveToAttribute("VX".ToLower()))
{
velocityX = double.Parse(xml.ReadContentAsString());
}
if (xml.MoveToAttribute("VY".ToLower()))
{
velocityY = double.Parse(xml.ReadContentAsString());
}
//}
//Enumeration enum = xml.enumerateAttributeNames();
//while (enum.hasMoreElements()) {
// String key = enum.nextElement().toString();
// if (key.equals("VX")) {
// velocityX = xml.getDoubleAttribute(key);
// }
// if (key.equals("VY")) {
// velocityY = xml.getDoubleAttribute(key);
// }
//}
}
示例2: Load
public void Load (XmlReader x)
{
if(x.MoveToAttribute("ShowParameters"))
ShowFuncParams = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("ShowVariables"))
ShowFuncVariables = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("ShowTypes"))
ShowBaseTypes = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("GrayOutNonPublic"))
GrayOutNonPublic = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("ExpansionBehaviour"))
Enum.TryParse(x.ReadContentAsString(),out ExpansionBehaviour);
}
示例3: loadUserDetail
public static UserDetail loadUserDetail(XmlReader reader)
{
reader.MoveToAttribute("name");
var user = reader.ReadContentAsString();
reader.MoveToAttribute("pass");
var password = reader.ReadContentAsString();
reader.MoveToAttribute("type");
var accountType = (byte) reader.ReadContentAsInt();
reader.MoveToAttribute("known");
var flag = reader.ReadContentAsString().ToLower().Equals("true");
return new UserDetail(user, password, accountType)
{
known = flag
};
}
示例4: ReadXml
public void ReadXml(XmlReader reader)
{
var isEmpty = reader.IsEmptyElement;
if (reader.HasAttributes)
{
for (var i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToNextAttribute();
if (reader.NamespaceURI == "")
{
if (reader.LocalName == "type")
{
Type = reader.Value;
}
else
{
AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), reader.Value);
}
}
}
}
reader.ReadStartElement();
if (!isEmpty)
{
DescriptionText = reader.ReadContentAsString();
}
reader.ReadEndElement();
}
示例5: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "usage":
Usage = reader.ReadContentAsInt();
break;
case "predicate":
PredicateName = reader.Value;
break;
case "namespace":
NamespaceName = reader.Value;
break;
}
}
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
PairName = reader.ReadContentAsString();
reader.Read();
}
示例6: ReadXml
public void ReadXml(XmlReader reader)
{
Boolean isEmpty = reader.IsEmptyElement;
AddAttributeExtensions(reader);
reader.ReadStartElement();
if (!isEmpty)
{
//Read the text content of the element
String rawValue = reader.ReadContentAsString();
if (!String.IsNullOrEmpty(rawValue))
{
//Split the raw string on commas to get the individual items
String[] unSplitItems = rawValue.Split(',');
foreach (var unSplitItem in unSplitItems)
{
//Split the items on the colon to seperate the tag from the weight
String[] splitItem = unSplitItem.Split(':');
TagCollection.Add(splitItem[0].Trim(), Int32.Parse(splitItem[1].Trim()));
}
}
}
reader.ReadEndElement();
}
示例7: ReadXml
public override void ReadXml(XmlReader reader)
{
Keyword.Clear();
var subReader = reader.ReadSubtree();
if (CheckEmptyNode(subReader, "KeywordList", string.Empty, true))
return;
while (!subReader.EOF)
{
subReader.MoveToContent();
if (subReader.LocalName == "Keyword")
{
var att = subReader.GetAttribute("vocabulary");
reader.ReadStartElement("Keyword");
var val = reader.ReadContentAsString();
reader.ReadEndElement();
Keyword.Add(new Keyword { Vocabulary = att, Value = val });
}
else
{
subReader.ReadEndElement();
}
}
reader.Skip();
}
示例8: readString
public static string readString(XmlReader reader, string nodeName)
{
reader.ReadStartElement(nodeName);
string s = reader.ReadContentAsString();
reader.ReadEndElement();
return s;
}
示例9: ClientData
private ClientData(XmlReader reader)
{
reader.ReadStartElement("ClientData");
for (int iter = 0; iter < _NumStoredValues; iter++) {
reader.ReadStartElement(_StoredValueNames[iter]);
if (_StoredValues[iter] is string)
_StoredValues[iter] = reader.ReadContentAsString();
else if (_StoredValues[iter] is DateTime) {
string s = reader.ReadContentAsString();
long l = long.Parse(s, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
_StoredValues[iter] = DateTime.FromFileTimeUtc(l);
} else if (_StoredValues[iter] is bool) {
string s = reader.ReadContentAsString();
_StoredValues[iter] = !(string.IsNullOrEmpty(s) || s != "1");
} else {
_StoredValues[iter] = ReadStringArray(reader);
}
reader.ReadEndElement();
}
reader.ReadEndElement();
}
示例10: ReadXml
public void ReadXml(XmlReader reader)
{
m_name = reader.Name;
while (reader.Read())
{
reader.SkipEmptyNodes();
if (reader.NodeType == XmlNodeType.EndElement)
{
// the end
break;
}
else if (reader.NodeType == XmlNodeType.Element)
{
reader.Read(); // go into ValueNode
reader.SkipEmptyNodes();
}
if (reader.NodeType != XmlNodeType.Text)
{
throw new Exception("Required NodeType: Text - Found: " + reader.NodeType);
}
var value = reader.ReadContentAsString();
Pairs.Add(new KeyValuePair<string, string>(reader.Name, value));
if (reader.NodeType == XmlNodeType.EndElement)
{
// the end
reader.ReadInnerXml();
}
}
}
示例11: while
void IFlickrParsable.Load(XmlReader reader)
{
if (reader.LocalName != "place_type")
UtilityMethods.CheckParsingException(reader);
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "place_type_id":
case "id":
Id = reader.ReadContentAsInt();
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
reader.Read();
Name = reader.ReadContentAsString();
reader.Skip();
}
示例12: while
void IFlickrParsable.Load(XmlReader reader)
{
if (!(reader.LocalName != "tag"))
;
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "id":
this.TagId = reader.Value;
continue;
case "author":
this.AuthorId = reader.Value;
continue;
case "authorname":
this.AuthorName = reader.Value;
continue;
case "raw":
this.Raw = reader.Value;
continue;
case "machine_tag":
this.IsMachineTag = reader.Value == "1";
continue;
default:
continue;
}
}
reader.Read();
this.TagText = reader.ReadContentAsString();
reader.Skip();
}
示例13: ReadXml
public virtual void ReadXml(XmlReader reader)
{
reader.MoveToContent();
if (reader.HasAttributes)
while (reader.MoveToNextAttribute())
AttributeWasRead(reader.Name, reader.Value);
AllAttributesRead();
var isEmpty = reader.IsEmptyElement;
if (!isEmpty)
{
while (reader.Read())
{
var nodeType = reader.NodeType;
switch (nodeType)
{
case XmlNodeType.Text:
var content = reader.ReadContentAsString();
ContentWasRead(string.Empty, content);
break;
case XmlNodeType.Element:
var name = reader.Name;
ProcessElement(name, reader);
break;
}
}
}
}
示例14: ReadMedia
private static IEnumerable<string> ReadMedia(XmlReader media)
{
while (media.ReadToFollowing("local"))
{
media.MoveToFirstAttribute();
yield return media.ReadContentAsString();
}
}
示例15: ReadKeyNameClause
private static KeyNameIdentifierClause ReadKeyNameClause(XmlReader reader)
{
reader.ReadStartElement("KeyName", SignedXml.XmlDsigNamespaceUrl);
var keyIdentifier = new KeyNameIdentifierClause(reader.ReadContentAsString());
reader.ReadEndElement();
return keyIdentifier;
}