Example #1
0
 ///
 ///	 <summary> * Moves the ChildElementVector of the second element into the first
 ///	 *  </summary>
 ///	 * <param name="moveToElement">
 ///	 *            the first element - new parent for the children of the second
 ///	 *            element </param>
 ///	 * <param name="moveFromElement">
 ///	 *            the second element - element whose children will be removed </param>
 ///
 private static void moveChildElementVector_Static(KElement moveToElement, KElement moveFromElement)
 {
     if (moveToElement != null && moveFromElement != null)
     {
         VElement v = moveFromElement.getChildElementVector(null, null, null, true, 0, false);
         for (int i = 0; i < v.Count; i++)
         {
             moveToElement.moveElement(v[i], null);
         }
     }
     return;
 }
Example #2
0
        ///
        ///	 <summary> * Composes a BugReport in XML form for the given JDFNode 'jdfRoot'. Gives a list of error messages for 'jdfRoot'
        ///	 * and every child rejected Node.<br>
        ///	 * Returns <code>null</code> if there are no errors.
        ///	 *  </summary>
        ///	 * <param name="jdfRoot"> the node to test </param>
        ///	 * <param name="testlists"> testlists that are specified for the State elements (FitsValue_Allowed or FitsValue_Present)<br>
        ///	 *            Will be used in fitsValue method of the State class. </param>
        ///	 * <param name="level"> validation level </param>
        ///	 * <returns> XMLDoc - XMLDoc output of the error messages. If XMLDoc is null there are no errors. </returns>
        ///
        public XMLDoc getBadJDFInfo(JDFNode jdfRoot, EnumFitsValue testlists, EnumValidationLevel level)
        {
            VElement vDC = getChildElementVector(ElementName.DEVICECAP, null, null, true, -1, false);

            if (vDC == null || vDC.IsEmpty())
            {
                return(null);
            }

            VElement vn = new VElement();

            for (int i = 0; i < vDC.Count; i++)
            {
                JDFDeviceCap dc        = (JDFDeviceCap)vDC[i];
                XMLDoc       bugReport = dc.getBadJDFInfo(jdfRoot, testlists, level);
                if (bugReport == null)
                {
                    return(null);
                }
                vn.addAll(bugReport.getRoot().getChildElementVector(null, null, null, true, -1, false));
            }

            int vnSize = vn.Count;

            if (vnSize == 0)
            {
                return(null);
            }

            XMLDoc   bugReport2 = new XMLDoc("BugReport", null);
            KElement root       = bugReport2.getRoot();
            bool     bFit       = false;

            for (int i = 0; i < vnSize; i++)
            {
                KElement e = vn[i];
                if (JDFConstants.TRUE.Equals(e.getAttribute(JDFDeviceCap.FITS_TYPE)))
                {
                    bFit = true;
                }
            }
            if (bFit)
            {
                for (int i = 0; i < vnSize; i++)
                {
                    KElement e = vn[i];
                    if (JDFConstants.FALSE.Equals(e.getAttribute(JDFDeviceCap.FITS_TYPE)))
                    {
                        vn[i] = null;
                    }
                }
            }
            for (int i = 0; i < vnSize; i++)
            {
                if (vn[i] != null)
                {
                    root.moveElement(vn.item(i), null);
                }
            }
            return(bugReport2);
        }