Xml to JTree, and JTree node to html file.

I have been trying to figure out a way to do this and I think I have a solution, but I am not sure how to structure the application and methods.
working with BorderLayout Panel p, JSplitPane split, JTree tree, and JEditorPane rpane
1st. My JSplitpane is divided with the tree, and rpane. The tree is on the left, and the rpane is on the right. both of these are then added to the Panel p
2. I will create a method that will read through a modules.xml file, and create a JTree - tree. When you click on the node element it's information is displayed in the right pane - rpane.
The Problem. I think it would take to long to create the html file on the fly each when I click on each individual node.
So my idea is to create the html files from many xml files when I run the program. I can then just load the html file when I click on each individual node.
This means alot of heavy processing in the front end, and everything will be static, but it will be faster when the user is in the program.
Problem. How do I associate each node element with the correct html file?
The Tree elements are always the same, but I can have 1 or many modules.
Here is an example:
<device>  // - root
   <module1>
      <Status>
         <Network></Network>
         <Device></Device>
         <Chassis></Chassis>
         <Resources></Resources>
      </Status>
      <ProjMngt></ProjMngt>
      <ProjEdit></ProjEdit>
      <Admin>
         <admNetwork></admNetwork>
         <admUsers></admUsers>
      </Admin>
      <Logging></Logging>
   </Module1>
   ...  Now I can have 1 or many Modules depending on what the xml file  has in it.
   <Module*n>
</device>Other problems. Some of the information I want to store as a sortable Table, but I cannot seem to get any of the sort methods to work. They work if I just open a browser, and run the html file, but if I stick the html file into the JEditorPane it does not work? - any suggestions?
Also, can I pass a JTabbebPane to the JEditorPane, or can I create a tabbed pane in html that will do the same thing.
I am working with a very small device. It does not have a web application container like Tomcat on it. Just Apache, and Java. That is why I am using Swing.

Using 'productAttribute/text()' gets you all three productAttribute nodes and then grabs all the text under that node. It simply concatenates together all the text under the desired node, hence the results you are seeing. If you want to get the text for each child node separately, then you need to do something like (assumes 10.2.x.x or greater)
WITH your_table AS (SELECT
'<root><productAttribute>
<name>Baiying_attr_03</name>
<required>false</required>
</productAttribute>
<productAttribute>
<name>Baiying_attr_04</name>
<required>false</required>
</productAttribute>
<productAttribute>
<name>Baiying_attr_05</name>
<required>false</required>
</productAttribute></root>' xmldata
FROM DUAL)
-- Above simulates your DB table as I don't have it
-- You only care about the following
SELECT xt.*
  FROM your_table yt,
       XMLTable('/root/productAttribute'
                PASSING XMLTYPE(yt.xmldata)
                COLUMNS
                prd_nm   VARCHAR2(30)  PATH 'name',
                prod_rqd VARCHAR2(5)   PATH 'required') xt;Note: I added a <root> node as you had just provided a XML fragment. You will need to adjust accordingly.
The above produces
PRD_NM                         PROD_RQD
Baiying_attr_03                false
Baiying_attr_04                false
Baiying_attr_05                false

