示例#1
0
        //TODO Simon: ORIG: @SuppressWarnings({"unchecked"})
        private static void ChangeNamesInColumnElement(XmlElement element, ColumnNameEnumerator colNameEnumerator)
        {
            //Iterator<XmlElement> properties = element.elementIterator();
            XmlNodeList nodeList = element.ChildNodes;

            //while (properties.hasNext()) {
            //    XmlElement property = properties.next();
            foreach (XmlElement property in nodeList)
            {
                if ("column".Equals(property.Name))
                {
                    string value = property.GetAttribute("name");
                    if (!String.IsNullOrEmpty(value))
                    {
                        //nameAttr.setText(columnNameIterator.next());
                        colNameEnumerator.MoveNext();
                        property.SetAttribute("name", colNameEnumerator.Current);
                    }
                }
            }
        }
示例#2
0
        //@SuppressWarnings({"unchecked"})
        public static void PrefixNamesInPropertyElement(XmlElement element, String prefix, ColumnNameEnumerator colNameEnumerator,
                                                        bool changeToKey, bool insertable)
        {
            XmlNodeList nodeList = element.ChildNodes;

            foreach (XmlElement property in nodeList)
            {
                if ("property".Equals(property.Name))
                {
                    string value = property.GetAttribute("name");
                    if (!String.IsNullOrEmpty(value))
                    {
                        property.SetAttribute("name", prefix + value);
                    }
                    ChangeNamesInColumnElement(property, colNameEnumerator);

                    if (changeToKey)
                    {
                        ChangeElementName(property, "key-property");
                    }

                    property.SetAttribute("insert", insertable?"true":"false");
                }
            }
        }