I m not able to create xml file in Java Project

hi all,
I have created one java project just to try with Ant Builder. I have created one class inside it. and now i m creating an XML file inside that project.
But as soon as i try to create the File -> New -> File and give the .xml extention of the file this gives error into the project.
Will you suggest me the solution for that?
Thanks in advance.

Assuming that you are facing this problem in NDS, here is the solution.
Go to Windows--> Preferences --> WorkBench -->File Associations
In the File Types list select *.xml
This will display the default associated XML editor as
XML Editor(default) in the bottom list box.
Click on add button near the bottom list box and select Text Editor, click Ok.You will see one more entry in the list box as "Text Editor".
Select this entry and click on the default button.
Click Ok and close the preferences dialogue.
Now create a new xml file.You wont see the error this time.
Please note that this will treat all simple xml files you will create as TEXT Files and always open with Text Editor.You can override this behaviour with right click on the file and select appropriate editor from the "Open With" context menu.
The error you are talking about is because the XML editor tries to check well-formedness and basic syntax rules for the file that you newly created, actually is a noce feature of the IDE.
Rgds,
Amol

Similar Messages

  • Creating XML file from Java Bean

    Hi
    Are there any standard methods in Java 1.5 to create XML file from java bean,
    i can use JAXB or castor to do so,
    But i would like to know if there is any thing in java core classes,
    I have seen XMLEncoder, but this is not what i want.
    Any ideas
    Ashish

    Marshall JavaBean to an XML document with JAXB or XMLBeans.

  • Not able to open XML file in the application server..........

    Hi,
    I have downloaded a XML file to the application server.....
    File is created but i am not able to open the file there....
    Plz advice ....how to open it.....
    Regards.

    Use Notepad. Drag and drop in notepad.
    Aman

  • Not able to create EAR file for WAR file extracted project

    Hi Experts,
    I am trying to import a WAR file, make changes to the project and create an EAR file for the same. I am not able to remove import
    errors despite of adding required jar files to it.
    Also, I am not able to create an EAR file for the same.
    I have copied the steps here with screen shots. Below are the steps :
    Import WAR file in NWDS 7.3 – Enterprise Portal perspective
    Select WAR file to create WAR and EAR project for it.
      Project created with import errors.     e.g – com.sapportals.portal.prt*
    Found jar file from Class – target jar file table. 
    e.g – for Class com.sapportals.portal.prt.resource.IResource needed jar file is tc~epbc~prt~api.jar
    Copied required jar files in WEB-INF -> lib folder.
    Configure Build path and Add External jars.
    Portalapp file screen shot
    I think errors should go now, but they still exist.
    Next I right click on WAR project and tried updating related EAR project.
      Next, Export EAR file from EAR project.
       I have tried both EAR types.
    But EAR file is not created.
    Please help me in removing the errors.
    Thanks in advance :-)
    Anubha Pandey

    Hi Anubha,
    I feel that you're missing JAR dependencies and hence not able to resolve the above import errors.
    Please go through the below thread for the AFP Masthead customization and follow the same:
    How to download and change AFP Masthead on SAP Portal 7.3
    Hope, this will help!!!
    BR,
    Anurag

  • Create XML file from java

    Hi all i am working to create a XML file using java can any one show me some sample code how to do so

    All I suggested was to insert a single line ("X.serialize(root);") into your code. Anyway, here's a ready-to-compile source code based on yours. This code utilizes the Xerces-J class library.import java.io.File;
    import java.io.FileWriter;
    import org.apache.xerces.dom.DocumentImpl;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    import org.w3c.dom.Element;
    public class Test {
      public static void main(String[] arguments) {
        FileWriter out;
        DocumentImpl d;
        Element root;
        XMLSerializer X;
        try {
          System.out.println(" creatin ");
          File fos = new File("xsr.xml");
          out = new FileWriter("xsr.xml");
          System.out.println("created File .." + fos.getName());
          out.flush();
          d = new DocumentImpl();
          System.out.println("create root");
          root = d.createElement("abc");
          System.out.println("creating element");
          d.insertBefore(root, null);
          //out.write(d.createAttribute(""));
          OutputFormat o = new OutputFormat(d);
          System.out.println("Output format...");
          o.setIndent(5);
          o.setIndenting(true);
          o.setDoctype("lab1.dtd", "lab1.dtd");
          o.setDoctype("name of dtd file", "name of dtd file");
          X = new XMLSerializer(o);
          X.setOutputCharStream(out);
          X.serialize(root);
          out.flush();
          out.close();
        catch (Exception e1){
          e1.printStackTrace();
    }

  • Not able to create XML from an existing relational database

    Hi,
    I am trying to create and xml from an existing relational database. I am not able to get any XML data, I receive "XMLTYPE()" as the result.
    Here's the query -
    SQL> select o.order_id, XMLELEMENT("order", XMLATTRIBUTES(o.order_id as ID)) AS "result" from order_
    info o where order_id=2793;
    ORDER_ID
    result()
    +2793+
    XMLTYPE()
    I was expecting to get +<order id=2793 />+ instead of XMLTYPE().
    I am using -
    SQLPlus: Release 9.0.1.0.1*
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    I have also run some checks to confirm XML DB installation -
    SQL> select 1 from all_users where username  = 'XDB';
    +1+
    +1+
    SQL> desc RESOURCE_VIEW;
    Name                                      Null?    Type
    RES                                                SYS.XMLTYPE
    ANY_PATH                                           VARCHAR2(4000)
    RESID                                              RAW(16)
    I think, I have something wrong with installation or configuration.
    Any idea about what have I done wrong here?

    Works fine now. Got the result "<order ID="2793"></order>".
    Thanks. :-)

  • Not able to display XML file

    I'm running Safari 6.0.2. And previous to a recent update I was able to drag a XML file into the browser and it would display the contents. Now it does nothing. I'm guessing with the last update it removed an extension that used to allow this to happen. Can anyone suggest a good XML display extention they've had good luck with.
    Thanks!

    The only browser I am aware of that currently knows how to
    display XML is IE5. Otherwise, you will need to convert the XML
    into well-formed HTML or xHTML through and XSLT stylesheet.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Ravinder Kamal (guest) wrote:
    : I not able to display the XML file in my browser even after
    using
    : using an XSL Stylesheet. I am not using IE5 browser.
    : The output of command :
    : C\>java XSLSample iden.xsl empl.xml
    : <root>
    : <ROWSET>
    : <ROW num="1">
    : <EMP_ID>PMA42628M</EMP_ID>
    : <FNAME>Paolo</FNAME>
    : <MINIT>M</MINIT>
    : <LNAME>Accorti</LNAME>
    : <JOB_ID>13</JOB_ID>
    : <JOB_LVL>35</JOB_LVL>
    : <PUB_ID>0877</PUB_ID>
    : <HIRE_DATE>1992-08-27 00:00:00.0</HIRE_DATE>
    : </ROW>
    : </root>
    : where iden.xsl is :-
    : <?xml version="1.0"?>
    : <!-- Identity transformation -->
    : <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    : <xsl:template match="*|@*|comment()|pi()|text()">
    : <xsl:copy>
    : <xsl:apply-templates
    : select="*|@*|comment()|pi()|text()"/>
    : </xsl:copy>
    : </xsl:template>
    : </xsl:stylesheet>
    : -R.S.Kamal
    null

  • Not able to create log files using logging API's

    Hi All,
    I am trying to make use of logging API's of SAP in my standalone java project.
    Below is the following line of code.
    public class TestLog {
    private static final com.sap.tc.logging.Location logger = com.sap.tc.logging.Location.getLocation(testLog.class);
    static
    logger.setEffectiveSeverity(Severity.INFO);
    // logger.addLog(new ConsoleLog());
    logger.addLog(new FileLog("C://temp//testOutput.log", new ListFormatter()));
    public static void main(String[] args) {
    writeLog();
    public static void writeLog()
    logger.entering("entering");
    logger.debugT("In Write Log");
    logger.exiting("exiting");
    But the above codes does not create the testOutput.log file in the dir which i have mentioned . I have added sap.comtcloggingjavaimpl.jar from eclipse plugin folder to make use of these API's .
    Could you please help me on this .
    Thanks & Regards,
    Mitul Adhia.

    Hi,
    Also try adjusting the severity level in nwa(Netweaver Administrator).
    1. Go to http://<host-name>:<port-number>/nwa
    2. Select Problem Management from tabs.
    3. In that select Logs and Traces tab.
    4. Select Log configuration
    5. in Show select Tracing Locations
    6. Select your application and set the severity to be the one lower than that you specify in your code.
    Hope it helps.
    Regards,
    Srinivasan Subbiah

  • What the best way to create XML files from JAVA application?

    Hi to all,
    I need to edit and to create new filex in format of xml. I know to parse, but what would be the best way to do:
    1. - Create new file, create like simle text file, or there is some clases that know to do it in more simple way
    2.a - Edit XML file, to take some data and add it to the XML in the place I want to.
    2.b - Also Edit, but not to add fields, just update some of them.
    Code examples or links to samples woul be welcomed.
    Best regards, Nick.

    I have tried working with XML directly using the Java classes but this was a pain. I then looked at DOM4J and JDOM and found JDOM easier to use.

  • Creating XML files in Java

    i am new to java progamming. I have created project using swing and JDBC. Now I want to do some modifications in that project and want create an XML file for the same. I don't know which API to use. Through googling i have only found information on Jave EE and web services. I am using jdk 1.5. Please help.
    Ashish

    Novice_Ashish wrote:
    want create an XML file for the same
    Ashishplease elaborate your needs,
    if you need to deal with xml
    then xerces

  • Create xml file using java

    how can i create an xml file with some data in java ?

    You can use the JAXB API to create a java objects that represent a certain DTD. You can then create the xml file by using these objects to conform to a DTD. Each of the objects effectively represent one element or set of elements in an xml file. See www.java.sun.com/xml and JAXB for more details.

  • Not able to create OUT file with "nidll_vxworks" in Matlab for use with the LabVIEW SIT 2010 and a cRio 9073, sh.exe error

    I am trying to compile an OUT file for my Simulink model using "nidll_vxworks" and run it using the Simulation Interface Toolkit for a cRIO 9073 . I am able to compile the DLL file using "nidll" and succesfully run the simulation using my PC as the host.
    I already downloaded the "gccdist" and "vxworks61gccdist" folders and copied them to "c:" When I build the model in Sumulink I get the following error at the end of the process (at the same time windows tells me that "sh.exe" has stopped working). If it matters I am running Windows 7 64bits, but using Matlab 2009b 32bits and LabView 2010 32 bits. ANY HELP WILL BE APPRECIATED. "QofV" is the name of my Simulink model and I changed to "XXX" parts of the file path.
    ### Linking ...
    rm -f "QofV.out" ctdt.c;nmppc QofV.o QofV_data.o rtGetInf.o rtGetNaN.o rt_logging.o rt_look.o rt_look1d.o rt_nonfinite.o  nidll_main.o rt_sim.o ode8.o    | tclsh c:/gccdist/WindRiver/vxworks-6.3/host/resource/hutils/tcl/munch.tcl -c ppc > ctdt.c 
    abnormal program termination 
    C:\Users\XXX\AppData\Local\Temp\make426012.sh: fork failed: no child processes [1]
    make: *** [QofV.out] Error 1 
    ### Real-Time Workshop build procedure for model: 'QofV' aborted due to an error.
    >> 
    ### Linking ...rm -f "QofV.out" ctdt.c;nmppc QofV.o QofV_data.o rtGetInf.o rtGetNaN.o rt_logging.o rt_look.o rt_look1d.o rt_nonfinite.o  nidll_main.o rt_sim.o ode8.o    | tclsh c:/gccdist/WindRiver/vxworks-6.3/host/resource/hutils/tcl/munch.tcl -c ppc > ctdt.c  
    abnormal program termination 
    C:\Users\XXX\AppData\Local\Temp\make426012.sh: fork failed: no child processes [1]make: *** [QofV.out] Error 1 ### Real-Time Workshop build procedure for model: 'QofV' aborted due to an error.>>
    ### Linking ...rm -f "QofV.out" ctdt.c;nmppc QofV.o QofV_data.o rtGetInf.o rtGetNaN.o rt_logging.o rt_look.o rt_look1d.o rt_nonfinite.o  nidll_main.o rt_sim.o ode8.o    | tclsh c:/gccdist/WindRiver/vxworks-6.3/host/resource/hutils/tcl/munch.tcl -c ppc > ctdt.c  abnormal program termination C:\Users\XXX\AppData\Local\Temp\make426012.sh: fork failed: no child processes [1]make: *** [QofV.out] Error 1 ### Real-Time Workshop build procedure for model: 'QofV' aborted due to an error.>> 
    Solved!
    Go to Solution.

    Hello jarcTec,
    I am not sure right now if you can do it, but this tutorial might help, also everything was made in Winddows 7 in this one.
    http://zone.ni.com/devzone/cda/tut/p/id/11654
    Take a quick look and let me know if it works!!!
    Luis Fernando
    National Instruments Cono Sur
    Ingeniería de Campo y Consultoría
    http://chile.ni.com/

  • Creating setup file for java project

    hi
    My project has java files, properties files,batch files as well as two jar files,mail.jar & activation.jar(for importing packages).
    I have to include these jar files while setting environment variables.
    Now i want to make setup file for myproject to provide quick launch from desktop ,can anyone pls help me how to include these all files into a single jar file. and how to make setup file
    Pls Help
    Thanks a lot !!!

    JAR files can contain any type of file that you want so you could use the following command:
    jar cf jar-file input-file(s)
    (the c tells jar to create the jar file; the f says the next item is the name of the jar file; the jar-file should be replaced with the name of the jar file; and the input-file(s) should be replaced with the name of the files you want jarred).
    In general, batch files don't do much good bundled inside a jar file. If you really want a way to bundle all of your files and have them installed, then you might want to look into JExpress or one of its competitors. Full disclosure, I work for DeNova (the mfg of JExpress).
    The advantage of an installer over a jar file is that you can distribute your files plus create a native executable to launch your java app, set up an uninstaller, etc.

  • Creating XML file in Project folder thru Java Program

    hi,
    i need one help. i need to create XML file in web://<Project Folder> in xmII thru Java Program. i created one java code and i am able to access XML file that is in c drive. i created jar file for this and placed as action block in Transaction and this working fine. but problem arises when i give file path in java code as web://<folder name>/file.xml which is in Web folder of project in xMII.
    How to access the file that is inside web folder from java code.
    regards
    senthil

    Hi Senthil,
    you can address the files that inside the MII workbench are viewed as "web://..." like this:
    http://<server>:<port>/XMII/CM/<Project>/<Folder>/<Filename>
    The workbench helps you find the correct filename:
    - open the WEB tab in the workbench
    - right-click on the filename
    - select "Copy Link" from the pop up
    Now you have the correct link in your clipboard.You can use the "web://" only inside MII.
    Michael

  • How to edit the existing data in the XML file from java programming.

    Hi all
    i am able to create XML file with the sample data as below from java programming.
    i need sample code on how to edit the existing data in the XML file?
    for example
    <?xml version="1.0"?>
       <mydata>
               <data1>
                         <key1>467</key1>
                        <name1>Paul</name1>
                        <id1>123</id1>
              </data1>
              <data2>
                         <key2>467</key2>
                        <name2>Paul</name2>
                        <id2>123</id2>
              </data2>
        </mydata>
    i am able to insert the data in the XML.
    now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
    Regards
    Sunil
    [points will be always rewardable]

    hi
    u need a parser or validate the xml file for to read the xml file from java coding u need for this
    xml4j.jar u can download this file  from here
    http://www.alphaworks.ibm.com/tech/xml4j
    or we can use the SAX(simple API for XML)
    some sample applications for this
    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
    http://www.xml-training-guide.com/e-xml44.html
    let me know u need any other info
    bvr

Maybe you are looking for