How to modify a static value to variable value

how to change a static variable to no-static variable, the code you see is to validate an xml file, if I change this line
private static final String XML = "xml/laPartieWord.xml";to
String XML = "xml/laPartieWord.xml";I m getting error " Cannot make a static reference to the non-static field XML
import java.io.*;
import javax.xml.XMLConstants;
import javax.xml.transform.sax.SAXSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class ValidationWXS {
private static final String SCHEMA = "xml/laPartieWord.xsd";
String XML = "xml/laPartieWord.xml";
public static void main(String[] args) throws IOException, SAXException {
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema xsd = sf.newSchema(new File(SCHEMA));
Validator validator = xsd.newValidator();
SAXSource src = new SAXSource(new InputSource(XML));
try {
validator.validate(src);
System.out.println("Le document '" + XML + "' est VALIDE!!!");
} catch (SAXException e) {
System.out.println("*** Le document '" + XML + "' n'est pas valide ***");
e.printStackTrace();

basics of java..
private static final String SCHEMA = "xml/laPartieWord.xsd";
String XML = "xml/laPartieWord.xml";
put these inside main and remove the static of the first..
shanu

Similar Messages

  • How to modify a node value in a DOM tree?

    I have following code; it parses a XML file from a file and builds a in-memory DOM tree, but when I tries to modify one of the node value, it keeps telling me: oracle.xml.parser.v2.XMLDOMException: Node cannot be modified. How do I do it?
    // ==================================
    DOMParser theParser = new DOMParser();
    theParser.setValidationMode(false);
    InputStream theInputStream = myApp.class.getResourceAsStream("/test.xml");
    theParser.parse(theInputStream);
    XMLDocument theXMLDoc = theParser.getDocument();
    NodeList theNodeList = theXMLDoc.selectNodes("/root/child");
    for (int i = 0; i < theNodeList.getLength(); i++)
    theNodeList.item(i).setNodeValue("test");
    null

    You're trying to set the node value of an element, which cannot have a node value.
    You need to set the node value of the text-node child of the element instead.
    Or remove the current text-node child and append a new text-node child with the new value.

  • How to Modify Hierarchy Filed Values by using Import Manager

    Hi All,
    I have some lookup table values in my source file in 1st attempt I have updated successfully. But, after cross checks the same i found that hierarchy level are incorrect at the destination side.
    Source Hierarchy lookup values
    Item1
           Item 2
           Item 3
    Item4 
    Destination Hierarchy lookup values
    Item1
    Item 2
    Item 3
    Item4 
    Note: After Adding the Source filed hierarchy structure by selecting the  Add Branch as child opting in the value mapping area
    I am getting unique constraint Violated error message while importing the values.
    So, how can I update the Source Hierarchy fields structure to Destination Hierarchy Field structure?
    Thanks in Advance.
    Mahesh

    Hi Mahesh,
    While importing the values if you get the error unique constraint Violated, that means that the same value has been mapped twice.
    when you try to map the values of the hierarchy, NULL would have been automatically mapped.
    When you select all the records and do add branch as child, the same NULL would have been added and mapped again.
    If not with NULL, this could be the case with some other value.
    Just check if some value is added and mapped twice in your value mapping.
    This should solve your issue.
    Try and let me know the result.
    Regards,
    Sravan

  • How to modify an XML values using XSLT and Java

    Hi Friends,
    I wish to modify a simple xml to another xml using XSLT, please let me know what are the things i need to know to convert the XML to another XML.
    If somebody can give a sample code, it will be great...
    I wish to do the following sample conversion of XML
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <ROOT>
    <NAME>TEST1</NAME>
    </ROOT>so that the results look like below....
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <ROOT>
    <NAME>TEST2</NAME>
    </ROOT>Notice TEST1 is replaced with TEST2 in the 2nd XML, I wish to get that result...please help.
    Thanks and Regards,
    JG

    Thanks for your nice reply... do you have a sample code...

  • Modify the preference value of the default route

    Hi
    How to achieve the Below ? any configuration example?
    1)How to modify the preference value of the default route to be less prefered than OSPF External route
    2)how to redistribute the default route as type 2 external route
    3)how to redistribute the default route as type 1 external route
    thanks

    Hi Ibrahim,
    See below:
    1) Can you elaborate on this a bit? Can you explain, specifically, what your trying to accomplish? I don't think you can get a default route into the OSPF RIB that is not external as the default is injected as a Type-5 LSA (e1 or e2). If your talking about getting a router to use the OSPF learned default over the default router learned via some other source (e.g. static, BGP, etc), then it depends on the source because of the Administrative Distance when comparing the two defaults ( the one default learned via OSPF has AD=110, and the other default is AD=X, where X is the Administrative Distance assigned to the protocol).
    2) Use the "default-information originate metric-type 2" command under "router ospf" -- Note this is the default
    3) Use the "default-information originate metric-type 1" command under "router ospf" -- Note, you don't need this in Totally Stubby Area.
    4) For NSSA area you have to use the "area nssa <area_num> default information-originate metric-type <type>" router subcommand. Note your NSSA should have a Type-7 LSA for the default route
    Rate if helpful.
    Joe

  • BO Webi: How to populate a variable with the set of static values for Graph

    Hi All,
    I have the data: Order number, Order Date, processing time coming from the SAP Bex query in the below format:
    Order No    Order Date    Processing time (Days)
    1                 Jan-2011      4
    2                 Jan-2011      5
    3                 Feb-2011      6
    In BO webi report, I have to report the number of orders which were processed in <1day, <2days, <3days,...<10days in a graphical view. i.e., X-Axis:  <1day, <2days, <3days,...<10days(10 static buckets for the processing days)
    Y-Axis: Number of Orders.
    The graphical output should be like below:
    X-Axis: <1day, <2days, <3days,<4days,<5days,<6days,<7days,<8days,<9days,<10days
    Y-Axis: 0, 0,0,0,1,2,3,3,3,3  (count(Order No)) (Cumulative count)
    I am able to calculate the number of orders individually for each of the 10 buckets. But the problem i am facing is that I am not able to hold the 10 static bucket values in a variable to use it for the x-axis in the Graph, as these 10 static bucket values are not coming from the backend source.
    I would like to know if there is way to populate a variable(to use it for the X-Axis in the graph) with the set of 10 static values.
    Any help would be highly appreciated.
    Thanks,
    Leela

    Hi ,
    I think we can use the variable as X-axis in chart.. but Variable Qulaification should be Dimension.
    can you try this?.
    Using efasion universe
    1) Select month and Sold at (unit price) , then run the query
    2) create the variable V_Month ==If [Month]=1 Then "Month1" Else "Month2"  (Note = Variable Qulaification should be Dimension)
    3) Create the variable V_Sum= sum (Sold at (unit price))
    4) create another variable V_Cumulative_Sum==[V_Sum]+Previous([V_Sum])
    Now add V_Month and V_Cumulative_Sum in table , then convert to chart.. now you can add the variable V_Month as X-axis of the chart.
    Hope this will help:)
    Thanks
    Ponnarasu K

  • How i pass table column  value to string variable or return to java applete

    Hi Master,
    How do I pass a table column value into string variable. See my code below:
    import java.sql.*;
    public class Waheed {
    public Waheed() {
    public static void main (String args [])
    String s = "9 23 45.4 56.7";
    System.out.println ("going for connection");
    // DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select accid from accbal");
    System.out.println ("going for connection");
    while (rset.next())
    s= rset.getString("accid"); this line give me error
    System.out.println (rset.getString("accid"));
    System.out.println (s);
    catch(Exception e){
    e.printStackTrace();
    This line give me an error:
    s= rset.getString("accid");
    s is string variable
    Plese give me an idea how I can pass accid in s variable.
    Thanks.
    Aamir

    See the code sample in the following thread (try using upeercase).
    JDBC  connection
    Kuassi

  • How to set a object value bound to a session to JavaScript variable

    In a JSP, I store an object value in a HttpSession and I also write a Javascript function to display something on the screen. I need to use the Javascript function to display the object value which is stored in the session. How to set the object value to variable of the JavaScript function. Thanks.

    I write a class JavaScriptHelper to convert the object value to variable of the JavaScript;
    1.get the data to a javabean from database;
    2.convert the data to variable of the JavaScript as a String ;
    3.store the object in a HttpSession or Httprequest ;
    4.use in Jsp get the String (variable of the JavaScript )
    YourBean bean = (YourBean) request.getAttribute("model");
         if (bean != null) out.println(bean .getJsCode())
    convert function,(this is only for the matrix):
    public static String formatJsCode(Vector vector) {
    String sJsCode = "";
    //get js head
    sJsCode = getJsHeader();
    //define js array;
    sJsCode += "var data=new Array();\n";
    Vector v = null;
    String sTemp = "", sLine = "";
    for (int i = 0; i < vector.size(); i++) {
    v = (Vector) vector.get(i);
    sLine = "";
    for (int j = 0; j < v.size(); j++) {
    sTemp = (String) v.get(j);
    //replace " to \"
    sTemp = sTemp.replaceAll("\"", "\\\\\\\"");
    //escape Html Tag
    //sTemp = StringUtil.escapeHTMLTags(sTemp);
    //replace \r\n to <br>
    sTemp = sTemp.replaceAll("\r\n", "<br>");
    if (j != 0)
    sLine += ",";
    sLine += "\"" + sTemp + "\"";
    sJsCode += "data[" + i + "]=new Array(" + sLine + ");\n";
    //get js foot
    sJsCode += getJsFooter();
    return sJsCode;
    public static String getJsHeader(){
    return "<script language=\"JavaScript\">";
    public static String getJsFooter(){
    return "</script>";
    }

  • How to get all the values of a variable with F4 with checkboxes to select

    Dear Experts,
    After Executing a query by giving let 3 values(Out of 10 Values) to a variable.
    To give 2 more input values to the same variable(i.e.,total I wanted to give 5 inputs this time ),after refreshing the query,for that variable if I click F4, I am seeing the historical values(i.e.,3) and remaining 7 values also But with out any Check Boxes besides them to select the 2 inputs.
    In the same F4 Screen, If I click all values(an Icon at The bottom),then also Im seeing but no check Box.
    I hve tried by deleting the Delete Personalization also,but no use.
    Please tell me How to get all the values with F4 with check boxes to select ,whatever I want??
    Thanks in advance

    Take a look at the InfoObject and go to the Business Explorer tab. If the 'Query Def. Filter Value Selection' is set to 'Only Values in InfoProvider', you're only going to get the values in F4 that exist in the InfoProvider, not everything in the Master Data. This would need to be changed to the value of 'Values in Master Data Table' if you want it to show everything possible when F4 is chosen.
    Likewise, you're going to need to look at the query and go to the Advanced tab for the InfoObject. Make sure that the radio button for 'Values in Master Data Table' is selected. If not, then you should change that selection.

  • How to Assign a Field value to a Variable??

    Dear All,
    Kindly let me know, if <b>"HOW TO ASSIGN A FIELD VALUE TO A VARIABLE????"</b>
    Situation is, we have a Field (OBJK-TASER) in which 2 tables (SER01 & SER03) are stored. And we want to access names of the Tables which are there in the field(TASER) in  (OBJK) table  to a variable and then passing that variable to the sql query as a table name to get data accessed dynamicaly.

    try this
    select TASER from OBJK into table it_table.
    loop at it_table.
    select field1 field2 from (it_table-table) into table it_fields.
    endloop

  • How can I obtain the value of a database column in a JSP variable ?

    How can I obtain the value of a table column in a JSP variable?
    For example the <jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>
    I need to have it in a variable like this:
    <% String cnt=<jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>; %>
    But it is not workig this way.
    Please help me to obtain the value.
    I am using JDev RC2.
    Thanks.

    Try something like
    String cnt = c1.getRowSet().getCurrentRow().getAttribute("Cont").toString();
    -A
    How can I obtain the value of a table column in a JSP variable?
    For example the <jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>
    I need to have it in a variable like this:
    <% String cnt=<jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>; %>
    But it is not workig this way.
    Please help me to obtain the value.
    I am using JDev RC2.
    Thanks.

  • How I can save the value of a variable in a database?

    hello,
    how I can save the value of a variable in a database? I need to keep the # of times you press click animation. to know how many times it has been seen.
    I connect to msql database, using php, javascript, ajax and jquery, but not how to save the variable counter clicks from adobe edge Animate
    appreciate your help so I can connect to the database from adobe edge animate.
    thank you very much
    Luis Felipe Garcia
    [email protected]

    Hi, all-
    This isn't an Animate-specific issue, but I thought I'd take a stab at it anyway.  As with anything else on the web, you need to have a server script to handle incoming data, so it's all back end work.  Your page will need to call that script and provide parameters to that script that it can read.
    The easiest way I can think of to do this (and this is all highly theoretical, so please make sure it's secure before you implement it) is to create a 1px div that has visibility off.  Whenever you click, you can load your URL in that div, which then increments your counter on your db.
    Hope that helps inspire some interesting solutions!
    -Elaine

  • How to save a new value for Set command variable

    I am using SET [variable = [String]] to update Set variable. It works fine. But when I restart MSDOS Prompt, I get old value for variable.
    How to save a new value for SET command variable?
    I am using Windows XP.

    And this has to do with java how?

  • How to show static values in h:selectOneListbox

    Hi
    i would like to show static values in <h:selectOneListbox>
    how do i that ??
    <managed-bean>
    <managed-bean-name>Options</managed-bean-name>
    <managed-bean-class>java.util.ArrayList</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <list-entries>
    <value>val1</value>
    <value>val2</value>
    <value>val3</value>
    </list-entries>
    </managed-bean>
    or some how i define a <managed-property> ??
    <managed-property>
    <property-name>options</property-name>
    <property-class>java.util.ArrayList</property-class>
    <list-entries>
    <value>val1</value>
    <value>val2</value>
    <value>val3</value>
    </list-entries>
    </managed-property>

    Hi Swetlin,
    I have this format in the main window.
    textaaaaaaaaaaaaaaaaa
    textfffffffffffffff
    123
    1234
    1234
    5667
    1234
    textweeeeeeeeeeeeeeeeeeeeee
    texttryrtyrtuyrturtur
    now when i am doing as you suggested
    the last texts are coming in the next page.
    What i want is to show overflow of numeric data in next page and the remaining last text should remain as it is in the first page only.
    i mean
    textaaaaaaaaaaaaaaaaa
    textfffffffffffffff
    123
    1234
    1234
    5667
    1234
    textweeeeeeeeeeeeeeeeeeeeee
    texttryrtyrtuyrturtur
    and in the next page
    4567
    4568
    8790
    Thanks and regards
    Mave

  • How to use any cell as an static value

    Hello,
    I don't know if it is possible to use any cell as an static value, same as $ in excel, E$2$.
    I need to divide all the values of a table with a unique value of a cell. In excel is when you put $E$2, this make a cell an static value.
    This is possible en Web Intelligence?
    Best Regards
    SU

    Hello Srivatsa,
    Thanks for your response. An example could be the sum and divide by the sum (to calculate participation) of a table.
    2
    2
    3
    S=7
    Then I want to divide 2 by 7, 2 by 7 and 3 by 7. The Sum (in this case 7) is the static value, how can I use it for operate all the registries?
    To have,
    0.29
    0.29
    0.43
    Thanks & Regards
    SU

Maybe you are looking for

  • My iphone is connecting to wifi but then disconnecting from it and not allowing me to do anything

    i have an iphone 4s version 8.1.2 when i used the iphone it worked perfectly then i go to use it later that day i have connected to my wifi and then my iphone disconnectes and doesnt work anymore on any apps as it tells me to sign into apple id and w

  • Why can't I upload Adobe CS3 on another Mac with the same operating system 10.5.8?

    I purchased a MacBook Pro in 2008 and had it installed with Adobe CS3 at the Apple Store. I don't believe I was given any CDs or serial numbers to take home. I still have all the documentation for my other programs I installed myself, like Logic, Fin

  • Mouse wheel scroll event ON CHANGE?

    Colleagues, Very simple question: How to get mouse wheel scrolling event on change? Without polling? Is Acquire Input Data.vi the only way to get it? Thank you in advance, Andrey.

  • Add File Attachment to CI using Powershell

    Hi Everyone, does sombody have a sample Powershell script of how to add an file attachment to a CI ? Found a few c# samples, but need to use Powershell. I want to add Icon files to a CI as File attatchment. Thanks

  • Changing sound card

    I have laptop with external sound card  and I would like to use the external one when its connected and the internal one when its not. What have I done I made simple udev rule which switches the default sound card like this: su - $USER -c 'asoundconf