XmlDocument xmlDoc = new XmlDocument(); XmlReaderSettings settings = new XmlReaderSettings { NameTable = new NameTable()}; settings.IgnoreComments = true; XmlNamespaceManager xmlns = new XmlNamespaceManager(settings.NameTable); xmlns.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); xmlns.AddNamespace("ifc", "http://www.iai-tech.org/ifcXML/IFC2x2/FINAL"); xmlns.AddNamespace("exp", "urn:oid:1.0.10303.28.2.1.1"); xmlns.AddNamespace("doc", "urn:oid:1.0.10303.28.2.1.3"); XmlParserContext context = new XmlParserContext(null, xmlns, "", XmlSpace.Default); XmlReader reader = XmlReader.Create(orgXMLFile, settings, context); xmlDoc.Load(reader); XmlNode root = xmlDoc.DocumentElement; XmlNodeList nodeList = root.ChildNodes; // ifc信息的根实体 XmlNode ifcNode = null; foreach (XmlNode node in nodeList) { if (node.Name == "ifc:uos") { ifcNode = node; break; } } // 需要加词头prefix XmlNodeList xmlNodeList = root.SelectNodes("ifc:IfcReinforcingBar", xmlns); XmlNodeList xmlNodeList = root.SelectNodes("//ifc:IfcSlab/ifc:Tag", xmlns);