Could xml files be displayed in a more readable / structured way?

Within a software test environment, xml files have to be checked on their content. When using the "View Page Source" the xml file is displayed as it is.
It would be very helpful if Firefox would have an option to display xml files in a more structured way to make then more readable.
This will save a lot of time, because now the file should first be downloaded and opened in another application.

Hi Atul,
The standard DMS system does not offer this feature!!
However,there are a couple of options you may explore.
- In SE38,run report DMS_KPRO_READ to retrieve the original file names of a DIR.
- Alternatively,you may also implement SAP Note 1015165 to display file names of a DIR.
Hope this helps.
Regards,
Pradeepkumar Haragoldavar

Similar Messages

  • Parsing large xml file and display using swing

    Hi all,
    I want to read a large xml file and display graphically in swing as a tree structure.
    I implemented it and works fine for files of 5MB size after increasing the jvm heap size (-Xmx). If the file size is larger than 5MB it throws out of memory error. I'm creating a custom datastructure from the xml and I'm using sax parsing.
    After displaying the datastructure, the user could do some operation on this, like search etc.
    Can any of you suggest a method, to support larger files ? What I'm looking for is create the datastructure in file system, rather than in memory.
    Any other tips for memory management would be greatly appreciated
    Thanks in Advance.
    Nisha

    Use a memory-mapped file?
    http://javaalmanac.com/egs/java.nio/CreateMemMap.html

  • Code to read xml file  and display that data using sax parser

    Hai
    My problem I have to read a xml file and display the contents of the file on console using sax parser.

    here you go

  • Xml file not displaying.

    Hello all,
    Pls i am trying to work on an example that displays some pics in form of slide show. Everything worked fine till i got to a point of displaying the content of an xml file. I tried all i could but things did not work out. someone pls help, i am frustrated. Below re my codes.
    test.xml
    <?xml version="1.0"?>
    <wedshow>
    <audio source="devpics/mus.mp3 />
    <photo duration="10" source="devpics/test.jpg" />
    <photo duration="20" source="devpics/tes.jpg" />
    <photo duration="20" source="devpics/testA.jpg" />
    </wedshow>
    WedShowPlayer2.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:MyComp="*" layout="absolute" initialize="init();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    private function init():void {
    service.send();
    ]]>
    </mx:Script>
    <mx:HTTPService id="service" url="component/test.xml" resultFormat="e4x" result="show.loadShow(
    XML(event.result) ); show.playShow();" />
    <MyComp:WedShow id="show" width="100%" height="100%" horizontalCenter="0"/>
    </mx:Application>
    WedShow.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import flash.display.Loader;
    [Bindable]
    private var _xml:XML;
    private var photos:ArrayCollection = new ArrayCollection();
    private var sound:Sound;
    private var iLoaded:uint = 1;
    private var isLoaded:Boolean = false;
    private var timer:Timer = new Timer(1000,0);
    private var photoIndex:int = 0;
    private var nextPhotoTime:int = 1;
    public function playShow():void {
    if(isLoaded) {
    play.visible = false;
    timer = new Timer(1000,0);
    timer.addEventListener( TimerEvent.TIMER, onTime );
    timer.start();
    if(sound!=null) {sound.play();}
    } else { loadShow( _xml ); }
    private function onTime( event:TimerEvent ):void {
    if( event.currentTarget.currentCount == nextPhotoTime ) {
    if( photos.length > photoIndex ) {
    image.load(Loader(photos[photoIndex]).content);
    // using e4x to access the photo duration attribute
    nextPhotoTime += int(_xml.photo[photoIndex].@duration);
    photoIndex++;
    } else {
    stopShow();
    public function stopShow():void {
    timer.stop();
    timer.reset();
    image.source="";
    SoundMixer.stopAll();
    photoIndex = 0;
    nextPhotoTime = 1;
    play.visible = true;
    public function loadShow( xml:XML ):void {
    _xml = xml;
    photos = new ArrayCollection();
    iLoaded = 1;
    isLoaded = false;
    photoIndex = 0;
    nextPhotoTime = 1;
    progress.visible = true;
    play.visible = false;
    for each(var photoNode:XML in _xml.photo) {
    var photo:Loader = new Loader();
    photo.load(new URLRequest(photoNode.@source));
    photo.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    onProgress);
    photo.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onComplete);
    photos.addItem(photo);
    progress.label="Loading Image " + iLoaded +" of " + photos.length + ".";
    private function onProgress( event:ProgressEvent ):void {
    var loaded:Number = 0;
    var total:Number = 0;
    if(iLoaded<photos.length) {
    for each(var item:Loader in photos) {
    loaded += item.contentLoaderInfo.bytesLoaded;
    total += item.contentLoaderInfo.bytesTotal;
    } else {
    loaded = event.bytesLoaded;
    total = event.bytesTotal;
    progress.setProgress(loaded,total);
    private function onComplete( event:Event ):void {
    if(iLoaded<photos.length) {
    iLoaded++;
    progress.label="Loading Image " + iLoaded + "of" +
    photos.length;
    } else if (sound==null && _xml.audio[0].@source!="") {
    sound = new Sound();
    sound.addEventListener(ProgressEvent.PROGRESS, onProgress);
    sound.addEventListener(Event.COMPLETE, onComplete);
    sound.load(new URLRequest(_xml.audio[0].@source));
    progress.label="Loading Audio";
    } else {
    progress.visible = false;
    play.visible = true;
    isLoaded = true;
    ]]>
    </mx:Script>
    <mx:LinkButton id="play" label="Play" horizontalCenter="0" verticalCenter="0" visible="false" color="0xFFFFFF" />
    <mx:ProgressBar id="progress" mode="manual" width="60%" horizontalCenter="0" verticalCenter="0" color="0xFFFFFF" />
    <mx:Image id="image" horizontalCenter="0" verticalCenter="0"/>
    </mx:Canvas>
    anyone pls help
    thanks in anticipation
    [email protected]

    hey try out this link it may help you
    http://www.judahfrangipane.com/blog/2007/01/01/error-2044-unhandled-ioerrorevent-texterror -2038-file-io-error/
    thanks & regards
    gajanan
    [email protected]

  • Reading the XML file and displaying teh string with teh desired output

    Hi Gurus,
    I have an xml file as below.
    catalog>
    <book>
    <id>101</id>
    <genre>Computer</genre>
    <author>Jim Cortez</author>
    <title>XML for dummies</title>
    <price>44.95</price>
    <description>An in-depth look at creating mashed potatoes
    with XML.</description>
    </book>
    <book>
    <id>102</id>
    <author>George Bush</author>
    <title>I'm the decider</title>
    <genre>Fantasy</genre>
    <price>0.95</price>
    <description>I like milk and cookies.</description>
    </book>
    </catalog>
    I would like to display the Output as
    [<catalog>:1]
    [<book>:1]
    [<id>:1]
    [101:3]
    [</id>:2]
    [<genre>:1]
    [Computer:3]
    [</genre>:2]
    [<author>:1]
    [Jim Cortez:3]
    [</author>:2]
    [<title>:1]
    [XML for dummies:3]
    ............ etc., etc.,,
    here is the code template.......
    import java.io.*;
    class TagScanner implements TokenStream {
    public static final int BEGIN_TAG_TYPE = 1;
    public static final int END_TAG_TYPE = 2;
    public static final int TEXT_TYPE = 3;
    protected Reader reader = null;
    /** Lookahead char */
    protected char c;
    /** Text of currently matched token */
    protected StringBuffer text = new StringBuffer(100);
    public TagScanner(Reader reader) throws IOException {
    this.reader = reader;
    nextChar();
    protected void nextChar() throws IOException {
    c = (char)reader.read();
    public Token nextToken() throws IOException {
         if ( start of a tag ) {
         // scarf until end of tag
         // type is either BEGIN_TAG_TYPE or END_TAG_TYPE
         if ( end of file ) {
         type = Token.EOF_TYPE;
         text = "end-of-file";
         else {
         // scarf until start of a tag
         type = TEXT_TYPE;
         if ( just whitespace ) {
         // ignore and get another token
    return new Token(type, text.toString());
    Can someone please provide me the logic for the code please........... here is the complete link of the excersie http://www.antlr.org/wiki/display/CS652/Lexer+for+XML
    Many Thanks
    -M

    Can someone please provide me the logic for the code please..........The logic is pretty well spelled out for you in the description of the assignment and the outline for the code you provided. If you mean
    Can someone please do my homework for me....The answer to that is usually yes, someone can do your homework for you, but no, they usually won't actually do it for you.
    However, if you are really stuck on what to do, you should consider:
            if ( start of a tag ) {How would you know that you are at the start of a tag? Once you can answer that, the rest sort of works itself out as long as
                // scarf until end of tagyou realize what it means to 'scarf' and how to determine when an end-of-tag is reached (hint, very similar as to how to determine if you are at the start-of-tag).

  • Reading the XML file and displaying the string with the desired output

    Hi Gurus,
    I have an xml file as below.
    catalog>
    <book>
    <id>101</id>
    <genre>Computer</genre>
    <author>Jim Cortez</author>
    <title>XML for dummies</title>
    <price>44.95</price>
    <description>An in-depth look at creating mashed potatoes
    with XML.</description>
    </book>
    <book>
    <id>102</id>
    <author>George Bush</author>
    <title>I'm the decider</title>
    <genre>Fantasy</genre>
    <price>0.95</price>
    <description>I like milk and cookies.</description>
    </book>
    </catalog>
    I would like to display the Output as
    [<catalog>:1]
    [<book>:1]
    [<id>:1]
    [101:3]
    [</id>:2]
    [<genre>:1]
    [Computer:3]
    [</genre>:2]
    [<author>:1]
    [Jim Cortez:3]
    [</author>:2]
    [<title>:1]
    [XML for dummies:3]
    ............ etc., etc.,,
    here is the code template.......
    import java.io.*;
    class TagScanner implements TokenStream {
    public static final int BEGIN_TAG_TYPE = 1;
    public static final int END_TAG_TYPE = 2;
    public static final int TEXT_TYPE = 3;
    protected Reader reader = null;
    /** Lookahead char */
    protected char c;
    /** Text of currently matched token */
    protected StringBuffer text = new StringBuffer(100);
    public TagScanner(Reader reader) throws IOException {
    this.reader = reader;
    nextChar();
    protected void nextChar() throws IOException {
    c = (char)reader.read();
    public Token nextToken() throws IOException {
    if ( start of a tag ) {
    // scarf until end of tag
    // type is either BEGIN_TAG_TYPE or END_TAG_TYPE
    if ( end of file ) {
    type = Token.EOF_TYPE;
    text = "end-of-file";
    else {
    // scarf until start of a tag
    type = TEXT_TYPE;
    if ( just whitespace ) {
    // ignore and get another token
    return new Token(type, text.toString());
    Can someone please provide me the logic for the code please........... here is the complete link of the excersie
    http://www.antlr.org/wiki/display/CS652/Lexer+for+XML
    Many Thanks
    -M

    Can someone please provide me the logic for the code please..........The logic is pretty well spelled out for you in the description of the assignment and the outline for the code you provided. If you mean
    Can someone please do my homework for me....The answer to that is usually yes, someone can do your homework for you, but no, they usually won't actually do it for you.
    However, if you are really stuck on what to do, you should consider:
            if ( start of a tag ) {How would you know that you are at the start of a tag? Once you can answer that, the rest sort of works itself out as long as
                // scarf until end of tagyou realize what it means to 'scarf' and how to determine when an end-of-tag is reached (hint, very similar as to how to determine if you are at the start-of-tag).

  • How to format and display xml file as displayed in IE

    I want to display the xml file as it is displayed in Internet Explorer. Which component I should use and how?
    Thanks in advance
    Sachin

    You mean you want to see the XML source?
    You need to replace the characters '<' and '&' with corresponding entities '&lt;' and '&amp;'. You can use replaceAll, but do the ampersands first.
    Then I suggest you probably want to put them in a <PRE> block.

  • Create a list from an XML file    no display

    I have a multiline Dynamic text box called projList.
    I am trying to populate it from an xml file and create a
    clickable list.
    The trace works but cannot get to display the list in the
    text box.
    As far as the clickable goes, haven't gotten that far yet.
    Help very much appreciated.
    The xml is structured like this:
    <?xml version="1.0" ?>
    - <images>
    - <pic>
    <Image>/Butler/Images/sfah2_small.jpg</Image>
    <Category>Institutional</Category>
    <Proj_title>FRESH AIR HOME</Proj_title>
    Please see code below:
    import mx.xpath.XPathAPI;
    var allproj_xml:XML = new XML();
    allproj_xml.ignoreWhite = true;
    allproj_xml.onLoad = function(success:Boolean) {
    trace("onload...");
    if (success) {
    trace("success...");
    var thePath_str:String = "/images/pic/Proj_title";
    var title_array:Array =
    XPathAPI.selectNodeList(this.firstChild,
    thePath_str);
    for (var i:Number = 0; i < title_array.length; i++) {
    trace(title_array
    .firstChild.nodeValue);
    projList.addItem(title_array.attributes.Proj_title);
    } else {
    trace("error loading XML");
    allproj_xml.load("allimages.xml");
    stop();

    This did it:
    projList.addItem(title_array
    .firstChild.nodeValue);
    > Thanks for your response.
    > How can I add what I am tracing, to the component
    properly?
    >
    > "DMennenoh **AdobeCommunityExpert**"
    <[email protected]> wrote in
    > message news:eqaejh$bi8$[email protected]..
    >>>>trace(title_array.firstChild.nodeValue);
    >> projList.addItem(title_array
    .attributes.Proj_title);
    >>
    >>
    >> Your code seems OK. What you are tracing here
    however isn't what you're
    >> adding to the component. Are you sure what you're
    adding traces?
    >>
    >> --
    >> Dave -
    >> Head Developer
    >> www.blurredistinction.com
    >> Adobe Community Expert
    >>
    http://www.adobe.com/communities/experts/
    >>
    >

  • XML DB: As XML file size doubles validate time more than doubles

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    We have default XMLDB install. I am using schemavalidate() to successfullly validate xml files against a registered xsd. For some reason as the files size doubles the time to validate the file grows at a faster rate than double? We wanted to generate approx 18MB files since they hold 5000 records. But as you can see it appears I would be better off generating six 3MB files instead. What init.ora or xdbconfig.xml parameter might I change to help out with behavior? Any other ideas of why this happening? Is this an example of "doesn't scale"?
    1.5MB 3 Seconds
    3MB 15 Seconds
    6MB 1 Minute
    12MB 6 Minutes
    18MB 16 Minutes
    Code is simple..
    procedure validate_xml_file (p_dir in varchar2, p_file in varchar2) is
    v_xmldoc xmltype;
    begin
    select XMLTYPE(bfilename(p_dir, p_file),NLS_CHARSET_ID('AL32UTF8'))
    into v_xmldoc
    from dual;
    v_xmldoc.schemaValidate();
    end validate_xml_file;

    If I take the clause off the end of the cview table this procedure does not work at all.. It fails at the schemavalidate call...
    Error report:
    ORA-19030: Method invalid for non-schema based XML Documents.
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at line 26
    19030. 00000 - "Method invalid for non-schema based XML Documents."
    *Cause:    The method can be invoked on only schema based xmltype objects.
    *Action:   Don't invoke the method for non schema based xmltype objects.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Help with displaying my xml file in my jtext area

    Hi i am trying to read the data from my xml file and display it once the user clicks on the list all button.
    below is the source code for my program can someone please tell me some code to this.
    package tractorgui;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.XMLEncoder;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.beans.XMLDecoder;
    import javax.swing.*;
    import javax.swing.border.LineBorder;
    //import tractor.TextInputPrompt;
    import tractor.Tractor;
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo isbeing used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    public class NewSwingApp extends javax.swing.JFrame {
    //          //Set Look & Feel
    //          try {
    //               javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    //          } catch(Exception e) {
    //               e.printStackTrace();
              private static final long serialVersionUID = 1L;
         private JButton searchmanufacturer;
         private JButton jButton3;
         private JLabel companyname;
         private JPanel labelpannel;
         private JButton listall;
         private JPanel MenuButtons;
         private JButton archivetractor;
         private JTextArea outputscreen;
         private JButton exhibittractor;
         private JButton deletetractor;
         private JButton addtractor;
         private JButton listallexbited;
         private Tractor [ ] tractors;
         private JScrollPane jScrollPane2;
         private JScrollPane jScrollPane1;
    private int numberOfTractors;
         * Auto-generated main method to display this JFrame
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        NewSwingApp inst = new NewSwingApp();
                        inst.setLocationRelativeTo(null);
                        inst.setVisible(true);
         public NewSwingApp() {
              super();
              initGUI();
         private void initGUI() {
              try {
                   BorderLayout thisLayout = new BorderLayout();
                   getContentPane().setLayout(thisLayout);
                   this.setPreferredSize(new java.awt.Dimension(750, 700));
                        labelpannel = new JPanel();
                        BorderLayout labelpannelLayout = new BorderLayout();
                        getContentPane().add(labelpannel, BorderLayout.NORTH);
                        labelpannel.setLayout(labelpannelLayout);
                        jButton3 = new JButton();
                        getContentPane().add(getExitsystem(), BorderLayout.SOUTH);
                        jButton3.setText("Exit System");
                        jButton3.setPreferredSize(new java.awt.Dimension(609, 57));
                        jButton3.setBackground(new java.awt.Color(0,255,255));
                        jButton3.setForeground(new java.awt.Color(0,0,0));
                        jButton3.setFont(new java.awt.Font("Arial",1,24));
                        jButton3.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                            System.exit(0);
                        MenuButtons = new JPanel();
                        getContentPane().add(MenuButtons, BorderLayout.WEST);
                        GridLayout MenuButtonsLayout = new GridLayout(7, 1);
                        MenuButtonsLayout.setColumns(1);
                        MenuButtonsLayout.setRows(7);
                        MenuButtonsLayout.setHgap(5);
                        MenuButtonsLayout.setVgap(5);
                        MenuButtons.setLayout(MenuButtonsLayout);
                        MenuButtons.setPreferredSize(new java.awt.Dimension(223, 267));
                             listall = new JButton();
                             MenuButtons.add(getListall());
                             listall.setText("List All");
                             listall.setBackground(new java.awt.Color(0,255,255));
                             listall.setForeground(new java.awt.Color(0,0,0));
                             listall.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
                             listall.setFont(new java.awt.Font("Arial",2,14));
                             listall.addActionListener(new ActionListener() {
                                  /* (non-Javadoc)
                                  * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
                                  public void actionPerformed(ActionEvent evt) {
                                       String XMLFile = "tractor.xml-courseworkasignment/src";
                                       //** Prints the contents of my XML file
                                       try {
                                       String s;
                                       BufferedReader in = new BufferedReader( new FileReader(XMLFile)
                                       outputscreen.setText("File successfully opened");
                                       try {
                                       while ( (s=in.readLine()) !=null)
                                       outputscreen.append(s);
                                       catch(Exception e) {
                                            outputscreen.append("Error reading line: " + e.getMessage());
                                       outputscreen.append("End of Document");
                                       catch(FileNotFoundException e) {
                                            outputscreen.append("Error in opening file: " + e.getMessage());
                             listallexbited = new JButton();
                             MenuButtons.add(getListallexbited());
                             listallexbited.setText("List All Tractors On Exhibition ");
                             listallexbited.setPreferredSize(new java.awt.Dimension(157, 57));
                             listallexbited.setBackground(new java.awt.Color(0,255,255));
                             listallexbited.setForeground(new java.awt.Color(64,0,0));
                             listallexbited.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       outputscreen.repaint();
                                       String XMLFile = "C:tractor.xml";
                                  // Print contents of XML file
                                  try {
                                  String s;
                                  BufferedReader in = new BufferedReader( new FileReader(XMLFile)
                                  outputscreen.setText("File successfully opened");
                                  try {
                                  while ( (s=in.readLine()) !=null)
                                  outputscreen.append(s);
                                  catch(Exception e) {
                                       outputscreen.append("Error reading line: " + e.getMessage());
                                  outputscreen.append("End of Document");
                                  catch(FileNotFoundException e) {
                                       outputscreen.append("Error in opening file: " + e.getMessage());
                             addtractor = new JButton();
                             MenuButtons.add(getAddtractor());
                             addtractor.setText("Add Tractor ");
                             addtractor.setBackground(new java.awt.Color(0,255,255));
                             addtractor.setForeground(new java.awt.Color(64,0,0));
                             addtractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       String manufacturer =JOptionPane.showInputDialog(getComponent(0), "Enter Manufacturer of Tractor");
                                       String shp = (JOptionPane.showInputDialog(getComponent(0), "Enter Horse Power of Tractor"));
                                       int hp =Integer.parseInt(shp);
                                       int sisRare =Integer.parseInt(JOptionPane.showInputDialog(getComponent(0), "Enter If the Tractor is rare (1=Yes/2=No)"));
                                       boolean isRare;
                                       if (sisRare== 1) {
                                       isRare =true;     
                                       }else
                                            isRare =false;
                                       String yom= JOptionPane.showInputDialog(getComponent(0), "Enter Year of Manufacture");
                                       int yearOfManufacture =Integer.parseInt(yom);
                                       String yis =JOptionPane.showInputDialog(getComponent(0), "Enter Number of years the Tractor has been in service");
                                       int yearsInService =Integer.parseInt(yis);
                                       String svalue = JOptionPane.showInputDialog(getComponent(0), "Enter Tractor's Value (?Pounds)");
                                       double value = Double.parseDouble(svalue);
                                       String lastWorkPlace =JOptionPane.showInputDialog(getComponent(0), "Enter Last Workplace");
                                            if(NewSwingApp.addTractor(new Tractor(manufacturer, hp, isRare, yearOfManufacture, yearsInService, value, lastWorkPlace, false)))
                                       JOptionPane.showMessageDialog((getComponent(0)), "Tractor Added");
                                       else
                                            JOptionPane.showMessageDialog(getComponent(0), "Could not Add Tractor");
                             deletetractor = new JButton();
                             MenuButtons.add(getDeletetractor());
                             deletetractor.setText("Delete Tractor ");
                             deletetractor.setBackground(new java.awt.Color(0,255,255));
                             deletetractor.setForeground(new java.awt.Color(64,0,0));
                             deletetractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("deletetractor.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Tractor ID");
                             exhibittractor = new JButton();
                             MenuButtons.add(getExhibittractor());
                             exhibittractor.setText("Exhibit Tractor");
                             exhibittractor.setBackground(new java.awt.Color(0,255,255));
                             exhibittractor.setForeground(new java.awt.Color(0,0,0));
                             exhibittractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("exhibittractor.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Tractor I.D");
                             archivetractor = new JButton();
                             MenuButtons.add(getArchivetractor());
                             archivetractor.setText("Archive Tractor");
                             archivetractor.setBackground(new java.awt.Color(0,255,255));
                             archivetractor.setForeground(new java.awt.Color(0,0,0));
                             archivetractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("archivetractor.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Tractor I.D");
                             searchmanufacturer = new JButton();
                             MenuButtons.add(searchmanufacturer);
                             searchmanufacturer.setText("Search Manufacturer");
                             searchmanufacturer.setPreferredSize(new java.awt.Dimension(159, 21));
                             searchmanufacturer.setBackground(new java.awt.Color(0,255,255));
                             searchmanufacturer.setForeground(new java.awt.Color(64,0,0));
                             searchmanufacturer.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("searchmanufacturer.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Manufacturer Name");
                        outputscreen = new JTextArea();
                        getContentPane().add(outputscreen, BorderLayout.CENTER);
                        outputscreen
                                  .setText("");
                        outputscreen.setBorder(BorderFactory.createTitledBorder(""));
                        outputscreen.setWrapStyleWord(true);
                        outputscreen.setEditable(false);
                        outputscreen.setEnabled(true);
                        outputscreen.setBackground(new java.awt.Color(255, 255, 255));
                        outputscreen.setForeground(new java.awt.Color(64, 0, 0));
                        companyname = new JLabel();
                        getContentPane().add(companyname, BorderLayout.NORTH);
                        companyname.setText(" Wolvesville Tractor Museum");
                        companyname.setPreferredSize(new java.awt.Dimension(609, 85));
                        companyname.setBackground(new java.awt.Color(255,255,0));
                        companyname.setFont(new java.awt.Font("Arial",1,28));
                        companyname.setForeground(new java.awt.Color(0,0,0));
                        companyname.setBorder(BorderFactory.createTitledBorder(""));
                        companyname.setOpaque(true);
                   this.setSize(750, 750);
              } catch (Exception e) {
                   e.printStackTrace();
         protected static boolean addTractor(Tractor tractor) {
                   if (tractor.getManufacturer()==null) return false; else
                   if (tractor.getHp()<50||tractor.getHp()>1100) return false; else
                   if (tractor.getIsRare()==false) return false; else
                   if (tractor.getYearsInService()<1||tractor.getYearsInService()>200) return false; else
                   if (tractor.getYearOfManufacture()<1800||tractor.getYearOfManufacture()>2008) return false; else
                   if (tractor.getValue()<100||tractor.getValue()>1500) return false; else
                   if (tractor.getLastWorkPlace()==null) return false; else
              return true;
         public JPanel getMenuButtons() {
              return MenuButtons;
         public JButton getListall() {
              return listall;
         public JLabel getCompanyname() {
              return companyname;
         public JButton getExitsystem() {
              return jButton3;
         public JButton getSearchmanufacturer() {
              return searchmanufacturer;
         public JButton getListallexbited() {
              return listallexbited;
         public JButton getAddtractor() {
              return addtractor;
         public JButton getDeletetractor() {
              return deletetractor;
         public JButton getExhibittractor() {
              return exhibittractor;
         public JButton getArchivetractor() {
              return archivetractor;
         public JTextArea getOutputscreenx() {
              return outputscreen;
    public void savetractors () {
         try {
              XMLEncoder encoder = new XMLEncoder(new FileOutputStream("tractor.xml"));
              encoder.writeObject(tractors);
              encoder.close();
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    public void loadtractors () {
    try {
              XMLDecoder decoder = new XMLDecoder(new FileInputStream("tractor.xml"));
              tractors = (Tractor[]) decoder.readObject();
              decoder.close();
              for (int i=0; i<tractors.length;i++) {
                   if (tractors!=null)numberOfTractors =i;
              numberOfTractors++;
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              tractors=new Tractor[25];
              numberOfTractors=0;

    here's an example:
    http://jdj.sys-con.com/read/37550.htm
    you need to have a class Tractor with all those properties and then use readObject.Somehow you need to tell the Encoder/Decoder what Tractor means..
    hope this helps!!

  • How do you display xml file with xlst sheet in jsp

    I have an xml file with accompanying xslt file (and several images that are used in a single directory. If I doubleclick on the xml file, it displays perfectly in my browser - Formatting, images and all!
              The 100 dollar question - How do I duplicate this behavior in a JSP page in WebLogic 8.1 using the code in the xml and the accompanying xslt (formatting) file? I tried simple embedding the xml code in the jsp, but that didn't seem to work. What is the secret?
              Okay, I need to add a bit more information here. I understand that it is really easy to just redirect to the XML file. The issue is really security. I want the XML to be inside a jsp that will only allow validated users to view it.
              Another way to look at the problem would be, can I add a jsp security tag to the xml file? Or how to I add the xml code inside a jsp and keep the path references to the xslt and graphics.
              Hope the added information helps
              Thanks,
              Ken
              Message was edited by: KLee - 20050609 10:25 MST
              [email protected]

    This proved out to be the answer. Thanks for the direction!
              import java.io.File;
              import java.io.IOException;
              import java.io.InputStream;
              import java.io.OutputStream;
              import java.io.FileNotFoundException;
              import java.io.FileOutputStream;
              import javax.servlet.ServletException;
              import javax.servlet.http.HttpServlet;
              import javax.servlet.http.HttpServletRequest;
              import javax.servlet.http.HttpServletResponse;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerConfigurationException;
              import javax.xml.transform.TransformerException;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.stream.StreamResult;
              import javax.xml.transform.stream.StreamSource;
              public class XML_XSLT_Servlet extends HttpServlet {
              protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
                        String xmlfile = req.getParameter("xmlfile"); if (xmlfile==null) xmlfile = "test.xml";
                        String xsltfile = req.getParameter("xsltfile"); if (xsltfile==null) xsltfile = "test.xslt";
                        /* Test if file exists!, or use default file */
                        File f1 = new File(getServletContext().getRealPath("WEB-INF/displayfiles/"), xmlfile);
                        File f2 = new File(getServletContext().getRealPath("WEB-INF/displayfiles/"), xsltfile);
                   if (f1.exists() && f2.exists()) {
                             // System.out.println("Files Found");
                        } else {
                             System.out.println("XML and XSLT Files NOT Found");
                             System.out.println(f1.getPath());
                             System.out.println(f1.getName());
                             xmlfile = "test.xml";
                             xsltfile = "test.xslt";
              InputStream fileXML = getServletContext().getResourceAsStream("WEB-INF/displayfiles/" + xmlfile);
              InputStream fileXSLT = getServletContext().getResourceAsStream("WEB-INF/displayfiles/" + xsltfile);
              OutputStream os = res.getOutputStream();
              TransformerFactory xFactory = TransformerFactory.newInstance();
              StreamSource stylesheet = new StreamSource(fileXSLT);
              Transformer xformer = null;
              try {
              xformer = xFactory.newTransformer(stylesheet);
              } catch (TransformerConfigurationException tfce) {
              tfce.printStackTrace();
              StreamSource input = new StreamSource(fileXML);
              StreamResult output = null;
              try {
              output = new StreamResult(os);
              } catch (Exception e) {
              e.printStackTrace();
              try {
              xformer.transform(input, output);
              } catch (TransformerException xfe) {
              xfe.printStackTrace();
              <pre></pre><pre></pre>

  • How to display an xml file contents in jsp as tree view

    hi,
    Iam trying to read an xml file and display the structure in jsp as tree view, can any one help me

    Use a [XML or DOM parser|http://java-source.net/open-source/xml-parsers] to read a XML file into a tree structure of Java objects.
    Use the [Collections API|http://java.sun.com/docs/books/tutorial/collections/index.html] to get hold of the relevant elements in a tree structure.
    Use JSTL´s [c:forEach|http://java.sun.com/javaee/5/docs/tutorial/doc/bnakh.html] tag to iterate over a Collection in JSP.
    Use HTML´s [<ul>/<li>|http://www.w3.org/TR/REC-html40/struct/lists.html#h-10.2] or [<dl>/<dt>/<dd>|http://www.w3.org/TR/REC-html40/struct/lists.html#h-10.3] tags to represent a tree in HTML.

  • Why MAX5.0 not report right XML file settings from AVT GigE camera?

    I have a AVT Prosilica GC660M GigE camera. It had a touble to synchonize with an external trigger. My ex-colleague posted this long time ago (http://forums.ni.com/t5/Machine-Vision/Problem-with-external-trigger-on-GigE-camera/m-p/1060572/high...), so I think it might be better to start a new one. Inside the MAX, there's only one option under the "ExposureMode" as "timed" which only use preconfigured time, and cannot be trigger by an external signal. The workaround is to manually register it inside the camera. It was thought to be a bug and an update of firmware should fix it.However the problem remains after I recently upgraded the firmware. And o I installed the AVT package. Both the MAX and the AVT GigEViewer correctly retrived the camera firmware version as 1.42.02. Yet MAX still shows only the "timed" option, while the GigEViewer shows all four enums as described in their attribute manual "Manual, Auto, AutoOnce, External". I had tried to delet the xml and files associate with the camera under IN-IMAQdx\Data. However everytime MAX genenrates them excatly the same with only "timed" option in the XML file. Now it feels more like something is wrong with the MAX instead. I wonder how to fix it.
    Thanks,
    Lei

    Hi Lei,
    I am not exactly sure why you are not seeing all the attributes, but it could be a few different things causing it. First let’s just make sure you have all you attributes being displayed (follow instructions from link below). What happens if you delete the XML file then set your camera to “External” in the GigEViewer software, then load MAX? Do you see any changes? Can you post a screenshot showing the camera attributes from MAX. If you have your camera set to External from GigEViewer and you try to grab from the camera in MAX do you get a timeout error, does it trigger external, what happens?
    Why Can I Not See All of My IMAQdx Camera's Attributes in Measurement & Automation Explorer
    http://digital.ni.com/public.nsf/allkb/9FA7FEE4FC51F043862574A30075B7A1?OpenDocument
    Why Won't My Allied Vision Technology Camera Work With National Instruments Software?
    http://digital.ni.com/public.nsf/allkb/470DA6BDE3883EB686257341006BCB56?OpenDocument
    Tim O
    Applications Engineer
    National Instruments

  • How to extract data from an arbitrary xml file and export in a nice csv file?

    Hallo,
    I'm facing big problems in the use of XML files. I have an
    application which generates XML files with clusters containing arrays
    and scalars like in the example pasted below. My task is to
    read it and export the data in a human-friendly CSV document.
    Since I don't know the actual content of the cluster, I need some kind
    of intelligent vi which goes through the XML file looking for arrays
    and other data structures in order to export them properly in the CSV
    format (columns with headers).
    Thank you
    <Cluster>
    <Name></Name>
    <NumElts>3</NumElts>
    <Array>
    <Name></Name>
    <Dimsize>6</Dimsize>
    <I32>
    <Name></Name>
    <Val>0</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>1</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>2</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>3</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>4</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>5</Val>
    </I32>
    </Array>
    <DBL>
    <Name></Name>
    <Val>3.14159265358979</Val>
    </DBL>
    <String>
    <Name></Name>
    <Val>ciao</Val>
    </String>
    </Cluster>
    Solved!
    Go to Solution.

    Thank you again,
    I'm forwarding my vi draft with many comments and an xml file sample.
    Data in cluster is stored according to the LabVIEW schema, infact it is generated by LabVIEW.
    What I'm trying to do is to access the element of the cluster and read their content using the Invoke node and Property node functions. Could you give it a look, there may be something wrong, I'm not able to access cluster children.
    Which funcions should I use? Could you give me an example? You may use the draft I enclosed...
    Then write these data in a csv file
    should be the easier part.
    BODY{font:x-small 'Verdana';margin-right:1.5em}
    .c{cursor:hand}
    .b{color:red;font-family:'Courier New';font-weight:bold;text-decoration:none}
    .e{margin-left:1em;text-indent:-1em;margin-right:1em}
    .k{margin-left:1em;text-indent:-1em;margin-right:1em}
    .t{color:#990000}
    .xt{color:#990099}
    .ns{color:red}
    .dt{color:green}
    .m{color:blue}
    .tx{font-weight:bold}
    .db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
    .di{font:small Courier}
    .d{color:blue}
    .pi{color:blue}
    .cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
    .ci{font:small Courier;color:#888888}
    PRE{margin:0px;display:inline}
      <?xml
    version="1.0" encoding="iso-8859-1" ?>
     <Contents type="Data"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XMLSection.xsd">
     <section name="beta"
    date="7/31/2009" time="3:43:03 PM" version="1.0">
     <Cluster>
      <Name />
      <NumElts>1</NumElts>
     <Array>
      <Name />
      <Dimsize>4</Dimsize>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.93317638164326</Val>
      </DBL>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.79233924020314</Val>
      </DBL>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.39199947274518</Val>
      </DBL>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.74817197429441</Val>
      </DBL>
      </Array>
      </Cluster>
      </section>
      </Contents>
    Attachments:
    read_array.vi ‏12 KB

  • Using an XML file for server URL instead of hard coding

    I can't find a good example.
    Could someone give me an example of using a local XML file to set a server url variable so i don't have to hard code url's?
    This works and i can trace the xml file but how do i access the individual xml data nodes?
    protected function initApp():void
         var loader:URLLoader = new URLLoader(new URLRequest("config.xml"));
         loader.addEventListener(Event.COMPLETE,configLoadComplete);
    private function configLoadComplete(event:Event):void
         trace(event.target.data);

    Hi,
    <a href="foobar.xml">right click and select save as from the context menu</a>
    or
    write your xml data or a copy of it with a different extension (text) so that it is not parsed as application/xml-xhtml
    or
    Use AJAX to retrieve the xml file and display it as the textContent of a <textarea>
    window.open wraps the xml markup in html tags for display purposes.
    Rob^_^

Maybe you are looking for

  • HTTP adapter - 500 Internal server error

    Hi Experts, I have configured a B2B scenarion in which i am using HTTP receiver adapter to send data to vendor.I have checked my configuration every thing is fine but i ended up with the error as below. SXMB_MONI: PLAINHTTP_ADAPTER">ATTRIBUTE_SERVER

  • Isight camera "not connected" but IS in USB configuration

    My iSight [BUILT-IN] camera keeps being reported as "There is no camera connected" in 'Photo Booth', though it Does show up in the USB configuration of System Profiler, and most times still functions OK using Google Video Chat. (for the first 'known'

  • Alt Text in CS03 Screen

    Hi All... In CS03 screen (BOM), there is a field called ALT TExt for entering Text lines. The field is from STKO-STKTXT. If User enters the Text in that field, only First Line is getting stored in the SAP Table. The rest can not be seen in the Databa

  • Can I make any hardware upgrade to make my Mac Pro1,1 compatible with OS X Mavericks?

    Hi! I have got a Mac Pro1,1 Dual-Core Intel Xeon, 2,66 GHz, 11 Gb RAM running OS X 10.7.5. I would like to know if there is any chance to make any hardware upgrade to make my Mac Pro compatible with Mavericks, maybe a Processor upgrade. I miss all th

  • Very slow Mac when streaming music to Airport Express

    I'm getting massive slow down on my Mac while streaming music to my stereo using my Airport Express (802.11n). The mouse is choppily moving around the screen, etc. The Airport Express is streaming through a D-Link wireless G router to my Mac which is