Parse and Modify Xml using DOMDocument60 in VC++

I am trying to traverse an in-memory xml, while traversing the nodes, I want to edit the value in the node and save it in memory.
Is there a way???
Below is a portion of the code snippet, it does not seem to work...
Any help will be great.
BOOL CTestDialog::ParseAndSave()
HRESULT hr = S_OK;
CComPtr<IXMLDOMDocument2> spDoc;
VARIANT_BOOL success = VARIANT_FALSE;
hr = spDoc.CoCreateInstance(__uuidof(DOMDocument60));
if (FAILED(hr))
return TRUE;
hr = spDoc->put_async(success);
if (FAILED(hr))
return TRUE;
hr = spDoc->loadXML(m_ErrText, &success);
if (FAILED(hr))
return TRUE;
CComPtr<IXMLDOMNode> pNode;
CComPtr<IXMLDOMElement> spElement;
CComPtr<IXMLDOMNamedNodeMap> pMap;
hr = pNodeList->get_item(i, &pNode);
hr = pNode->QueryInterface(&spElement);
hr = spElement->get_attributes(&pMap);
pMap->get_item(j, &pAttr);
pAttr->get_text(&txt);
pAttr->get_nodeName(&name);
if(someCondition)
CComVariant sValue("");
pAttr->put_nodeValue(sValue); // ???

