An simple Example for beginer ...

Hi:
I want to generate a pdf-file from somefile.xml and somefile.xsl using fop. And it doesn't work. Could somebody provide a simple example, how to do it? It would be very nice.
Thanks a lot.

Here is my code-example:
import java.io.*;
import org.apache.fop.apps.*;
import org.xml.sax.*;
import java.util.logging.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestClass extends HttpServlet
     public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException
          PrintWriter pw = new PrintWriter(new FileOutputStream("C:/Temp/logFile.log"));
          String xmlFileName = "C:/xml/xmlfile.xml";
          String xslFileName = "C:/xsl/xslfile.xsl";
          ServletOutputStream outStream = response.getOutputStream();
          ByteArrayOutputStream arr = new ByteArrayOutputStream(); 
          try
               XSLTInputHandler in = new XSLTInputHandler(new File(xmlFileName), new File(xslFileName));         
               Driver driver = new Driver();           
               driver.setRenderer(Driver.RENDER_PDF);           
               driver.setOutputStream(arr);                                   
               InputSource inputSource = in.getInputSource();           
               XMLReader xmlReader = in.getParser();   // Error! Unknown Source !!!                                            
               driver.render(xmlReader, inputSource);       
          catch (Exception ex)
               ex.printStackTrace(pw);
               pw.close();
          response.setContentType("application/pdf");
          response.setContentLength(arr.size());
          arr.writeTo(outStream);
          outStream.flush();
}Any idea? Thanks.

