Adding XML tags to an existing XML file

Hi,
I am inserting 1 lac records in an XML file after reading it from a database. Situation arises that the operation is aborted (80,000 records already have been inserted) unintentionally because of some problem (network disconnection, power shut down etc ). Is it possible to start filling up the XML file from the location where i had aborted (ie from the 80,001th record), i will be using SAX (As it is faster than DOM) to fill up the file .

Visit gotoandlearn.com and find a tutorial there for creating
a preloader.

Similar Messages

  • Error when adding form responses in an existing response file

    Following the announcement of the retirement of FormsCentral, I am testing Acrobat XI Pro to distribute PDF forms.
    I followed the steps proposed in this tutorial: https://acrobatusers.com/tutorials/how-to-distribute-existing-pdf-forms
    Everything works fine until I try to add the responses in an existing response file. I select the received files in the dialog box an when I clik on "OK" the progress bar appear then Acrobat Pro freezes.
    I tried different forms, all exported from FormsCentral and still encouter this bug/issue.
    Any hint?

    These are the current privs for that user:
    ALTER DATABASE
    ALTER SESSION
    ALTER USER
    CREATE ANY CONTEXT
    CREATE ANY DIRECTORY
    CREATE CLUSTER
    CREATE DATABASE LINK
    CREATE DIMENSION
    CREATE INDEXTYPE
    CREATE JOB
    CREATE LIBRARY
    CREATE MATERIALIZED VIEW
    CREATE OPERATOR
    CREATE PROCEDURE
    CREATE PUBLIC SYNONYM
    CREATE ROLE
    CREATE SEQUENCE
    CREATE SYNONYM
    CREATE TABLE
    CREATE TABLESPACE
    CREATE TRIGGER
    CREATE TYPE
    CREATE USER
    CREATE VIEW
    DROP ANY DIRECTORY
    DROP PUBLIC SYNONYM
    DROP TABLESPACE
    DROP USER
    EXECUTE ANY PROCEDURE
    SELECT ANY DICTIONARY
    SELECT ANY TABLE
    UNLIMITED TABLESPACE

  • Need help with adding a PRELOADER to an existing .fla file

    I have a 9-layer .fla file that needs a preloader. How can I
    shift all of the layers to make room for a preloader? Thanks

    Visit gotoandlearn.com and find a tutorial there for creating
    a preloader.

  • How to add tags to the existing XML file?

    Hi,
    I have a requirement wherein I have to add a tag to the existing xml data.
    For Eg:
    <ROW>
    <EVNT_ID>7333976</EVNT_ID>
    <DISTRCT_CD>67</DISTRCT_CD>
    <TIME_OFF>06-May-2008 10:50:04 AM</TIME_OFF>
    </ROW>
    The desired output is,
    <DI_DATA>
    <ROW>
    <EVNT_ID>7333976</EVNT_ID>
    <DISTRCT_CD>67</DISTRCT_CD>
    <TIME_OFF>06-May-2008 10:50:04 AM</TIME_OFF>
    </ROW>
    </DI_DATA>
    I have to add <DI_DATA> </DI_DATA>at the start and end of the input.
    Could any of you help me on this?
    Thanks,
    GV

    If your XML is just in a CLOB, you can just use string manipulation to prepend/append the nodes on. If you have it in an XMLType you could just do the following
    select appendchildxml(XMLTYPE('<DI_DATA/>'),
                                  'DI_DATA',
                                  XMLTYPE('<ROW>
    <EVNT_ID>7333976</EVNT_ID>
    <DISTRCT_CD>67</DISTRCT_CD>
    <TIME_OFF>06-May-2008 10:50:04 AM</TIME_OFF>
    </ROW>'))  -- this would be your variable
      from dual;which will put your data within the DI_DATA node.

  • How can i write also to xml file the settings of the Tag property to identify if it's "file" or "directory" ?

    The first thing i'm doing is to get from my ftp server all the ftp content information and i tag it so i can identify later if it's a file or a directory:
    private int total_dirs;
    private int searched_until_now_dirs;
    private int max_percentage;
    private TreeNode directories_real_time;
    private string SummaryText;
    private TreeNode CreateDirectoryNode(string path, string name , int recursive_levl )
    var directoryNode = new TreeNode(name);
    var directoryListing = GetDirectoryListing(path);
    var directories = directoryListing.Where(d => d.IsDirectory);
    var files = directoryListing.Where(d => !d.IsDirectory);
    total_dirs += directories.Count<FTPListDetail>();
    searched_until_now_dirs++;
    int percentage = 0;
    foreach (var dir in directories)
    directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name, recursive_levl+1));
    if (recursive_levl == 1)
    TreeNode temp_tn = (TreeNode)directoryNode.Clone();
    this.BeginInvoke(new MethodInvoker( delegate
    UpdateList(temp_tn);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    foreach (var file in files)
    TreeNode file_tree_node = new TreeNode(file.Name);
    file_tree_node.Tag = "file";
    directoryNode.Nodes.Add(file_tree_node);
    numberOfFiles.Add(file.FullPath);
    return directoryNode;
    The line i'm using to Tag is:
    file_tree_node.Tag = "file";
    So i know what is "file" then i make a simple check if the Tag is not null then i know it's a "file" if it's null then it's directory.
    For example this is how i'm checking if it's file or directory after getting all the content from my ftp server:
    if (treeViewMS1.SelectedNode.Tag != null)
    string s = (string)treeViewMS1.SelectedNode.Tag;
    if (s == "file")
    file = false;
    DeleteFile(treeViewMS1.SelectedNode.FullPath, file);
    else
    RemoveDirectoriesRecursive(treeViewMS1.SelectedNode, treeViewMS1.SelectedNode.FullPath);
    I also update in real time when getting the content of the ftp server xml file on my hard disk with the treeView structure information so when i'm running the program each time it will load the treeView structure with all directories and files.
    This is the class of the xml file:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml;
    using System.Windows.Forms;
    namespace FTP_ProgressBar
    class TreeViewXmlPopulation
    // Xml tag for node, e.g. 'node' in case of <node></node>
    private const string XmlNodeTag = "node";
    // Xml attributes for node e.g. <node text="Asia" tag=""
    // imageindex="1"></node>
    private const string XmlNodeTextAtt = "text";
    private const string XmlNodeTagAtt = "tag";
    private const string XmlNodeImageIndexAtt = "imageindex";
    public static void DeserializeTreeView(TreeView treeView, string fileName)
    XmlTextReader reader = null;
    try
    // disabling re-drawing of treeview till all nodes are added
    treeView.BeginUpdate();
    reader = new XmlTextReader(fileName);
    TreeNode parentNode = null;
    while (reader.Read())
    if (reader.NodeType == XmlNodeType.Element)
    if (reader.Name == XmlNodeTag)
    TreeNode newNode = new TreeNode();
    bool isEmptyElement = reader.IsEmptyElement;
    // loading node attributes
    int attributeCount = reader.AttributeCount;
    if (attributeCount > 0)
    for (int i = 0; i < attributeCount; i++)
    reader.MoveToAttribute(i);
    SetAttributeValue(newNode,
    reader.Name, reader.Value);
    // add new node to Parent Node or TreeView
    if (parentNode != null)
    parentNode.Nodes.Add(newNode);
    else
    treeView.Nodes.Add(newNode);
    // making current node 'ParentNode' if its not empty
    if (!isEmptyElement)
    parentNode = newNode;
    // moving up to in TreeView if end tag is encountered
    else if (reader.NodeType == XmlNodeType.EndElement)
    if (reader.Name == XmlNodeTag)
    parentNode = parentNode.Parent;
    else if (reader.NodeType == XmlNodeType.XmlDeclaration)
    //Ignore Xml Declaration
    else if (reader.NodeType == XmlNodeType.None)
    return;
    else if (reader.NodeType == XmlNodeType.Text)
    parentNode.Nodes.Add(reader.Value);
    finally
    // enabling redrawing of treeview after all nodes are added
    treeView.EndUpdate();
    reader.Close();
    /// <span class="code-SummaryComment"><summary>
    /// Used by Deserialize method for setting properties of
    /// TreeNode from xml node attributes
    /// <span class="code-SummaryComment"></summary>
    private static void SetAttributeValue(TreeNode node,
    string propertyName, string value)
    if (propertyName == XmlNodeTextAtt)
    node.Text = value;
    else if (propertyName == XmlNodeImageIndexAtt)
    node.ImageIndex = int.Parse(value);
    else if (propertyName == XmlNodeTagAtt)
    node.Tag = value;
    public static void SerializeTreeView(TreeView treeView, string fileName)
    XmlTextWriter textWriter = new XmlTextWriter(fileName,
    System.Text.Encoding.ASCII);
    // writing the xml declaration tag
    textWriter.WriteStartDocument();
    //textWriter.WriteRaw("\r\n");
    // writing the main tag that encloses all node tags
    textWriter.WriteStartElement("TreeView");
    // save the nodes, recursive method
    SaveNodes(treeView.Nodes, textWriter);
    textWriter.WriteEndElement();
    textWriter.Close();
    private static void SaveNodes(TreeNodeCollection nodesCollection,
    XmlTextWriter textWriter)
    for (int i = 0; i < nodesCollection.Count; i++)
    TreeNode node = nodesCollection[i];
    textWriter.WriteStartElement(XmlNodeTag);
    textWriter.WriteAttributeString(XmlNodeTextAtt,
    node.Text);
    textWriter.WriteAttributeString(
    XmlNodeImageIndexAtt, node.ImageIndex.ToString());
    if (node.Tag != null)
    textWriter.WriteAttributeString(XmlNodeTagAtt,
    node.Tag.ToString());
    // add other node properties to serialize here
    if (node.Nodes.Count > 0)
    SaveNodes(node.Nodes, textWriter);
    textWriter.WriteEndElement();
    And this is how i'm using the class this method i'm calling it inside the CreateDirectoryNode and i'm updating the treeView in real time when getting the ftp content from the server i build the treeView structure in real time.
    DateTime last_update;
    private void UpdateList(TreeNode tn_rt)
    TimeSpan ts = DateTime.Now - last_update;
    if (ts.TotalMilliseconds > 200)
    last_update = DateTime.Now;
    treeViewMS1.BeginUpdate();
    treeViewMS1.Nodes.Clear();
    treeViewMS1.Nodes.Add(tn_rt);
    TreeViewXmlPopulation.SerializeTreeView(treeViewMS1, @"c:\XmlFile\Original.xml");
    ExpandToLevel(treeViewMS1.Nodes, 1);
    treeViewMS1.EndUpdate();
    And when i'm running the program again in the constructor i'm doing:
    if (File.Exists(@"c:\XmlFile\Original.xml"))
    TreeViewXmlPopulation.DeserializeTreeView(treeViewMS1, @"c:\XmlFile\Original.xml");
    My question is how can i update the xml file in real time like i'm doing now but also with the Tag property so next time i will run the program and will not get the content from the ftp i will know in the treeView what is file and what is directory.
    The problem is that now if i will run the program the Tag property is null. I must get the ftp content from the server each time.
    But i want that withoutout getting the ftp content from server to Tag each file as file in the treeView structure.
    So what i need is somehow where i;m Tagging "file" or maybe when updating the treeView also to add something to the xml file so when i will run the progrma again and read back the xml file it will also Tag the files in the treeView.

    Hi
    Chocolade1972,
    Your case related to Winform Data Controls, So i will move your thread to Windows Forms> Windows
    Forms Data Controls and Databinding  forum for better support.
    Best regards,
    Kristin
    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.

  • Adding Multiple Tag Prefixes in an XML in XI

    I have a problem on one of the messages we are trying to send to trading partners. The customers' system only accepts the message if it has a tag prefix of sh, orders... and so on in the particular message we are sending (Standard Business Document). The problem is that XI does not use the tag prefixes the trading partners are expecting. Another problem is that we do not have the orginal and current XSD of the Standard Business Document so we created the message in XI and it cannot adapt the multiple namespaces scheme that we are suppose to send.
    The messages are sent via HTTP adapter so what we plan is after mapping the data to the output XML, we are going to send it or store it in a directory which a configure File Adapter polls and use the Java Anonymizer Bean to do the trick of adding the tag prefixes and then use Enhanced Receiver Determination to actually send the data via HTTPS (since the receiving system's information is stored in a database which we query in XI using a UDF).
    Are there any other approach that we could explore than the one I mentioned above? And could XI actually handle multiple namespaces of an XML?
    Thanks and Best Regards,
    Rommel

    Hi Prateek,
    Thanks for the reply. Just another question though, would XI recognize the multiple namespaces and the tag prefixes associated with it during the mapping?
    Thanks again!
    Regards,
    Rommel

  • How can I convert the metadata tags on my mp4s to xml files so that they can be read in Windows Media Center?

    I have a library with almost 3000 movies and TV shows that I have fully tagged. However, I have decided to start using Windows Media Center and it does its metadata tagging through XML files.  I wanted to know if anyone could tell me if there was a way to extract the metadata from those mp4s and convert them to a format that WMC could read?  Thanks!!!!

    iTunes can make XML playlists so it might be all you need, I made a simple one file playlist and exported it from iTunes. The result is shown below. In principle I could delete the playlist and the entry from the library, as long as I don't delete the file, then later reimport the XML playlist file. I haven't tested this particular scenario, but I assume that iTunes will read all the properties as listed unless it can read some kind of tag from the file itself in which case the current value of the tag would take precedence.
    What I don't know is what media center would make of this file, or what its files look like, however assuming they have a similar structure that can be decoded then it should be possible to read data from the iTunes library and write out a text file that will make sense to media centre.
    Video Test.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Major Version</key><integer>1</integer>
    <key>Minor Version</key><integer>1</integer>
    <key>Date</key><date>2013-09-26T23:30:26Z</date>
    <key>Application Version</key><string>11.1</string>
    <key>Features</key><integer>5</integer>
    <key>Show Content Ratings</key><true/>
    <key>Music Folder</key><string>file://localhost/E:/iTunes/iTunes%20Media/</string>
    <key>Library Persistent ID</key><string>CCF046191585EA85</string>
    <key>Tracks</key>
    <dict>
    <key>155170</key>
    <dict>
    <key>Track ID</key><integer>155170</integer>
    <key>Name</key><string>Abbott &#38; Costello: "Two Tens For A Five" &#38; "Who's On First"</string>
    <key>Artist</key><string>Abbott &#38; Costello</string>
    <key>Album Artist</key><string>Abbott &#38; Costello</string>
    <key>Album</key><string>Abbott &#38; Costello: "Two Tens For A Five" &#38; "Who's On First"</string>
    <key>Genre</key><string>Comedy Clip</string>
    <key>Kind</key><string>MPEG-4 video file</string>
    <key>Size</key><integer>110483524</integer>
    <key>Total Time</key><integer>532096</integer>
    <key>Year</key><integer>1950</integer>
    <key>Date Modified</key><date>2013-06-19T17:35:18Z</date>
    <key>Date Added</key><date>2012-12-01T17:30:57Z</date>
    <key>Bit Rate</key><integer>156</integer>
    <key>Comments</key><string>www.dvdvideosoft.com</string>
    <key>Artwork Count</key><integer>1</integer>
    <key>Persistent ID</key><string>5AF2C490D1E065CD</string>
    <key>Track Type</key><string>File</string>
    <key>Has Video</key><true/>
    <key>HD</key><false/>
    <key>Video Width</key><integer>1136</integer>
    <key>Video Height</key><integer>640</integer>
    <key>Location</key><string>file://localhost/E:/iTunes/iTunes%20Media/Home%20Vide os/Abbott%20&#38;%20Costello_%20_Two%20Tens%20for%20a%20Five_%20&#38;%20_Who's%2 0on%20First_.mp4</string>
    <key>File Folder Count</key><integer>3</integer>
    <key>Library Folder Count</key><integer>1</integer>
    </dict>
    </dict>
    <key>Playlists</key>
    <array>
    <dict>
    <key>Name</key><string>Video Test</string>
    <key>Playlist ID</key><integer>1930541</integer>
    <key>Playlist Persistent ID</key><string>30BF2769C94F7F29</string>
    <key>All Items</key><true/>
    <key>Playlist Items</key>
    <array>
    <dict>
    <key>Track ID</key><integer>155170</integer>
    </dict>
    </array>
    </dict>
    </array>
    </dict>
    </plist>
    Such files are easier to interpret if opened with Notepad++.
    tt2

  • Getting an error while changing a tag in an XML file

    Hi,
    When I am trying to replace the existing XML tag with other one I am getting the following exception:
    org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.
    at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
    at org.apache.xerces.dom.ParentNode.replaceChild(Unknown Source)
    at org.apache.xerces.dom.CoreDocumentImpl.replaceChild(Unknown Source)
    at com.Replace_Tag.replaceNode(Replace_Tag.java:97)
    at com.Replace_Tag.processRequest(Replace_Tag.java:39)
    at com.Replace_Tag.doGet(Replace_Tag.java:56)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    The following is the code I am using :
    public void replaceNode() throws Exception{
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse("file:/C:/Documents and Settings/srikanth.d.KNOAHSOFT/Desktop/Linechart.jrxml");
            Element root = doc.getDocumentElement();
            Element newElement = doc.createElement("stackedBarchart");
            NodeList oldList = root.getElementsByTagName("lineChart");
            int length = oldList.getLength();
            System.out.println("length::"+length);
            for(int i=0;i<length;i++)
                Node oldNode = oldList.item(i);
                NodeList nl = doc.getChildNodes();
    newElement.getTagName().toString());                   
    (i).getNodeName().toString());
                doc.replaceChild((Node)newElement, oldNode);           
    Can anybody help me in this regard...
    Thanks and Regards
    DNV Srikanth

    i am posting the xml file also :
    <?xml version="1.0" encoding="UTF-8"  ?>
    <!-- Created with iReport - A designer for JasperReports -->
    <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport
               name="Line chart"
               columnCount="1"
               printOrder="Vertical"
               orientation="Portrait"
               pageWidth="396"
               pageHeight="842"
               columnWidth="396"
               columnSpacing="0"
               leftMargin="0"
               rightMargin="0"
               topMargin="0"
               bottomMargin="0"
               whenNoDataType="NoPages"
               isTitleNewPage="false"
               isSummaryNewPage="false">
         <property name="ireport.scriptlethandling" value="2" />
         <property name="ireport.encoding" value="UTF-8" />
         <import value="java.util.*" />
         <import value="net.sf.jasperreports.engine.*" />
         <import value="net.sf.jasperreports.engine.data.*" />
         <queryString><![CDATA[select * from evalsubcomparison where qacount1 between 70.0 and 75.0]]></queryString>
         <field name="EmpId" class="java.lang.Double"/>
         <field name="Empname" class="java.lang.String"/>
         <field name="BaseEmpId" class="java.lang.Double"/>
         <field name="QACount1" class="java.lang.Double"/>
         <field name="WeekId1" class="java.lang.String"/>
         <field name="QACount2" class="java.lang.Double"/>
         <field name="WeekId" class="java.lang.String"/>
         <field name="QACount3" class="java.lang.Double"/>
         <field name="WeekId3" class="java.lang.String"/>
         <field name="QACount4" class="java.lang.Double"/>
         <field name="WeekId4" class="java.lang.String"/>
         <field name="level" class="java.lang.Double"/>
              <background>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </background>
              <title>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </title>
              <pageHeader>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </pageHeader>
              <columnHeader>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </columnHeader>
              <detail>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </detail>
              <columnFooter>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </columnFooter>
              <pageFooter>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </pageFooter>
              <summary>
                   <band height="301"  isSplitAllowed="true" >
                        <lineChart>
                             <chart  hyperlinkTarget="Self" >
                             <reportElement
                                  mode="Opaque"
                                  x="0"
                                  y="0"
                                  width="390"
                                  height="300"
                                  backcolor="#FFFFFF"
                                  key="element-1"/>
                             <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                                  <chartLegend textColor="#000000" backgroundColor="#FFFFFF" >
                             <font fontName="Times New Roman" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/>
                             </chartLegend>
                             </chart>
                             <categoryDataset>
                                  <dataset >
                                  </dataset>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId1}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount1}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount2}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId3}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount3}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId4}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount4}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                             </categoryDataset>
                             <linePlot >
                                  <plot backcolor="#FFFFFF" />
                                  <categoryAxisFormat>
                                       <axisFormat >
                                       </axisFormat>
                                  </categoryAxisFormat>
                             <valueAxisLabelExpression><![CDATA["No. of Evaluations"]]></valueAxisLabelExpression>
                                  <valueAxisFormat>
                                       <axisFormat >
                                            <labelFont>
                             <font fontName="Serif" pdfFontName="Helvetica" size="14" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/>
                                            </labelFont>
                                            <tickLabelFont>
                                            </tickLabelFont>
                                       </axisFormat>
                                  </valueAxisFormat>
                             </linePlot>
                        </lineChart>
                   </band>
              </summary>
    </jasperReport>can anybody pls help me in this regard......

  • How to edit the existing data in the XML file from java programming.

    Hi all
    i am able to create XML file with the sample data as below from java programming.
    i need sample code on how to edit the existing data in the XML file?
    for example
    <?xml version="1.0"?>
       <mydata>
               <data1>
                         <key1>467</key1>
                        <name1>Paul</name1>
                        <id1>123</id1>
              </data1>
              <data2>
                         <key2>467</key2>
                        <name2>Paul</name2>
                        <id2>123</id2>
              </data2>
        </mydata>
    i am able to insert the data in the XML.
    now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
    Regards
    Sunil
    [points will be always rewardable]

    hi
    u need a parser or validate the xml file for to read the xml file from java coding u need for this
    xml4j.jar u can download this file  from here
    http://www.alphaworks.ibm.com/tech/xml4j
    or we can use the SAX(simple API for XML)
    some sample applications for this
    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
    http://www.xml-training-guide.com/e-xml44.html
    let me know u need any other info
    bvr

  • Selecting the first 4000 characters from a tag in an xml file

    Oracle Enterprise Edition 11.1.0.7 64 bit (Jan 2012 CPU applied)
    Windows 2003 64 bit
    We have an XML file with the following sample format.
    <?xml version="1.0"?>
    <HR>
    <EMP>
    <FNAME>JOHN</FNAME>
    <LNAME>DOE</LNAME>
    <COMMENT>Comment with less than 4000 characters</COMMENT>
    </EMP>
    <EMP>
    <FNAME>JANE</FNAME>
    <LNAME>DOE</LNAME>
    <COMMENT>Comment with more than 4000 characters</COMMENT>
    </EMP>
    </HR>
    The query below
    (full disclosure: which I took from odie_63's response in Creating External Table using Xml Dataset - how to include null values? and added the CURSOR_SHARING_EXACT hint on the top)
    works when the contents of the <Comment> tag are smaller than 4000 characters. If it is more than 4000 I get
    ORA-01706: user function result value was too large
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'COMMENT'
    I found another query where someone was doing a substring (I think to get only the first 4000 characters from the tag) here.
    http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14638197 (See OP's post)
    TERMINATION_DATE VARCHAR(32) path 'TerminateDate/substring(text(), 1, 32)',
    So I updated my query to be
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'COMMENT/substring(text(),1,4000)'
    The query runs without an error when the <comment> tag has 4000 or less characters but still errors out with it is more than 4000.
    I found an alternative method to do the SUBSTRING here in Herald ten Dam's reponse in Re: A view over XML that is not 1:1
    code varchar2(30) path 'substring(code,1,3)',
    so I tried this:
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'substring(COMMENT,1,4000)'
    but that doesn't work either.
    How can I extract the first 4000 characters of the <COMMENT> tag so that the query doesn't fail.
    We are not using any other XMLDB features at this time. This is the first we've started looking into using Oracle built in XML features, so we might not have setup something that other's might know to specifically setup to start using the XML features in Oracle 11.1
    Thanks in advance,
    Wally

    walls99 wrote:
    This is regardless of the COMMENTS tag being 4000 characters or more and the same with the ideas from Odie.
    WallyNo idea if it is an issue with your version. I don't have your version to test but following works for me. Does this simple test work?
    SQL> select * from v$version ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> set define off
    SQL> select dbms_xmlgen.convert(xmlserialize(content xmltype('<brand>Ben &amp; Jerry</brand>') as clob), 1) from dual ;
    DBMS_XMLGEN.CONVERT(XMLSERIALIZE(CONTENTXMLTYPE('<BRAND>BEN&AMP;JERRY</BRAND>')A
    <brand>Ben & Jerry</brand>

  • Instance variable to hold the element of a tag in the xml file

    Hi I have an xml file that is handled using this parser
    <attr id="MY_NAME" >
    this parser hanled the above tag but now I want to have it handle
    <attr id="MY_NAME" desc="GOOD">
    but I need to create an instance variable to handle the desc element in the attr tag .
    Can some one help me out as this is not my file and I am having trouble to do please......
    import java.util.*;
    import java.io.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
       The SupportMatrix class provides static variables and methods to simplify
       the determination of whether or not a given attribute is supported for a
       certain object type (queue manager, channel, etc.), depending on the version
       and platform of the queue manager to which it belongs.
       The SupportMatrix class may not be instantiated. Its constructor is private.
       An instance of the class is created internally in the static initializer so
       that the XML parsing methods are available.
       A corresponding XML document, SupportMatrix.xml, is parsed to create the various
       HashMaps which contain the version/platform dependency information. A number of
       inner classes are used to represent the various elements of the XML matrix
       definition.
       Here's a sample document:
       <!-- The supportmatrix tag opens the document -->
       <supportmatrix>
         <!-- Objects are keyed by classid. "1" is the classid of a queue manager object. -->
         <object classid="1">
           <!-- Versions group attributes according to the queue manager version where they
                were introduced. The "base" cmdlevel encompasses all versions up to 5.1. -->
           <version cmdlevel="base">
             <!-- Attributes are defined by the attr tag. -->
             <attr id="MQCA_Q_MGR_NAME">
               <!-- Support elements define the platform-specific requirements for an attribute. -->
               <support platforms="UNIX,WINDOWS,OS400,VMS,NSK" maxlen="48" type="MQCFST"/>
               <support platforms="MVS" maxlen="4" type="MQCFST"/>
             </attr>
             <attr id="MQCA_Q_MGR_DESC">
               <!-- Specific attribute characteristics, most notably maximum len for string parms,
                    are defined in the support element. As shown in the following example, it may
                    apply to all platforms. -->
               <support platforms="all" maxlen="64" type="MQCFST"/>
             </attr>
             <!-- Support elements are optional. -->
             <attr id="MQIA_PLATFORM"/>
             <attr id="MQIA_COMMAND_LEVEL"/>
           </version>
           <!-- The version element may 'include' other versions. Note that object elements
                may also refer to other objects via the 'include' parm of the object tag.
                This is to allow common attributes (especially for queues and channels) to
                be shared by multiple definitions in order to reduce some of the
                redundancy. -->
           <version cmdlevel="520" include="base">
           </version>
         </object>
       </supportmatrix>
       The inner classes, and their hierarchical relationships are as follows:
         SupportObject - corresponds to the <object> element. Stored in a static HashMap, and
                         keyed by classid.
           VersionObject - corresponds to the <version> element. Stored in a HashMap instance
                           variable of the SupportObject class, keyed by cmdlevel.
             AttributeObject - corresponds to the <attr> element. Stored in a HashMap instance
                               variable of the VersionObject class, keyed by attribute name.
               PlatformObject - corresponds to the <support> element. Stored in HashMaps belonging
                                to the AttributeObjects, keyed by platform. A single PlatformObject
                                instance is created when the support tag is encountered. The
                                "platforms" attribute of the support element is then processed. For
                                each platform in the comma-delimited list, an entry is added to the
                                collection of PlatformObjects. This is to greatly simplify later
                                lookups.
       In order to support the 'include' feature of object and version elements, certain
       functions are recursive. If the attribute to be validated is not found for the passed
       cmdlevel, the 'parent' VersionObject is consulted by means of the 'include' value. If
       the chain of VersionObjects has been exhausted and the attribute in question has still not
       been located, the next SupportObject in the chain is consulted in a similar fashion.
    public class SupportMatrix extends DefaultHandler {
        /** The objects collection holds all the SupportObjects, keyed by classid. */
        private static HashMap objects;
        /** xmlFile will name the xml document to be parsed. Note that using the
            default class loader expects the string to be the path to the file. It must
            NOT begin with the '/' character. */
        private static String xmlFile =
            ResourceManager.getApplicationProperties().getProperty("SupportMatrixFile");
        private Stack stack;
        /** This static initializer allocates the static objects collection, creates an
            instance of the SupportMatrix class for xml parsing purposes, and initiates
            the parse operation to populate the collection. */
        static {
            objects = new HashMap();
            // Create a parser and process the xml doc
            SupportMatrix handler = new SupportMatrix();
            InputSource is = null;
            try {
                is = new InputSource(ClassLoader.getSystemClassLoader().getResourceAsStream(xmlFile));
                XMLReader xmlReader =
                    SAXParserFactory.newInstance().newSAXParser().getXMLReader();
                xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
                xmlReader.setContentHandler(handler);
                if (is == null) {
                    System.err.println("No input stream, dammit");
                xmlReader.parse(is);
            } catch(Exception e) {
                e.printStackTrace();
        /** Private constuctor, used only for XML parsing. */
        private SupportMatrix() {
            stack = new Stack();
        /** Add a SupportObject instance to the objects collection. */
        private void addObject(SupportObject obj) {
            String key = obj.getClassId();
            objects.put(key, obj);
        /* DefaultHandler methods                                              */
        /** Not used. */
        public void characters(char[] ch, int start, int length) {}
        /** Not used. */
        public void endDocument() {}
        /** For the version, object, and attr elements, pop the top element of the stack. */
        public void endElement(String uri, String localName, String qName) {
            if (localName.equals("version") || localName.equals("object") || localName.equals("attr")) {
                stack.pop();
        /** Not used. */
        public void setDocumentLocator(Locator locator) {}
        /** Not used. */
        public void startDocument() {}
        /** Most of the work is done here. Create the appropriate inner class instance for
            element; for object, version, and attr, push the element onto the stack so that
            child elements may be added to their collections as needed. */
        public void startElement(String uri, String localName, String qName,
                                 Attributes attributes) {
            String include = attributes.getValue("include");
            if (localName.equals("object")) {
                SupportObject obj = new SupportObject(attributes.getValue("classid"), include);
                addObject(obj);
                stack.push(obj);
            } else if ( localName.equals("version")) {
                VersionObject ver = new VersionObject(attributes.getValue("cmdlevel"), include);
                ((SupportObject)stack.peek()).addVersion(ver);
                stack.push(ver);
            } else if ( localName.equals("attr")) {
                AttributeObject a = new AttributeObject(attributes.getValue("id"));
                //String desc = StringFactory.getString(attributes.getValue("desc"));
                //if(desc != null)
                   //     a.setAttribute();
                String readonly = attributes.getValue("readonly");
                String exclude = attributes.getValue("exclude");
                if (include != null && exclude != null) {
                    Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                    exclude = null;
                if (include != null) {
                    a.setCondition(include, true);
                if (exclude != null) {
                    a.setCondition(exclude, false);
                if (readonly != null)
                    a.setReadonly(readonly.equals("y"));
                ((VersionObject)stack.peek()).addAttr(a);
                stack.push(a);
            } else if (localName.equals("support")) {
                String platforms = attributes.getValue("platforms");
                String readonly = attributes.getValue("readonly");
                String maxlen = attributes.getValue("maxlen");
                String type = attributes.getValue("type");
                int attrType = 0;
                if (type != null) {
                    if (type.equals("MQCFIN")) {
                        attrType = CMQCFC.MQCFT_INTEGER;
                    } else if (type.equals("MQCFIL")) {
                        attrType = CMQCFC.MQCFT_INTEGER_LIST;
                    } else if (type.equals("MQCFST")) {
                        attrType = CMQCFC.MQCFT_STRING;
                    } else if (type.equals("MQCFSL")) {
                        attrType = CMQCFC.MQCFT_STRING_LIST;
                    } else if (type.equals("EXBIN")) {
                        attrType = MqcConstants.EXCFT_BINARY;
                    } else if (type.equals("EXPCF")) {
                        attrType = MqcConstants.EXCFT_PCF;
                PlatformObject p = null;
                if (readonly == null) {
                    p = new PlatformObject(platforms);
                } else {
                    p = new PlatformObject(platforms, readonly.equals("y"));
                String exclude = attributes.getValue("exclude");
                if (include != null && exclude != null) {
                    Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                    exclude = null;
                if (include != null)
                    p.setCondition(include, true);
                if (exclude != null)
                    p.setCondition(exclude, false);
                if (attrType != 0)
                    p.setType(attrType);
                if (maxlen != null)
                    p.setLen(Integer.parseInt(maxlen));
                ((AttributeObject)stack.peek()).addPlatform(p);
        public static boolean isExported(int attribute, TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isExported(name, node);
        public static boolean isExported(String attribute, TopologyModelNode node) {
            // Find the qmgr node to fetch platform and cmdlevel
            TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
            // If there's no qmgr for this node, it must be one of 'ours'.
            if (qmgr == null)
                return false;     // None of 'our' objects can be exported to MQSC.
            String classId = node.getClassId();
            String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
            String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
            return isExported(attribute, classId, cmdLevel, platform, node);
        public static boolean isExported(int attribute, String classId, String cmdLevel, String platform,
                                         TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isExported(name, classId, cmdLevel, platform, node);
        /** Determine if an attribute is exportable. The attribute name, the classid of the object to
            which it belongs, plus the command level and platform of the queue manager are all needed
            to make this determination.
            Start by finding the AttributeObject for the combination of attribute, classid, and
            command level. If we can't find the AttributeObject, we assume that the attribute
            is not exported. Otherwise, find out if it is exportable for the selected platform.
        public static boolean isExported(String attribute, String classId, String cmdLevel, String platform,
                                         TopologyModelNode node) {
            AttributeObject attr = getAttributeObject(attribute, classId, cmdLevel);
            if (attr == null) {
                return false;
            } else {
                return attr.isExported(platform, node);
        public static boolean isSupported(int attribute, TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isSupported(name, node);
        public static boolean isSupported(String attribute, TopologyModelNode node) {
            // Find the qmgr node to fetch platform and cmdlevel
            TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
            // If there's no qmgr for this node, it must be one of 'ours'.
            if (qmgr == null)
                return true;
            String classId = node.getClassId();
            String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
            String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
            return isSupported(attribute, classId, cmdLevel, platform);
        public static boolean isSupported(int attribute, String classId, String cmdLevel, String platform) {
            String name = ResourceManager.getAttributeName(attribute);
            return isSupported(name, classId, cmdLevel, platform);
        /** Determine if an attribute is supported. The attribute name, the classid of the object to
            which it belongs, plus the command level and platform of the queue manager are all needed
            to make this determination.
            Start by finding the SupportObject for the classid. If it isn't there, we make the assumption
            (for now) that the attribute is supported. The only classids for which this can occur are
            broker, agent, and the various container objects.
            Propagate the isSupported request to the chain of SupportObjects (based on 'include' values)
            until we get a 'true' result or we run out of SupportObjects. */
        public static boolean isSupported(String attribute, String classId, String cmdLevel, String platform) {
            if (attribute == null)
                return false;
            SupportObject obj = (SupportObject)objects.get(classId);
            // If the object type isn't even in the support matrix, we interpret that to
            // mean that it's a Broker or Agent, in which case all attributes are supported
            // at present.
            if (obj == null)
                return true;
            boolean result = false;
            while (result == false && obj != null) {
                result = obj.isSupported(attribute, cmdLevel, platform);
                if (result == false && obj.getInclude() != null) {
                    obj = (SupportObject)objects.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        /** Locate an AttributeObject for a given attribute name, object type, and command level.
            This is a helper function for the getMaxLen and getType methods. */
        private static AttributeObject getAttributeObject(String attr, String classID, String cmdLevel) {
            AttributeObject result = null;
            SupportObject obj = (SupportObject)objects.get(classID);
            while (result == null && obj != null) {
                result = obj.getAttr(attr, cmdLevel);
                if (result == null && obj.getInclude() != null) {
                    obj = (SupportObject)objects.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        /** Determine the maximum length for a given combintation of attribute name, object type,
            command level, and platform. If the AttributeObject can't be found, or if the length
            hasn't been set, return -1. */
        public static int getMaxLen(String attr, String classId, String cmdLevel, String platform) {
            AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
            if (a == null)
                return -1;
            return a.getMaxLen(platform);
        /** Determine the PCF parm type for a given combintation of attribute name, object type,
            command level, and platform. If the AttributeObject can't be found, or if the length
            hasn't been set, return -1. */
        public static int getType(String attr, String classId, String cmdLevel, String platform) {
            AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
            if (a == null)
                return -1;
            return a.getType(platform);
        /** Inner class to contain platform-specific info for an attribute. */
        class PlatformObject {
            /** This instance variable will contain the comma-delimited string of all
                platforms to which this object applies. */
            private String platform;
            private int maxlen;
            private String condition = null;
            private boolean include;
            private boolean readonly;
            private boolean lenSet;
            private int attrType;
            private boolean typeSet;
            public PlatformObject(String p, boolean readonly) {
                platform = p;
                this.readonly = readonly;
                lenSet = false;
                typeSet = false;
            public PlatformObject(String p) {
                this(p, false);
            public void setCondition(String condition, boolean include) {
                this.condition = condition;
                this.include = include;
            public boolean isReadonly() {
                return readonly;
            public boolean isExported(TopologyModelNode node) {
                if (condition != null) {
                    boolean test = false;
                    try {
                        test = Utilities.evaluateCondition(node, condition);
                    } catch (Exception e) {}
                    if (include ^ test)
                        return false;
                return !readonly;
            public void setLen(int len) {
                maxlen = len;
                lenSet = true;
            public void setType(int type) {
                attrType = type;
                typeSet = true;
            public String getPlatform() {
                return platform;
            public int getMaxLen() {
                if (!lenSet)
                    return -1;
                return maxlen;
            public int getType() {
                if (!typeSet)
                    return -1;
                return attrType;
        /** This class represents a specific MQSeries attribute. It can optionally contain
            instances of the PlatformObject class as needed. When the 'platforms' collection
            is empty, the attribute is supported on all platforms. It is also possible to
            include a PlatformObject for the 'all' platform, if specific attribute characteristics
            need representation. When the 'platforms' collection is non-empty, it will include one
            entry for each platform where the attribute is supported. */
        class AttributeObject {
            private String attribute;
            private String attrValue;
            private HashMap platforms;
            private String condition = null;
            private boolean include;
            private boolean readonly = false;
            public AttributeObject(String a) {
                this(a, false);
            public AttributeObject(String a, boolean readonly) {
                attribute = a;
                platforms = new HashMap();
                this.readonly = readonly;
            public void setCondition(String condition, boolean include) {
                this.condition = condition;
                this.include = include;
            public void setReadonly(boolean readonly) {
                this.readonly = readonly;
            public boolean isReadonly() {
                return readonly;
            public void addPlatform(PlatformObject p) {
                for (StringTokenizer st = new StringTokenizer(p.getPlatform(), ","); st.hasMoreTokens() ;) {
                    platforms.put(st.nextToken(), p);
            public PlatformObject getPlatform(String platform) {
                PlatformObject p = (PlatformObject)platforms.get(platform);
                if (p == null)
                    p = (PlatformObject)platforms.get("all");
                return p;
            public String getAttribute() {
                return attribute;
            public int getMaxLen(String platform) {
                PlatformObject p = getPlatform(platform);
                if (p == null)
                    return -1;
                return p.getMaxLen();
            public int getType(String platform) {
                PlatformObject p = getPlatform(platform);
                if (p == null)
                    return -1;
                return p.getType();
            public boolean isSupported(String platform) {
                if (platforms.isEmpty()) {
                    return true;
                if (platforms.containsKey(platform)) {
                    return true;
                if (platforms.containsKey("all")) {
                    return true;
                return false;
            public boolean isExported(String platform, TopologyModelNode node) {
                if (readonly) {
                    Log.log(Log.DEBUG, this, attribute + " is readonly, returning false");
                    return false;
                if (condition != null) {
                    Log.log(Log.DEBUG, this, "Testing condition = " + condition);
                    boolean test = false;
                    try {
                        test = Utilities.evaluateCondition(node, condition);
                        Log.log(Log.DEBUG, this, "Condition result is " + test);
                    } catch (Exception e) {
                        Log.log(Log.ERROR, this, "Condition through an exception");
                    if (include ^ test)
                        return false;
                if (platforms.isEmpty()) {
                    return true;
                PlatformObject p = getPlatform(platform);
                if (p == null) {
                    Log.log(Log.DEBUG, this, platform + " not found for " + attribute + ", returning false");
                    return false;
                return p.isExported(node);
        /** This class represents a specific value of a queue manager's command level. A
            given instance of this class may 'include' a 'parent' instance through its
            include instance variable. The traversal of the parent/child hierarchy is
            delegated to the SupportObject class, since that is where the collection of
            VersionObjects lives. */
        class VersionObject {
            private String cmdLevel;
            private String include;
            private HashMap attributes;
            public VersionObject(String cmdLevel, String include) {
                this.cmdLevel = cmdLevel;
                this.include = include;
                attributes = new HashMap();
            public void addAttr(AttributeObject attr) {
                attributes.put(attr.getAttribute(), attr);
            public AttributeObject getAttr(String attr) {
                return (AttributeObject)attributes.get(attr);
            public String getCmdLevel() {
                return cmdLevel;
            public String getInclude() {
                return include;
            public boolean isSupported(String attr, String platform) {
                AttributeObject obj = (AttributeObject)attributes.get(attr);
                if (obj == null) {
                    return false;
                } else
                    return obj.isSupported(platform);
        /** This class represents an MQSeries object type, as identified by its classid, e.g.
            queue manager or local queue. This class implements an include facility similar to
            that described for the VersionObject. The traversal of that hierarchy is delegated
            to the static isSupported method, because the collection of SupportObject instances
            is a static variable of the SupportMatrix class. */
        class SupportObject {
            private String classId;
            private String include;
            private HashMap versions;
            public SupportObject(String classId, String include) {
                this.classId = classId;
                this.include = include;
                versions = new HashMap();
            public void addVersion(VersionObject obj) {
                String key = obj.getCmdLevel();
                versions.put(key, obj);
            public String getClassId() {
                return classId;
            public String getInclude() {
                return include;
            public boolean isSupported(String attr, String cmdLevel, String platform) {
                boolean result = false;
                VersionObject obj = (VersionObject)versions.get(cmdLevel);
                if (obj == null)
                    obj = (VersionObject)versions.get("base");
                // I don't actually know what it means if obj is null at this point.
                // It probably can't happen.
                if (obj == null)
                    return false;
                while (result ==  false && obj != null) {
                    result = obj.isSupported(attr, platform);
                    if (result == false && obj.getInclude() != null) {
                        obj = (VersionObject)versions.get(obj.getInclude());
                    } else
                        obj = null;
                return result;
            public AttributeObject getAttr(String attr, String cmdLevel) {
                AttributeObject result = null;
                VersionObject obj = (VersionObject)versions.get(cmdLevel);
                if (obj == null)
                    obj = (VersionObject)versions.get("base");
                // I don't actually know what it means if obj is null at this point.
                // It probably can't happen.
                if (obj == null)
                    return null;
                while (result ==  null && obj != null) {
                    result = obj.getAttr(attr);
                    if (result == null && obj.getInclude() != null)
                        obj = (VersionObject)versions.get(obj.getInclude());
                    else
                        obj = null;
                return result;
    }

    Are you the one who commented out the code you're looking for ?//String desc = StringFactory.getString(attributes.getValue("desc"));You just have to modify you AttributeObject class to hold a new field : String description. And then, it's up to you to create a new constructor or a new setter method.
    Btw, this is not a Swing related question.

  • How to find the existence of a tag in  XML file through  XSLT Mapping?

    Hello Friends,
    Working on an SAP XI interface ,I have come across a situation where I need to map the values only when a particular tag exists in the inbound XML file.I need to use the XSLT mapping for the same.
    Requesting your advice on as to how may I validate the existence of a tag through XSLT mapping?
    Thanks.

    Hello Friends
    After research , I could also find another way to check the existence of a node .We can even use CHOOSE to check the existence.
    <xsl:choose>
          <xsl:when test="(/mynode)">
              your action if the mynode is found
          </xsl:when>
          <xsl:otherwise>
                    action if mynode is not found
          </xsl:otherwise>
    </xsl:choose>
    Thanks.
    Wishes
    Richa

  • How to quick import Tags from a xml file?

    Good morning/afternoon/night everyone.
       I have this client that want me to import something like 1000 tags from a xml file in CQ5.5. I know I can do it programatically and in dev.day.com I have already found some instructions, but, there is some easier way to do this? Or, if the only way is developing a bundle to run in a workflow (and then the client can import tags from xml files anytime he want to), do you guys have some advice or guidelines?
    Thanks!

    I would expect it should be possible using vault. If you export an existing namespace from cq using vault (checkout/update) you can see what format it should be in. Then you should convert your xml to match that format (perhaps using XSLT) and use vault in the other direction (commit).
    We are using vault all the time behind the scenes using a vault plugin for maven. This way we can export content from one developer's cq instance, put it in SVN and have another developer import it in his cq instance, all using maven (and vault). This is especially usefull for general content structures and for tags.

  • Appending content to an XML file in the Root tag using FileAdapter

    Hi Friends..!!
    I have got a requirement like this. There will be an XML file with List of Employees like following...
    <Employees>
    <Emp>
    <SNo>111</Sno>
    <Fname>Mahesh<Fname>
    <Lname>Babu</Lname>
    </Emp>
    <Emp>
    <SNo>222</Sno>
    <Fname>----<Fname>
    <Lname>-----</Lname>
    </Emp>
    <Emp>
    <SNo>----</Sno>
    <Fname>----<Fname>
    <Lname>----</Lname>
    </Emp>
    </Employees>
    .. So What i have to do is Appending the given Employees info to the existed XML file using File Adapter. But When i m trying to figure it out.. the given details are appended at the end of the previous content.. but i want to see all the Emp tags(the newly appended emp list also) in the existed <Employees> tag only..
    (i m also facing namespace issues here)
    Can u plz provide solution for this problem..?
    Thanks in advance.
    Regards-
    Nlion7

    Hi Nilon7,
    the given details are appended at the end of the previous contentThat will be the behaviour if you are just using file write with append...
    You will need to expand your solution into three steps, firstly a file adapter sync read to retrieve the current contents of the file, then a xslt transformation to "merge" the current data with the new data and finally a file adapter write with the merged content...
    Cheers,
    Vlad

  • Importing from XML to Excel - need to know how to append to existing Excel file

    Hello,
    I have several XML files that I will need to import into one Excel spreadsheet. I have been able to figure out how to import an XML file to an Excel file but when I import a second XML file, the contents of the second XML overwrite the Excel spreadsheet.
    I am looking for an option to append. Thanks in advance
    private void XmlToExcel(string xmlFilePath, string excelFilePath)
    object misValue = System.Reflection.Missing.Value;
    DataSet Trans_ds = new System.Data.DataSet();
    Trans_ds.ReadXml(xmlFilePath);
    Excel.Application excel = new Excel.Application();
    excel.Application.Workbooks.Add(true);
    System.Data.DataTable table = Trans_ds.Tables[0];
    Worksheet worksheet = (Worksheet)excel.ActiveSheet;
    Range excelRange = (Excel.Range)worksheet.get_Range("A" + worksheet.Rows.Count, Type.Missing);
    int lastRow = excelRange.get_End(XlDirection.xlUp).Row;
    int ColumnIndex = 0;
    int rowIndex = lastRow++;
    foreach (System.Data.DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[lastRow, ColumnIndex] = col.ColumnName;
    foreach (DataRow row in table.Rows)
    rowIndex++;
    ColumnIndex = 0;
    foreach (DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[rowIndex + 1, ColumnIndex] = row[col.ColumnName];
    worksheet.StandardWidth = 20.0;
    worksheet.SaveAs(excelFilePath, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
    excel.Quit();
    releaseObject(worksheet);
    releaseObject(excel);

    See if this helps.  I opened the old excel file and added the new rows into the existing workbook.
    private void XmlToExcel(string xmlFilePath, string excelFilePath, Boolean append)
    object misValue = System.Reflection.Missing.Value;
    DataSet Trans_ds = new System.Data.DataSet();
    Trans_ds.ReadXml(xmlFilePath);
    Excel.Application excel = new Excel.Application();
    Excel.Workbook Bk = excel.Workbooks.Add(true);
    System.Data.DataTable table = Trans_ds.Tables[0];
    Excel.Worksheet worksheet = (Excel.Worksheet)excel.Worksheets[1];
    Excel.Range excelRange = (Excel.Range)worksheet.get_Range("A" + worksheet.Rows.Count, Type.Missing);
    int lastRow = excelRange.get_End(Excel.XlDirection.xlUp).Row;
    int ColumnIndex = 0;
    int rowIndex = lastRow++;
    foreach (System.Data.DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[lastRow, ColumnIndex] = col.ColumnName;
    foreach (DataRow row in table.Rows)
    rowIndex++;
    ColumnIndex = 0;
    foreach (DataColumn col in table.Columns)
    ColumnIndex++;
    excel.Cells[rowIndex + 1, ColumnIndex] = row[col.ColumnName];
    worksheet.StandardWidth = 20.0;
    if (append == false)
    worksheet.SaveAs(excelFilePath, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
    else
    //open old workbook
    Excel.Workbook oldworkbook = (Excel.Workbook)excel.Workbooks._Open(
    excelFilePath,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing);
    //get first sheet in workbook
    Excel.Worksheet oldxlSht = (Excel.Worksheet)oldworkbook.Worksheets[1];
    //get column A of old worksheet to find last row in sheet
    Excel.Range xlRange = (Excel.Range)oldxlSht.get_Range(
    "A" + oldxlSht.Rows.Count, Type.Missing);
    int LastRow = xlRange.get_End(Microsoft.Office.Interop.Excel.XlDirection.xlUp).Row;
    int newrow = LastRow + 1;
    //get last row of new worksheet
    xlRange = (Excel.Range)worksheet.get_Range(
    "A" + oldxlSht.Rows.Count, Type.Missing);
    LastRow = xlRange.get_End(Microsoft.Office.Interop.Excel.XlDirection.xlUp).Row;
    // copy rows of new worksheet to old worksheet
    xlRange = (Excel.Range)worksheet.Rows["1:" + LastRow, Type.Missing];
    xlRange.Copy(oldxlSht.Rows[newrow, Type.Missing]);
    oldworkbook.Save();
    excel.Quit();
    releaseObject(oldxlSht);
    releaseObject(worksheet);
    releaseObject(excel);
    jdweng

Maybe you are looking for