/// <summary> /// Load definitions section. /// </summary> /// <param name="reader"></param> protected static void loadDefinitions(XmlTextReader reader, ref DefinitionsNode definitions) { DefineTypeNode ut = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.LocalName.Equals("defineType")) { string sTypename = reader.GetAttribute("typeName"); ut = new DefineTypeNode(sTypename); } else if (reader.LocalName.Equals("struct") && ut != null) { ut.setBaseType(LoadStruct(reader)); } else if (reader.LocalName.Equals("union") && ut != null) { ut.setBaseType(LoadUnion(reader)); } else if (reader.LocalName.StartsWith("array") && ut != null) { ut.setBaseType(LoadArray(reader)); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.LocalName.Equals("defineType") && ut != null) { definitions.addChild(ut); ut = null; } else if (reader.LocalName.Equals(sDefinitions)) { return; } } } }
/// <summary> /// Load definitions section. /// </summary> /// <param name="reader"></param> protected static void loadDefinitions(XmlTextReader reader, ref DefinitionsNode definitions) { DefineTypeNode ut = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.LocalName.Equals("defineType")) { string sTypename = reader.GetAttribute("typeName"); ut = new DefineTypeNode(sTypename); } else if (reader.LocalName.Equals("struct") && ut!=null) { ut.setBaseType( LoadStruct(reader) ); } else if (reader.LocalName.Equals("union") && ut!=null) { ut.setBaseType( LoadUnion(reader) ); } else if (reader.LocalName.StartsWith("array") && ut!=null) { ut.setBaseType( LoadArray(reader) ); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.LocalName.Equals("defineType") && ut!=null) { definitions.addChild(ut); ut = null; } else if (reader.LocalName.Equals(sDefinitions)) { return; } } } }
public void addDefinition(DefineTypeNode node) { definitions_.addChild(node); }