本文整理汇总了C#中XmlTextReader.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextReader.Skip方法的具体用法?C# XmlTextReader.Skip怎么用?C# XmlTextReader.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.Skip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: load3ds
private _3dsLoader load3ds(string path)
{
XmlTextReader doc = new XmlTextReader(Application.StartupPath + "\\" + "Models\\" + "models.xml");
string id = "";
_3dsLoader temp = null;
string name = "";
int[] rot = null;
float[] trans = null;
float[] scl = null;
bool notdone=true;
while (doc.Read() && notdone)
{
switch (doc.NodeType)
{
case XmlNodeType.Element:
switch (doc.Name)
{
case "model":
if(doc.GetAttribute("id")!=path)
doc.Skip();
else
id = doc.GetAttribute("id");
break;
case "name":
name = (string)(doc.GetAttribute("id"));
break;
case "rot":
rot = new int[3];
rot[0] = Int32.Parse(doc.GetAttribute("x"));
rot[1] = Int32.Parse(doc.GetAttribute("y"));
rot[2] = Int32.Parse(doc.GetAttribute("z"));
break;
case "trans":
trans = new float[3];
trans[0] = Single.Parse(doc.GetAttribute("x"));
trans[1] = Single.Parse(doc.GetAttribute("y"));
trans[2] = Single.Parse(doc.GetAttribute("z"));
break;
case "scl":
scl = new float[3];
scl[0] = Single.Parse(doc.GetAttribute("x"));
scl[1] = Single.Parse(doc.GetAttribute("y"));
scl[2] = Single.Parse(doc.GetAttribute("z"));
break;
}
break;
case XmlNodeType.EndElement:
switch (doc.Name)
{
case "model":
temp = new _3dsLoader(id, name, rot, trans, scl);
center=new Point3D(trans[0],trans[1],trans[2]);
temp.Load3DS(Application.StartupPath + "\\" + "Models\\" + temp.ID);
notdone=false;
return temp;
}
break;
}
}
return null;
}
示例2: ParseMath
public void ParseMath(XmlTextReader reader)
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
String elementName = reader.LocalName.ToLower();
Hashtable attributes = new Hashtable();
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
attributes.Add(reader.Name.ToLower(), reader.Value);
}
}
if (elementName == "csymbol")
{
reader.Skip(); // csymbol will have an unimportant text childNode
}
StartMathElement(elementName, attributes);
break;
case XmlNodeType.EndElement:
EndMathElement(reader.Name.ToLower());
break;
case XmlNodeType.Text: // from cn or ci
MathCharacters(reader.Value);
break;
}
}
示例3: GetPatientDetails
//.........这里部分代码省略.........
this.patientBanner.MobilePhoneNumber = reader.ReadString();
reader.Read();
break;
case "EmailAddress":
this.patientBanner.EmailAddress = reader.ReadString();
reader.Read();
break;
case "Address1":
this.patientBanner.Address1 = reader.ReadString();
reader.Read();
break;
case "Address2":
this.patientBanner.Address2 = reader.ReadString();
reader.Read();
break;
case "Address3":
this.patientBanner.Address3 = reader.ReadString();
reader.Read();
break;
case "Town":
this.patientBanner.Town = reader.ReadString();
reader.Read();
break;
case "County":
this.patientBanner.County = reader.ReadString();
reader.Read();
break;
case "PostCode":
this.patientBanner.Postcode = reader.ReadString();
reader.Read();
break;
case "AccessKey":
this.patientBanner.AccessKey = reader.ReadString();
reader.Read();
break;
case "PatientImage":
this.patientBanner.PatientImage = reader.ReadString();
reader.Read();
break;
case "AllergyInformation":
this.patientBanner.AllergyInformation = (NhsCui.Toolkit.AllergyInformation)Enum.Parse(typeof(NhsCui.Toolkit.AllergyInformation), reader.ReadString(), true);
if (this.patientBanner.AllergyInformation != NhsCui.Toolkit.AllergyInformation.Present)
{
this.patientBanner.Allergies.Clear();
}
else
{
this.AddAllergies();
}
reader.Read();
break;
case "PreferredName":
this.patientBanner.PreferredName = reader.ReadString();
reader.Read();
break;
case "PreferredNameLabel":
string preferredNameLabel = reader.ReadString();
if (String.IsNullOrEmpty(preferredNameLabel))
{
this.patientBanner.PreferredNameLabelText = null;
}
else
{
this.patientBanner.PreferredNameLabelText = preferredNameLabel;
}
reader.Read();
break;
case "GenderLabelTooltip":
this.patientBanner.GenderLabelTooltip = reader.ReadString();
reader.Read();
break;
case "GenderValueTooltip":
this.patientBanner.GenderValueTooltip = reader.ReadString();
reader.Read();
break;
case "IdentifierTooltip":
this.patientBanner.IdentifierTooltip = reader.ReadString();
reader.Read();
break;
case "IdentifierLabelTooltip":
this.patientBanner.IdentifierLabelTooltip = reader.ReadString();
reader.Read();
break;
default:
reader.ReadString();
reader.Read();
break;
}
}
}
}
else
{
reader.Skip();
}
}
}
}
示例4: Parse
public void Parse(string filePath)
{
try
{
XmlTextReader reader = new XmlTextReader(filePath);
reader.WhitespaceHandling = WhitespaceHandling.None;
while (reader.Read())
{
if (this.inMathNode == true)
{
ParseMath(reader);
continue;
}
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Prefix != String.Empty)
{
// namespaced element not part of SBML
reader.Skip();
}
String elementName = reader.LocalName.ToLower();
if (elementName == "notes" ||
elementName == "annotation")
{
// not part of the SBML model
//reader.Skip(); // need to skip then move back one node
reader.Read();
}
Hashtable attributes = new Hashtable();
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
if (reader.Name == "xmlns" && elementName != "math"
&& elementName != "sbml")
{
// namespaced node/subtree not part of SBML...unless MathML
reader.MoveToElement();
reader.Skip();
}
if (reader.Name == "specie")
{
// horrible leftover from SBML Level 1
attributes.Add("species", reader.Value);
}
else
{
attributes.Add(reader.Name.ToLower(), reader.Value);
}
}
}
StartElement(elementName, attributes);
break;
case XmlNodeType.EndElement:
EndElement(reader.LocalName.ToLower());
break;
// There are many other types of nodes, but
// we are not interested in them
}
}
}
catch (XmlException e)
{
Console.WriteLine(e.Message);
}
}
示例5: GetPatientNames
/// <summary>
/// To retrieve the patient banner to bind to list box
/// </summary>
/// <returns>Patient element List<string></string></returns>
private IEnumerable<string> GetPatientNames()
{
XmlTextReader reader = new XmlTextReader(this.Page.MapPath("~/Data/XMLPatientData.xml"));
while (reader.Read())
{
// keep reading to find Patient elements
if (reader.Name.Equals("Patient") && (reader.NodeType == XmlNodeType.Element))
{
if (reader.GetAttribute("FamilyName") != null)
{
yield return reader.GetAttribute("FamilyName");
}
else
{
reader.Skip();
}
}
}
}