本文整理汇总了C#中XmlTextReader.ReadOuterXml方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextReader.ReadOuterXml方法的具体用法?C# XmlTextReader.ReadOuterXml怎么用?C# XmlTextReader.ReadOuterXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadOuterXml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
AWSAuthConnection conn = new AWSAuthConnection(accessKey, secretKey);
XmlTextReader r = new XmlTextReader(Request.InputStream);
r.MoveToContent();
string xml = r.ReadOuterXml();
XmlDocument documentToSave = new XmlDocument();
documentToSave.LoadXml(xml);
SortedList metadata = new SortedList();
metadata.Add("title", bucket);
metadata.Add("Content-Type", "application/xml");
S3Object titledObject =
new S3Object(documentToSave.OuterXml, metadata);
SortedList headers = new SortedList();
headers.Add("Content-Type", "application/xml");
headers.Add("x-amz-acl", "public-read");
conn.put(bucket, documentKey, titledObject, headers);
Response.Write("saved: " + documentToSave.OuterXml);
}
示例2: LoadNode
private Node LoadNode(string sXML)
{
Node ReturnedNode = null;
if (sXML.Length == 0) return ReturnedNode;
ReturnedNode = new Node();
ReturnedNode.TreeView = oTV;
XmlTextReader tr = new XmlTextReader(sXML, System.Xml.XmlNodeType.Element , null);
while (tr.Read())
if (tr.IsStartElement()) break;
//nastavi atributy nodu
for (int i = 0; i < tr.AttributeCount; i++)
{
tr.MoveToAttribute(i);
SetProperty(ReturnedNode, tr.Name, tr.Value);
}
bool NextElement = true;
while (NextElement)
{
while (tr.Read())
if (tr.IsStartElement()) break;
string ElementName = tr.LocalName;
if (ElementName.Length == 0) break;
switch (ElementName.ToUpper())
{
case "TEXT" :
string s = this.LoadMultiLineText(tr.ReadString());
SetProperty(ReturnedNode, "Text", s);
break;
case "FLAG" :
for (int i = 0; i < tr.AttributeCount; i++)
{
tr.MoveToAttribute(i);
SetProperty(ReturnedNode.Flag, tr.Name, tr.Value);
}
break;
case "NODESTYLE" :
this.LoadObject(ReturnedNode, tr.ReadOuterXml(), ReturnedNode.NodeStyle);
break;
case "NODE" :
Node n = LoadNode(tr.ReadOuterXml());
if (n != null)
{
ReturnedNode.Nodes.Add(n);
//n.Parent = ReturnedNode;
//n.TreeView = ReturnedNode.TreeView;
}
break;
}
}
return ReturnedNode;
}
示例3: LoadNodes
private void LoadNodes(object objParent, string sXML)
{
if (sXML.Length == 0) return;
XmlTextReader tr = new XmlTextReader(sXML, System.Xml.XmlNodeType.Element , null);
while (tr.ReadState != ReadState.EndOfFile)
{
while (tr.Read())
if (tr.IsStartElement()) break;
string ElementName = tr.LocalName;
if (ElementName.Length == 0) break;
switch (ElementName.ToUpper())
{
case "BEHAVIOR" :
for (int i = 0; i < tr.AttributeCount; i++)
{
tr.MoveToAttribute(i);
SetProperty(oTV, tr.Name, tr.Value);
}
break;
case "NODE" :
while (tr.ReadState != ReadState.EndOfFile)
{
if (tr.LocalName.ToUpper() == "NODE")
{
Node n = null;
string s = tr.ReadOuterXml();
if (s.Length > 0)
{
n = LoadNode(s);
if (n != null) oTV.Nodes.Add(n);
}
}
else tr.Read();
}
break;
}
}
}
示例4: LevelDataXML
public void LevelDataXML(string pathToXml)
{
parseFile = Resources.Load(pathToXml) as TextAsset;
platforms = new List<PlatformData>();
metadata = new List<MetaData>();
portalSpawns = new List<Portal>();
hazardSpawns = new List<Hazard>();
playerSpawns = new List<Vector2>();
enemySpawns = new List<Vector2>();
items = new List<Vector2>();
XmlTextReader mapReader = new XmlTextReader(new StringReader(parseFile.text));
mapReader.Read();
XmlDocument doc = new XmlDocument();
doc.LoadXml(mapReader.ReadOuterXml());
mapSize = new Vector2((float)int.Parse(doc.ChildNodes[0].Attributes[0].Value)/16, (float)int.Parse(doc.ChildNodes[0].Attributes[1].Value)/16);
for (int x = 0; x < doc.ChildNodes[0].ChildNodes.Count; x++)
{
if (doc.ChildNodes[0].ChildNodes[x].Name.ToLower().Equals("frontlayer")) {
LoadTiles(doc.ChildNodes[0].ChildNodes[x], platforms);
}
if (doc.ChildNodes[0].ChildNodes[x].Name.ToLower().Equals("entities"))
{
LoadSpawnPoints(doc.ChildNodes[0].ChildNodes[x]);
}
}
}