예제 #1
0
        /// <summary>
        /// Create new reference
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public VXmlReference CreateReference(VXmlNode n)
        {
            if (!DEFX.BR_NODE_REFERENCE(n.NodeTypeCode))
            {
                throw new VXmlException(VXmlException.E0004_INVALID_NODE_TYPE_CODE, ": " + n.NodeType + " (Create Reference)");
            }

            // Check if this object is already in child node or reference

            VXmlNodeCollection refs = this.get_child_nodes_of_type(DEFX.NODE_TYPE_REFERENCE);

            //Check if ref already exists
            foreach (VXmlReference rf in refs)
            {
                if (rf.ReferenceId == n.Id)
                {
                    return(rf);
                }
            }

            VXmlReference r = (VXmlReference)create_node(DEFX.NODE_TYPE_REFERENCE, n.Name);

            r.set_reference_node(n);

            root_catalog.index_reference.Insert(n.ID, r.Id);          // Add index

            return(r);
        }
예제 #2
0
 /// <summary>
 /// Delete reference
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public void RemoveReference(VXmlReference r)
 {
     remove_child_node(r, true);
 }