Similar Messages

  • I need simple example for alv grid

    hi
    i need code for simple example for alv grid.
    thanks.

    hi bharat,
                  this is report with most of the functionality.
    report zus_alv_demo_grid .
    tables:     ekko.
    type-pools: slis.
    types: begin of t_ekko,
    ebeln type ekpo-ebeln,
    ebelp type ekpo-ebelp,
    statu type ekpo-statu,
    aedat type ekpo-aedat,
    matnr type ekpo-matnr,
    menge type ekpo-menge,
    meins type ekpo-meins,
    netpr type ekpo-netpr,
    peinh type ekpo-peinh,
    line_color(4) type c, "Used to store row color
    end of t_ekko.
    data: it_ekko type standard table of t_ekko initial size 0,
           wa_ekko type t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    Data declaration for EVENT and PRINT PARAMETER.
    data: gt_events type slis_t_event,
           gd_prntparams type slis_print_alv.
    data declaration for sorting.
    data : it_sortcat   type slis_sortinfo_alv occurs 1,
           wa_sort like line of it_sortcat.
    data :  i_list_comments type slis_t_listheader.
    start-of-selection.
      perform data_retrieval.
    perform user_command.
      perform build_fieldcatalog.
      perform build_layout.
      perform build_events.
      perform build_print_params.
      perform build_sortcat.
      perform display_alv_report.
    end-of-selection.
    *TOP-OF-PAGE.
    PERFORM top-of-page.
    end-of-page.
    *&      Form  build_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      fieldcatalog-do_sum = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " build_fieldcatalog
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for
    *when double
                                            "click(press f2)*
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " build_layout
    *&      Form  data_retrieval
          text
    -->  p1        text
    <--  p2        text
    form data_retrieval.
      data: ld_color(1) type c.
      select ebeln ebelp statu aedat matnr menge meins netpr
    peinh from ekpo  into table it_ekko.
    *Populate field with color attributes
      loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
        if ld_color = 8.
          ld_color = 1.
        endif.
        concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
        modify it_ekko from wa_ekko.
      endloop.
    endform.                    " data_retrieval
    *&      Form  display_alv_report
          text
    -->  p1        text
    <--  p2        text
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = gd_repid
                is_layout                = gd_layout
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                i_callback_user_command  = 'USER_COMMAND'
                i_callback_pf_status_set = 'SET_PF_STATUS'
                it_event                 = gt_events
                is_print                 = gd_prntparams
                it_fieldcat              = fieldcatalog[]
                it_sort                 = it_sortcat
                i_save                   = 'X'
           tables
                t_outtab                 = it_ekko
           exceptions
                program_error            = 1
                others                   = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.              " DISPLAY_ALV_REPORT
    *&      Form  user_command
          text
    -->  p1        text
    <--  p2        text
    *&      Form  top-of-page
          text
    -->  p1        text
    <--  p2        text
    form top-of-page.
    *ALV Header declarations
      data: t_header type slis_t_listheader,
            wa_header type slis_listheader,
            t_line like wa_header-info,
            ld_lines type i,
            ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      concatenate  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
       sy-datum(4) into wa_header-info."todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
         into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
           it_list_commentary = t_header
           i_logo             = 'GANESH_LOGO'.
    endform.                    " top-of-page
          FORM user_command                                             *
    -->  R_UCOMM                                                       *
    -->  RS_SELFIELD                                                   *
    form user_command using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case r_ucomm.
        when '&IC1'.
          if rs_selfield-fieldname = 'EBELN'.
            read table it_ekko into wa_ekko index rs_selfield-tabindex.
            set parameter id 'BES' field wa_ekko-ebeln.
            call transaction 'ME23N' and skip first screen.
          endif.
        when 'ULHAS'.
          if rs_selfield-fieldname = 'EBELN'.
            read table it_ekko into wa_ekko index rs_selfield-tabindex.
            set parameter id 'BES' field wa_ekko-ebeln.
            call transaction 'ME23N' and skip first screen.
          endif.
      endcase.
    endform.
          FORM set_pf_status                                            *
    -->  RT_EXTAB                                                      *
    form set_pf_status using rt_extab type slis_t_extab.
      set pf-status 'ZNEWSTATUS'.
    endform.
    *&      Form  build_events
          text
    -->  p1        text
    <--  p2        text
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = gt_events[]
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      read table gt_events with key name =  slis_ev_end_of_page
                  into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
      read table gt_events with key name =  slis_ev_end_of_list
                  into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " build_events
    *&      Form  build_print_params
          text
    -->  p1        text
    <--  p2        text
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " build_print_params
          FORM END_OF_PAGE                                              *
    form end_of_page.
      data: listwidth type i,
      ld_pagepos(10) type c,
      ld_page(10)    type c.
      write: sy-uline(50).
      skip.  write:/40 'Page:', sy-pagno .
    endform.
          FORM END_OF_LIST                                              *
    form end_of_list.
      data: listwidth type i,
      ld_pagepos(10) type c,
      ld_page(10)    type c.
      skip.  write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  build_sortcat
          text
    -->  p1        text
    <--  p2        text
    form build_sortcat.
    wa_sort-spos      = 1.
    wa_sort-fieldname = 'EBELN'.
    append wa_sort to it_sortcat.
    wa_sort-spos      = 2.
    wa_sort-fieldname = 'EBELP'.
    append wa_sort to it_sortcat.
    endform.                    " build_sortcat
    Rewards if helpfull
    regards
    vijay dwivedi

  • Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it. 
    Alex D
    Applications Engineer
    National Instruments

  • Provide simple example for Arbitrary data sending through NI4551(DSA)

    We Converted NI-DSA function palette
    in LabVIEW under Application
    Examples>>Advanced>>Arbitrary Output Example.
    But, We not exactly getting arbitrary wave. Our arbitrary data is correct. I think there is a problem with FFT settings. So Please Provide simple example for Arbitrary data sending through NI4551(DSA)

    Hello Sateesh!
    First, what versions of LabVIEW and NI-DSA are you using.  I have been searching around for the example you are refering too and I am not able to find it.  Are you creating and arb. wave in the frequency domain and then performing an FFT to get it to the time domain?  Next, remember your wave will only be as exact as the AO specs. of the hardware...
    The output conversions occur simultaneously at software-programmable rates from 1.25 to 51.2 kS/s in increments of 47.684 µS/s. The analog output circuitry uses eight-times oversampling interpolators with 64-times oversampling delta-sigma modulators to generate high-quality signals. Software-programmable attenuation of 0, -20, or -40 dB is available on the output channels. The PCI-4451 has excellent amplitude flatness of ±0.2 dB within DC to 23 kHz, and a THD of -90 dB at 1 kHz.
    Now, as far as obtaining other examples If you use the LabVIEW example finder and goto Hardware Input and Output>>Traditional DAQ>>Analog Output.  I would also in the lower right hand corner of the Example Finder select your 4451 this will show you all examples that work with your hardware.  I hope this helps a little but please give me more details we will go from there.   Have a great day!
    Allan S.
    National Instruments

  • Simple example for web dynpro abap

    send me one simple and easiest example with screen
    shots in web dynpro abap......

    Hi cranjith kumar ,
    The following r PDF & PPT docs on simple and easiest example with screen
    shots in web dynpro abap.
    Web Dynpro for ABAP: Tutorials for Beginners
    Web Dynpro for ABAP: Tutorials for Beginners [original link is broken]
    Developing ABAP applications using Web Dynpro Configuration Scenario
    http://www50.sap.com/businessmaps/8729920B31E343F099B71340B15F06DB.htm
    Web Dynpro for ABAP
    http://www.vnsg.nl/temp/508773747/A1-WDA_Themadag.pdf
    Web Dynpro for ABAP in SDN
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/512040e1-0901-0010-769c-c238c6ca35d9 [original link is broken]
    Developing ABAP Applications Using Web Dynpro
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/d41b25d2216babe10000000a1553f6/frameset.htm
    Web Dynpro ABAP: Development in Detail
    http://help.sap.com/saphelp_nw2004s/helpdata/en/03/0048413e466e24e10000000a155106/frameset.htm
    WDA Sample programs & tutorials
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d
    Web Dynpro ABAP Demonstration Videos
    /people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
    cheers!
    gyanaraj
    ****Pls reward points if u find this helpful

  • Please provide me with a simple example for creating a trunk from a 6506 to a 3750

    An simple config example would be perfect

    Here goes the configuration 
    3560 – example
    Switch(config)#int fa0/2
    Switch(config-if)#switchport
    Switch(config-if)#switchport trunk encapsulation ?
    dot1q Interface uses only 802.1q trunking encapsulation when trunking
    Switch(config-if)#switchport trunk encapsulation dot1q
    Switch(config-if)#switchport trunk native vlan ?
    <1-1005> VLAN ID of the native VLAN when this port is in trunking mode
    Switch(config-if)#switchport trunk native vlan 3
    Switch(config-if)#switchport trunk allowed vlan ?
    WORD VLAN IDs of the allowed VLANs when this port is in trunking mode
    add add VLANs to the current list
    all all VLANs
    except all VLANs except the following
    none no VLANs
    remove remove VLANs from the current list
    Switch(config-if)#switchport trunk allowed vlan 1 – 5 , 23 , 34
    Switch(config-if)#switchport mode ?
    access Set trunking mode to ACCESS unconditionally
    dynamic Set trunking mode to dynamically negotiate access or trunk mode
    trunk Set trunking mode to TRUNK unconditionally
    Switch(config-if)#switchport mode trunk
    Ok so now let’s confirm the port by using the show interface trunk command….
    sh int trunk
    Port Mode Encapsulation Status Native vlan
    Fa0/2 on 802.1q trunking 3
    Port Vlans allowed on trunk
    Fa0/2 1-1005

  • Simple example for sap.viz.ui5.Scatter required

    Hello,
    I'm developing my first view including a scatter control. Can anyone provide me with a simple coding example? Currently I can see a place holder containing the text "No Data".
    Best regards,
    Silvana

    You can use this one:
    UI5 CVOM HTML5 Charts - sap.viz.ui5

  • Can anyone recommend a simple example for displacementmapfilter? I just want a simple expand effect.

    As the title says, can anyone recommend any simple displacementmapfilter examples?
    I have a bitmap image of a sleeping animal that I would like to add a small effect to that will make it look like it is breathing. I'm guessing this should be pretty simple with displacementmapfilter - a spherical distortion tweened over time over the animal's chest.
    Any suggestions?

    i don't think there's anything simple about the displacementmapfilter. i've tried to explain it before but i've never had the feeling that i was able to convey understanding.
    here's the displacementmapfilter at work:  www.kglad.com, click snippets, click displacement.
    here's the source code:  www.kglad.com/Files/forums/displacementMapFilter_AS3.fla
    p.s.  there's commented-out code in there that used a squeeze and bulge function during my early experiments that could probably be used by you.

  • Any simple example for comparator for treemap

    I have a treemap collection stored some data like
    a:4
    b:7
    c:5
    d:7
    e:1
    f:3
    The Treemap helped me to sort by key value like above.
    But what I want is sort by value , it should be like this
    b:7
    d:7
    c:5
    a:4
    f:3
    e:1
    I know comparator object can help me about the sorting mechanism in treemap, it is used like
    comp is comparator
    TreeMap tm = new TreeMap(comp)
    but I don't know how to construct this comparator object to help me sort by value.
    Any one can help me here??
    Thank you

    Here's a sample that demonstrates the issue. Note that when you run this that the comparator class never sees the data items (in this case 'a' - 'f'), only the numbers.
    Also notice that both sets that are returned (keySet and entrySet) are appropriately sorted.
    Finally, it is interesting to note that it looks like the TreeMap.get() method walks the tree to find the entry (no surprise), but the entrySet method returns both the keys and data in one shot. This implies that there may be a performance blip gained by asking for the entrySet and getting the values that way, rather than the first technique using the keySet and get().
    import java.util.*;
    public class x
         public static void main(String args[])
              TreeMap t = new TreeMap(new Comparator() {
                   public int compare(Object o1, Object o2) {
                        Comparable c1 = (Comparable) o1;
                        Comparable c2 = (Comparable) o2;
                        System.out.println("Comparing " + c1 + " - " + c2);
                        return c1.compareTo(c2);
                   public boolean equals(Object o) {
                        return false;
              String s;
              t.put("1", "f");
              t.put("2", "e");
              t.put("3", "d");
              t.put("4", "c");
              t.put("5", "b");
              t.put("6", "a");
              Iterator i;
              Set keys = t.keySet();
              i = keys.iterator();
              while(i.hasNext()) {
                   s = (String)i.next();
                   System.out.println(s + " - " + t.get(s));
              Set entries = t.entrySet();
              i = entries.iterator();
              while(i.hasNext()) {
                   System.out.println(i.next());

  • I want simple example of UTL_FILE package

    I want simple example of UTL_FILE package , and please I want this example be complete as possible as you can ( i mean - as I understand - we suppose make Create Directory statement at beginning and so on ... ) .
    even if you know any links for simple examples for UTL_FILE package .... I will be so grateful to post it .

    Maybe something like this?
    http://www.oracle-base.com/articles/9i/GeneratingCSVFi
    les.phpthanks Jens Petersen .... it's good one.

  • Any example for a MFC, WTL or Win32 without Measurement Studio?

    It seems that NI wants you buy their Measurement Studio which can easily cost you a fortune. I am looking around a simple example for MFC, WTL without touching the measurement studio. But if you do not have measurement studio, NI only gives you very old examples in ANSI C which is difficult to implement to MFC or WTL. Apparently they want to increase their revenue by forcing you to buy the Measurement Studio. But I will not buy their hardware in the future if this is their strategy.
    Anyone successfully implement the ANSI C example to MFC or WTL without measurement studio? Can you share an example?

    Junqi,
    Im a little confused with this request in general. What development environment are you using? Visual Studio? Also, what language are you coding in? We provide C, C#, VB.net, and legacy VB6 examples with our DAQmx driver that do not require measurement studio. They can be found in documents\National Instruments\NI-DAQ\Examples 
    Now forgive me if Im misinformed about this, but MFC and WTL are just libraries that have some of the windows API wrapped into them, correct? If so, I dont see how interfacing with them is any different than interfacing with any other library, or why this would cause issues with doing DAQ calls. If you need help with the MFC or WTL library, there are many good places to find help with on the internet. MSDN, codeproject.com, and many others come up as having examples of using MFC in various projects.   
    The MS examples dont install withough MS because they wouldnt be able to be used because they use libraries that are installed with measurement studio, so they would be nonfunctional and largely useless. 
    Regards,
    Kyle Mozdzyn
    Applications Engineering
    National Instruments
    Regards,
    Kyle M.
    Applications Engineering
    National Instruments

  • Need Simple Example of Notifier and Occurance

    hi friends
    i need to know the exact funtion of notifiers and occurances. So can you send me the simple example for both..
    Thanks in advance... 

    Open your example finder (help..find examples...") and search for these two terms.
    I recommend looking at "General Notifier example.vi" and "Generate Occurrences.vi".
    Is there anything in the online help that is not clear? What are you trying to do?
    Message Edited by altenbach on 09-26-2008 11:22 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Mapviewer svg jsp - example for enableFeatureSelect ?

    hi,
    can anybody give me a simple example for enableFeatureSelect/getSelectedIdList (or even for enablePolygonSelect to get some highway-id's)? in the demo mapinit.jsp with svg you can zoomin and recenter.
    i want to create a new radio button for clicking on the svg and not to zoomin or recenter, but for selecting and highlighting a county.
    how can i select a county so it changes its color and i can get the id for this county?
    greetings
    thomas

    There is a SVG Territory Manager Demo that comes with MapViewer that can be downloaded from OTN. It alows you to select a county on the map and it uses the enableFeatureSelect and getSelectedIdList functioins. If you have not downloaded the latest 10.1.2 mapviewer and the demo data, you can download it from here, http://www.oracle.com/technology/software/products/mapviewer/index.html.
    Basically you need to do the following things to make it work.
    1. In the XML base map definition, set "selectable_in_svg" attribute and onclick function for the theme on which you want feature selection to be enabled . Here is an example,
    <?xml version="1.0" standalone="yes"?>
    <map_definition>
    <theme name="STATES" min_scale="50.0" max_scale="4.0"/>
    <theme name="COUNTIES" min_scale="4.0" max_scale="0.0" min_dist="0.5" selectable_in_svg="true" onclick="selectCounty"/>
    <theme name="STATES_LINE" min_scale="4.0" max_scale="0.0"/>
    <theme name="HIGHWAYS" min_dist="1.0"/>
    <theme name="CITIES" min_scale="1.2" max_scale="0.0" />
    </map_definition>
    2. Define the onclick javascript function in your jsp/html page where the svg map is embedded. For example, if you have created a base map using the sample XML shown above, you should define a javacript function called "selectCounty" to handle the mouse click event when the feature is clicked. Inside this javascript function, you can call getSelectedIdList to get the id of the clicked feature.
    3. In your jsp/html page, call javascript function enableFeatureSelect to enable single feature selection.

  • Simple Sample for BackgroundSound

    Hi,
    I only want to add a simple BackgroundSound to my scene, but it does not work! I get no error but I get no sound, too! Has anyone a simple example for me which shows how it works or can someone tell me what's wrong with my code? Here is my code:
    MediaContainer mediaContainer = new MediaContainer();
    try {
    mediaContainer.setURLObject(new URL("File:///c:/demo.wav"));
    catch (MalformedURLException e) {
    System.out.println(e.toString());
    BackgroundSound sound = new BackgroundSound();
    BoundingSphere soundBounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 1000.0);
    sound.setSchedulingBounds(soundBounds);
    sound.setSoundData(mediaContainer);
    sound.setLoop(-1);
    sound.setEnable(true);
    objTrans.addChild(sound);
    objTrans is a TransformGroup. I add it to the Root-BranchGraph. I do this in the createSceneGraph()-Method.
    Greetings
    Alex

    cough declare the audio device first cough :D
    SimpleUniverse u = new SimpleUniverse(my_canvas_3D);
    AudioDevice audioDev = u.getViewer().createAudioDevice();
    (>'.')>

  • Looking for a simple example of the Minimax algorithm in java

    Hey everyone,
    I'm currently working on a Gameboy emulator program as a pet project, and for one of the game's I'd like for the enemy AI to use the Minimax algorithm, but I don't have any experience with it (or recursion in general, for that matter). Could anyone maybe post a simple example of how this algorithm works?

    WTF? I'm sure you can find plenty of examples on google. It's on you to take the time to go through them, study them, and, if you still don't understand something, post a clear, concrete question that indicates what you read and what you didn't understand about it.
    As is, you're essentially treating folks here as your research flunkies and saying, "Give me an example that's better than all the ones already easily available to me. Read my mind to know why I didn't like them."

Maybe you are looking for