本文整理匯總了C#中System.Xml.XmlTextReader.ReadOuterXml方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTextReader.ReadOuterXml方法的具體用法?C# XmlTextReader.ReadOuterXml怎麽用?C# XmlTextReader.ReadOuterXml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadOuterXml方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Arcs
/// <summary>
/// Constructs the Arcs using Xml
/// </summary>
/// <param name="vsXml">Xml data</param>
public Arcs(string vsXml)
{
XmlTextReader reader = new XmlTextReader(new StringReader(vsXml));
reader.Read();
ArcType = (EnumArcType)Enum.Parse(typeof(EnumArcType), reader.GetAttribute("arctype"));
moArcList = new List<Arc>();
while (reader.Read())
{
switch (reader.Name)
{
case "Arcs" :
if (reader.NodeType != XmlNodeType.EndElement)
{
if (moInnerArcs == null)
{
moInnerArcs = new List<Arcs>();
}
moInnerArcs.Add(new Arcs(reader.ReadOuterXml()));
}
break;
case "Arc" :
moArcList.Add(new Arc(reader.ReadOuterXml()));
break;
}
}
}
示例2: Listen
private void Listen(object sender, DoWorkEventArgs e)
{
string url = @"http://" + _ipAddr.ToString() + "/PSIA/Metadata/stream?AreaControlEvents=true";
credentialCache.Add(new System.Uri(url), "Basic", _credentials);
_req = WebRequest.Create(url);
_req.Credentials = credentialCache;
_req.PreAuthenticate = true;
HttpWebResponse response = (HttpWebResponse)_req.GetResponse();
Stream responseStream = response.GetResponseStream();
XmlTextReader reader = new XmlTextReader(responseStream);
while (true)
{
reader.MoveToContent();
string contents = reader.ReadOuterXml();
if (OnEventRaised != null)
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.RunWorkerAsync(contents);
}
reader.ResetState();
}
}
示例3: DeserializeEdrmXml
public EDRMEntity DeserializeEdrmXml(string filePath)
{
// create an xml reader.
XmlReader reader = new XmlTextReader(new FileStream(filePath, FileMode.Open));
// read through elements
while (reader.Read())
{
// parse document elements.
if (reader.Name.Equals("document", StringComparison.InvariantCultureIgnoreCase))
{
edrmEntity.BatchEntity.DocumentEntity.Add(ParseEdrmDocumentXml(reader.ReadOuterXml()));
}
if (reader.Name.Equals("relationship", StringComparison.InvariantCultureIgnoreCase))
{
edrmEntity.BatchEntity.Relationships.Add(new RelationshipEntity()
{
Type = reader.SafeGetAttribute("Type"),
ParentDocID = reader.SafeGetAttribute("ParentDocId"),
ChildDocID = reader.SafeGetAttribute("ChildDocId")
});
}
}
return edrmEntity;
}
示例4: Execute
public async Task<int> Execute()
{
using (var reader = new StreamReader(FileName, Encode))
{
XmlReader xmlReader = new XmlTextReader(reader);
xmlReader.ReadStartElement();
while (xmlReader.Read())
{
var xdoc = new XmlDocument();
string content = xmlReader.ReadOuterXml();
if (string.IsNullOrEmpty(content))
{
break;
}
xdoc.LoadXml(content);
for (int i = 0; i < xdoc.DocumentElement.ChildNodes.Count; i++)
{
var xele = xdoc.DocumentElement.ChildNodes[i] as XmlElement;
if (i != 0)
{
_logger.InfoLine(",");
}
_logger.InfoLine(xele.InnerText);
}
_logger.InfoLine("");
}
xmlReader.Close();
return 0;
}
}
示例5: ConstructBody
public string ConstructBody()
{
using (var reader = new XmlTextReader(new StringReader(page)))
{
reader.DtdProcessing = DtdProcessing.Ignore;
reader.ReadToFollowing("body");
return reader.ReadOuterXml();
}
}
示例6: RequestRestaurantInfo
private static string RequestRestaurantInfo(string strURL)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = response.GetResponseStream();
XmlTextReader reader = new XmlTextReader(s);
reader.MoveToContent();
string xml = reader.ReadOuterXml();
return xml;
}
示例7: ConvertToXMLDoc
public XmlDocument ConvertToXMLDoc(string xmlData)
{
XmlDocument xmlDoc = new XmlDocument();
System.Xml.XmlTextReader xmlReader;
xmlReader = new System.Xml.XmlTextReader(xmlData, System.Xml.XmlNodeType.Document, null);
xmlReader.ReadOuterXml();
xmlDoc.Load(xmlReader);
return xmlDoc;
}
示例8: CreateLookup
public void CreateLookup(SPFeatureReceiverProperties properties, SPWeb web, String filePath)
{
string fieldId;
bool isReading = true;
XmlDocument document = GetXmlDocument(properties.Definition, filePath, web.Locale);
using (XmlTextReader reader = new XmlTextReader(new StringReader(document.OuterXml)))
{
CreateListMapping(properties);
while (true)
{
if (reader.LocalName != "Field" || isReading)
{
if (!reader.Read())
{
break;
}
}
if (reader.LocalName == "Field")
{
if (reader.MoveToAttribute("Type") &&
reader.Value == "Lookup" &&
reader.MoveToAttribute("Name"))
{
fieldId = reader.Value;
if (lookupsListMapping.ContainsKey(fieldId))
{
String listName = lookupsListMapping[fieldId];
SPList list = GetListForLookup(listName, web);
reader.MoveToContent();
XmlDocument doc = new XmlDocument();
String fieldElement = reader.ReadOuterXml();
doc.LoadXml(fieldElement);
XPathNavigator navigator = doc.DocumentElement.CreateNavigator();
navigator.CreateAttribute("", "List", "", list.ID.ToString());
SPFieldLookup field = (SPFieldLookup)web.Fields[fieldId];
AddWebIdAttribute(web, doc);
field.SchemaXml = RemoveXmlnsAttribute(doc.OuterXml);
field.Update(true);
isReading = false;
continue;
}
}
}
isReading = true;
}
}
}
示例9: makeJob
public void makeJob()
{
if (languages.Count == 0)
{
scanLanguages();
}
using (reader = new XmlTextReader(path)) {
while (reader.Read())
{
if (reader.IsStartElement() && reader.LocalName == "tu")
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(reader.ReadOuterXml());
foreach (XmlNode item in xmlDoc.FirstChild.ChildNodes)
{
if (item.LocalName == "tuv")
{
string lang;
if (null == item.Attributes["xml:lang"])
{
lang = item.Attributes["lang"].Value;
}
else
{
lang = item.Attributes["xml:lang"].Value;
}
int columnNumber = languages[lang];
foreach (XmlNode seg in item.ChildNodes)
{
if (seg.LocalName == "seg")
{
foreach (XmlNode txt in seg.ChildNodes)
{
if (txt.NodeType == XmlNodeType.Text)
{
output.addCell(columnNumber, txt.Value);
}
}
}
}
}
}
output.writeRow();
}
}
}
output.Close();
}
示例10: LoadXml
/// <summary>
/// Loads the nodes from Xml
/// </summary>
public void LoadXml(string vsFileName)
{
XmlTextReader reader = new XmlTextReader(vsFileName);
while (reader.Read())
{
switch (reader.Name)
{
case "RuleBase":
if (reader.NodeType != XmlNodeType.EndElement)
{
CreateRulesBase(reader);
}
break;
case "ContinuousRuleVariable":
CreateContinuousRuleVariable(reader.ReadOuterXml());
break;
case "Rule":
//reader.ReadOuterXml();
CreateRules(reader.ReadOuterXml());
break;
}
}
reader.Close();
}
示例11: LoadSingleElement
public void LoadSingleElement(string filename, XmlTextReader sourceReader) {
_filename = filename;
_lineOffset = sourceReader.LineNumber;
string outerXml = sourceReader.ReadOuterXml();
try {
_reader = new XmlTextReader(new StringReader(outerXml), sourceReader.NameTable);
base.Load(_reader);
}
finally {
if (_reader != null) {
_reader.Close();
_reader = null;
}
}
}
示例12: GetProductList
public List<Product> GetProductList()
{
List<Product> list = new List<Product>();
XmlTextReader reader = new XmlTextReader(dataFileName);
reader.MoveToContent();
XmlDocument doc = new XmlDocument();
doc.LoadXml(reader.ReadOuterXml());
XmlNodeList nodes = doc.SelectNodes("products/product");
foreach (XmlNode node in nodes)
{
Product product = new Product(node.Attributes["id"].Value,
node.Attributes["name"].Value,
Convert.ToDouble(node.Attributes["price"].Value));
list.Add(product);
}
reader.Close();
return list;
}
示例13: BeliefNode
/// <summary>
/// Construct the Belief Node given the input Xml
/// </summary>
/// <param name="vsXml">Xml Data</param>
public BeliefNode(string vsXml)
{
XmlTextReader reader = new XmlTextReader(new StringReader(vsXml));
reader.Read();
Name = reader.GetAttribute("name");
PriorProbability = float.Parse(reader.GetAttribute("priorprob"));
CurrentProbability = float.Parse(reader.GetAttribute("currentprob"));
while(reader.Read())
{
switch (reader.Name)
{
case "Arcs" :
moArcs = new Arcs(reader.ReadOuterXml());
break;
}
}
}
示例14: ReadXmlFile
internal string ReadXmlFile(string location)
{
TTE.Log(location);
string xml;
Match testHttp = Regex.Match(location, "^(http|https)://");
if (testHttp.Success) {
XmlTextReader oTR = new XmlTextReader(location);
xml = oTR.ReadOuterXml();
} else {
StreamReader oSR = new StreamReader(location);
xml = oSR.ReadToEnd();
oSR.Close();
oSR.Dispose();
GC.Collect();
}
return xml;
}
示例15: ProcessPages
public void ProcessPages()
{
XmlTextReader reader = new XmlTextReader(this.InputStream);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name == "page")
{
PageProcessor.ProcessPage(reader.ReadOuterXml());
}
break;
default:
// Do nothing for now
break;
}
}
}