XML simple code help

Hello Everyone, I am learning XML and I'm trying to make a simple code that will display three different messages on a separate line. I already have the code but there is something that does not let it work. Please if somebody can take a quick look at the code and tell me what should I do in order to get it working. Thanks in advance
This is my simplerequestdata.xml
{<root>
<message1>This</message1>
<message2>Technology</message2>
<message3>Is confusing</message3>
</root>}
This is my xmlrequest.html code
{<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
var req=null;
function xhr(){
try
{ // Firefox, Opera 8.0+, Safari
req=new XMLHttpRequest();
catch (e)
// Internet Explorer
try
req=new ActiveXObject("Msxml2.XMLHTTP");
catch (e)
req=new ActiveXObject("Microsoft.XMLHTTP");
return req;
function getData(){
req = new xhr();
req.open("get","simpleRequestData.xml");
req.send(null);
if(req.readyState==4){
if(req.status==200){
var doc = req.responseXML;
var msgNodes = doc.documentElement.getElementsByTagName('message');
var msgDiv = document.getElementById("message");
var msg = document.createElement("message");
msg.innerHTML = msgNodes[0].firstChild.nodeValue + "<br />" + msgNodes[1].firstChild.nodeValue + '
' + msgNodes[2].firstChild.nodeValue;
msgDiv.innerHTML = '';
msgDiv.appendChild(msg);
</script>
<style>
#message{color:red;}
message{display:block;color:green;}
</style>
</head>
<body>
<form>
<input type="button" onclick="getData()" value="Get Message"/>
<div id="message">Message Goes Here</div>
</form>
</body>
</html>
}

That looks like Javascript to me. This forum is about Java and XML, not Javascript and XML. However the error is pretty obvious:
var msgNodes = doc.documentElement.getElementsByTagName('message');You don't have any elements named "message" in that XML document. You have an element named "message1" and an element named "message2" and an element named "message3", but no "message" elements. So you get a list of zero elements there. You need to rewrite your DOM-handling code to reflect the actual input.

Similar Messages

  • Simple code help with streaming  1 file

    I set up the Flash Media Server 2.0 on Windows (test box)
    under the host dl35.tamu.edu (behind a firewall so I don't mind
    giving it out)
    Under the applications directory I create a directory called
    test
    Under this directory I place a flash movie called motion.flv
    In this same directory I copy the main.asc that comes with
    the Flash 8 software
    I load the "test" application and use _definst_ as the
    instance name
    In Flash Professional 8 I create a new fla called test.fla
    I embed a movie and use the ClearOverAll.swf as the skin for
    the movie.
    Under the Paramaters Tab I edit the content path to point to
    rtmp:"//dl35.tamu.edu/test/_definst_/motion.flv
    I test produce the html code and indeed the server shows a
    connection even though nothing is playing.
    Here is probably where I am most confused but I might have
    done something wrong with the above as well. I am not a Flash
    programmer, I am a network guy. All I want to do is the bare
    minimum in the simplest form of streaming. I could not find code
    samples that worked including the tutorial on the Adobe site (seems
    to be fairly common). Digging through other examples I "believe" I
    found what I wanted but apparantly I did not implement it correctly
    or it is not what I need after all and I would like someone to
    verify. The below is the action script that I found that I placed
    within the test.fla. Is this wrong to do?
    nc = new NetConnection();
    nc.connect("rtmp://dl35.tamu.edu/test/_definst_");
    ns = new NetStream(nc);
    my_video.attachVideo(ns);
    ns.setBufferTime(0);
    ns.play("test");
    Is the above correct? Given the names I have told you, what
    should be changed. Also does this even need to go here? Is it
    supposed to be in an action script file all by itself? At any rate
    when producing this to html there are several errors:
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 16:
    Statement must appear within on/onClipEvent handler
    nc = new NetConnection();
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 17:
    Statement must appear within on/onClipEvent handler
    nc.connect("rtmp://dl35.tamu.edu/test/_definst_");
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 19:
    Statement must appear within on/onClipEvent handler
    ns = new NetStream(nc);
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 20:
    Statement must appear within on/onClipEvent handler
    my_video.attachVideo(ns);
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 21:
    Statement must appear within on/onClipEvent handler
    ns.setBufferTime(0);
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 22:
    Statement must appear within on/onClipEvent handler
    ns.play("test");
    Total ActionScript Errors: 6 Reported Errors: 6
    Goal: All I want to do is stream 1 file.. just 1. I have no
    way of knowing whether this server works before taking this simple
    step. It would be nice is Adobe delivered out of the box streaming
    samples like all of the other streaming servers we support do. But
    I digress. Any help is will be appreciated beyond any means that I
    can appropriately convey including a sample code package that works
    that I can just change a few lines in so I can understand what is
    happening.

    Imstamu, I'm relatively new to this myself, but I did notice
    a few items in your message that I wanted to comment on. First, the
    error messages you're coming up with may be the result of putting
    the actionscript in the video object itself, rather than in the
    timeline for the main SWF movie. What I think you may want to do is
    put the actionscript in a layer called "Actions" in the main
    timeline, select the keyframe for that layer in frame 1, and put
    the actionscript in that keyframe. If you have put it in the video
    object (or in some other object such as a button, etc.), you can
    get errors of the type you are reporting (at least it has happened
    to me). However, as noted below, you may not need that actionscript
    at all.
    Second, you may want to try placing a directory under the
    "test" directory called "streams", putting another directory called
    "_definst_" beneath the "streams" directory, and putting the FLV in
    the _definst_ directory. This is where FMS is looking for the files
    to stream, as I understand it. (It sounds from your description
    like you have placed the FLV directly below "test".) Directly below
    test *is* the right place for main.asc, as you have done.
    IMPORTANT: In terms of the path you use in the contentPath variable
    in the video player object, the path for the directory actually
    holding the FLV should *still* be
    rtmp://dl35.tamu.edu/test/_definst_/motion.flv, as you have done --
    i.e., "streams" should not appear in the contentPath variable.
    Don't ask me why, but this worked for me. The reason the server is
    showing a connection is that you have put a "test" directory in the
    right place, and thus have registered the application from the
    point of view of FMS, but you have not put the FLV in the right
    place, and so FMS can't find the FLV file in the path you've
    specified.
    Third, are you using the FLVPlayback component in the swf
    file? (From the fact that you're using one of the canned Flash
    skins, it sounds like that's the case.) If so, and if you're just
    streaming one movie, you don't need to worry about the code to open
    up a new net connection, new netstream, etc. -- all of that is
    embedded in the FLVPlayback object. So all you need to do is put in
    the RTMP path to the file --
    rtmp://dl35.tamu.edu/test/_definst_/motion.flv -- in the
    contentPath variable for the FLVPlayback object; you do not need
    the code opening the NetConnection and NetStream objects.
    I hope this is useful. As noted, I am fairly new to this
    myself, but I have been able to stream files successfully using
    FMS, FLV, and Flash.

  • Ask for help( simple code but wired error )!

    The post I sent just now has some mistakes. This post is correct. My simple code is as follows:
    import java.io.*;
    import java.net.*;
    public class count {
    float dclient = (float)3.333;
    float dlan = (float)0.01884;
    float drouter = (float)0.00115;
    float doutlink = (float)0.04185;
    float dinternet = (float)1.2615;
    float dinlink = (float)3.18129;
    float client1 = 0;
    float lan1 = 0;
    float router1 = 0;
    float outlink1 = 0;
    float internet1 = 0;
    float inlink1 = 0;
    float client2 = 0;
    float lan2 = 0;
    float router2 = 0;
    float outlink2 = 0;
    float internet2 = 0;
    float inlink2 = 0;
    float x = 0;
    float z = (float)3.333;
    public static void main(String[] args) {
    for (int n=1; n<16; ++n)
    client1 = dclient;
    lan1 = dlan * (1+lan2);
    router1 = drouter;
    outlink1 = doutlink * (1+outlink2);
    internet1 = dinternet;
    inlink1 = dinlink * (1+inlink2);
    x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
    client2 = x * client1;
    lan2 = x * lan1;
    rounter2 = x * rounter1;
    outlink2 = x * outlink1;
    internet2 = x * internet1;
    inlink2 = x * inlink1;
    System.out.println(client1 + " " +
    lan1 + " " +
    rounter1 + " " +
    outlink1 + " " +
    internet1+ " " +
    inlink1+ " **** " +
    x + " **** " +
    client2 + " " +
    lan2 + " " +
    rounter2 + " " +
    outlink2 + " " +
    internet2+ " " +
    inlink2 + " ********************end of n = " + n + "************************"
    The compiling error is:
    count.java:43: Can't make a static reference to nonstatic variable dclient in class count.
    client1 = dclient;
    ^
    1 error
    What is wrong with it? Many thanks!

    import java.io.*;
    import java.net.*;
    public class count
         public static float dclient = (float)3.333;
         public static float dlan = (float)0.01884;
         public static float drouter = (float)0.00115;
         public static float doutlink = (float)0.04185;
         public static float dinternet = (float)1.2615;
         public static float dinlink = (float)3.18129;
         public static float client1 = 0;
         public static float lan1 = 0;
         public static float router1 = 0;
         public static float outlink1 = 0;
         public static float internet1 = 0;
         public static float inlink1 = 0;
         public static float client2 = 0;
         public static float lan2 = 0;
         public static float router2 = 0;
         public static float outlink2 = 0;
         public static float internet2 = 0;
         public static float inlink2 = 0;
         public static float x = 0;
         public static float z = (float)3.333;
         public static void main(String[] args)
              for (int n=1; n<16; ++n)
                   client1 = dclient;
                   lan1 = dlan * (1+lan2);
                   router1 = drouter;
                   outlink1 = doutlink * (1+outlink2);
                   internet1 = dinternet;
                   inlink1 = dinlink * (1+inlink2);
                   x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
                   client2 = x * client1;
                   lan2 = x * lan1;
                   router2 = x * router1;
                   outlink2 = x * outlink1;
                   internet2 = x * internet1;
                   inlink2 = x * inlink1;
                   System.out.println(client1 + " " +     lan1 + " " router1 " " outlink1 " " internet1 " " inlink1 " **** " +     x + " **** " +
                   client2 + " " +
                   lan2 + " " +
                   router2 + " " +
                   outlink2 + " " +
                   internet2+ " " +
                   inlink2 + " ********************end of n = " + n + "************************"

  • Need help in simple code for LayeredPane

    Hi,
    here is my simple code for displaying layered pane,
    why is it not working, when i comment label.setBounds();
    also is there a way to have a transparent layer, like
    what i want to do it
    have ont JPanel with some painting on it
    then i want to add one more JPanel over it which is transparent
    Ashish
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestLayeredPaneFrame extends JFrame
         public TestLayeredPaneFrame()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              JLayeredPane layeredPane =new JLayeredPane();
              layeredPane.setPreferredSize(new Dimension(400,600));
    int x = 30;
    int y = 30;
    for (int i = 0; i < 3; i++) {
    x +=30;
    y +=30;
    origin.x += offset;
    origin.y += offset;
    layeredPane.add(new myLabel(x ,y ), new Integer(i));
              Container contentPane = this.getContentPane();
              contentPane.add(layeredPane, BorderLayout.CENTER);
              JPanel panel = myGlassPane();
              this.setGlassPane(panel);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         private JLabel myLabel(int x, int y)
         JLabel label = new JLabel("My Name");
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.BLUE);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    label.setBounds(x, y, 140, 140);     
    return label;     
         public static void main(String args[])
    TestLayeredPaneFrame tlp = new TestLayeredPaneFrame();
    }     

    Hi,
    here is my simple code for displaying layered pane,
    why is it not working, when i comment label.setBounds();
    also is there a way to have a transparent layer, like
    what i want to do it
    have ont JPanel with some painting on it
    then i want to add one more JPanel over it which is transparent
    Ashish
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestLayeredPaneFrame extends JFrame
         public TestLayeredPaneFrame()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              JLayeredPane layeredPane =new JLayeredPane();
              layeredPane.setPreferredSize(new Dimension(400,600));
    int x = 30;
    int y = 30;
    for (int i = 0; i < 3; i++) {
    x +=30;
    y +=30;
    origin.x += offset;
    origin.y += offset;
    layeredPane.add(new myLabel(x ,y ), new Integer(i));
              Container contentPane = this.getContentPane();
              contentPane.add(layeredPane, BorderLayout.CENTER);
              JPanel panel = myGlassPane();
              this.setGlassPane(panel);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         private JLabel myLabel(int x, int y)
         JLabel label = new JLabel("My Name");
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.BLUE);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    label.setBounds(x, y, 140, 140);     
    return label;     
         public static void main(String args[])
    TestLayeredPaneFrame tlp = new TestLayeredPaneFrame();
    }     

  • Installing XML::Simple Perl module on 10.4.8

    Two of my friends today asked me to help them get XML::Simple working on their Mac's. Somthing that should be a simple cpan one-liner "install XML::Simple" doesnt work on OSX. It took me a half hour to figure all this out... here are the steps:
    Prerequisites:
    - X11 1.1.3 package from the OSX install disk (or Apple download site)
    - Perl 5.8.x w/cpan (default on OSX)
    - a terminal
    - A reasonable working knowledge of Perl and Unix
    Step 1:
    Open terminal, type 'cpan' to enter the cpan installer.
    cpan> install XML::Simple
    It will ask you three times if you want to follow the prerequired modules. Hit enter every time. Eventually you will get a dozen test failures. These are in XML::Parser, a required module.
    Step 2:
    cpan> exit
    $ cd ~/.cpan/build/XML-Parser-2.34 **Note the version may change
    $ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11R6/include
    $ make test
    $ make install
    Step 3:
    Back to cpan...
    $ cpan
    cpan> install XML::Parser
    Already Installed
    cpan> install XML::Parser::Expat
    Already Installed
    cpan> install XML::SAX::Expat
    Installs with some silly warning about ParserDetails.ini. Lets fix that.
    cpan> exit
    Step 4:
    Here is the command/code to add Expat to the ParserDetails.ini file. If we don't, we can't proceed past this point.
    $ sudo perl -MXML::SAX -e "XML::SAX->addparser(q(XML::SAX::Expat))->saveparsers()"
    Step 5:
    Back to cpan to finish the install
    $ cpan
    cpan> install XML::Simple
    Hit enter if it asks you anyting. The whole thing should work.
    cpan> exit
    Step 6:
    Verify XML::Simple existance with:
    $ perl -MXML::Simple -e '1;'
    If you don't get an error, you're all done!
    Enjoy.
    Macbook Pro 15" C2D   Mac OS X (10.4.8)  

    Two of my friends today asked me to help them get XML::Simple working on their Mac's. Somthing that should be a simple cpan one-liner "install XML::Simple" doesnt work on OSX. It took me a half hour to figure all this out... here are the steps:
    Prerequisites:
    - X11 1.1.3 package from the OSX install disk (or Apple download site)
    - Perl 5.8.x w/cpan (default on OSX)
    - a terminal
    - A reasonable working knowledge of Perl and Unix
    Step 1:
    Open terminal, type 'cpan' to enter the cpan installer.
    cpan> install XML::Simple
    It will ask you three times if you want to follow the prerequired modules. Hit enter every time. Eventually you will get a dozen test failures. These are in XML::Parser, a required module.
    Step 2:
    cpan> exit
    $ cd ~/.cpan/build/XML-Parser-2.34 **Note the version may change
    $ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11R6/include
    $ make test
    $ make install
    Step 3:
    Back to cpan...
    $ cpan
    cpan> install XML::Parser
    Already Installed
    cpan> install XML::Parser::Expat
    Already Installed
    cpan> install XML::SAX::Expat
    Installs with some silly warning about ParserDetails.ini. Lets fix that.
    cpan> exit
    Step 4:
    Here is the command/code to add Expat to the ParserDetails.ini file. If we don't, we can't proceed past this point.
    $ sudo perl -MXML::SAX -e "XML::SAX->addparser(q(XML::SAX::Expat))->saveparsers()"
    Step 5:
    Back to cpan to finish the install
    $ cpan
    cpan> install XML::Simple
    Hit enter if it asks you anyting. The whole thing should work.
    cpan> exit
    Step 6:
    Verify XML::Simple existance with:
    $ perl -MXML::Simple -e '1;'
    If you don't get an error, you're all done!
    Enjoy.
    Macbook Pro 15" C2D   Mac OS X (10.4.8)  

  • Data Binding: Simple code does not work.

    hi... the following simple code is used to display the ename field for a record selected in scott.emp on the console. the code is placed in an event handler. it is as follows:
    DCBindingContainer bindings = ctx.getBindingContainer();
    DCControlBinding binding = bindings.findCtrlBinding("ename");
    String Name = (binding != null) ? binding.toString() : "";
    System.out.println(Name);
    is the code above correct????
    if so, why it does not work???
    thanks for every help in advance & best regards.

    Hi,
    please check the UIModel.xml file for the page if the binding name is "name". The code you have is the same code we published in our QBE workshop and it works there. The only difference is the name of the control binding. So please check if the binding name exists. (e.g. it could be ename1 instead of ename)
    Frank

  • Installing XML::Simple - CPAN

    I need some help, I've been trying to install the CPAN module XML::Simple on OS X Lion 10.7.3 so far with no good results.
    I installed this on my linux mint machine in no time but for some reason the simple task had turned onto a project on the Mac.
    I found an old posting for setting up the CPAN modules on Mac but I haven't been able to applied to my environment.
    -------   this is the old post ---------------
    Two of my friends today asked me to help them get XML::Simple working on their Mac's. Somthing that should be a simple cpan one-liner "install XML::Simple" doesnt work on OSX. It took me a half hour to figure all this out... here are the steps:
    Prerequisites:
    - X11 1.1.3 package from the OSX install disk (or Apple download site)
    - Perl 5.8.x w/cpan (default on OSX)
    - a terminal
    - A reasonable working knowledge of Perl and Unix
    Step 1:
    Open terminal, type 'cpan' to enter the cpan installer.
    cpan> install XML::Simple
    It will ask you three times if you want to follow the prerequired modules. Hit enter every time. Eventually you will get a dozen test failures. These are in XML::Parser, a required module.
    Step 2:
    cpan> exit
    $ cd ~/.cpan/build/XML-Parser-2.34 **Note the version may change
    $ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11R6/include
    $ make test
    $ make install
    Step 3:
    Back to cpan...
    $ cpan
    cpan> install XML::Parser
    Already Installed
    cpan> install XML::Parser::Expat
    Already Installed
    cpan> install XML::SAX::Expat
    Installs with some silly warning about ParserDetails.ini. Lets fix that.
    cpan> exit
    Step 4:
    Here is the command/code to add Expat to the ParserDetails.ini file. If we don't, we can't proceed past this point.
    $ sudo perl -MXML::SAX -e "XML::SAX->addparser(q(XML::SAX::Expat))->saveparsers()"
    Step 5:
    Back to cpan to finish the install
    $ cpan
    cpan> install XML::Simple
    Hit enter if it asks you anyting. The whole thing should work.
    cpan> exit
    Step 6:
    Verify XML::Simple existance with:
    $ perl -MXML::Simple -e '1;'
    If you don't get an error, you're all done!
    -------- end of old post ---------------------
    This is where I have gotten so far:
    to get in CPAN I use sudo cpan <enter>
    cpan[6]> cpan[6]> install XML::Simple
    Going to read '/Users/josephhandschu/.cpan/sources/authors/01mailrc.txt.gz'
    ............................................................................DONE
    Going to read '/Users/josephhandschu/.cpan/sources/modules/02packages.details.txt.gz'
      Database was generated on Mon, 13 Feb 2012 00:12:32 GMT
      New CPAN.pm version (v1.9800) available.
      [Currently running version is v1.9456]
      You might want to try
        install CPAN
        reload cpan
      to both upgrade CPAN.pm and run the new version without leaving
      the current session.
    ..............................................................DONE
    Going to read '/Users/josephhandschu/.cpan/sources/modules/03modlist.data.gz'
    ............................................................................DONE
    Going to write /Users/josephhandschu/.cpan/Metadata
    XML::Simple is up to date (2.18).
    Then I get out of CPAN
    cpan[11]> exit
    Terminal does not support GetHistory.
    Lockfile removed.
    Josephs-MacBook-Air-2:/ josephhandschu$ cd ~/.cpan/build/XML-Parser*
    Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$ perl^C
    Try to run the Makefile.PL
    Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11/include
    Couldn't find your C compiler
    Compilation failed in require at Makefile.PL line 5.
    BEGIN failed--compilation aborted at Makefile.PL line 5.
    Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$
    or with a shorter version taking the default parameters
    Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$ perl Makefile.PL
    Couldn't find your C compiler
    Compilation failed in require at Makefile.PL line 5.
    BEGIN failed--compilation aborted at Makefile.PL line 5.
    But this complains about not finding the C compiler
    Any ideas?
    Suggestions are greatly appreciated, I've hitted a wall....
    Joseph.

    (I'm using the bash shell below. If you use csh, some of these commands won't work.)
    It sounds like the compiler is not in your PATH. Test this by:
    $ which cc
    My guess is that nothing will be returned by that command.
    You've already installed XCode, so it should be on your system. If your locate(1) database is up to date, the fastest way to find the compiler is this:
    $ locate cc | grep /cc$
    On my machine (OS X 10.7), the compiler is /Developer/usr/bin/cc so I added /Developer/usr/bin to my PATH:
    $ export PATH="$PATH:/Developer/usr/bin"
    And obviously add that to your ~.bashrc file.

  • Does anyone have a simple code.....

    Does anyone have a simple code to make a xml video like you tube?

    Hi zenith
    By default the source of counter 0 while using the 9401 is located on PFI0 or pin 14.  In order to determine the rest of the pins have a look at the image below.  I was able to get this information from by right clicking my device in Measurement and Automation Explorer (MAX) and selecting device pinouts.
    You can also specify which PFI line the counter outputs on.  In order to use this you use a DAQmx Channel Property node and modify the Counter Output Pulse Terminal.  Have a look at the screen shot below 
    Hope this helps. 
    Chris_K_
    Message Edited by Chris_K_ on 08-27-2008 12:26 PM
    National Instruments
    Applications Engineer
    Attachments:
    2008-08-27_111350.jpg ‏20 KB
    2008-08-27_110349.jpg ‏72 KB

  • What's wrong with this simple code?

    What's wrong with this simple code? Complier points out that
    1. a '{' is expected at line6;
    2. Statement expected at the line which PI is declared;
    3. Type expected at "System.out.println("Demostrating PI");"
    However, I can't figure out them. Please help. Thanks.
    Here is the code:
    import java.util.*;
    public class DebugTwo3
    // This class demonstrates some math methods
    public static void main(String args[])
              public static final double PI = 3.14159;
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);

    Change your code to this:
    import java.util.*;
    public class DebugTwo3
         public static final double PI = 3.14159;
         public static void main(String args[])
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);
    Klint

  • Convert simple code from as2 to as3

    Hello, i am looking for some help here for something simple (i think)
    var txt:String = link1;
    btn.onRelease = function():Void {
    if( sample_id )
    getURL("http://www.website.com/registration?partner_id=" + sample_id + "sampleURLCode", "_blank");
    else
    getURL("http://www.website.com/registration?sampleURLCode", "_blank");
    Is there a way to make this simple code into AS3?

    Hi, Apparantly that's because the 'link1' and 'sample_id' variables are not within the scope of the code you posted above, Perhaps you have defined them outside on a different frame or class. You can either define them with the same code like:
    var sample_id:Number=1234;  //Use your own variable type and value here
    var link1:String = "your string or link URL here";
    var txt:String = link1;
    btn.addEventListener(MouseEvent.CLICK, gotoURL);
    function gotoURL(e:MouseEvent)
    if( sample_id )
          navigateToURL(new URLRequest("http://www.website.com/registration?sample_id=" + sample_id + "sampleURLCode"),"_blank");
    else
          navigateToURL(new URLRequest("http://www.website.com/registration?sampleURLCode"),"_blank");
    Or you can put a direct reference to your existing variable like (If your variables are defined on root/frame 1) :
    var link1:String = "your string or link URL here";
    var txt:String = MovieClip(this.root).link1;
    btn.addEventListener(MouseEvent.CLICK, gotoURL);
    function gotoURL(e:MouseEvent)
    if( MovieClip(this.root).sample_id )
          navigateToURL(new URLRequest("http://www.website.com/registration?sample_id=" + sample_id + "sampleURLCode"),"_blank");
    else
          navigateToURL(new URLRequest("http://www.website.com/registration?sampleURLCode"),"_blank");
    try that, or you can share your .fla !
    cheers

  • Jmf simple code

    Hi all,
    this is my simple code that plays a video from a specifed location.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package javaapplication1;
    * @author rohan
    import com.sun.media.util.ContentType;
    import javax.media.*;
    import javax.media.Manager;
    import java.io.*;
    import java.net.URL;
    import javax.media.bean.playerbean.MediaPlayer;
    import java.awt.*;
    import java.net.ProtocolException;
    import javax.swing.*;
    public class Main extends JFrame{
    * @param args the command line arguments
    public Main()
    try
    Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
    Container cont=getContentPane();
    cont.setLayout(new FlowLayout());
    String myUrl=new String("C:\\Users\\rohan\\Softwares\\Jmf and jain sip\\Fig21_06_07\\bailey.mpg");
    System.out.println("myUrl====="+myUrl);
    MediaLocator myurls =new MediaLocator(myUrl);
    Player myplayer=Manager.createRealizedPlayer(myurls);
    System.out.println("Rohan");
    Component video = myplayer.getVisualComponent();
    cont.add(video);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    myplayer.start();
    catch(Exception e)
    System.out.println("Exception====="+e);
    public static void main(String[] args) {
    // TODO code application logic here
    // JFrame fr=new JFrame("hello");
    Main obj=new Main();
    obj.setBounds(300, 300 , 300, 300);
    obj.setVisible(true);
    Problem here is i get this exception
    "Exception=====javax.media.NoPlayerException: Cannot find a Player for :C:\Users\rohan\Softwares\Jmf and jain sip\Fig21_06_07\bailey.mpg
    Can u plz tel me where do i make changes ,so that i can run this simple app. Plz help me...so that i can go further(plz this is my first jmf app.)
    thanks.

    Change your file path like +"file:/C:/delta.mpg"+.
    Hope this will help you to fix your issue.
    Cheers,
    ARIF

  • Can anyone that works wirth xml in InDesign help me

    I am trying to create a schema to get an Excel workbook into xml so I can take that information and make a member list in inDesign CS6 so I don't have to type it by hand. This is the schema:
    <?xml version="1.0"?>
    <schema xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance">
    <element name="memberList">
        <member>
            <lastname>LastName</lastname>
            <firstname>FirstName</firstname>
            <phone>555-555-5555</phone>
            <streetaddress>streetaddress</streetaddress>
            <city>City</city>
            <state>State</state>
            <zipcode>Zip code</zipcode>
            <email>email</email>           
        </member>
    </element>
    </schema>
    When I bring the schema into Excel, everything seems to be fine except that the top of the tree is wrong in excel. memberList is nott at the top ot the tree. When I pull it over to populate the cells I get no names but when i click on the cell it highlights the proper name in the tree.
    Schema
         element
              name
         member
              lastname
              firstname
              phone
              streetaddress
              city
              state
              zipcode
              email
    Can anyone that works wirth xml in inDesign help me

    I typically get XML from a database, or an Excel sheet without the troublesome XML mapping. Once I simply received an Access database. Access spits out XML in a mostly usable state.
    I use an XML editor that converts the Excel sheet to XML, do any needed transformations, search and replaces, etc in the editor, then save it as an XML I use in ID. The editor is XML Blueprint. I often do other manipulations using UltraEdit as I have long used it for programming and am comfortable with it.
    I did a test in Excel's requisite mapping and found it so cumbersome I didn't successfully get it to export in the 20 minutes it took me to try it. I suspect I could do it with more head scratching but I don't have much hair left.
    But I'll give it another try later today or tonight and see if I can help in the way you want to go about it.
    Take care, Mike

  • How to replace huge decode statements with lookups to some simple code/key

    I have a legacy PL/SQL application, composed of many very huge decode statements. And the most terribe one is that the guys who develops the application left the company now, leaves no documentation.
    We are trying to read and understand those PL/SQL programs, and I'm asked to replace those huge decode statements with lookups to some simple code/key tables? But I have no idea about how to design such code/key tables. Is there any one who has similar experience may help me? Besides code/key tables, any idea will be welcome.
    Thank you very much!

    Not sure what your data looks like but sometimes decode can be replaced with more appropriate functions, ie;
    SQL> with t as (
       select 'DAY' a, 30 b, null c, null d from dual union all
       select null a, null b, 'MONTH' c, 12 from dual)
    select coalesce(b,d)
    from t
    COALESCE(B,D)
               30
               12
    2 rows selected.
    SQL> with t as (
       select 'DAY' a, 30 b, null c, 0 d from dual union all
       select null a, 0 b, 'MONTH' c, 12 from dual)
    select greatest(b,d)
    from t
    GREATEST(B,D)
               30
               12
    2 rows selected.

  • Pseudo Easy XML Generate Code

    Hi Everyone,
    I'm new to LabVIEW.
    I'm getting the HI XML code but I need to get my HI XML code to be the same as XML string code I used using DEMO Easy XML. I'm doing this because I wanted to create the VI for my own usage and I can't afford to buy it.
    I hope someone with LabVIEW experience can help me.
    For now, I can deal with Individual data type, now I need them to be displayed all values like the XML string code in my attachment but I tried my best but still didn't managed to find a way to do it.
    Thanks,
    Alan.
    Attachments:
    bbb.jpg ‏94 KB
    aaa.jpg ‏78 KB

    saintalan94 wrote:
    [...] DEMO Easy XML [...] I can't afford to buy it. 
    You've already wasted the $299 it would take to purchase the tool you need.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Sample ruby XML serialization code ?

    Does anybody have some sample ruby code to interface with the ACS4 server ? We are specifically interested by the XML serialization code and the generation of an hmac signature.
    Any help or pointer would be greatly appreciated.
    Thanlks!
    Eljay

    Sorry
    Diffrent versions of the JVM. A save game from J2SE
    1.4.2 might not work when the user upgrades to
    J2SE 1.5.Oh, OK. Thanks for clarifying things.
    >
    It also might fail if you change the internal
    structure of your saved classes.
    (as of yet I've heard of any problems, but this is the
    reason Sun give for using XML instead of
    Serialization)Sounds like a tradeoff . . . increased flexibility at the expense of increased complexity.
    >
    You might want to look into Externalization as well.Hmm, this makes things a bit more complex.
    What I did for my games was take String equivalents for all
    information I needed for a saved game and put them all together
    separated by spaces. Sounds like a good idea. A revised version of this idea might work.

Maybe you are looking for

  • Oracle Custom Workflow Redesign best practices

    Hi All, Morning , need some help with this scenario. We are in the process of redesigning existing developed custom Oracle Workflows in our system ( Oracle Apps Release 12.0.6 ) hence wanted to know if there are steps or guidelines/best practices whi

  • Blurred preview image when dragging playhead in Animation Timeline

    Hi, when I move the playhead (of the Animation Timeline) by hand back and forth, the image get's blurred untill I stop dragging. This is really annoying since I need to draw and animate some small shapes in pixel perfect manner and can't see the diff

  • 'Data for last import/Statistics' tab missing for Distributed imports in EMIGALL

    Hi experts, For some reason when I initiate Distributed loads using 'Distributed imports' in EMIGALL, I do not get the third and fourth tabs viz. 'Data for last import' and 'Statistics for import runs' after the loads are triggered. Is there a specif

  • Change security settings Linux

    Hi, Can anyone post me the link for how to edit Linux security settings (Need more then one logon attempt before lockout of user account on Linux) Regards 933746

  • OS and DB migration

    Hi Guys, Please share with me if any one having SAP EP migration OS- Windows 2003 Server  to Solaris DB-SQL Server to Oracle Thanks.