ParseGraphMLAttributeDefinitions ( XmlNode oGraphMLXmlNode, XmlNamespaceManager oXmlNamespaceManager ) { Debug.Assert(oGraphMLXmlNode != null); Debug.Assert(oXmlNamespaceManager != null); AssertValid(); Dictionary <String, GraphMLAttribute> oGraphMLAttributeDictionary = new Dictionary <String, GraphMLAttribute>(); // Read the GraphML-attribute nodes. foreach (XmlNode oKeyXmlNode in oGraphMLXmlNode.SelectNodes( GraphMLPrefix + ":key[@for='node' or @for='edge']", oXmlNamespaceManager)) { GraphMLAttribute oGraphMLAttribute = new GraphMLAttribute(oKeyXmlNode, oXmlNamespaceManager, GraphMLPrefix); String sID = oGraphMLAttribute.ID; try { oGraphMLAttributeDictionary.Add(sID, oGraphMLAttribute); } catch (ArgumentException) { throw new XmlException( "The key id \"" + sID + "\" exists for two keys. Key id" + " values must be unique." ); } } return(oGraphMLAttributeDictionary); }
ParseGraphMLAttributeDefinitions ( XmlNode oGraphMLXmlNode, XmlNamespaceManager oXmlNamespaceManager ) { Debug.Assert(oGraphMLXmlNode != null); Debug.Assert(oXmlNamespaceManager != null); AssertValid(); Dictionary<String, GraphMLAttribute> oGraphMLAttributeDictionary = new Dictionary<String, GraphMLAttribute>(); // Read the GraphML-attribute nodes. foreach ( XmlNode oKeyXmlNode in oGraphMLXmlNode.SelectNodes( GraphMLPrefix + ":key[@for='node' or @for='edge']", oXmlNamespaceManager) ) { GraphMLAttribute oGraphMLAttribute = new GraphMLAttribute(oKeyXmlNode, oXmlNamespaceManager, GraphMLPrefix); String sID = oGraphMLAttribute.ID; try { oGraphMLAttributeDictionary.Add(sID, oGraphMLAttribute); } catch (ArgumentException) { throw new XmlException( "The key id \"" + sID + "\" exists for two keys. Key id" + " values must be unique." ); } } return (oGraphMLAttributeDictionary); }
CreateGraphMLAttribute ( Boolean bIsForVertex, String sAttributeType, String sDefaultAttributeValue ) { XmlElement oKeyXmlNode = CreateKeyXmlNode(bIsForVertex, sAttributeType); if (sDefaultAttributeValue != null) { XmlElement oDefaultXmlNode = m_oXmlDocument.CreateElement( "default", GraphMLGraphAdapter.GraphMLNamespaceUri); oDefaultXmlNode.InnerText = sDefaultAttributeValue; oKeyXmlNode.AppendChild(oDefaultXmlNode); } m_oGraphMLAttribute = new GraphMLAttribute(oKeyXmlNode, m_oXmlNamespaceManager, GraphMLPrefix); return (m_oGraphMLAttribute); }