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

◆ LoadNode()

XmlNode System.Xml.XmlLoader.LoadNode ( bool skipOverWhitespace)
inlineprivate

Definition at line 88 of file XmlLoader.cs.

89 {
90 XmlReader reader = _reader;
91 XmlNode xmlNode = null;
92 do
93 {
94 XmlNode xmlNode2 = null;
95 switch (reader.NodeType)
96 {
97 case XmlNodeType.Element:
98 {
99 bool isEmptyElement = reader.IsEmptyElement;
100 XmlElement xmlElement2 = _doc.CreateElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
102 if (reader.MoveToFirstAttribute())
103 {
104 XmlAttributeCollection attributes = xmlElement2.Attributes;
105 do
106 {
107 XmlAttribute node = LoadAttributeNode();
108 attributes.Append(node);
109 }
110 while (reader.MoveToNextAttribute());
111 reader.MoveToElement();
112 }
113 if (!isEmptyElement)
114 {
115 xmlNode?.AppendChildForLoad(xmlElement2, _doc);
117 continue;
118 }
119 IXmlSchemaInfo schemaInfo = reader.SchemaInfo;
120 if (schemaInfo != null)
121 {
122 xmlElement2.XmlName = _doc.AddXmlName(xmlElement2.Prefix, xmlElement2.LocalName, xmlElement2.NamespaceURI, schemaInfo);
123 }
125 break;
126 }
127 case XmlNodeType.EndElement:
128 {
129 if (xmlNode == null)
130 {
131 return null;
132 }
133 IXmlSchemaInfo schemaInfo = reader.SchemaInfo;
134 if (schemaInfo != null && xmlNode is XmlElement xmlElement)
135 {
136 xmlElement.XmlName = _doc.AddXmlName(xmlElement.Prefix, xmlElement.LocalName, xmlElement.NamespaceURI, schemaInfo);
137 }
138 if (xmlNode.ParentNode == null)
139 {
140 return xmlNode;
141 }
142 xmlNode = xmlNode.ParentNode;
143 continue;
144 }
145 case XmlNodeType.EntityReference:
147 break;
148 case XmlNodeType.EndEntity:
149 return null;
150 case XmlNodeType.Attribute:
152 break;
153 case XmlNodeType.Text:
154 xmlNode2 = _doc.CreateTextNode(reader.Value);
155 break;
156 case XmlNodeType.SignificantWhitespace:
158 break;
159 case XmlNodeType.Whitespace:
161 {
162 xmlNode2 = _doc.CreateWhitespace(reader.Value);
163 break;
164 }
165 if (xmlNode == null && !skipOverWhitespace)
166 {
167 return null;
168 }
169 continue;
170 case XmlNodeType.CDATA:
171 xmlNode2 = _doc.CreateCDataSection(reader.Value);
172 break;
173 case XmlNodeType.XmlDeclaration:
175 break;
176 case XmlNodeType.ProcessingInstruction:
177 xmlNode2 = _doc.CreateProcessingInstruction(reader.Name, reader.Value);
178 break;
179 case XmlNodeType.Comment:
180 xmlNode2 = _doc.CreateComment(reader.Value);
181 break;
182 case XmlNodeType.DocumentType:
184 break;
185 default:
186 throw UnexpectedNodeType(reader.NodeType);
187 }
188 if (xmlNode != null)
189 {
190 xmlNode.AppendChildForLoad(xmlNode2, _doc);
191 continue;
192 }
193 return xmlNode2;
194 }
195 while (reader.Read());
196 if (xmlNode != null)
197 {
198 while (xmlNode.ParentNode != null)
199 {
200 xmlNode = xmlNode.ParentNode;
201 }
202 }
203 return xmlNode;
204 }
virtual XmlWhitespace CreateWhitespace(string? text)
virtual XmlText CreateTextNode(string? text)
virtual XmlCDataSection CreateCDataSection(string? data)
virtual XmlProcessingInstruction CreateProcessingInstruction(string target, string data)
XmlName AddXmlName(string prefix, string localName, string namespaceURI, IXmlSchemaInfo schemaInfo)
virtual XmlSignificantWhitespace CreateSignificantWhitespace(string? text)
XmlElement CreateElement(string name)
virtual XmlComment CreateComment(string? data)
XmlAttribute LoadAttributeNode()
Definition XmlLoader.cs:206
XmlDeclaration LoadDeclarationNode()
Definition XmlLoader.cs:318
static Exception UnexpectedNodeType(XmlNodeType nodetype)
Definition XmlLoader.cs:841
XmlEntityReference LoadEntityReferenceNode(bool direct)
Definition XmlLoader.cs:296
XmlDocument _doc
Definition XmlLoader.cs:9
XmlDocumentType LoadDocumentTypeNode()
Definition XmlLoader.cs:345

References System.Xml.XmlLoader._doc, System.Xml.XmlLoader._preserveWhitespace, System.Xml.XmlLoader._reader, System.Xml.XmlDocument.AddXmlName(), System.Xml.XmlAttributeCollection.Append(), System.Xml.XmlDocument.CreateCDataSection(), System.Xml.XmlDocument.CreateComment(), System.Xml.XmlDocument.CreateElement(), System.Xml.XmlDocument.CreateProcessingInstruction(), System.Xml.XmlDocument.CreateSignificantWhitespace(), System.Xml.XmlDocument.CreateTextNode(), System.Xml.XmlDocument.CreateWhitespace(), System.Xml.Dictionary, System.Xml.XmlReader.IsEmptyElement, System.Xml.XmlLoader.LoadAttributeNode(), System.Xml.XmlLoader.LoadDeclarationNode(), System.Xml.XmlLoader.LoadDocumentTypeNode(), System.Xml.XmlLoader.LoadEntityReferenceNode(), System.Xml.XmlReader.LocalName, System.Xml.XmlReader.MoveToElement(), System.Xml.XmlReader.MoveToFirstAttribute(), System.Xml.XmlReader.MoveToNextAttribute(), System.Xml.XmlReader.Name, System.Xml.XmlReader.NamespaceURI, System.Xml.XmlReader.NodeType, System.Xml.XmlReader.Prefix, System.Xml.XmlReader.Read(), System.Xml.XmlReader.SchemaInfo, System.Xml.XmlLoader.UnexpectedNodeType(), and System.Xml.XmlReader.Value.

Referenced by System.Xml.XmlLoader.LoadDocSequence(), System.Xml.XmlLoader.LoadEntityReferenceNode(), System.Xml.XmlLoader.ParsePartialContent(), and System.Xml.XmlLoader.ReadCurrentNode().