I am glad that you solve this question and share the solution with us, I will mark your reply as the answer.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Parsing ejb-jar.xml using jaxb

    hi all,
    how to parse the ejb-jar.xml using jaxb? can anybody send the information about the API which we have to use to parse the ejb-jar.xml? (ejb2.0)
    i need the details about all ejbs in an application, (like jndi name, Home and Remote name). so, how can i parse the ejb descriptors?
    regards,
    panneer

    Hi Panneer,
    Well, parsing the EJB descriptors is, in principle, a task for the EJB container where they are deployed. From what you wrote I assume that you need to gather that kind of info to visualize in some (monitoring?) tool. Is that correct?
    If so, the question would be whether you have access to the EJB jar on the file system (before it's deployed) or you can only connect to the server with the already deployed EJBs. In the latter case, this information is shown in the [NWA plugins|http://help.sap.com/saphelp_nwce10/helpdata/en/0b/5b5a42ea221153e10000000a155106/frameset.htm]. There are also some [telnet commands|http://help.sap.com/saphelp_nw04/helpdata/en/79/3cf82ade038d45a21fbfdaee349b22/frameset.htm] in NW 04 and 7.0 (04s).
    If you have access to the EJB jar file, you can parse the descriptors using DOM or SAX, but I'm not aware of any pre-defined JAXB API for this purpose. Probably you can also generate the mapped classes yourself and use them, however I'm not sure how that works with DTD (because of EJB 2.0).
    HTH!
    \-- Vladimir

  • Parse and output XML document while preserving attribute order

    QUESTION: How can I take in an element with attributes from an XML and output the same element and attributes while preserving the order of those attributes?
    The following code will parse and XML document and generate (practically) unchanged output. However, all attributes are ordered a-z
    Example: The following element
    <work_item_type work_item_db_site="0000000000000000" work_item_db_id="0" work_item_type_code="3" user_tag_ident="Step" name="Work Step" gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_site="0000000000000000" last_upd_db_id="0" rstat_type_code="1">
    </work_item_type>is output as:
    <work_item_type gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_id="0" last_upd_db_site="0000000000000000" name="Work Step" rstat_type_code="1" user_tag_ident="Step" work_item_db_id="0" work_item_db_site="0000000000000000" work_item_type_code="3">
    </work_item_type>As you may notice, there is no difference in these besides order of the attributes!
    I am convened that the problem is not in the stylesheet.xslt but if you are not then it is posted bellow.
    Please, someone help me out with this! I have a feeling the solution is simple
    The following take the XML from source.xml and outputs it to DEST_filename with attributes in a-z order
    Code:
    private void OutputFile(String DEST_filename, String style_filename){
         //StreamSource stylesheet = new StreamSource(style_filename);
         try{
              File dest_file = new File(DEST_filename);
              if(!dest_file.exists())
                  dest_file.createNewFile();
              TransformerFactory tranFactory = TransformerFactory.newInstance();
              Transformer aTransformer = tranFactory.newTransformer();
              aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
              Source src = new DOMSource("source.xml");
              Result dest = new StreamResult(dest_file);
              aTransformer.transform(src, dest);
              System.out.println("Finished");
         catch(Exception e){
              System.err.print(e);
              System.exit(-1);
        }

    You can't. The reason is, the XML Recommendation explicitly says the order of attributes is not significant. Therefore conforming XML serializers won't treat it as if it were significant.
    If you have an environment where you think that the order of attributes is significant, your first step should be to reconsider. Possibly it isn't really significant and you are over-reaching in some way. Or possibly someone writing requirements is ignorant of this fact and the requirement can be discarded.
    Or possibly your output is being given to somebody else who has a defective parser which expects the attributes to be in a particular order. You could quote the XML Recommendation to those people but often XML bozos are resistant to change. If you're stuck writing for that parser then you'll have to apply some non-XML processing to your output to fix it up on their behalf.

  • XMLDataSet and Dynamic XML using JSP

    I am trying to use the XMLDataSet function to call a jsp page
    instead of an xml file. The jsp page fetches records out of a db
    and creates xml to return to the spry function. Nothing seems to be
    returned, and blank spry data region on page.
    If i supply a xml file to the function it works correctly.
    I adapted the ASP/PHP samples from XMLExport demo. Code as
    follows:- If i run 2nd jsp directly, the browser shows the xml as
    expected.
    --- TEST.JSP ---
    <script type="text/javascript">
    Spry.Data.Region.debug=true;
    var dsPeople = new Spry.Data.XMLDataSet("transtoxml.jsp",
    "company/person");
    </script>
    --- transtoxml.jsp ---
    <%@ page language="java"
    import="java.sql.*, java.io.*, java.util.*,
    com.Ostermiller.util.*"
    errorPage="" %>
    <%@ include file="globals.jsp" %>
    <%
    String SQL="";
    Statement sTransaction;
    ResultSet rTransaction;
    try
    Class.forName(className);
    con =
    java.sql.DriverManager.getConnection(connectionURL,userName,password);
    }catch(Exception e){
    out.print(e.toString());
    out.print("Error connecting to database " + connectionURL);
    SQL ="SELECT ";
    SQL+="[ID], ";
    SQL+="[DocumentNo]";
    SQL+="FROM TRX_TRANSACTION_MAPPING";
    sTransaction = con.createStatement();
    try {
    rTransaction = sTransaction.executeQuery(SQL);
    response.setContentType("text/xml");
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("pragma","no-cache");
    %>
    <?xml version='1.0' encoding='iso-8859-1'?>
    <company>
    <% while(rTransaction.next()) { %>
    <person>
    <id><%=(rTransaction.getString("ID"))%></id>
    </person>
    <% } %>
    </company>
    <%
    response.flushBuffer();
    sTransaction.close();
    } catch (SQLException e) {
    out.print(e);
    %>

    This is the xml output the jsp gives when run directly:- Cut
    n pasted from browser. There does appear to be an error, because
    the spry:state="error" div is being displayed. If i paste the
    following into a file all is ok, any ideas anyone.
    regards
    sm@rt
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <company>
    - <person>
    <id>117</id>
    </person>
    - <person>
    <id>118</id>
    </person>
    - <person>
    <id>119</id>
    </person>
    - <person>
    <id>120</id>
    </person>
    - <person>
    <id>121</id>
    </person>
    - <person>
    <id>122</id>
    </person>
    - <person>
    <id>123</id>
    </person>
    - <person>
    <id>124</id>
    </person>
    - <person>
    <id>125</id>
    </person>
    - <person>
    <id>126</id>
    </person>
    - <person>
    <id>127</id>
    </person>
    - <person>
    <id>128</id>
    </person>
    - <person>
    <id>129</id>
    </person>
    - <person>
    <id>130</id>
    </person>
    - <person>
    <id>131</id>
    </person>
    - <person>
    <id>132</id>
    </person>
    - <person>
    <id>133</id>
    </person>
    - <person>
    <id>134</id>
    </person>
    - <person>
    <id>135</id>
    </person>
    - <person>
    <id>136</id>
    </person>
    - <person>
    <id>137</id>
    </person>
    - <person>
    <id>138</id>
    </person>
    - <person>
    <id>139</id>
    </person>
    - <person>
    <id>141</id>
    </person>
    </company>

  • Parse and render XML... and get original replicated?

    Now that I've (temporarily) got iFS working (on another machine for now). I've got an XML question: I moved the airportdefinition.xml into the folder, and then subsequently moved the airport.xml into the folder, whereupon iFS parsed it and stored it. Yeah! However when examining (or copy out) the stored data, it is somewhat different than the original:
    original:
    <?xml version="1.0"?>
    <Airport>
    <Name>airport1.fly</Name>
    <AirportCode>SFO</AirportCode>
    <AirportName>San Francisco</AirportName>
    <FolderPath>.</FolderPath>
    </Airport>
    As recreated by the renderer:
    <?xml version = '1.0' standalone = 'yes'?>
    <AIRPORT>
    <Name>airport1.fly</Name>
    <Owner RefType="Name" ClassName="DIRECTORYUSER">system<!--ID # 96--></Owner>
    <ACL RefType="Name" ClassName="SYSTEMACCESSCONTROLLIST">Published<!--ID # 422--></ACL>
    <CreateDate format="MMM dd HH:mm">Nov 09 15:44</CreateDate>
    <Creator RefType="Name" ClassName="DIRECTORYUSER">system<!--ID # 96--></Creator>
    <LastModifyDate format="MMM dd HH:mm">Nov 09 15:44</LastModifyDate>
    <LastModifier RefType="Name" ClassName="DIRECTORYUSER">system<!--ID # 96--></LastModifier>
    <LockState>0</LockState>
    <AIRPORTCODE>SFO</AIRPORTCODE>
    <AIRPORTNAME>San Francisco</AIRPORTNAME>
    </AIRPORT>
    We'd like (to have cake and eat it) to be able to store parsed xml (to support queryability, indexing, reporting, etc.) but also want to be able to recreate the original xml UNCHANGED.
    If we don't parse it, we can have unchanged data, but then limit the queryability. Other than storing the xml document twice (both parsed and not) is there any way to do this?
    null

    I am glad that you solve this question and share the solution with us, I will mark your reply as the answer.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Q: How to access and modify xml tags using Java

    I have an xml based document that i need to access and change. For example, the code
    <section id="section1">
    <div>
    <xforms:group id="id1">
    <xforms:label id="label1">
    <l style="font-size:16pt"> something </l>
    </xforms:label>
    </xforms:group>
    </div>
    </section>
    Working with Java I need to access all the tags, select some of them that are relevant to the current device and remade the document. I thought I would read the file character by character identifying the different labels and building a tree, storing in the tree nodes the relevant information as some kind of attributes (for example, in the case of the <xforms:group id="id1"> I would name the node "xforms:group" and create an "id" attribute with value "id1"). I'm not sure if that is the most efficient way of accessing the problem (computational power might be an issue), and would appreciate some help on the subject.
    Thanks,

    this may help you..
    this is a little util i made to help me read/write files.
    using this, you are only one step away from your solutions, you only need to figure out the regex you need to run on the text of the file to make it become what you need it to become.
    though if you use non-standard encoding, you might not want to use this code..
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.Arrays;
    public class ASCIIFile {
         private File file;
         private StringBuilder builder;
         public ASCIIFile(String path) throws IOException{
              file = new File(path);
              openFile();
         public ASCIIFile(File file) throws IOException{
              this.file = file;
              openFile();
         public void setNewFileName(String fileName){
              file = new File(file.getAbsolutePath(), fileName);
         public void setNewFilePath(String filePath){
              file = new File(filePath, file.getName());
         private void openFile() throws IOException{
              if(!file.exists()) file.createNewFile();
              BufferedReader read = new BufferedReader(new FileReader(file));
              String line = read.readLine();
              builder = new StringBuilder();
              while(line != null){
                   builder.append(line);
                   builder.append("\n");
                   line = read.readLine();
              read.close();
         public String getContents(){
              return builder.toString();
         public StringBuilder getStringBuilder(){
              return builder;
         public void setStringBuilder(StringBuilder b) throws IOException{
              setContents(b.toString());
         public void setContents(String contents) throws IOException{
              FileWriter writer = new FileWriter(file);
              writer.write(contents);
              writer.flush();
              writer.close();
              builder = new StringBuilder(contents);
         public static File[] getAllFilesUnderDir(String fullpath, boolean recursive) {
              ArrayList queue = new ArrayList(10);
              ArrayList matched = new ArrayList();
              File root = new File(fullpath);
              File[] files = root.listFiles();
              if (files == null || files.length == 0) {
                   return new File[] {};
              queue.addAll(Arrays.asList(files));
              for (int j = 0; j < queue.size(); j++) {
                   File child = (File) queue.get(j);
                   if (child.isDirectory() && recursive) {
                        files = child.listFiles();
                        if (files != null) {
                             queue.addAll(Arrays.asList(files));
                   } else { // child is file
                        matched.add(child);
              return (matched.size() > 0)?((File[]) matched.toArray(new File[] {})):(new File[] {});
    }

  • Parse and display xml doc when click on JTree node?

    Ok so here is the code that I have now. You will have to make alot of html files to run the program, but they can be empty for now. What you can do is just put the same exact html file to be displayed in each node element. for example.
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));could be changed to
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "status.html"));And just keep adding the status.html page to each one of the nodes.
    anyway.
    For now when I click on the node, the html file is displayed in the JScrollPane rPane = new JScrollPane(htmlPane); and the htmlPane is a JEditorPane
    what I need it to do.
    When I click on the JTree node. I would like to go out to an xml file, parse the information in it, and display it to the pane.
    I will need to later, be able to add, edit, or delete information on the xml through the pane later.
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.JTree;
    import javax.swing.JPanel;
    import javax.accessibility.*;
    import javax.swing.UIManager;
    import javax.swing.JComponent;
    import javax.swing.JEditorPane;
    import javax.swing.tree.TreeSelectionModel;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.ImageIcon;
    import java.net.URL;
    import java.io.IOException;
    import java.awt.Dimension;
    * @author orozcom
    public class Example extends JFrame implements TreeSelectionListener
        private JEditorPane htmlPane;
        private URL helpURL;
        private static boolean DEBUG = false;
        private JTree tree;
        public Example()
            super("Example");
            setSize(1200,900);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JMenuBar jmb = new JMenuBar();
            JMenu fileMenu = new JMenu("File");
            JMenuItem openItem = new JMenuItem("Open");
            JMenuItem saveItem = new JMenuItem("Save");
            JMenuItem exitItem = new JMenuItem("Exit");
            exitItem.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    System.exit(0);
            fileMenu.add(openItem);
            fileMenu.add(saveItem);
            fileMenu.add(new JSeparator());
            fileMenu.add(exitItem);
            jmb.add(fileMenu);
            setJMenuBar(jmb);
            //  **************** start JTree ******************//       
            JPanel lPane =new JPanel();       
            lPane.setLayout(new BorderLayout());
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(new ModuleInfo("Devices","splashScreen.html"));
            DefaultMutableTreeNode branch1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 1", "module1.html"));
            DefaultMutableTreeNode branch2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 2", "module2.html"));
            //DefaultMutableTreeNode branch3 =
                    //new DefaultMutableTreeNode(new ModuleInfo("Module 3", "module3.html"));
            //adding to the topmost node
            top.add(branch1);
            top.add(branch2);
            //top.add(branch3);
             *          BRANCH 1           *
            //adding to the First branch
            DefaultMutableTreeNode node1_b1
                    =new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
            //branch1.add(node1_b1);
                DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b1.add(n1_node1_b1);
                node1_b1.add(n2_node1_b1);
                node1_b1.add(n3_node1_b1);
                node1_b1.add(n4_node1_b1);    
            DefaultMutableTreeNode node2_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
            DefaultMutableTreeNode n1_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
            DefaultMutableTreeNode n2_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
            DefaultMutableTreeNode n3_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
            node4_b1.add(n1_node4_b1);
            node4_b1.add(n2_node4_b1);
            node4_b1.add(n3_node4_b1);
            DefaultMutableTreeNode node5_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch1.add(node1_b1);
            branch1.add(node2_b1);
            branch1.add(node3_b1);
            branch1.add(node4_b1);
            branch1.add(node5_b1);
             *          BRANCH 2           *
            //adding to the Second branch
            DefaultMutableTreeNode node1_b2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
                DefaultMutableTreeNode n1_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b2.add(n1_node1_b2);
                node1_b2.add(n2_node1_b2);
                node1_b2.add(n3_node1_b2);
                node1_b2.add(n4_node1_b2);
            DefaultMutableTreeNode node2_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
                DefaultMutableTreeNode n1_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
                node4_b2.add(n1_node4_b2);
                node4_b2.add(n2_node4_b2);
                node4_b2.add(n3_node4_b2);
            DefaultMutableTreeNode node5_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch2.add(node1_b2);
            branch2.add(node2_b2);
            branch2.add(node3_b2);
            branch2.add(node4_b2);
            branch2.add(node5_b2);
             *          BRANCH 3           *
            //adding to the Third branch
            DefaultMutableTreeNode node1_b3=new DefaultMutableTreeNode("Status");
            DefaultMutableTreeNode n1_node1_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node1_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node1_b3=new DefaultMutableTreeNode("Chassis");
            DefaultMutableTreeNode n4_node1_b3=new DefaultMutableTreeNode("Resources");
            node1_b3.add(n1_node1_b3);
            node1_b3.add(n2_node1_b3);
            node1_b3.add(n3_node1_b3);
            node1_b3.add(n4_node1_b3);
            DefaultMutableTreeNode node2_b3=new DefaultMutableTreeNode("Project Editor");
            DefaultMutableTreeNode node3_b3=new DefaultMutableTreeNode("Project Manager");
            DefaultMutableTreeNode node4_b3=new DefaultMutableTreeNode("Administration");
            DefaultMutableTreeNode n1_node4_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node4_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node4_b3=new DefaultMutableTreeNode("Users");
            node4_b3.add(n1_node4_b3);
            node4_b3.add(n2_node4_b3);
            node4_b3.add(n3_node4_b3);
            DefaultMutableTreeNode node5_b3=new DefaultMutableTreeNode("Logging");
            branch3.add(node1_b3);
            branch3.add(node2_b3);
            branch3.add(node3_b3);
            branch3.add(node4_b3);
            branch3.add(node5_b3);
            tree=new JTree(top,true);
            //tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
            //Set the icon for leaf nodes.       
            ImageIcon deviceIcon = createImageIcon("/device.gif");       
            if (deviceIcon != null)
                DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
                renderer.setLeafIcon(deviceIcon);
                tree.setCellRenderer(renderer);
            else
                System.err.println("Leaf icon missing; using default.");
            //Listen for when the selection changes.
            tree.addTreeSelectionListener(this);
            //Create the scroll pane and add the tree to it.
            //JScrollPane treeView = new JScrollPane(tree);
            tree.setToolTipText(" and ");
            lPane.add(tree);
            getContentPane().add(lPane);
            //  ****************  end  JTree  ******************//
            htmlPane = new JEditorPane();
            htmlPane.setEditable(false);       
            initHelp();
            JScrollPane rPane = new JScrollPane(htmlPane);
            JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, lPane, rPane);
            jsp.setDividerLocation(180);
            getContentPane().add(jsp, BorderLayout.CENTER);
            JPanel bPane = new JPanel();
            JButton okButton = new JButton("Ok");
            JButton applyButton = new JButton("Apply");
            JButton clearButton = new JButton("Clear");
            bPane.add(okButton);
            bPane.add(applyButton);
            bPane.add(clearButton);
            getContentPane().add(bPane, BorderLayout.SOUTH);
            setVisible(true);
        /** Required by TreeSelectionListener interface. */
        public void valueChanged(TreeSelectionEvent e)
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)
            tree.getLastSelectedPathComponent();
            if (node == null) return;
            Object nodeInfo = node.getUserObject();
            if (node.isLeaf())
                ModuleInfo module = (ModuleInfo)nodeInfo;
                displayURL(module.moduleURL);
                if (DEBUG)
                    System.out.print(module.moduleURL + ":  \n    ");
            else
                displayURL(helpURL);
            if (DEBUG)
                System.out.println(nodeInfo.toString());
        private class ModuleInfo
            public String deviceName;
            public URL moduleURL;
            public ModuleInfo(String device, String filename)
                deviceName = device;
                moduleURL = (URL)Example.class.getResource("/" + filename);
                if (moduleURL == null)
                    System.err.println("Couldn't find file: "
                            + filename);
            public String toString()
                return deviceName;
        private void initHelp()
            String s = "YFDemoHelp.html";
            helpURL = Example.class.getResource("/" + s);
            if (helpURL == null)
                System.err.println("Couldn't open help file: " + s);
            else if (DEBUG)
                System.out.println("Help URL is " + helpURL);
            displayURL(helpURL);
        private void displayURL(URL url)
            try
                if (url != null)
                    htmlPane.setPage(url);
                else
                { //null url
                    htmlPane.setText("File Not Found");
                    if (DEBUG)
                        System.out.println("Attempted to display a null URL.");
            catch (IOException e)
                System.err.println("Attempted to read a bad URL: " + url);
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path)
            java.net.URL imgURL = Example.class.getResource(path);
            if (imgURL != null)
                return new ImageIcon(imgURL);
            else
                System.err.println("Couldn't find file: " + path);
                return null;
        public static void main(String args[])
            new Example();
            //new AssistiveExample();
    }Thanks orozcom

    yes i can at the time of MIRO u can see both
    go in SU01 for and user
    in Parameters enter IVFIDISPLAY in Parameter ID and X in Paramater Value
    thus for that user u will be able to c Invoice number and accounting number after saving MIRo
    u will get message like
    Invoice document 5105608893 was posted ( Accountng Documnt: 5100000000 )
    hope this helps

  • Help on parsing and storing XML data

    Hi :
    I have a huge file with a format similar to this.
    <EmployeeDB>
    <employee>
    <name>Steve</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    <employee>
    <name>Ray</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    <employee>
    <name>Prag</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    </EmployeeDB>
    I have a table in my database with 2 columns one is a nsystem generated id and another column is of xmlType.
    What I want to do is store each employee's XML as a seperate record.
    For example: My table data should look like this
    EmployeeID(Number) EmployeeXML (XMLType)
    1 <employee>
    <name>Steve</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    2 <employee>
    <name>Ray</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    What I need is a code to take the document and insert the records as above.
    Please send me the code if you have to [email protected]

    Yes, I am using oralce 9i release 2

  • Help on parsing and storing XML file

    Hi :
    I have a huge file with a format similar to this.
    <EmployeeDB>
    <employee>
    <name>Steve</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    <employee>
    <name>Ray</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    <employee>
    <name>Prag</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    </EmployeeDB>
    I have a table in my database with 2 columns one is a nsystem generated id and another column is of xmlType.
    What I want to do is store each employee's XML as a seperate record.
    For example: My table data should look like this
    EmployeeID(Number) EmployeeXML (XMLType)
    1 <employee>
    <name>Steve</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    2 <employee>
    <name>Ray</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    What I need is a code to take the document and insert the records as above.
    Please send me the code if you have to [email protected]

    Yes, I am using oralce 9i release 2

  • How to create and modify an XML file from an Oracle Form

    I would like to build an Oracle Form to maintain a small XML file in the file system (i.e. Not in Oracle database but in the operating system).
    I would like the Form to display existing values from the XML file and the user can update and save content back to the XML file.
    Can any one tell me how this can be done? Thanks.

    Does Forms 9i provide any XML Parser Functions?
    Can I insert the XML file into a table column by inserting XML using the XSU Front End rather than using TEXT_IO to maintain the XML file directly?
    Can I use XSU PL/SQL API in Forms to retrieve and modify XML values?
    Any help is appreciated.

  • How to read xml-stylesheet Processing Instruction from XML using DOM Parser

    Hi,
    I am trying to read an xml that contains xsl stylesheet PI using DOMParser. The parse() method reads the entire contents of the XML except the PI instruction. Below is the XML I am using to read
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet href="../../../lang/en-us/style0/usc_profile.xsl" type="text/xsl"?>
    <Oblix oblang="en-us" xmlns="http://www.oblix.com/" xmlns:oblix="http://www.oblix.com/">
    <ObProfile>
    </ObProfile>
    </Oblix>
    Can anyone let me know if there are any propery settings to be done for the DOM parser before parsing?. If so, what is the property to be set?.
    Thanks in Advance
    Muthu

    A COTS product builds the XML and inserts the respective xsl (xml:stylesheet) file name to be used for transforming the xml. I am trying to interrupt this xml and make some updations on an element and finally send the updated xml to the stream.
    For the above process, I parse the input XML using DOMParser and update the elements (some internal elements). While I view the final XML that would be passed to the stream, I found the <?xml-stylesheet... PI is missing.
    I somehow managed using a temp fix by doing the below. I manually pulled the PI using document.getFirstChild().getNodeValue() and reconstructed the PI and inserted it to the outgoing XML. This needs to be done every time. This might run into problems when more than one PI is used in the XML.
    If the parsed XML could get the PI along with it the above problem could be resolved.
    Is there any property that could be set on the parser (prior to parsing) to resolve the issue?.

  • How to create and modify multiple responsibilities thru backend

    Hi,
    I have to create multiple responsibilities.
    Also I have to rename the current responsibilities.
    How can I do this using sql scripts.
    At metalink I found that you can use FND_FUNCTION_SECURITY package to do this.
    But I dont have the details how to use this package.
    Thanks,
    Dnyanesh

    Does Forms 9i provide any XML Parser Functions?
    Can I insert the XML file into a table column by inserting XML using the XSU Front End rather than using TEXT_IO to maintain the XML file directly?
    Can I use XSU PL/SQL API in Forms to retrieve and modify XML values?
    Any help is appreciated.

  • Read, Modify and Apply Report XML using Java Script

    Hi Guys,
    Is there any way that we can Pragmatically Read, Modify and Apply Report XML using Java Script or some other way.
    Thanks
    Kaushik
    Edited by: Kaushik K on Jun 20, 2012 8:36 PM

    Requirement ::
    Users should be able to add Column to the Report Dynamically at Runtime.
    (There are around 1000+ Users, Answers Approach is not acceptable)
    So we are planning to provide a Multi Select / Shuttle Box Option for Users to add Columns dynamically. (Only for Table View)
    What we planned to DO ::
    Create a Presentation Variable Prompt, Which reads the Metadata Table (Presentation Table.Column Name, populated using the Metadata Dictionary)
    And Create a report with One Column and the Column Fx like @{var_dynamic_columns}{'"Time"."Year","Time"."Month"'}
    With this, OBIEE is rewriting the Logical SQL Currently as "Select "Time"."Year","Time"."Month" from "A - Sample Sales" "
    But getting an error
    The number of columns returned in retrieving column metadata was invalid (expected: 1; received: 2)
    So we want to see, if we can rewrite the Advanced XML of the Report to have dynamic columns based on the Values from the Presentation Variable.
    Please help me if this is a viable solution or any other better solution.

  • Importing/Parsing XML using SQL and/or PL/SQL

    What is the recomended way of importing/parsing XML data using SQL and/or PL/SQL?
    I have an XSD that defines the structure of the file, and an XML file that has the content in the appropriate structure. I have parsed (checked) the structure of the XML file using JDOM in my java application, and then passed it to a function in a package on the database as a CLOB.
    What I need to do is parse the contents of the XML file that is passed into the function and extract the values of each XML element so that I can then do some appropriate validation before inserting and committing the data to the database (hence completing the import function).
    A DBA colleague of mine has been experimenting with various ways of acheiving this, but has encountered a number of problems along the way, one of which being that he thinks that it is not possible to parse XML elements that are nested more than four levels deep - is this the case?
    The structure of the XSD/XML that the database function needs to manipulate and import data from is very complex (and recursive by it's nature).
    I would appreciate any suggestions as to how I can achieve the above in the most efficient manner.
    Thanks in advance for your help
    David

    This is the forum for the SQLDeveloper tool. You will get better answers in the SQL and PL/SQL forum, and especially the XML DB forum.
    Oracle has comprehensive and varied support for XML, including a PL/SQL parser.

  • Oracle9i: Difference between oraxml and oracle.xml.parser.v2.DOMParser?

    I have parsed the following xml document with the oraxml batch
    and with the sample '..\xdk\demo\java\parser\dom\DOMSample' and
    observed a diffent behavior in Oracle9i:
    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
    <Document xmlns:n1='urn:example:some-names'
    xmlns:n2='urn:example:some-names'>
    <BadAttrs_XML_1.0 att='1' att='2' />
    <BadAttrs_Namespaces n1:att='1' n2:att='2' />
    <OKAttrs_XML_1.0 att='1' n2:att='2' />
    </Document>
    ----------------------------1.) oraxml
    C:\oracle\ora9011\xdk\demo\java\parser\dom>oraxml -version
    -warning Namespaces2.xml
    Parser version: Oracle XDK Java 9.0.1.0.0 Production
    The input XML file is parsed without errors using partial
    validation mode
    Oraxml does not recognize the two attributes with the same name
    in element 'BadAttrs_XML_1.0' as an error.
    2.) oracle.xml.parser.v2.DOMParser
    C:\oracle\ora9011\xdk\demo\java\parser\dom>java DOMSample
    Namespaces2.xml
    file:Namespaces2.xml<Line 8, Column 38>: XML-0124: (Fata
    l Error) An attribute cannot appear more than once in the same
    start tag.
    oracle.xml.parser.v2.XMLParseException: An attribute cannot
    appear more than once in the same start tag.
    I have modified the DomSample.java. The DomParser just checks for
    well-formed documents and doesn't validate the document anymore.
    (only a comment before
    parser.setValidationMode(DOMParser.DTD_VALIDATION);)
    My question is:
    Is there really a difference between oracle.xml.parser.v2.oraxml
    and oracle.xml.parser.v2.DOMParser or which parameters do I have
    to use to get the same results?
    With Oracle8i, both report an xml error!!
    (Oracle9i, Win2000, JDK1.3)
    Thanx in advance!
    Markus

    It would appear that there is a difference when a loadjava is given a jar vs. the individual class files. When I load the jar, I get the previously described error, but when I load the individual class files (the same class files that the jar contains) the error goes away.
    Why?

Maybe you are looking for