Validation of a String

I'm pretty new to Java. Could you tell what judgment error I make here?
I'm trying to see if the String contains letters or spaces, otherwise, it return false.
It return false in every situation. :|
String var = "Bla";
for(int i=0; i<var.length();i++)
            char c = var.charAt(i);
            if( ! (Character.isLetter(c)) || (!Character.isWhitespace(c)))
                              return  false;
}Edited by: abcdriver on Sep 23, 2009 11:11 AM

You look at the first character. Let's suppose it's the letter "A".
Is it a letter? Yes, it is, so the first half of the expression is false. Is it whitespace? No, it isn't, so the second half of the expression is true. And since "false || true" is true, your code will execute the "return false" line.
You want to return false if the character isn't a letter and if the character isn't whitespace.

Similar Messages

  • Validation For Date,String and Date in a reports Region

    Apex 4
    Good day to all apex users How do I validate a apex_item.text if the value is string the user can only input a string value if it is number then the user can input numbers only and if it is a date the user can only input a date values?

    APEX_ITEMS are not part of the default apex gui... In fact they are just functions which returns html.
    You can however do some stuff with the attributes parameters. You can find some cool stuff over here: Re: Validation For Date,String and Date in a reports Region
    If you want apex validation you need to create a page validation and loop over your apex_items with apex_application.g_f0x
    Br,
    Nico

  • How can I achieve good validation check on String Input?

    This is a portion of my code,am just starting to learn java programming.public class Thickness
    public Thickness(){
    public static void main(String[]args)
    int thickness=0;
    double length;
    String strL;
    strL=JOptionPane.showInputDialog(null,"Enter the length of your building:");
    length=Double.parseDouble(strL);
    while((length<4)||(length>12))
    JOptionPane.showMessageDialog(null,"Error!This Program only works for"+"\n"+"Building whose Length lies Between 4m and 12m:");
    strL=JOptionPane.showInputDialog(null,"Enter the length of your building:"+"\n"+"Note that Minimum Length is 4m:"+"\n"+"Maximum Length is 12m:");
    length=Double.parseDouble(strL);
    So that if the user enters a length outside the specified range of values the error message,"Error!This Program only works for"+"\n"+"Building whose Length lies Between 4m and 12m:" will be displayed and the program will prompt the user to re-enter the length.
    This validation check works perfectly as long as the input is double or integer,What I need now is to include a check to display an error message if the user inputs nothing or supplies a character (other than integer or double)as input.I want to be able to customise the error message,like having(JOptionPane.showMessageDialog(null,"Error!This is an invalid input:")).
    I know the compiler will also generate an error message if the user inputs a String instead of a double,but I want to be able to achieve this instead of the compiler doing it for me.
    pls I will be very happy if you can assist me with the code that would perform this check.
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    length=Double.parseDouble(strL);Read the API. It tells you that it can throw some kind of exception if the input isn't valid. Then it's up to you to properly handle the exception. If you don't handle it, the VM does by displaying the exception and terminating the app.
    API docs:
    http://java.sun.com/j2se/1.5.0/docs/api/index.html
    Tutorial on exceptions:
    http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html

  • Validating Char. & Strings

    Hello,
    I am a novice programmer and my program does not check for strings and numeric characters. Below is my program, please give me some feedback, as soon as possible. Thanks a lot
    Martin
    import javax.swing.JOptionPane;
    import java.text.DecimalFormat;
    public class GradeWatch6{//start of class definition GradeWatch
         public static void main ( String args[] ) {//start of main method
              //string declarations
              String firstname="";
              String secondname;
              String studentid;
              String midtermgrade;
              String finalgrade;
              String listings="";
              String option;//variable used to receive user's option <-1>//<0>
              //character declarations
              char actualgrade;//letter grade assigned to total points earned
              char lettergrade=0;//assignment of a letter grade
              //integer declarations
              int loop=0;//(this will be converted fr. option//will compare result)
              int studentid_int;
              int midterm_grade=0;
              int final_grade=0;
              double midterm_gradevalue=0;//point calculations
              double final_gradevalue=0;//point calculations
              double total_gradevalue=0;//total points possible out of 100
              do
              //input dialogs (5)
              boolean firstnamecheck=true;
              while (firstnamecheck=false){
              firstname = JOptionPane.showInputDialog("Enter The Student's First Name: ");
              if (!Character.isLetter(firstname.charAt(0)))
                   firstnamecheck=false;
              for (int j=1;j<firstname.length();j++)
                   if (!Character.isDigit(firstname.charAt(j)))
                             firstnamecheck=false;
                             System.out.println(""+firstnamecheck);//printing on black screen
                             secondname= JOptionPane.showInputDialog ( "Invalid Entry!" );
              secondname = JOptionPane.showInputDialog("Enter The Student's Last Name: ");
              studentid = JOptionPane.showInputDialog("Student Id is the Student's Social Security Number.\nEnter The Student's ID #: ");
              studentid_int= Integer.parseInt(studentid);
              /*Validates student id so that it can only receive a 9 digit number,
              no negative values, and only alows integer input/
              while ( (studentid.length()!=9) ||(studentid_int<0) )
                        studentid= JOptionPane.showInputDialog ( "Invalid Entry! \n Student Id is the Student's Social Security Number.\nPlease Re-Enter Student Id: ");
                        studentid_int= Integer.parseInt(studentid);
              midtermgrade = JOptionPane.showInputDialog("This is worth 40% of Student's Grade.\nEnter Mid-term Grade: ");
              midterm_grade = Integer.parseInt( midtermgrade);
              while ( (midterm_grade < 0) || (midterm_grade > 100) )
                        midtermgrade=JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter Mid-term Grade: ");
                        midterm_grade = Integer.parseInt( midtermgrade);
              finalgrade = JOptionPane.showInputDialog("This is worth 60% of Student's Grade.\nEnter Final Grade:");
              final_grade= Integer.parseInt( finalgrade);
              while ( (final_grade<0) || (final_grade > 100) )
                        finalgrade= JOptionPane.showInputDialog ("Invalid Entry!\nA grade entered must be between (0-100).\nPleae Re-Enter the Final's Grade: ");
                        final_grade= Integer.parseInt( finalgrade);
              DecimalFormat twoDigits = new DecimalFormat( "0.00");
              //calculations for grades
                   //midterm is worth 40% of grade
              midterm_gradevalue = midterm_grade * .4;
                   //final is worth 60% of grade
              final_gradevalue = final_grade * .6;
                   //calculates the final grade for the student in class
              total_gradevalue = midterm_gradevalue + final_gradevalue;
              //if else statement for grade allotment
              if (total_gradevalue>=90)
                   lettergrade='A';
              else if (total_gradevalue>=80)
                   lettergrade='B';
              else if (total_gradevalue>=70)
                   lettergrade='C';     
              else if (total_gradevalue>=60)
                   lettergrade='D';     
              else if (total_gradevalue>=50)
                   lettergrade='F';          
              //Shows Output of Information Entered (5) of one student               
              JOptionPane.showMessageDialog
                   (null, "Student: " + secondname + " , " + firstname +
                        "\nMid-Term Points Earned: " + midterm_gradevalue +
                        "\nFinal Points Earned: " + final_gradevalue +
                        "\nTotal Points Earned: " + total_gradevalue +
                        "\nGrade Assigned: "+ lettergrade,
                        "\n STUDENT ID #: " + studentid,
                        JOptionPane.PLAIN_MESSAGE);
              /*Askes user whether or not to input an additional student*/
              option = JOptionPane.showInputDialog("Enter < 0 > to input a student. \nEnter < -1 > to quit. ");
              //converts string input into integer loop     
              loop = Integer.parseInt( option );
         listings +="Student ID #: " + studentid +
                   "\n [ " + secondname + ", " + firstname + " ] " +
                   "\n Midterm Points Earned: " + midterm_gradevalue +
                   "\n Final Points Earned: " + final_gradevalue +
                   "\n Total Points Earned: " + total_gradevalue +
                   "\n**********Grade Assigned: "+ lettergrade + "\n";
              } while ( loop !=-1);     
              JOptionPane.showMessageDialog(
                   null, listings,
                   "Class Results: ",
                   JOptionPane.PLAIN_MESSAGE);
              System.exit ( 0 );
         }//end of programming method
    }//end of class definition

    You didn't indent your code, so that makes it hard to read, and there's a lot of it that has nothing to do with what your question might be. But you want feedback? Well you are "validating" the student's first name in a strange way. A letter followed by any characters that aren't digits -- for example, "a++?" would pass. And that validation will fail if an empty string is provided, because "charAt(0)" assumes there is at least one character. I would just check it isn't blank. And I would provide a meaningful error message. "Invalid Entry" is unhelpful as it doesn't tell the user what is wrong with the input.

  • Chinese Letter validation in a string

    Hi Experts,
    I am facing a problem while validating a string for chinese characters in it.
    If the string contains chinese letters, then i need to pass a text message into the string.
    If the string contains both english and chinese, then i need to erase the chinese part and print only english.
    I have been using the below logic for this purpose.
    The Below logic performs well if the string has value like " #$%^PAVAN", it will print as PAVAN.
    But fails to validate the string if it contains 'PAVAN@#$%%".....
    (Here, special characters are to be assumed as chinese...)
    The logic is as follows.....
    data: wa_vndr_data type ty_vndr_data.
    data: v_string1 type string.
    DATA: V_NUM TYPE I VALUE 1,
    V_LEN TYPE I,
    V_TEMP TYPE I.
    data: text-022(100) type c value 'ABCD....Zabcd....z1234567890'
    DATA: V_ENGLISH(35).
    loop at i_po_dtails_po_inv into wa_po_dtails_po_inv.
    v_num = 1.
    v_string1 = wa_po_dtails_po_inv-txz01.
    if v_string1 CA text-022.
    v_len = strlen( wa_po_dtails_po_inv-txz01 ).
    do v_len times.
    if wa_po_dtails_po_inv-txz01(v_num) ca text-022.
    v_temp = v_num - 1.
    v_english = wa_po_dtails_po_inv-txz01+v_temp(*).
    write v_english to wa_po_dtails_po_inv-txz01 left-justified.
    modify i_po_dtails_po_inv from wa_po_dtails_po_inv.
    EXIT.
    ENDIF.
    V_NUM = V_NUM + 1.
    ENDDO.
    else.
    wa_po_dtails_po_inv-txz01 = text-023. "'Material Description in Chinese'.
    modify i_po_dtails_po_inv from wa_po_dtails_po_inv.
    ENDIF.
    clear: v_string1, v_temp, v_len, v_english.
    endloop.
    Please Help me to know how to validate if the string has text like 'PAVAN#$%^^*'..??????   (English- chinese)....
    It works fine for 'Chinese-English'...ex: $%^^&PAVAN....
    Help me Friends......
    Regards
    Pavan

    The code below illustrates how it can be done. It draws two TextFields, reacts to input and writes number of times letter was inputted.
    Just paste it on a timeline in a new FLA
    var inputText:TextField;
    var feedbackText:TextField;
    var myletter:String = "e";
    init();
    function init():void
              inputText = new TextField();
              inputText.defaultTextFormat = new TextFormat("Arial", 12);
              inputText.type = TextFieldType.INPUT;
              inputText.multiline = inputText.wordWrap = false;
              inputText.border = true;
              inputText.width = 200;
              inputText.height = 22;
              inputText.x = inputText.y = 20;
              feedbackText = new TextField();
              feedbackText.defaultTextFormat = new TextFormat("Arial", 12, 0xff0000);
              feedbackText.multiline = feedbackText.wordWrap = false;
              feedbackText.width = 200;
              feedbackText.height = 22;
              feedbackText.text = "letter " + myletter + " was entered 0 times";
              feedbackText.x = inputText.x;
              feedbackText.y = inputText.y + inputText.height + 10;
              addChild(inputText);
              addChild(feedbackText);
              inputText.addEventListener(Event.CHANGE, onInput);
    function onInput(e:Event):void
              feedbackText.text = "letter " + myletter + " was entered " + inputText.text.match(new RegExp(myletter, "gi")).length + " times";

  • Numeric Validation of a String

    Hello, Im writing a program asking for users to enter a number between 1 and 255, how can i go about checking to make sure the number entered is numeric.
    I was thinking the Character.isDigit method, but am unsure. Im fairly new at this, any help would be appreciated.
    Gabe

    Use the code given below to make your textfield accept only numeric values.
    textField.setDocument( new TextFieldVerifier() );
    class TextFieldVerifier extends PlainDocument {
    public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {
    boolean valid = false;
    if ( str == null ) {
    return;
    String old = getText( 0, getLength() );
    /* insert the new string at the given offset, into the old string */
    String newStr = old.substring( 0, offset ) + str + old.substring( offset );
    try {
    /* check if the new string is a valid integer */
    Integer.parseInt( newStr );
    valid = true;
    } catch ( NumberFormatException ne ) {
    /* invalid, if not an integer */
    valid = false;
    Toolkit.getDefaultToolkit().beep();
    if ( valid ) {
    super.insertString( offset, str, attSet );
    }

  • Validating an XML string

    What is the most efficient way to validate an XML string with about 25 elements?
    I was going to do something like this, but I am not sure if its the most effienct way to
    validate the elements being passed.
    Basically, I want to put a message on a queue if one of the elements are null that is passed.
    Any suggestions, please let me know.
    Thanks!
    public String validateXmlString(String validate) throws Exception
         DocumentImpl docXml = null;
         docXml = new DocumentImpl();
         docXml = XMLHlper.loadXMLFromString(validate);
         documentType = XMLHlper.getElementTextByName(docXml,"test:DOCUMENT_TYPE");
         indexClass = XMLHlper.getElementTextByName(docXml,"test:INDEX_CLASS");
         .//about 25 elements
         if(documentType == null)
              putMessageOnQueue("Error message");
         else if(indexClass == null)
              putMessageOnQueue("Error message");
         .//for all 25
    }

    Use a List of element names and a simple iteration. Enqueue if any result is null and break out of the loop.
    ~

  • Content validation of a String

    If I have to check if all characters in a string are digit or all characters are alphabetic is there is an API which does these checks on a String. I know Character class has all functions but I will still have to iterate over all characters in the string.
    Thanks in advance

    I guess you can do some kind of arithmetic and if it throws a numberformat exception then you know that not all the characters in the string are digits so thats maybe how you would check for all numbers.
    To check for all characters, String also has a method to turn the string into an array of chars. You can iterate through the array with a loop then to test if its all chars. "EachString".toCharArray()

  • Looking for Regex library to generate valid/invalid String

    Hi-
    My project use MDA (domain object are specified from an XML file) and we generate the domain, transfer object, DAO, services and controllers, flex controller, flex services and flex .as files.
    Now we want to generate the Unit Test Case. Of course, we can't cover everything. What we can cover is most domain fields validation, such as length, max value, min value and perhaps regex matching.
    So, what I'm looking for is a library that allow me to generate a valid and invalid String based on a given Regex pattern. So far, I have found Google Xeger, which only allow me to generate valid String based on the Regex pattern. I'm also looking for a library that will allow me tpo generate invalid String for a given regex.
    Anyone know of such library. I really don't want to parse the Regex to come up with an invalid String (as I am not strong in Regex).

    T.PD wrote:
    915826 wrote:
    My project use MDA (domain object are specified from an XML file) and we generate the domain, transfer object, DAO, services and controllers, flex controller, flex services and flex .as files.
    Now we want to generate the Unit Test Case. What do you think you're going to check with a <b>generated UnitTest</b>?
    The only thing you can check is the that your Code Generator generates a bunch of Classes (the Tests) the same way like another bunch of Classes (the production code). So unless you wrote the Code Generator: What does a generated Test tell you about the corerectness of your Domain Model?
    IMHO generated tests are nothing more than a placebo...
    bye
    TPDYou are correct, but it probably doesn't matter. Plenty of people create (or in this wacky case: generate) unit tests because it is company policy that unit tests are there, not because you write them to support your development efforts.
    Example: the company I work for has a whole legion of "PL/SQL developers". In other words: people who write endless amounts of SQL procedures. Company policy goes in effect: all code should be covered by unit tests. Result: unit tests that insert a record and then check if the record is inserted. Unit test that updates a record and then checks if the record is updated. I try to explain to such people: you can be pretty sure the database works, you don't need to unit test it. Blank stares.

  • Identifying string validity

    hi i have a problem creating a class for identify string validity
    example a string would be invalid if
    String xx = "abcdef'abde";
    theres an '
    how would i detect any illegal expressions in a string

    It all of course depends upon what you define as "invalid". Having said that, for great flexibility in checking strings, matching strings, replacing substrings, etc... look into Java's implementation of Regular Expressions. This is a large and complex subject requiring quite a bit of effort if you are new at it, but the effort pays off in the long run. Have a look here
    [http://java.sun.com/docs/books/tutorial/essential/regex/index.html]

  • How can I valid the path in different devices

    I wrote a program using the PDA module months ago, I was now told to modify to make it robust in the sense that, the program with ‘run’ in any PDA.
    There are several directories that are common with PDA’s, such as Storage, Storage Card, SD Card, MMC-SD Card e.t.c.
    I previous used a Build Path to create the path I wanted that looked like this:
    "Storage Card/S345220107.txt" where S345 is the user id and 220107 is the date from a time stamp VI.
    What I want to do is to find a way of knowing what directory a PDA has somehow.
    An algorithm of it will look some thing like this:
    String aPath;
    String pathToUse;
    String[ ] path = new Path[4]; // An array
    path[0] = "Storage" // First index
    path[0] = "Storage Card"
    path[0] = "SD Card"
    path[0] = "MMC-SD Card"
    public void setPath( String Path) {
    aPath = path;
    public String getPath( ) {
           return aPath;
    I will use a For Loop to set the path, but what I don’t know is how to test each one.
    In Java I can say:
    if( aPath.equals(Storage)) {
            pathToUse = "Storage" + userId + date + ".txt";
    System.out.println("valid Path");
    else if ( aPath.equals(Storage Card)) {
                pathToUse = "Storage" + userId + date + ".txt";
                System.out.println("Valid Path");
    else if ( aPath.equals(SD Card)) {
                pathToUse = "Storage" + userId + date + ".txt";
                System.out.println("Valid Path");
    else if ( aPath.equals(MMC-SD Card)) {
               pathToUse = "Storage" + userId + date + ".txt";
               System.out.println("");
    else {
              System.out.println("path not valid");
    The pathToUse string is then used as the input to the Open/Create/Replace File VI.
    Any ideas guys

    Hi
    I created the VI you sent, and for the first version, when there is a Match, it does not place the found folder name in the Start Path or the Current Path Indicators. So the path created is not correct
    I then tried a second version called PathSearch1Vi and added a few things for it to do what I wanted. Please run both and see if the second version is OK or what should be added to the first version.
    Thanks you very much for your help.
    Attachments:
    PathSearch.vi ‏25 KB
    PathSearch1.vi ‏28 KB

  • Insering quoted string in a table

    i have a string liek the following in a variable
    hello'786'
    Please tell me how to insert this into a table

    > But these data is coming from a file
    i am fetching it in a variable.
    I have to insert it
    pls tell me how
    Just insert the variable. That simple.
    The variable contains a string. The string contains quotes. But you deal, at INSERT time, with the variable - not the actual contents of the variable. Oracle will grab and insert that contents just fine, provided that is is of a valid type. And quotes are valid in a string.
    So...create or replace procedure ....
       line varchar2(4000);
    begin
      -- string has been read from file into line, and this now
      -- has to be inserted into the table foo
      insert into foo ( text_line ) values ( line );
    end;

  • String usage in interactive PDF on R/3

    Hi there,
    I have set up an interactive PDF which uses a table of strings. The output is fine, but once the data has been entered into the form and that the form is uploaded into the system, I get an error on the string table :
    XML - Error in ABAP format in node {} ITEM (Typ Element).
    The this is that in abap the table type is set as : ZT_XXX and line type equivalent to ECM_STRING.
    In the XML data being sent back form the transformation id instruction is ZT_XXX - DATA - ITEM. It seems that the transformation id cannot get the String back into the table???
    Has anyone been working on an identical problem?
    Nicolas.

    hi
    did you solve this problem?
    i'm having trouble using Strings at all in my generated XML Schema. the generated XML are not valid for the String-attibutes.
    cheers
    tom

  • Xsd validation of an xml.. another program...

    hiii......this is another program ..........
    please see the problem with the code..
    package com.pgs.tma;
    import java.io.*;
    import javax.xml.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import java.io.IOException;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    public class valid {
         static final String JAXP_SCHEMA_SOURCE =
                        "http://java.sun.com/xml/jaxp/properties/schemaSource";
         public static void main(String args[]) throws IOException, SAXException, ParserConfigurationException
         if(args.length < 2)
                             System.err.println("usage is:");
                             System.err.println(" java -jar tips.jar -validatedom "
                                                      + "xml.xml xsd.xsd");
                             return;
         System.out.println(args[0]);
         System.out.println(args[1]);
         File input = new File(args[0]),
                             schema = new File(args[1]);
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(true);
              factory.setValidating(true);
         System.out.println("1");
         try{
              System.out.println("2");
              factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
    "http://www.w3.org/2001/XMLSchema");
              System.out.println("3");
              factory.setAttribute(JAXP_SCHEMA_SOURCE,"C://TWWorkspace//TMA//input//schema.xsd");
    //     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",schema);
         System.out.println("4");
         catch(IllegalArgumentException x)
                   System.out.println("5");
                   System.err.println(" DOM parser is not JAXP 1.2 compliant"+x);
         System.out.println("6");
         Document doc = null;
         try{       
              DocumentBuilder parser = factory.newDocumentBuilder();
              //factory.setErrorHandler( myErrorHandler );
              doc = parser.parse(input);
              System.out.println("7");
         catch (ParserConfigurationException e){
              System.out.println("Parser not configured: " + e.getMessage());
         catch (SAXException e){
              System.out.print("Parsing XML failed due to a " + e.getClass().getName() + ":");
              System.out.println(e.getMessage());
         catch (IOException e){
              e.printStackTrace();
         System.out.println("end of program");
    the error message is:
    C:\TWWorkspace\TMA\input\input.xml
    C:\TWWorkspace\TMA\input\schema.xsd
    1
    2
    3
    5
    DOM parser is not JAXP 1.2 compliantjava.lang.IllegalArgumentException: http://java.sun.com/xml/jaxp/properties/schemaSource
    6
    Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
    set, which is probably not what is desired. Parser will use a default
    ErrorHandler to print the first 10 errors. Please call
    the 'setErrorHandler' method to fix this.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=3: cvc-elt.1: Cannot find the declaration of element 'shiporder'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=4: cvc-elt.1: Cannot find the declaration of element 'orderperson'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=5: cvc-elt.1: Cannot find the declaration of element 'shipto'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=6: cvc-elt.1: Cannot find the declaration of element 'name'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=7: cvc-elt.1: Cannot find the declaration of element 'address'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=8: cvc-elt.1: Cannot find the declaration of element 'city'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=9: cvc-elt.1: Cannot find the declaration of element 'country'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=11: cvc-elt.1: Cannot find the declaration of element 'item'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=12: cvc-elt.1: Cannot find the declaration of element 'title'.
    Error: URI=file:C:/TWWorkspace/TMA/input/input.xml Line=13: cvc-elt.1: Cannot find the declaration of element 'note'.
    7
    end of program

    I see you problem but the strictness of XML is essential. One has learned from of HTML - each browser trying to fix and show the stuff in spite of, say, invalid tags. To blow up at the first error is a compliant (and maybe desired?) behaviour.

  • How to handle user entered data validation

    Hi,
    In my page i have three fields
    Empname (String)
    Empnumber (Number)
    DOB (Date)
    These fields are mapped to VO which are mapped to EO.
    When user enters string in Empnumber field then it will throw user following Error "Cannot create an object of type:oracle.jbo.domain.Number with value hghfg"
    I want to display above Error in user friendly fashion.
    Where to do this and How to do this?
    And i have one more question
    can we handle all the exceptions in seter method of EOIMPL?
    -Thanks
    Mithun

    Sumit,
    I have set 'Disable Client Side Validation' in the property inspector true for submit button. Added below code for validation
    In CO
    String lb_flag= (String)am.invokeMethod("validateRVSize",prm1,prmType1);
    In AM
    public String validateRVSize(String val)
    String values = "1234567890' ";
    for (int i=0; i < val.length(); i++)
    if (values.indexOf(val.charAt(i)) < 0)
    return "false";
    return "true";
    but what i have observed is control is not at all coming to process form request. it is doing it's validation in processformdata itself, i suppose.
    because no statement is getting printed if i had entered characters in number field.
    -Mithun

Maybe you are looking for