Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReadContentFrom() [2/2]

bool System.Xml.Linq.XContainer.ContentReader.ReadContentFrom ( XContainer rootContainer,
XmlReader r,
LoadOptions o )
inline

Definition at line 189 of file XContainer.cs.

190 {
191 XNode xNode = null;
192 string baseURI = r.BaseURI;
193 switch (r.NodeType)
194 {
195 case XmlNodeType.Element:
196 {
197 XElement xElement2 = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName));
198 if (_baseUri != null && _baseUri != baseURI)
199 {
200 xElement2.SetBaseUri(baseURI);
201 }
202 if (_lineInfo != null && _lineInfo.HasLineInfo())
203 {
205 }
206 if (r.MoveToFirstAttribute())
207 {
208 do
209 {
210 XAttribute xAttribute = new XAttribute(_aCache.Get((r.Prefix.Length == 0) ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value);
211 if (_lineInfo != null && _lineInfo.HasLineInfo())
212 {
214 }
215 xElement2.AppendAttributeSkipNotify(xAttribute);
216 }
217 while (r.MoveToNextAttribute());
218 r.MoveToElement();
219 }
221 if (!r.IsEmptyElement)
222 {
224 if (_baseUri != null)
225 {
226 _baseUri = baseURI;
227 }
228 }
229 break;
230 }
231 case XmlNodeType.EndElement:
232 if (_currentContainer.content == null)
233 {
234 _currentContainer.content = string.Empty;
235 }
236 if (_currentContainer is XElement xElement && _lineInfo != null && _lineInfo.HasLineInfo())
237 {
238 xElement.SetEndElementLineInfo(_lineInfo.LineNumber, _lineInfo.LinePosition);
239 }
241 {
242 return false;
243 }
245 {
247 }
249 break;
250 case XmlNodeType.Text:
251 case XmlNodeType.Whitespace:
252 case XmlNodeType.SignificantWhitespace:
253 if ((_baseUri != null && _baseUri != baseURI) || (_lineInfo != null && _lineInfo.HasLineInfo()))
254 {
255 xNode = new XText(r.Value);
256 }
257 else
258 {
260 }
261 break;
262 case XmlNodeType.CDATA:
263 xNode = new XCData(r.Value);
264 break;
265 case XmlNodeType.Comment:
266 xNode = new XComment(r.Value);
267 break;
268 case XmlNodeType.ProcessingInstruction:
269 xNode = new XProcessingInstruction(r.Name, r.Value);
270 break;
271 case XmlNodeType.DocumentType:
272 xNode = new XDocumentType(r.LocalName, r.GetAttribute("PUBLIC"), r.GetAttribute("SYSTEM"), r.Value);
273 break;
274 case XmlNodeType.EntityReference:
275 if (!r.CanResolveEntity)
276 {
278 }
279 r.ResolveEntity();
280 break;
281 default:
283 case XmlNodeType.EndEntity:
284 break;
285 }
286 if (xNode != null)
287 {
288 if (_baseUri != null && _baseUri != baseURI)
289 {
290 xNode.SetBaseUri(baseURI);
291 }
292 if (_lineInfo != null && _lineInfo.HasLineInfo())
293 {
295 }
297 xNode = null;
298 }
299 return true;
300 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string InvalidOperation_UnresolvedEntityReference
Definition SR.cs:60
static string InvalidOperation_UnexpectedNodeType
Definition SR.cs:58
Definition SR.cs:7
void AddNodeSkipNotify(XNode n)
void AddStringSkipNotify(string s)
XName GetName(string localName)
Definition XNamespace.cs:37
XContainer parent
Definition XObject.cs:7
XNamespace Get(string namespaceName)

References System.Xml.Linq.XContainer.ContentReader._aCache, System.Xml.Linq.XContainer.ContentReader._baseUri, System.Xml.Linq.XContainer.ContentReader._currentContainer, System.Xml.Linq.XContainer.ContentReader._eCache, System.Xml.Linq.XContainer.ContentReader._lineInfo, System.Xml.Linq.XContainer.AddNodeSkipNotify(), System.Xml.Linq.XContainer.AddStringSkipNotify(), System.Xml.Linq.XObject.BaseUri, System.Xml.Linq.XContainer.content, System.Xml.Dictionary, System.SR.Format(), System.Xml.Linq.NamespaceCache.Get(), System.Xml.Linq.XNamespace.GetName(), System.Xml.Linq.XObject.HasBaseUri, System.Xml.IXmlLineInfo.HasLineInfo(), System.SR.InvalidOperation_UnexpectedNodeType, System.SR.InvalidOperation_UnresolvedEntityReference, System.Xml.IXmlLineInfo.LineNumber, System.Xml.IXmlLineInfo.LinePosition, and System.Xml.Linq.XObject.parent.