Similar Messages

  • Catch the image of JTree and save it as a file

    There is an JTree and it has a few nodes.
    And there, I want to capture both the image of JTree and
    the images of it's child nodes as they show in screen.
    if possible, I want to capture image of all expanded nodes in tree and
    save them as jpg file.
    I try to capture the Image of JTree from JTree.createImage() method.
    and I also tried to capture the images of child nodes
    from JTree.getComponents() and capture images all of child nodes as they were.
    I,however,get to know the method
    Component.createImage() doesn't return the image that shows in screen as it was.
    could anybody tell me the answer?

    Hi,
    don't know if I got you right, but what you want is a "screenshot" of the JTree, right ?
    Try to paint the JTree in a BufferedImage and encode this as JPEG or whatever.
    BufferedImage theImage = new BufferedImage(
          owner.getWidth(), owner.getHeight(), BufferedImage.TYPE_INT_RGB);
          Graphics g = theImage.createGraphics();
          g.setClip( 0, 0, owner.getWidth(), owner.getHeight());
          owner.paint( g);owner is your JTree or any other component you want.
    Hope that helped.

  • JTree and selected node question

    Hello
    Is it possible to convert the selected node to an int?
    I guess I'm looking for something llike this.
    int nodeNumber = node.getSelectedIndex();
    There is nothing like that in the API, and it would help greatly if I could find a way do this.
    Thanks
    Have a good holiday
    Jim

    From the API for JTree
    public int getMinSelectionRow()
    Gets the first selected row.
    Returns:
    an integer designating the first selected row, where 0 is the first row in the display
    But I think this is based on how many rows are displayed at the present time and might change if the tree is opened above it.

  • DnD, JTree and inter-node placement

    Hi, there.
    Drag'n'Drop with JTrees has been discussed at length in this list. I have a DnD-capable application, and the user sees the nodes affected by the drag position as selected, so he knows where the drop will perform.
    Now I want to drop not only on other nodes, but also inbetween. You may imagine there is a red bar shown as soon as the drag is between tree nodes, and the result will be a new node inserted at exactly this position.
    Any ideas how to implement that?
    Hiran

    Still on the problem. Have some thoughts. But absolutely no idea whether this may work at all:
    Upon dragover, the cell affected is selected. That means I query getClosestPathForLocation() and then call setSelectionPath with the result. This works for nodes.
    Now I need to detect the inter-node placement. So the row must get calculated by myself, and if necessary, an extra node will be inserted into the tree. This extra node is rendered just as slim red line, so the user knows now he drops between nodes. Whatever happens now (drop performed, mouse moved elsewhere), the red line will be removed first.
    What do you think?

  • JTree  and Unique node values

    Hi,
    I am dynamically generating a JTree based on (non-unique) category descriptions found in a database. My trouble is that each node must also be identified by a (hidden) unique node id number.
    I have played around with myNode.setUserObject("uniqueNodeNumber");
    but that appears to change the title of the node itself.
    Any ideas or suggestions would be greatly appreciated.
    Thank you!

    class UserObject {
        private int id;
        private Object object;
        public UserObject (int id, Object object) {
            this.id = id;
            this.object = object;
        public int getID () {
            return id;
        public Object getObject () {
            return object;
        public String toString () {
            return object.toString ();
    }You can add this object to your tree.
    Kind regards,
      Levi

  • Different output observed in IE8 and IE11 for same HTML file

    when I open the below html code in ie8 and ie11 the output is different.
    <div style=" color: EAE6F1; " id="Screen147">
    <img style=" width: 1280; height: 1020; " id="item1" src="Desert.jpg" border="0"/>
    <div style=" background-color: FFFFFF; color: 000000; font-family: 'Arial'; font-size: 31px; layout-grid: both fixed 51px 32px; white-space: nowrap; " id="item2">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    <div style=" background-color: FFFFFF; color: 000000; font-family: 'Arial'; font-size: 31px; layout-grid: both fixed 51px 32px; white-space: nowrap; " id="item3">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    <div style=" background-color: FFFFFF; color: 000000; font-family: 'Arial'; font-size: 31px; layout-grid: both fixed 51px 32px; white-space: nowrap; " id="item4">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    I want to display a white block in the image. but when run in IE8 the white block appears bigger as compared to when displayed in IE11. 
    I wanted to know why is this behaviour and if the code is same then the output should also be the same. can anyone help me to understand this behaviour?
    thank you very much in advance for your replies.

    Hi yashajmera,
    Same script gets different results ,just as Greg said this may be related to the different rendering pages methods between different Internet Explorer versions.
    Here is a link for reference :
    Specifying legacy document modes
    https://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx
    We also can try to choose different view mode by F12 tool to have a check .
    To get more detailed information ,it is recommended to look for help from our MSDN forum for help.
     https://social.msdn.microsoft.com/Forums/ie/en-US/home?forum=iewebdevelopment
    Best regards
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • I dont know how to set a site setup and edit some ready html files

    how to set up a site in dreamweaver when using a WAMP SERVER and edit some html files

    Is it a PHP or ASP site or does it have SSI components?
    If not you don't need to seet up a server. You can preview pages offline in a browser window.
    If it IS a PHP, ASP or SSI site, you need to copy it (the site folder)  to your "www" folder of the WAMP folder and then define the site using the folder you placed in the "www" folder as the root.

  • Pls Help--- URGENT... Combining XML file and HTML file Using java program.

    Hi, I need to implemnt this for my project....
    I need to combine XML and HTML file and generate a new HTML file
    Sample XML File:
    <user>
    <txtName>sun</txtName>
    <txtAge>21 </txtAge>
    </user>
    Sample HTML File:
    <body>
    Name: <input type="text" name="txtName" value=""
    Age : <input type="text" Age="txtAge" value=""
    </body>
    I need a java program to combine the above xml and html files and generate the output in HTML.
    Any kind of help is sincerely Appreciated.
    Thanks.

    toucansam wrote:
    So you want us to write it for you? It's pretty straight forward, first parse the xml file with the *[best java xml parser|http://www.google.com/search?&q=parsing+xml+in+java]* and then go through the nodes and construct the html with strings and concatination. Then write the file using *[the best java file writer|http://www.google.com/search?hl=en&q=writing+to+a+file+in+java]*.
    He would do better to use existing tools that make this easy [http://www.ling.helsinki.fi/kit/2004k/ctl257/JavaXSLT/Ch05.html|http://www.ling.helsinki.fi/kit/2004k/ctl257/JavaXSLT/Ch05.html]

  • Convert an xml file into separate html files

    hi,
    i've a problem. i have an xml database. i want to create an html file from that database. but the condition is ,after reading a specified number of nodes say(100) it must write the rest in a new html file. how could i do this.
    please help.

    DOM in explorer or java dom will help u i n that

  • Corruption of index.html file

    I am truly at my wit's end. My web site is hosted on Yahoo. I contracted with them before I was given a Mac for my birthday. I redeveloped my site using iWeb and have frequently had problems when uploading files. I made a small change to my home page the other day and after uploading, the page is corrupted--graphics are skewed, text is shrunken and misplaced, etc. I performed all the usual steps, clearing caches, etc., all to no avail. Uploaded several times--still no good.
    Here's the rub--the files look good on the Mac; the published to a folder site works fine. The first time I called Apple about this they told me that if it's fine on our machine the problem is in the FTP you are using. I went to Yahoo file manager and uploaded the index.html file directly from my hard drive. The same problem. I called Yahoo, and after toying with it the tech told me that the html code is corrupted. He changed the web site designation in the html, and we got a different result, still corrupted. He says it's an iWeb problem.
    I called Apple again--got the same answer, "It's a problem with your web host."
    Here's the html code from index.html:
    <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><meta http-equiv="refresh" content="0;url= http://raffellis.com/Home.html" /></head><body></body></html>
    Any help will be appreciated.

    Well, I solved my problem. Here's what I did. I don't have a clue as to whether this is useful to anyone but here goes:
    It seems only the home page has a problem. After many tries, I decided to dupe the home page and add it as the second page. I uploaded and lo and behold the second page was fine while the home was still corrupted. So, I went back to iWeb and deleted the original home page, making the 2nd page home. Uploaded again and guess what? The home page was corrupted again! What I did next was to go back to iWeb and make my home page a simple "Enter Site by selecting from the menu above." I uploaded and now my site is fine. Not the solution I wanted but I was desperate.
    The bottom line is? Beats the **** outa me,

  • HTML  File Import into InDesign - Reg.

    Dear All
    I want to import html files into Adobe indesign document...
    But indesign does not support html files...Please give me ur Valuable suggestion.
    (*) I can find one of the method is HTML->XML->InDesign
    (*)Is it Possible to Load HTML File to InDesign?
    (*)Is it possible to Import any otherway?
    So Please anyone can give me the Solutions, and I am waiting for favourable answers...
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear Kvern and Sagpogov,
    Many thanks for your suggestion.
    Yah!. I have convert the HTML Document into XML document, using Find / Replace format.
    Example :
    <HTML> </HTML> is change to <?xml version="1.0"?><chapter>...</chapter>
    likewise, all the tags are convert as per the HTML document into XML File.
    Same as <img href="..."> also convert as <Figure ...> </Figure> Tag.
    Table Tags
    <Table...><TH><TR><TD>...</TD></TR></TH><TR><TD></TD></TR></Table>
    as converted
    <Table ...><thead><row><entry>... </entry></row></thead><tbody>...</tbody></Table>.
    No Problem. Its working fine.
    Thanks & Regards
    T.R.Harihara SudhaN

  • How to display local HTML file in web-view?

    Hello everyone,
    we have no problem with showing of remote HTML content from server in box on page in web view. But how we can show such a content when included in HTMLResources? In guide is just "Display a local HTML file in an in-app browser", which works wihout problem, but we don't want to show this HTML content in in-app viewer, it should be part of page.
    Thanks
    Martin

    Now i'm confused. In guide is this:
    To use local HTML files, click the folder icon and specify the local HTML file. The HTML file (such as index.html) should appear in a folder that includes any images or scripts used in the HTML file.
    But no info where such a local HTML file should reside. If this file is in HTMLResources, it is ignored.

  • How to make a VR html file autoplay via the Web Content overlay

    Hello,
    We have created a VR using Object2VR and have loaded the .html file via the Web Content Overlay panel in InDesign CS5.5.
    We want this VR to play automatically on page load, so we have checked the box 'aut play' in the Web Content overlay panel, but it won't play automatically.
    We've tried switching the auto play off in Object 2VR and switching it on in the Web Content overlay and vice versa and also with both on, but still we cannot get it to autoplay.
    Any suggestions? Is this a bug?
    thanks,
    AG

    DPS is no longer supported in 5.5 you need Indesign 6 or Creative Cloud.
    Set you auto play delay for the web overlay to something other than zero seconds, 0.125 works, if it is set to zero seconds. Leave the auto play enabled for the VR.

  • How to show applets in a html file ?

    Hi all
    I have created an applet with jdev ,and I also generated the corresponding html file and a main method. So the java file runs standalone when I click on the run button , but when I copied the class file and the html file in a web server, then there is nothing in the applet region ! Can anyone help me ?
    Here are the code :
    Code of the java file :
    // Copyright (c) 2001
    package pack_applet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    * Applet
    * <P>
    * @author xxxx
    public class Capplet extends JApplet {
    boolean isStandalone = false;
    String x;
    String y;
    JLabel label = new JLabel();
    * Constructs a new instance.
    * getParameter
    * @param key
    * @param def
    * @return java.lang.String
    public String getParameter(String key, String def) {
    if (isStandalone) {
    return System.getProperty(key, def);
    if (getParameter(key) != null) {
    return getParameter(key);
    return def;
    public Capplet() {
    * Initializes the state of this instance.
    * init
    public void init() {
    x = this.getParameter("x", "0");
    y = this.getParameter("y", "1");
    try {
    jbInit();
    catch (Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception {
    this.setSize(new Dimension(400, 400));
    this.getContentPane().add(label, BorderLayout.CENTER);
    label.setText("x = "+x+" y = "+y);
    * start
    public void start() {
    * stop
    public void stop() {
    * destroy
    public void destroy() {
    * getAppletInfo
    * @return java.lang.String
    public String getAppletInfo() {
    return "Applet Information";
    * getParameterInfo
    * @return java.lang.String[][]
    public String[][] getParameterInfo() {
    String[][] pinfo =
    {"x", "String", ""},
    {"y", "String", ""},
    return pinfo;
    * main
    * @param args
    public static void main(String[] args) {
    Capplet applet = new Capplet();
    applet.isStandalone = true;
    JFrame frame = new JFrame();
    frame.setTitle("Applet Frame");
    frame.getContentPane().add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(400, 420);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);
    frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
    static {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception e) {
    e.printStackTrace();
    And code of the html file :
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <HTML>
    <TITLE>
    HTML Applet Test Page
    </TITLE>
    </HEAD>
    <BODY>
    <SCRIPT LANGUAGE="JavaScript"><!--
    var info = navigator.userAgent; var ns = false;
    var ie = (info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0
    && _info.indexOf("Windows 3.1") < 0)
    //--></SCRIPT>
    <COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
    var _ns = (navigator.appName.indexOf("Netscape") >=0
    && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0
    && java.lang.System.getProperty("os.version").indexOf("3.5") < 0)
    || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
    //--></SCRIPT></COMMENT>
    pack_applet.Capplet will appear below in a Java enabled browser.<BR>
    <SCRIPT LANGUAGE="JavaScript"><!--
    if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" codebase="HTTP://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0"> <NOEMBED><XMP>');
    else if(_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.2" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" java_CODE = "pack_applet.Capplet" java_CODEBASE = "Capplet.class" "x" = "0" "y" = "1" pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"> <NOEMBED><XMP>');
    //--></SCRIPT>
    <APPLET CODE = "pack_applet.Capplet" CODEBASE = "Capplet.class" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" >
    </XMP>
    <PARAM NAME = CODE VALUE = "pack_applet.Capplet" >
    <PARAM NAME = CODEBASE VALUE = "Capplet.class" >
    <PARAM NAME = NAME VALUE = "TestApplet" >
    <PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.2">
    <PARAM NAME = "x" VALUE = "0">
    <PARAM NAME = "y" VALUE = "1">
    </APPLET>
    </NOEMBED></EMBED></OBJECT>
    </BODY>
    </HTML>
    Thank you very much.

    you can load your pdf into your browser using
    navigateToURL(new URLRequest("yourpdf.pdf"));

  • How to I get access to the Captivate object in javascript within an HTML file?

    I'm still struggling with this and would really appreciate any help/guidance you can .
    here's what I've got right now:
    var g_bIsInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    document.write("<P><H1> g_bIsInternetExplorer=" + g_bIsInternetExplorer + "</H1></P>");
    document.write("<P><H1> setting objCP....</H1></P>");
    var objCp = g_bIsInternetExplorer ? Captivate : document.Captivate;
    document.write("<P><H1> set objCP....</H1></P>");
    var description = objCp.cpEIGetValue("m_VarHandle.cpInfoDescription");
    document.write("<P><H1> description=" + description + "</H1></P>");
    I've published the captivate project.. I then launch it and then launch the html file that has this code in it
    It does everyting up thru and including line 3
    But it seems to fail on line 4..
    Any ideas /suggestions?
    Thanks in advance.

    Hey Jim - thank you thank you thank you
    Here's what was up with my code:
    This worked:
    alert("about to set objCP...");
    var objCp = document.Captivate;
    alert("completed setting of objCP, about to set get cpInfoDescription...");
    var description = objCp.cpEIGetValue("m_VarHandle.cpInfoDescription");
    alert("description=" + description);
    This did NOT work:
    document.write("<P><H1> AT BEGINNING </H1></P>");
    alert("about to set objCP...");
    var objCp = document.Captivate;
    alert("completed setting of objCP, about to set get cpInfoDescription...");
    var description = objCp.cpEIGetValue("m_VarHandle.cpInfoDescription");
    alert("description=" + description);
    ====
    I'm guessing the 2nd didn't work because i tried to get the captivate object AFTER the script wrote something to an HTML file.  I'm ultimately trying to get Captivate to generate a report for the user to report out what they did in response to the various quiz questions in the course (in HTML in table).   I've posted a query on how to do this here: http://forums.adobe.com/message/5120417#5120417
    Any chance you could take a look at this posting and let me know your thoughts on how best to do this .. It seems like this would be a fairly common thing to do .. It comes stock in Articulate Storyline (through their 'Report.HTML') but I haven't found a comparable one in Captivate.
    Thanks again!
    tom.

Maybe you are looking for

  • How to mapp in UDF column of MasterData  &  Master Data Rows  UDO add time?

    Hi   all ,   I have one MasterData(A) & 3 MasterData Rows(B&C) table     A (Code ,Name ,U_SKU,U_AName,U_AID)      Master table     B(Code ,Name ,U_SKU,U_BName,U_BID)        Child table     C(Code ,Name ,U_SKU,U_CName,U_CID)        Child table    Now

  • Cannot access sites saved to Reading List in Safari with OS 10.8.5

    I just upgraded to 10.8.5, Mountain Lion, and encountered a number of problems with overall performance. One of these problems is that I cannot access sites that I have added to Safari's reading list. When I click on the link in the list I just get a

  • Why have the ports on the left of my macbook pro and the wifi and bluetooth stopped working?

    Hey All, About a week ago the two usb ports on the left of my 17" macbook pro, soundcard, wifi, and bluetooth stopped working. The power port, ethernet, remaining usb on the right are still functional. I've tried repairing the permissions and other s

  • CC install crashes

    Hi I have a Windows 7 SP1 computer. Computer is 64 bit AMD A10-4600M APU, 8 GB RAM, AMD Radeon HD 76606 I am trying to install the latest CC version. 1. Downloaded the installer. 2. It started installing, but then at some point of time taskbar and ot

  • IPod shuffle current and previous gen

    I was going through the Apple Store's refurb iPod site and saw that the current generation iPod shuffle and previous generation iPod shuffle look exactly alike. They're of the clip type. Now, what has actually improved in the current generation of th