Package net.n3.nanoxml

Examples of net.n3.nanoxml.IXMLReader


    /*--------------------------------------------------------------------------*/
    protected void addTextField(XMLElement spec)
    {
        Vector forPacks = spec.getChildrenNamed(SELECTEDPACKS);
        Vector forOs = spec.getChildrenNamed(OS);
        XMLElement element = spec.getFirstChildNamed(SPEC);
        JLabel label;
        String set;
        int size;

        String variable = spec.getAttribute(VARIABLE);
        if ((variable == null) || (variable.length() == 0)) { return; }

        // ----------------------------------------------------
        // extract the specification details
        // ----------------------------------------------------
        if (element != null)
        {
            label = new JLabel(getText(element));
            set = element.getAttribute(SET);
            if (set == null)
            {
                set = idata.getVariable(variable);
                if (set == null)
                {
                    set = "";
                }
            }else{
                if (set != null && !"".equals(set)){
                    VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
                    set = vs.substitute(set, null);
                }
            }
               
            try
            {
                size = Integer.parseInt(element.getAttribute(TEXT_SIZE));
            }
            catch (Throwable exception)
            {
                size = 1;
            }
View Full Code Here


    /*--------------------------------------------------------------------------*/
    protected void addComboBox(XMLElement spec)
    {
        Vector forPacks = spec.getChildrenNamed(SELECTEDPACKS);
        Vector forOs = spec.getChildrenNamed(OS);
        XMLElement element = spec.getFirstChildNamed(SPEC);
        String variable = spec.getAttribute(VARIABLE);
        TextValuePair listItem = null;
        JComboBox field = new JComboBox();
        JLabel label;

        // ----------------------------------------------------
        // extract the specification details
        // ----------------------------------------------------
        if (element != null)
        {
            label = new JLabel(getText(element));

            Vector choices = element.getChildrenNamed(COMBO_CHOICE);

            if (choices == null) { return; }

            for (int i = 0; i < choices.size(); i++)
            {
View Full Code Here

        Vector forPacks = spec.getChildrenNamed(SELECTEDPACKS);
        Vector forOs = spec.getChildrenNamed(OS);
        String variable = spec.getAttribute(VARIABLE);
        String value = null;

        XMLElement element = null;
        ButtonGroup group = new ButtonGroup();

        TwoColumnConstraints constraints = new TwoColumnConstraints();
        constraints.position = TwoColumnConstraints.BOTH;
        constraints.indent = true;
        constraints.stretch = true;

        // ----------------------------------------------------
        // get the description and add it to the list of UI
        // elements if it exists.
        // ----------------------------------------------------
        element = spec.getFirstChildNamed(DESCRIPTION);
        addDescription(element, forPacks, forOs, null);

        // ----------------------------------------------------
        // extract the specification details
        // ----------------------------------------------------
        element = spec.getFirstChildNamed(SPEC);

        if (element != null)
        {
            Vector choices = element.getChildrenNamed(RADIO_CHOICE);

            if (choices == null) { return; }

            // --------------------------------------------------
            // process each choice element
View Full Code Here

        Vector forOs = spec.getChildrenNamed(OS);
        String variable = spec.getAttribute(VARIABLE);
        String validator = null;
        String message = null;
        String processor = null;
        XMLElement element = null;
        PasswordGroup group = null;
        int size = 0;

        // ----------------------------------------------------
        // get the description and add it to the list of UI
        // elements if it exists.
        // ----------------------------------------------------
        element = spec.getFirstChildNamed(DESCRIPTION);
        addDescription(element, forPacks, forOs, null);

        // ----------------------------------------------------
        // get the validator and processor if they are defined
        // ----------------------------------------------------
        element = spec.getFirstChildNamed(VALIDATOR);
        if (element != null)
        {
            validator = element.getAttribute(CLASS);
            message = getText(element);
        }

        element = spec.getFirstChildNamed(PROCESSOR);
        if (element != null)
        {
            processor = element.getAttribute(CLASS);
        }

        group = new PasswordGroup(validator, processor);

        // ----------------------------------------------------
        // extract the specification details
        // ----------------------------------------------------
        element = spec.getFirstChildNamed(SPEC);

        if (element != null)
        {
            Vector inputs = element.getChildrenNamed(PWD_INPUT);

            if (inputs == null) { return; }

            // --------------------------------------------------
            // process each input field
            // --------------------------------------------------
            XMLElement fieldSpec;
            for (int i = 0; i < inputs.size(); i++)
            {
                fieldSpec = (XMLElement) inputs.elementAt(i);
                String set = fieldSpec.getAttribute(SET);
                if (set != null && !"".equals(set)){
                    VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
                    set = vs.substitute(set, null);
                }
                JLabel label = new JLabel(getText(fieldSpec));
                try
                {
                    size = Integer.parseInt(fieldSpec.getAttribute(PWD_SIZE));
                }
                catch (Throwable exception)
                {
                    size = 1;
                }
View Full Code Here

       }
       return fRet;
    }
    protected Vector getFieldSuppressionList( XMLElement spec ) { // ###ead
       Vector supps = null;
       XMLElement suppress = spec.getFirstChildNamed( SUPPRESS );
       if( suppress != null ) {
          Vector whens = suppress.getChildrenNamed( WHEN );
          for( int i = 0; i < whens.size(); ++i ) {
             if( supps == null ) supps = new Vector();
             XMLElement when = (XMLElement)whens.elementAt(i);
             String var = when.getAttribute( VARIABLE );
             String val = when.getAttribute( VALUE );
             supps.add( new TextValuePair( var, val ));
          }
       }
       return supps;
    }
View Full Code Here

        String label = "";
        String set = null;
        String trueValue = null;
        String falseValue = null;
        String variable = spec.getAttribute(VARIABLE);
        XMLElement detail = spec.getFirstChildNamed(SPEC);
        Vector suppress = getFieldSuppressionList( spec ); // ###ead
        if (variable == null) { return; }

        if (detail != null)
        {
            label = getText(detail);
            set = detail.getAttribute(SET);
            trueValue = detail.getAttribute(TRUE);
            falseValue = detail.getAttribute(FALSE);
        }

        VCheckBox checkbox = new VCheckBox(label, varMap, idata, spec);

        if (set != null)
        {
            if (set != null && !"".equals(set)){
                VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
                set = vs.substitute(set, null);
            }
            if (set.equals(FALSE))
            {
                checkbox.setSelected(false);
            }
            if (set.equals(TRUE))
            {
                checkbox.setSelected(true);
            }
        }

        // ----------------------------------------------------
        // get the description and add it to the list of UI
        // elements if it exists.
        // ----------------------------------------------------
        XMLElement element = spec.getFirstChildNamed(DESCRIPTION);
        addDescription( element, forPacks, forOs, suppress );

        TwoColumnConstraints constraints = new TwoColumnConstraints();
        constraints.position = TwoColumnConstraints.BOTH;
        constraints.stretch = true;
View Full Code Here

    /*--------------------------------------------------------------------------*/
    protected void addSearch(XMLElement spec)
    {
        Vector forPacks = spec.getChildrenNamed(SELECTEDPACKS);
        Vector forOs = spec.getChildrenNamed(OS);
        XMLElement element = spec.getFirstChildNamed(SPEC);
        String variable = spec.getAttribute(VARIABLE);
        String filename = null;
        String check_filename = null;
        int search_type = 0;
        int result_type = 0;
        JComboBox combobox = new JComboBox();
        JLabel label = null;

        // System.out.println ("adding search combobox, variable "+variable);

        // allow the user to enter something
        combobox.setEditable(true);

        // ----------------------------------------------------
        // extract the specification details
        // ----------------------------------------------------
        if (element != null)
        {
            label = new JLabel(getText(element));

            // search type is optional (default: file)
            search_type = SearchField.TYPE_FILE;

            String search_type_str = element.getAttribute(SEARCH_TYPE);

            if (search_type_str != null)
            {
                if (search_type_str.equals(SEARCH_FILE))
                {
                    search_type = SearchField.TYPE_FILE;
                }
                else if (search_type_str.equals(SEARCH_DIRECTORY))
                {
                    search_type = SearchField.TYPE_DIRECTORY;
                }
            }

            // result type is mandatory too
            String result_type_str = element.getAttribute(SEARCH_RESULT);

            if (result_type_str == null)
            {
                return;
            }
            else if (result_type_str.equals(SEARCH_FILE))
            {
                result_type = SearchField.RESULT_FILE;
            }
            else if (result_type_str.equals(SEARCH_DIRECTORY))
            {
                result_type = SearchField.RESULT_DIRECTORY;
            }
            else if (result_type_str.equals(SEARCH_PARENTDIR))
            {
                result_type = SearchField.RESULT_PARENTDIR;
            }
            else
            {
                return;
            }

            // might be missing - null is okay
            filename = element.getAttribute(SEARCH_FILENAME);

            check_filename = element.getAttribute(SEARCH_CHECKFILENAME);

            Vector choices = element.getChildrenNamed(SEARCH_CHOICE);

            if (choices == null) { return; }

            for (int i = 0; i < choices.size(); i++)
            {
                XMLElement choice_el = (XMLElement) choices.elementAt(i);

                if (!OsConstraint.oneMatchesCurrentSystem(choice_el)) continue;

                String value = choice_el.getAttribute(SEARCH_VALUE);

                combobox.addItem(value);

                String set = ((XMLElement) choices.elementAt(i)).getAttribute(SET);
                if (set != null)
View Full Code Here

        System.out.println("Descripciones ..." + ansDescriptions);
        PreparedStatement stmtItem = c.prepareStatement("insert into articulo ( codigo , descripcion , fecha_registro , "
                    + "codigo_de_barras , modelo , unidad_venta, "
                    + "existencia_actual, bloqueado, imagen, descuento ) values (?,?,now(),?,?,?,0,0,?,?)");
        PreparedStatement stmtBarcode = c.prepareStatement("insert IGNORE into codigo_de_barras(codigo_de_articulo,codigo_de_barras) values(?,?)");
        XMLElement xmlI = null;
        for (Object x : xml.getChildren()) {
            xmlI = (XMLElement)x;
            if ( !itemsNeededJustOnce.contains(xmlI.getAttribute("MATNR","")) ){
                stmtItem.setString(1, xmlI.getAttribute("MATNR",""));
                stmtItem.setString(2, xmlI.getAttribute("MAKTG",""));
                stmtItem.setString(3, xmlI.getAttribute("EAN11",""));
                stmtItem.setString(4, xmlI.getAttribute("MATKL",""));
                stmtItem.setString(5, xmlI.getAttribute("MSEH3",""));
                stmtItem.setString(6, Shared.getConfig("photoDir") + xmlI.getAttribute("MATNR","") + ".JPG");
                stmtItem.setString(7, "0");
                stmtItem.executeUpdate();

                stmtBarcode.setString(1, xmlI.getAttribute("MATNR",""));
                stmtBarcode.setString(2, xmlI.getAttribute("EAN11",""));
                stmtBarcode.executeUpdate();

                itemsNeededJustOnce.add(xmlI.getAttribute("MATNR",""));

            }
            xmlI = null;
        }

        itemsNeededJustOnce = null;
        xml = null;
        parser = null;
        reader = null;
        ansDescriptions = null;

        Iterator<XMLElement> itr = Shared.itemsNeeded.iterator();
        stmtItem = c.prepareStatement("update articulo set existencia_actual = existencia_actual + ? where codigo = ? ");
        while ( itr.hasNext() ){
            xmlI = itr.next();
            int reason = 1;
            if ( checkReason ){
                reason = Shared.calculateReason(xmlI.getAttribute("BWART",""), xmlI.getAttribute("SHKZG",""));
            }
            if ( reason == 0 ){
                // we are in problems... =(
            }else{
                stmtItem.setString(2, xmlI.getAttribute("MATNR",""));
                stmtItem.setInt(1, reason * Integer.parseInt(xmlI.getAttribute("MENGE","").split("\\.")[0]));
                int ans = stmtItem.executeUpdate();
                if ( ans == 0 ){
                    // We are in problemas again... ='(
                }
            }
View Full Code Here

  {
    BufferedOutputStream os =
      new BufferedOutputStream(new FileOutputStream(file));
    try
    {
      XMLWriter wtr = new XMLWriter(os);
      wtr.write(_rootElement, true);
    }
    finally
    {
      os.close();
    }
View Full Code Here

        IXMLElement root = new XMLElement(WebDAVConstants.PROPFIND_ELEM, WebDAVConstants.XML_DAV_NAMESPACE);
        root.addChild(new XMLElement(WebDAVConstants.ALLPROP_ELEM));

        StringWriter xml = new StringWriter();
        XMLWriter writer = new XMLWriter(xml);
        writer.write(root);

        String str = WebDAVConstants.XML_TEMPLATE + "\r\n" + xml.toString(); //$NON-NLS-1$
        byte[] content = str.getBytes("UTF8"); //$NON-NLS-1$

        request.setHeaderField("Content-Length", String.valueOf(content.length)); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.IXMLReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.