Parse xml for conky

I'd like to capture two key outputs and have them displayed in conky.  On my system, GPU load and GPU memory usage are available from the nvidia-smi program.  I can output in xml format which I'd like to parse and harvest to display in conky.  I can brute-force myself through it via grep and sed statements, but I'm looking for some suggestions from more knowledgeable people to do this in a minimal way.  For example, only run the program once, and harvest all data.  My current solution runs twice.
Example output:
$ nvidia-smi -a -x
<?xml version="1.0" ?>
<!DOCTYPE nvsmi_log SYSTEM "./nvsmi.dtd">
<nvsmi_log>
<timestamp>Mon Dec 6 17:48:50 2010</timestamp>
<driver_version>260.19.21</driver_version>
<gpu id="0">
<prod_name>GeForce 8400 GS</prod_name>
<pci_device_id>6e410de</pci_device_id>
<pci_location_id>0:1:0</pci_location_id>
<serial>2648101198649</serial>
<display>Connected</display>
<temp>43 C</temp>
<utilization>
<gpu_util>0%</gpu_util>
<memory_util>8%</memory_util>
</utilization>
</gpu>
</nvsmi_log>
[facade@simplicity ~]$ nvidia-smi -a -x
<?xml version="1.0" ?>
<!DOCTYPE nvsmi_log SYSTEM "./nvsmi.dtd">
<nvsmi_log>
<timestamp>Mon Dec 6 17:49:30 2010</timestamp>
<driver_version>260.19.21</driver_version>
<gpu id="0">
<prod_name>GeForce 8400 GS</prod_name>
<pci_device_id>6e410de</pci_device_id>
<pci_location_id>0:1:0</pci_location_id>
<serial>2648101198649</serial>
<display>Connected</display>
<temp>43 C</temp>
<utilization>
<gpu_util>5%</gpu_util>
<memory_util>10%</memory_util>
</utilization>
</gpu>
</nvsmi_log>
Or it might be better not to go to xml which I can do by omitting the -x switch:
$ nvidia-smi -a
==============NVSMI LOG==============
Timestamp : Mon Dec 6 17:50:06 2010
Driver Version : 260.19.21
GPU 0:
Product Name : GeForce 8400 GS
PCI Device/Vendor ID : 6e410de
PCI Location ID : 0:1:0
Board Serial : 2648101198649
Display : Connected
Temperature : 43 C
Utilization
GPU : 0%
Memory : 8%
Thanks!
Last edited by graysky (2014-11-03 08:39:36)

Damn, my memory is truly shit.  Thanks, ST.  The awk syntax is still foreign to me.  How would I segregate the RAM usage from the GPU usage?  I think conky needs the output to be unique for each one in their own script.
EDIT: Got it.
# Swap Usage:$color $swapperc%${color lightgrey}
# the ${template x x x} command uses /sys/bus/platform/devices
# for this to work you need both lm-sensors and hddtemp
# get both from main repos
# set to yes if you want Conky to be forked in the background
background no
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
out_to_console no
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
#xftfont Bitstream Vera Sans Mono:size=8
xftfont monospace:size=8
#xftalpha 0.8
# Update interval in seconds
update_interval 2
# Create own window instead of using desktop (required in nautilus)
own_window yes
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
#minimum_size 250 5
maximum_width 258
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 10
# border margins
#border_margin 4
# border width
border_width 1
# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white
# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
#alignment top_right
alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 12
gap_y 37
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer left
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
default_bar_size 120 6
TEXT
${color #6495ed}$nodename$color - $sysname $kernel on $machine
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg${color lightgrey}
$color$stippled_hr${color lightgrey}
Processes: $processes Running:$color$running_processes
${color}Name PID CPU% MEM%
${color #6495ed} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color}Mem usage
${color #6495ed} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
$color$stippled_hr${color lightgrey}
${color #6495ed}CPU0: ${color lightgrey}Intel Xeon X3360 @ $color${freq_g} GHz${color lightgrey}
${color #6495ed}CPU Fan: $color${platform it87.656 fan 1}${color grey} RPM @ $color${execi 8 cat /sys/class/hwmon/hwmon4/device/pwm1}
${color #6495ed}RAM:$color$mem ($memperc%) ${color lightgrey}of 8.0 GB
${color black}${cpugraph 35,200 5000a0 6495ed}${color white} ${cpugauge 35}${color lightgrey}
${color lightgrey}Core0:$color${platform coretemp.0 temp 1} °C${color grey} @$color ${cpu cpu1}% ${alignr}${cpubar cpu1 6,120}
${color lightgrey}Core1:$color${platform coretemp.1 temp 1} °C${color grey} @$color ${cpu cpu2}% ${alignr}${cpubar cpu2 6,120}
${color lightgrey}Core2:$color${platform coretemp.2 temp 1} °C${color grey} @$color ${cpu cpu3}% ${alignr}${cpubar cpu3 6,120}
${color lightgrey}Core3:$color${platform coretemp.3 temp 1} °C${color grey} @$color ${cpu cpu4}% ${alignr}${cpubar cpu4 6,120}${color grey}
${color grey}CPU:$color${platform it87.656 temp 1} °C ${color grey} ${color grey} M/B:$color ${platform it87.656 temp 2} °C ${color grey} sda:$color ${execi 300 sudo hddtemp /dev/sda | cut -c34-35} °C
$color$stippled_hr${color lightgrey}
${color #6495ed}GPU0:${color lightgrey} nVidia 8800 GS (${nvidia gpufreq}/${nvidia memfreq}) MHz
${color #6495ed}VRAM:${color lightgrey} ${exec nvidia-smi -a | grep -A 2 "Utilization" | tr -d % | grep "Memory" | awk '{print $3}'}% of 512MiB
${color #6495ed}GPU0:${color lightgrey}$color${nvidia temp} °C @ ${exec nvidia-smi -a | grep -A 2 "Utilization" | tr -d % | grep "GPU" | awk '{print $3}'}% ${execbar nvidia-smi -a | grep -A 2 "Utilization" | tr -d % | grep "Memory" | awk '{print $3}'}
$color$stippled_hr${color lightgrey}
${color lightgrey}RAMDisk: ${color }${fs_used_perc /dev/shm} % ${fs_bar /dev/shm 6,120}
Last edited by graysky (2010-12-07 00:54:15)

Similar Messages

  • How to parse XML for internal table

    hi guys, I would like to know how to parse xml for an internal table. I explain myself.
    Let's say you have a purchase order form where you have header data & items data. In my interactive form, the user can change the purchase order quantity at the item level. When I received back the pdf completed by mail, I need to parse the xml and get the po qty that has been entered.
    This is how I do to get header data from my form
    lr_ixml_node = lr_ixml_document->find_from_name( name = ''EBELN ).
    lv_ebeln = lr_ixml_node->get_value( ).
    How do we do to get the table body??
    Should I used the same method (find_from_name) and passing the depth parameter inside a do/enddo?
    thanks
    Alexandre Giguere

    Alexandre,
    Here is an example. Suppose your internal table is called 'ITEMS'.
    lr_node = lr_document->find_from_name('ITEMS').
    lv_num_of_children = lr_node->num_children( ).
    lr_nodechild = lr_node->get_first_child( ).
    do lv_num_of_children times.
        lv_num_of_attributes = lr_nodechild->num_children( ).
        lr_childchild = lr_nodechild->get_first_child( ).
       do lv_num_of_attributes times.
          lv_value = lr_childchild->get_value( ).
          case sy-index.
             when 1.
               wa_item-field1 = lv_value
             when 2.
               wa_item-field2 = lv_value.
          endcase.
          lr_childchild = lr_childchild->get_next( ).
       enddo.
       append wa_item to lt_item.
       lr_nodechild = lr_nodechild->get_next( ).
    enddo.

  • Parsing xml for complex type using sax

    I have an xsd of below type:
    <xs:complexType name="itemInfo">
        <xs:sequence>
          <xs:element name="displayLineNumber" type="xs:string" minOccurs="0"/>
          <xs:element name="lineNumber" type="xs:integer" minOccurs="0"/>
          <xs:element name="parentLineNumber" type="xs:integer" minOccurs="0"/>
       <xs:element name="service" type="serviceInfo" minOccurs="0" maxOccurs="unbounded"/>
       </xs:sequence>
    </xs:complexType>
    <xs:complexType name="serviceInfo">
        <xs:sequence>
          <xs:element name="displayLineNumber" type="xs:string" minOccurs="0"/>
          <xs:element name="lineNumber" type="xs:integer" minOccurs="0"/>
          <xs:element name="serviceName" type="xs:string" minOccurs="0"/>
          <xs:element name="serviceDescription" type="xs:string" minOccurs="0"/>
          <xs:element name="subscriptionBand" type="subscriptionBandInfo" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="subscriptionBandInfo">
        <xs:sequence>
          <xs:element name="min" type="xs:long"/>
          <xs:element name="max" type="xs:long"/>
          <xs:element name="duration" type="xs:string" minOccurs="0"/>
          <xs:element name="price" type="xs:decimal"/>
        </xs:sequence>
      </xs:complexType>
    I have written a handler and able to handle simple type but how I can handle serviceInfo and subscriptionBandInfo as itemInfo is my root element.
    My handler class is:
    public class ProductHandler
      extends DefaultHandler
      //List to hold ProductInfo object
      private List<ProductInfo> productList = null;
      private ProductInfo product = null;
      public List<ProductInfo> getProductList()
        return productList;
      boolean bDisplayLineNumber = false;
      boolean bLineNumber = false;
      boolean bParentLineNumber = false;
      @Override
      public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException
        if (qName.equalsIgnoreCase("item"))
        { //create a new ProductInfo and put it in Map
          //initialize ProductInfo object and set id attribute
          product = new ProductInfo();
          //initialize list
          if (productList == null)
            productList = new ArrayList<ProductInfo>();
        else if (qName.equalsIgnoreCase("name"))
          //set boolean values for fields, will be used in setting ProductInfo variables
          bName = true;
        else if (qName.equalsIgnoreCase("displayLineNumber"))
          bDisplayLineNumber = true;
        else if (qName.equalsIgnoreCase("lineNumber"))
          bLineNumber = true;
        else if (qName.equalsIgnoreCase("parentLineNumber"))
          bParentNumber = true;
      @Override
      public void endElement(String uri, String localName, String qName)
        throws SAXException
        if (qName.equalsIgnoreCase("item"))
          //add ProductInfo object to list
          productList.add(product);
      @Override
      public void characters(char ch[], int start, int length)
        throws SAXException
       if (bDisplayLineNumber)
          product.setDisplayLineNumber(Integer.parseInt(new String(ch, start, length)));
          bDisplayLineNumber = false;
       else if (bLineNumber)
          product.setLineNumber(Integer.parseInt(new String(ch, start, length)));
          bLineNumber = false;
        else if (bParentNumber)
          product.setParentNumber(Integer.parseInt(new String(ch, start, length)));
          bParentNumber = false;
      @Override
      public void endElement(String uri, String localName, String qName)
        throws SAXException
        if (qName.equalsIgnoreCase("item"))
          //add ProductInfo object to list
          productList.add(product);
    My ProductInfo class is:
    import com.vpc.schema.ServiceInfo;
    import java.util.ArrayList;
    import java.util.List;
    public class ProductInfo
      private String category, family, subGroup, size, productType, availability;
      private String displayLineNumber;
      private int lineNumber;
      private int parentNumber;
    private List<ServiceInfo> serviceInfo;
      public int getLineNumber()
        return lineNumber;
      public int getParentNumber()
        return parentNumber;
      public List<ServiceInfo> getServiceInfo()
        if (serviceInfo == null)
          serviceInfo = new ArrayList<ServiceInfo>();
        return serviceInfo;
      public void setServiceInfo(List<ServiceInfo> serviceInfo)
        this.serviceInfo = serviceInfo;
    I am able to do parsing for my simple type but when a complex type comes I am not able to do it. So please suggest how I can add complex type

    I suppose the posting of xsd is to show the structure of the xml...
    In any case, I can suggest a couple of things to do for the purpose.
    [1] If you still follow the same line of reasoning using some boolean like bDisplayLineNumber etc to identify the position of the parser traversing the document, you can complete the logic adding bItem (which you did not need under simplified consideration) and bService and bSubscriptionBand to identify at the parent or the grandparent in the case of the "complexType" serviceInfo and even the great-grand-parent in the case of arriving to the complexType subscriptionBandInfo...
    [1.1] With those boolean value, you determine bDisplayLineNumber etc under item directly, and then as well say bDisplayLineNumber_Service under the service etc and then bMin_SubscriptionBand etc under subscriptionBand etc. You just expand the number of those variables to trigger the setting of those fields in the object product, service in the serviceList and subscriptionBand in the subscriptionBandList etc etc.
    [1.2] All the reset of those booleans should be done in the endElement() method rather than in characters() method. That is logically more satisfactory and has a bearing in case there is a mixed content type.
    [1.3] Then when arriving at startElement of service, you make sure you initiate the serviceList, same for subscriptionBand the subscriptionList...
    [1.4] Then when arriving at endElement of service, you use setServiceInfo() setter to pass the serviceList to product and the same when arriving at endElement of serviceBand, you use setSubscriptionBand() setter to pass the subscriptionBand to service.
    ... and then basically that's is it, somewhat laborious and repetitive but the logical layout is clear. (As a side-note, you shouldn't use equalsIgnoreCase(), why should you? xml is case sensitive.)
    [2] Actually, I would suggest a much neater approach, especially when you probe many more levels of complexType. It would be even appear cleaner when you have two levels of depth already...
    [2.1] You maintain a Stack (or an implementation class of Deque, but Stack is largely sufficient here) of element name to guide the parser identifying its whereabout. By such doing, you get ride of all those bXXX's.
    This is a rewrite of the content handler using this approach and I only write the code of capturing service. Adding serviceBand is a matter of repetition of how it is done on service. And it is already clear it appears a lot neater as far as I'm concerned.
    public class ProductHandler extends DefaultHandler {
    Stack<String> tagstack=new Stack<String>();
    private List<ProductInfo> productList = null;
    private ProductInfo product = null;
    private List<ServiceInfo> serviceList=null;
    private ServiceInfo service=null;
    public List<ProductInfo> getProductList() {
      return productList;
    public List<ServiceInfo> getServiceList() {
      return serviceList;
    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes) {
      if (qName.equals("item")) {
       product = new ProductInfo();
       //initialize list
       if (productList == null) {
        productList = new ArrayList<ProductInfo>();
      } else if (qName.equals("service") && tagstack.peek().equals("item")) {
       service=new ServiceInfo();
       if (serviceList==null) {
        serviceList=new ArrayList<ServiceInfo>();
      tagstack.push(qName);
    @Override
    public void endElement(String uri, String localName, String qName) {
      if (tagstack.peek().equals("item")) {
       //add ProductInfo object to list
       productList.add(product);
      } else if (tagstack.peek().equals("service") && tagstack.search("item")==2) {
       serviceList.add(service);
       product.setServiceInfo(serviceList);
      tagstack.pop();
    @Override
    public void characters(char ch[], int start, int length) throws SAXException {
      String currentName=tagstack.peek();
      int itemPos=tagstack.search("item");
      int servicePos=tagstack.search("service");
      if (currentName.equals("name") && itemPos==2)  {
       product.setName(new String(ch, start, length));
      } else if (currentName.equals("displayLineNumber") && itemPos==2) {
       product.setDisplayLineNumber(Integer.parseInt(new String(ch, start, length)));
      } else if (currentName.equals("lineNumber") && itemPos==2) {
       product.setLineNumber(Integer.parseInt(new String(ch, start, length)));
      } else if (currentName.equals("parentLineNumber") && itemPos==2) {
       product.setParentLineNumber(Integer.parseInt(new String(ch, start, length)));
      } else if (currentName.equals("displayLineNumber") && servicePos==2 && itemPos==3) {
       service.setDisplayLineNumber(Integer.parseInt(new String(ch, start, length)));
      } else if (currentName.equals("lineNumber") && servicePos==2 && itemPos==3) {
       service.setLineNumber(Integer.parseInt(new String(ch, start, length)));
      } else if (currentName.equals("serviceName") && servicePos==2 && itemPos==3) {
       service.setServiceName(new String(ch, start, length));
      } else if (currentName.equals("serviceDescription") && servicePos==2 && itemPos==3) {
       service.setServiceDescription(new String(ch, start, length));

  • Parse xml for font / paragraph styling

    Has anyone tried to understand the XML representation of font style (or as I believe it is defined in the XML, "paragraphstyle")? I am having trouble getting all the lookups. I get multiple results. I am not an expert on XML. Is "property-map" a term that is unique to this XML definition, or is their a standard way to look up values via an XML property-map.
    I am wondering if I need a combination of styletheetID, paragraphstyleID and parent-ident, just to get a single lookup val?
    I have pasted what my return results look like:
    <sf:paragraphstyle sfa:ID="SFWPParagraphStyle-94" sf:parent-ident="titleHeadlineParagraphStyleID">
    <sf:property-map/>
    </sf:paragraphstyle>
    <sf:paragraphstyle sfa:ID="SFWPParagraphStyle-94" sf:parent-ident="slideNotesParagraphStyleID">
    <sf:property-map/>
    </sf:paragraphstyle>
    <sf:paragraphstyle sfa:ID="SFWPParagraphStyle-94" sf:parent-ident="shapeParagraphStyleID">
    <sf:property-map>
    <sf:fontName>
    <sf:string sfa:string="CopperplateGothic-Bold"/>
    </sf:fontName>
    <sf:fontColor>
    <sf:color xsi:type="sfa:calibrated-white-color-type" sfa:w="0.90196079015731812" sfa:a="1"/>
    </sf:fontColor>
    <sf:fontSize>
    <sf:number sfa:number="18" sfa:type="q"/>
    </sf:fontSize>
    </sf:property-map>
    </sf:paragraphstyle>
    <sf:paragraphstyle sfa:ID="SFWPParagraphStyle-94" sf:parent-ident="level1HeadlineParagraphStyleID">
    <sf:property-map/>
    </sf:paragraphstyle>
    <sf:paragraphstyle sfa:ID="SFWPParagraphStyle-94" sf:parent-ident="shapeParagraphStyleID">
    <sf:property-map>
    <sf:fontName>
    <sf:string sfa:string="Corbel-Bold"/>
    </sf:fontName>
    <sf:fontColor>
    <sf:color xsi:type="sfa:calibrated-white-color-type" sfa:w="0.90196079015731812" sfa:a="1"/>
    </sf:fontColor>
    <sf:fontSize>
    <sf:number sfa:number="18" sfa:type="q"/>
    </sf:fontSize>
    </sf:property-map>
    </sf:paragraphstyle>
    <sf:paragraphstyle sfa:ID="SFWPParagraphStyle-94" sf:parent-ident="shapeParagraphStyleID">
    <sf:property-map>
    <sf:fontName>
    <sf:string sfa:string="Futura-Medium"/>
    </sf:fontName>
    <sf:alignment/>
    <sf:fontColor>
    <sf:color xsi:type="sfa:calibrated-white-color-type" sfa:w="0.90196079015731812" sfa:a="1"/>
    </sf:fontColor>
    <sf:fontSize/>
    </sf:property-map>
    </sf:paragraphstyle>
    I should also note another weird behavior... when I do a "find" within the text application I only get two results for "SFWPParagraphStyle-94", one for the paragraph where it is used, and one in the stylesheet section where it is defined (ie. the return result that I expect).

    I am trying to decipher what the current text formatting of a shape is. I am parsing through the slides, parsing through the shapes of a slide, and am now trying to lookup/extract the formatting of the text that is inside the shape.
    which looks like this in my test file:
    <sf:p sf:style="SFWPParagraphStyle-94">Centered, has a font override<sf:br/></sf:p>
    <sf:p sf:style="SFWPParagraphStyle-94">and line break</sf:p>
    With regards to the post above, I was making a rookie error... I was using:
    xml.blablabla.paragraphstyle.(@ID="SFWPParagraphStyle-94");
    instead of
    xml.blablabla.paragraphstyle.(@ID=="SFWPParagraphStyle-94");
    .... so that obviously now clears that up.... totally.. duh
    Now I am just trying to continue to look up all the inheritance formatting... which to me, at this point is not that straight forward. So I would prefer to leave this thread open as to "how to parse for text formatting"
    So far I am:
    getting the stylesheet-ref
    looking up the paragraphStyle
    which then points to the master-slide
    ....

  • Parse xml for newline chars using xpath

    Hi guys,
    need your help.
    I was curious to how can we use subString-before and subString after function to extracts records based on newline.
    Ex.
    for an strin xml field with data
    1st line
    2nd line
    and want to extract each line as separate record.
    Hope i am clear on req.
    anybody done something similar before?
    Thanks in advance.

    While SOA is based on handling XML messages, it has no relation with a presentation layer. Characters such as new-line, line-feed are processed as whitespace.
    If you want to add specific characters, you must encode this. So a new line would be &#10; This also applies for characters like quote and less-then and greater then.
    You must encode your information into UTF8 format.
    Marc
    http://orasoa.blogspot.com

  • Flash Player 10 removes HTML encoding in CDATA when parsing XML

    I have an application that was written with Flash Professional 8/AS2 and it parses XML for rendering dynamic media content. The XML pulls text with HTML markup out of CDATA sections and places them into an html enabled text field. Everything has worked wonderfully until Flash Player 10.
    Now, if we use html escape characters for greater than or less than symbols, they are being decoded by the xml parser.
    Here's my example CDATA section:
    Here <u>we</u> go: This &#60;node&#62; &lt;works&gt; 
    when I grab its value using nodeValue or toString, the results are different from Flash Player 9 to 10. Here's what I'm getting:
    node.nodeValue (Flash Player 9):
    Here <u>we</u> go: This &#60;node&#62; <works>
    node.nodeValue (Flash Player 10):
    Here <u>we</u> go: This <node> <works>
    node.toString (Flash Player 9):
    Here <u>we</u> go: This &#60;node&#62; &lt;works&gt;
    node.toString (Flash Player 10):
    Here <u>we</u> go: This <node> <works>
    In Flash 10, if I escape the ampersand, it will work, but this doesn't work in 9. for example, the following works in 10:
    <![CDATA[Here <u>we</u> go: This &amp;#60;node&amp;#62; &amp;lt;works&amp;gt;]]>
    This all happens before I assign it to a text field. How do I keep the parser from destroying my escaped characters in Flash 10? Do I just need to drop support for Flash Player 9 and go for what works in 10, or is there a solution for both?
    Message was edited by: Xygar

    I'm not an action script programmer. I'm just trying to fix some code written like 3 years ago. So I think I am wrong about where this problem is coming from.
    The original developer actually set up a class to load a remote xml file via sendAndLoad on a LoadVars object. It passes an object with an onData delegate set that passes the event object to an xml parsing method.
    the parsing method looks like this:
         private function parseXml(eventObj:Object){
              if(eventObj != undefined)
                   try
                        //ExternalInterface.call("logMessage", eventObj.toString());
                        _xmlDoc.parseXML(eventObj.toString());
                        _xmlDoc.loaded = true;
                        _xmlDoc.onLoad(true);
                   catch(ex)
                        _xmlDoc.onLoad(false);
              else
                   _xmlDoc.onLoad(false);
    I added the ExternalInterface call so that I could log the stuff out in javascript (since I'm not sure how to debug this app).
    _xmlDoc is defined as: private var _xmlDoc:XML;
    The eventObj receives the xml string and then passes it to the parseXML thing. Here's the odd part. In Flash Player 10, if I comment out my ExternalInterface call, the xml string has the escaped character decoded before it gets to the parser.
    However, if I uncomment my ExternalInterface call, it logs the escaped strings as i would expect, but the parser gets the correct formatting this time! Suddenly it all works.
    I really wish I had an AS2 programmer on campus still....

  • How do i Parsing xml

    This how my customers xml is coming across and can not
    change.
    <month name="January">
    <day>
    <date>01</date>
    <name>Thursday</name>
    <time>12:03 PM</time>
    <comment>It is a hot day</comment>
    </day>
    <day>
    <date>05</date>
    <name>Monday</name>
    <time>09:28 AM</time>
    <comment>Another hot day</comment>
    </day>
    </month>
    The above data structure uses a new node for each bit of core
    information. It is well laid out and very readable by humans,
    however a better structure exists when using Flash. The data
    structure below makes more use of the attributes feature, speeding
    the parsing process up. It takes longer for Flash to read 6
    separate nodes, than it does 6 attributes of a node. The data
    structure below is suited better for use with Flash.
    How do I get it formated like this?
    <month name="January">
    <day date="01" name="Thursday" time="12:03 PM" comment="It
    is a hot day" />
    <day date="05" name="Monday" time="09:28 AM"
    comment="Another hot day" />
    </month>

    Hello again,
    Sorry, I thought you wanted to know how to parse XML for this
    structure
    <month name="January">
    <day date="01" name="Thursday" time="12:03 PM" comment="It
    is a hot day" />
    <day date="05" name="Monday" time="09:28 AM"
    comment="Another hot day" />
    </month>
    This is the one that the code I wrote is using. I think
    you're loading in the other one. Doesn't matter - I've included the
    for loop for both structures below so that you can try it with
    both.

  • Script for parsing xml data and inserting in DB

    Thank you for reading.
    I have the following example XML in an XML file. I need to write a script that can insert this data into an Oracle table. The table does not have primary keys. The data just needs to be inserted.
    I do not have xsd file in this scenario. Please suggest how to modify Method 1 https://community.oracle.com/thread/1115266?tstart=0 mentioned so that I can call the XML mentioned below and insert into a table
    Method 1
    Create or replace procedure parse_xml is 
      l_bfile   BFILE; 
      l_clob    CLOB; 
      l_parser  dbms_xmlparser.Parser; 
      l_doc     dbms_xmldom.DOMDocument; 
      l_nl      dbms_xmldom.DOMNodeList; 
      l_n       dbms_xmldom.DOMNode; 
      l_file      dbms_xmldom.DOMNodeList; 
      l_filen       dbms_xmldom.DOMNode; 
      lv_value VARCHAR2(1000); 
       l_ch      dbms_xmldom.DOMNode; 
    l_partname varchar2(100); 
    l_filename varchar2(1000); 
      l_temp    VARCHAR2(1000); 
      TYPE tab_type IS TABLE OF tab_software_parts%ROWTYPE; 
      t_tab  tab_type := tab_type(); 
    BEGIN 
      l_bfile := BFileName('DIR1', 'SoftwareParts.xml'); 
      dbms_lob.createtemporary(l_clob, cache=>FALSE); 
      dbms_lob.open(l_bfile, dbms_lob.lob_readonly); 
      dbms_lob.loadFromFile(dest_lob => l_clob,    src_lob  => l_bfile,    amount   => dbms_lob.getLength(l_bfile)); 
      dbms_lob.close(l_bfile);  
      dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY'''); 
      l_parser := dbms_xmlparser.newParser; 
      dbms_xmlparser.parseClob(l_parser, l_clob); 
      l_doc := dbms_xmlparser.getDocument(l_parser); 
        dbms_lob.freetemporary(l_clob); 
      dbms_xmlparser.freeParser(l_parser); 
      l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/PartDetails/Part'); 
        FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP 
        l_n := dbms_xmldom.item(l_nl, cur_emp); 
        t_tab.extend; 
        dbms_xslprocessor.valueOf(l_n,'Name/text()',l_partname); 
        t_tab(t_tab.last).partname := l_partname; 
        l_file := dbms_xslprocessor.selectNodes(l_n,'Files/FileName'); 
        FOR cur_ch IN 0 .. dbms_xmldom.getLength(l_file) - 1 LOOP 
          l_ch := dbms_xmldom.item(l_file, cur_ch); 
          lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_ch)); 
          if t_tab(t_tab.last).partname is null then t_tab(t_tab.last).partname := l_partname; end if; 
          t_tab(t_tab.last).filename := lv_value; 
        t_tab.extend; 
       END LOOP; 
       END LOOP; 
        t_tab.delete(t_tab.last); 
      FOR cur_emp IN t_tab.first .. t_tab.last LOOP 
      if t_tab(cur_emp).partname is not null and  t_tab(cur_emp).filename is not null then 
        INSERT INTO tab_software_parts 
        VALUES 
        (t_tab(cur_emp).partname, t_tab(cur_emp).filename); 
        end if; 
      END LOOP; 
      COMMIT; 
      dbms_xmldom.freeDocument(l_doc); 
    EXCEPTION 
      WHEN OTHERS THEN 
        dbms_lob.freetemporary(l_clob); 
        dbms_xmlparser.freeParser(l_parser); 
        dbms_xmldom.freeDocument(l_doc); 
    END; 
    <TWObject className="TWObject">
      <array size="240">
        <item>
          <variable type="QuestionDetail">
            <questionId type="String"><![CDATA[30]]></questionId>
            <questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
            <country type="String"><![CDATA[GB]]></country>
            <questionText type="String"><![CDATA[Please indicate]]></questionText>
            <optionType type="String"><![CDATA[RadioButton]]></optionType>
            <answerOptions type="String[]">
              <item><![CDATA[Yes]]></item>
              <item><![CDATA[No]]></item>
            </answerOptions>
            <ruleId type="String"><![CDATA[CRP_GB001]]></ruleId>
            <parentQuestionId type="String"></parentQuestionId>
            <parentQuestionResp type="String"></parentQuestionResp>
          </variable>
        </item>
        <item>
          <variable type="QuestionDetail">
            <questionId type="String"><![CDATA[40]]></questionId>
            <questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
            <country type="String"><![CDATA[DE]]></country>
            <questionText type="String"><![CDATA[Please indicate]]></questionText>
            <optionType type="String"><![CDATA[RadioButton]]></optionType>
            <answerOptions type="String[]">
              <item><![CDATA[Yes]]></item>
              <item><![CDATA[No]]></item>
            </answerOptions>
            <ruleId type="String"><![CDATA[CRP_Q0001]]></ruleId>
            <parentQuestionId type="String"></parentQuestionId>
            <parentQuestionResp type="String"></parentQuestionResp>
          </variable>
        </item>
      </array>
    </TWObject>

    Reposted as
    Script to parse XML data into Oracle DB

  • Setting Third-Party Saxon parser for parsing xml files

    Hi,
              I wish to parse certain xhtml files using saxon parser because that serves our needs. In order to that in tomcat, I used to use the following code -
              System.getProperties().setProperty("javax.xml.parsers.SAXParserFactory","com.icl.saxon.aelfred.SAXParserFactoryImpl");
              System.getProperties().setProperty("javax.xml.transform.TransformerFactory","com.icl.saxon.TransformerFactoryImpl");
              However this does not work in Weblogic 8.1 SP5. Which means, it actually ignores the settings and uses the default parser (which fails to parse the documents).
              I noticed that in weblogic I need to include these in the weblogic-application.xml located under the application/META-INF folder. I update the file with the following -
              <xml>
              <parser-factory>
              <saxparser-factory>com.icl.saxon.aelfred.SAXParserFactoryImpl</saxparser-factory>
              <transformer-factory>com.icl.saxon.TransformerFactoryImpl</transformer-factory>
              </parser-factory>
              </xml>
              Everything was fine and the documents were parsed but for every server start up, I got an error message -
              <Apr 4, 2006 10:34:43 AM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "action" failed to preload on startup in Web application: "HarvesterWeb".
              javax.servlet.UnavailableException: Parsing error processing resource path
              at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.initModuleConfig
              (AutoRegisterActionServlet.java:416)
              at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
              at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.init(AutoRegisterActionServlet.java:103)
              at javax.servlet.GenericServlet.init(GenericServlet.java:258)
              at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.init(AutoRegisterActionServlet.java:109)
              at com.bea.wlw.netui.pageflow.PageFlowActionServlet.init(PageFlowActionServlet.java:107)
              at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:1094)
              at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
              at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
              at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:970)
              at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:949)
              at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:888)
              at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3430)
              at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3375)
              at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3356)
              at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:6208)
              at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:864)
              at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2134)
              at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2175)
              at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2122)
              at weblogic.management.deploy.slave.SlaveDeployer$Application.setActivation(SlaveDeployer.java:3099)
              at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForAllApplications(SlaveDeployer.java:1768)
              at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:351)
              at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
              at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:136)
              at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:965)
              at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:360)
              at weblogic.Server.main(Server.java:32)
              >
              And the server needs to be restarted after every couple of hits(particularly failures).
              Also, my other applications won't deploy throwing the same stack trace.
              At the end of all this, I get this message - Not sure if they are related but
              log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
              log4j:WARN Please initialize the log4j system properly.
              Any ideas or anyone run into these kind of situations? Moderators, can you please help?

    Try the following.
              1. Keep the 3rd party jars in your WLS classpath and not within your ear.
              2. Create an XML Registry through admin console.
              Services->XML.
              3. Enter appropriate values for the following
              Document Builder Factory:
              SAX Parser Factory:
              Transformer Factory:
              4. Restart WLS.
              Refer to this link. http://e-docs.bea.com/wls/docs81/ConsoleHelp/domain_xmlregistrytable.html
              cheers,
              Dips

  • Create a cache for external map source - Error in parsing xml request.

    When doing the following:
    Create a cache for external map source
    I get "error in parsing xml request" when setting the following
    Map service Url:
    http://neowms.sci.gsfc.nasa.gov/wms/wms?version=1.3.0&service=WMS&request=GetCapabilities
    It looks like it is breaking on "&". Any suggestions?
    Rob

    Hi Chris,
    thanks for your reply!
    I've tried to add the following into persistence.xml (although I've read that eclipseLink uses L2 cache by default..):
    <shared-cache-mode>ALL</shared-cache-mode>
    Then I replaced the Cache bean with a stateless bean which has methods like
    Genre findGenreCreateIfAbsent(String genreName){
    Genre genre = genreDAO.findByName(genreName);
    if (genre!=null){
    return genre;
    genre = //Build new genre object
    genreDAO.persist(genre);
    return genre;
    As far as I undestood, the shared cache should automatically store the genre and avoid querying the DB multiple times for the same genre, but unfortunately this is not the case: if I use a FINE logging level, I see really a lot of SELECT queries, which I didn't see with my "home made" Cache...
    I am really confused.. :(
    Thanks again for helping + bye

  • Problem for using oracle xml parser v2 for 8.1.7

    My first posting was messed up. This is re-posting the same question.
    Problem for using oracle xml parser v2 for 8.1.7
    I have a sylesheet with
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">.
    It works fine if I refer this xsl file in xml file as follows:
    <?xml-stylesheet type="text/xsl" href="http://...../GN.xsl"?>.
    When I use this xsl in pl/sql package, I got
    ORA-20100: Error occurred while processing: XSL-1009: Attribute 'xsl:version' not found in 'xsl:stylesheet'.
    After I changed name space definition to
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> in xsl file, I got
    ORA-20100: Error occurred while processing: XSL-1019: Expected ']' instead of '$'.
    I am using xml parser v2 for 8.1.7
    Can anyone explain why it happens? What is the solution?
    Yi

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Element's dont have text content, they [b]contain text node children.
    So instead of trying to setNodeValue() on the element, construct a Text node and use the appendChild method on the element to append the text node as a child of the element.<HR></BLOCKQUOTE>
    Steve,
    We are also creating an XML DOM from java and are having trouble getting the tags created as we want. When we use XMLText it creates the tag as <tagName/>value rather than <tagName>value</tagName>. We want separate open and close tags. Any ideas?
    Lori

  • XML for Analysis parser: The 'Domain\User' value of the 'EffectiveUserName' XML for Analysis property is not valid.

    hi 
    i have sharepoint 2013 enterprise over sql server 2012 standard, and i want to create some reports trhought excel services and performance point using EffectiveUserName feature, but right actually my environment is not working, when a configure an excel
    to read a SSAS cube from my local machine the rol is ok, but when i published the excel and try to update from Internet Explorer this error is presenting
    XML for Analysis parser: The Domain\User' value of the 'EffectiveUserName' XML for Analysis property is not valid.
    Anybody can helpme is urgent find out for some solution
    thanks a lot

    Turns out that you need the SP Farm service account to be an admin on the SSAS server as well.  That fixed the problem for us.
    MS: Please update your documentation :)

  • SAP J2EE Engine JTA Transaction Xml for table TABLE could not be ana

    I'm having a weird case. I created 3 entity bean. In my R/3 will call this JCO.Function to do the insert to database. But out of 3 entity bean, only 1 entity bean got error where it unable to insert to database and have this error in the log.
    The case is quite weird where i created the same entity but only 1 entity is not working as expected. Wondering what cause this problem.
    Thanks.
    org.xml.sax.SAXException: Fatal Error: URI=:main: Line=1: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Name expected: 0x20(:main:, row:1, col:218)#
    at com.sap.dictionary.database.dbs.XmlExtractor$XMLErrorHandler.fatalError(XmlExtractor.java:279)#
    at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:144)#
    at com.sap.dictionary.database.dbs.XmlExtractor.map(XmlExtractor.java:130)#
    at com.sap.dictionary.database.catalog.DbGeneralStructure.<init>(DbGeneralStructure.java:86)#
    at com.sap.dictionary.database.catalog.XmlCatalogReader.getTable(XmlCatalogReader.java:90)#
    at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:124)#
    at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:87)#
    at com.sap.sql.sqlparser.CheckColAndTabVisitor.checkTables(CheckColAndTabVisitor.java:299)#
    at com.sap.sql.sqlparser.CheckColAndTabVisitor.performCatalogChecks(CheckColAndTabVisitor.java:176)#
    at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:169)#
    at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)#
    at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)#
    at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)#
    at com.sap.sql.jdbc.common.AbstractCommonStatement.parseStatement(AbstractCommonStatement.java:472)#
    at com.sap.sql.jdbc.common.CommonConnectionImpl.prepareStatement(CommonConnectionImpl.java:375)#
    at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:81)#
    at net.tnb.model.ReasonCodeEntityBean3_0Persistent.ejb_iInsert(ReasonCodeEntityBean3_0Persistent.java:306)#
    at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)#
    at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)#
    at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)#
    at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)#
    at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)#
    at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:226)#
    at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:546)#
    at net.tnb.model.ReasonCodeEntityHome_Stub.create(ReasonCodeEntityHome_Stub.java:57)#
    at net.tnb.model.EToGatewayBean.insertIntoTable(EToGatewayBean.java:223)#
    at net.tnb.model.EToGatewayBean.processFunction(EToGatewayBean.java:166)#
    at net.tnb.model.EToGatewayLocalLocalObjectImpl3_0.processFunction(EToGatewayLocalLocalObjectImpl3_0.java:175)#
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)#
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)#
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)#
    at java.lang.reflect.Method.invoke(Method.java:324)#
    at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277)#
    at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)#
    at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:260)#
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)#
    at java.security.AccessController.doPrivileged(Native Method)#
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)#
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)#
    ##0#0#Error##Java###{0}.commit(), Cannot commit due to unexpected exception in beforeCompletion(): 
    [EXCEPTION]
    {1}#2#SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b]#java.lang.IllegalStateException: Xml for table <TABLE> could not be analysed
         at com.sap.dictionary.database.catalog.XmlCatalogReader.getTable(XmlCatalogReader.java:100)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:124)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:87)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.checkTables(CheckColAndTabVisitor.java:299)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.performCatalogChecks(CheckColAndTabVisitor.java:176)
         at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:169)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
         at com.sap.sql.jdbc.common.AbstractCommonStatement.parseStatement(AbstractCommonStatement.java:472)
         at com.sap.sql.jdbc.common.CommonConnectionImpl.prepareStatement(CommonConnectionImpl.java:375)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:81)
         at net.tnb.model.ReasonCodeEntityBean3_0Persistent.ejb_iInsert(ReasonCodeEntityBean3_0Persistent.java:306)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:226)
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:546)
         at net.tnb.model.ReasonCodeEntityHome_Stub.create(ReasonCodeEntityHome_Stub.java:57)
         at net.tnb.model.EToGatewayBean.insertIntoTable(EToGatewayBean.java:223)
         at net.tnb.model.EToGatewayBean.processFunction(EToGatewayBean.java:166)
         at net.tnb.model.EToGatewayLocalLocalObjectImpl3_0.processFunction(EToGatewayLocalLocalObjectImpl3_0.java:175)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:260)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    #1.5 #001A6467CDF400590000004E000018D8000459BB785F496C#1224561620123#com.sap.engine.services.ts#sap.com/ESolutionsEGatewayEAR#com.sap.engine.services.ts#J2EE_GUEST#0####95b74d409f2411dd86c4001a6467cdf4#SAPEngine_Application_Thread[impl:3]_20##0#0#Error#1#/System/Server#Java#ts_0004##Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b] ).#1#SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b]#
    #1.5 #001A6467CDF400590000004F000018D8000459BB785F4BC5#1224561620123#com.sap.engine.services.ts#sap.com/ESolutionsEGatewayEAR#com.sap.engine.services.ts#J2EE_GUEST#0####95b74d409f2411dd86c4001a6467cdf4#SAPEngine_Application_Thread[impl:3]_20##0#0#Error#1#/System/Audit#Java###Exception {0}#1#com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b] ).
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:236)
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:546)
         at net.tnb.model.ReasonCodeEntityHome_Stub.create(ReasonCodeEntityHome_Stub.java:57)
         at net.tnb.model.EToGatewayBean.insertIntoTable(EToGatewayBean.java:223)
         at net.tnb.model.EToGatewayBean.processFunction(EToGatewayBean.java:166)
         at net.tnb.model.EToGatewayLocalLocalObjectImpl3_0.processFunction(EToGatewayLocalLocalObjectImpl3_0.java:175)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:260)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: java.lang.IllegalStateException: Xml for table ZREASON_CODE could not be analysed
         at com.sap.dictionary.database.catalog.XmlCatalogReader.getTable(XmlCatalogReader.java:100)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:124)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:87)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.checkTables(CheckColAndTabVisitor.java:299)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.performCatalogChecks(CheckColAndTabVisitor.java:176)
         at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:169)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
         at com.sap.sql.jdbc.common.AbstractCommonStatement.parseStatement(AbstractCommonStatement.java:472)
         at com.sap.sql.jdbc.common.CommonConnectionImpl.prepareStatement(CommonConnectionImpl.java:375)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:81)
         at net.tnb.model.ReasonCodeEntityBean3_0Persistent.ejb_iInsert(ReasonCodeEntityBean3_0Persistent.java:306)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:226)
         ... 16 more
    #1.5 #001A6467CDF4005900000050000018D8000459BB785F4E8F#1224561620123#com.sap.engine.services.ejb.entity.Container#sap.com/ESolutionsEGatewayEAR#com.sap.engine.services.ejb.entity.Container#J2EE_GUEST#0####95b74d409f2411dd86c4001a6467cdf4#SAPEngine_Application_Thread[impl:3]_20##0#0#Error##Java###null
    [EXCEPTION]
    {0}#1#com.sap.engine.services.ejb.exceptions.BaseRemoteException: Transaction system failure in method net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(net.tnb.model.ReasonCodeBean).
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:573)
         at net.tnb.model.ReasonCodeEntityHome_Stub.create(ReasonCodeEntityHome_Stub.java:57)
         at net.tnb.model.EToGatewayBean.insertIntoTable(EToGatewayBean.java:223)
         at net.tnb.model.EToGatewayBean.processFunction(EToGatewayBean.java:166)
         at net.tnb.model.EToGatewayLocalLocalObjectImpl3_0.processFunction(EToGatewayLocalLocalObjectImpl3_0.java:175)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:260)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b] ).
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:236)
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:546)
         ... 15 more
    Caused by: java.lang.IllegalStateException: Xml for table ZREASON_CODE could not be analysed
         at com.sap.dictionary.database.catalog.XmlCatalogReader.getTable(XmlCatalogReader.java:100)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:124)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:87)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.checkTables(CheckColAndTabVisitor.java:299)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.performCatalogChecks(CheckColAndTabVisitor.java:176)
         at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:169)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
         at com.sap.sql.jdbc.common.AbstractCommonStatement.parseStatement(AbstractCommonStatement.java:472)
         at com.sap.sql.jdbc.common.CommonConnectionImpl.prepareStatement(CommonConnectionImpl.java:375)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:81)
         at net.tnb.model.ReasonCodeEntityBean3_0Persistent.ejb_iInsert(ReasonCodeEntityBean3_0Persistent.java:306)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:226)
         ... 16 more
    #1.5 #001A6467CDF4005900000051000018D8000459BB785F5FA9#1224561620123#System.err#sap.com/ESolutionsEGatewayEAR#System.err#J2EE_GUEST#0####95b74d409f2411dd86c4001a6467cdf4#SAPEngine_Application_Thread[impl:3]_20##0#0#Error##Plain###RemoteException insertOk=false#
    #1.5 #001A6467CDF4005900000052000018D8000459BB785F6094#1224561620123#System.err#sap.com/ESolutionsEGatewayEAR#System.err#J2EE_GUEST#0####95b74d409f2411dd86c4001a6467cdf4#SAPEngine_Application_Thread[impl:3]_20##0#0#Error##Plain###Tue Oct 21 12:00:20 SGT 2008 java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Transaction system failure in method net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(net.tnb.model.ReasonCodeBean).
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:573)
         at net.tnb.model.ReasonCodeEntityHome_Stub.create(ReasonCodeEntityHome_Stub.java:57)
         at net.tnb.model.EToGatewayBean.insertIntoTable(EToGatewayBean.java:223)
         at net.tnb.model.EToGatewayBean.processFunction(EToGatewayBean.java:166)
         at net.tnb.model.EToGatewayLocalLocalObjectImpl3_0.processFunction(EToGatewayLocalLocalObjectImpl3_0.java:175)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:260)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b] ).
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:236)
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:546)
         ... 15 more
    Caused by: java.lang.IllegalStateException: Xml for table <TABLE> could not be analysed
         at com.sap.dictionary.database.catalog.XmlCatalogReader.getTable(XmlCatalogReader.java:100)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:124)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:87)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.checkTables(CheckColAndTabVisitor.java:299)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.performCatalogChecks(CheckColAndTabVisitor.java:176)
         at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:169)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
         at com.sap.sql.jdbc.common.AbstractCommonStatement.parseStatement(AbstractCommonStatement.java:472)
         at com.sap.sql.jdbc.common.CommonConnectionImpl.prepareStatement(CommonConnectionImpl.java:375)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:81)
         at net.tnb.model.ReasonCodeEntityBean3_0Persistent.ejb_iInsert(ReasonCodeEntityBean3_0Persistent.java:306)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:226)
         ... 16 more
    ; nested exception is:
         javax.transaction.RollbackException: com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [031fffffff3ffffffb2005b] ).
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:236)
         at net.tnb.model.ReasonCodeEntityHomeImpl3_0.create(ReasonCodeEntityHomeImpl3_0.java:546)
         at net.tnb.model.ReasonCodeEntityHome_Stub.create(ReasonCodeEntityHome_Stub.java:57)
         at net.tnb.model.EToGatewayBean.insertIntoTable(EToGatewayBean.java:223)
         at net.tnb.model.EToGatewayBean.processFunction(EToGatewayBean.java:166)
         at net.tnb.model.EToGatewayLocalLocalObjectImpl3_0.processFunction(EToGatewayLocalLocalObjectImpl3_0.java:175)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:260)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: java.lang.IllegalStateException: Xml for table ZREASON_CODE could not be analysed
         at com.sap.dictionary.database.catalog.XmlCatalogReader.getTable(XmlCatalogReader.java:100)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:124)
         at com.sap.sql.catalog.impl.BufferedCatalogReader.getTable(BufferedCatalogReader.java:87)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.checkTables(CheckColAndTabVisitor.java:299)
         at com.sap.sql.sqlparser.CheckColAndTabVisitor.performCatalogChecks(CheckColAndTabVisitor.java:176)
         at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:169)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
         at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
         at com.sap.sql.jdbc.common.AbstractCommonStatement.parseStatement(AbstractCommonStatement.java:472)
         at com.sap.sql.jdbc.common.CommonConnectionImpl.prepareStatement(CommonConnectionImpl.java:375)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:81)
         at net.tnb.model.ReasonCodeEntityBean3_0Persistent.ejb_iInsert(ReasonCodeEntityBean3_0Persistent.java:306)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:226)
         ... 16 more

    Hi Stefan and Everyone,
    I have solved my problem. Just want to let everyone know if u have to install the SP's for WEB AS 6.30/6.40.
    You start from the installation from CD 6.30/6.40. Everything will be working at this point. You can login to Visual Admin, Config tool and SDM.
    Before you apply any SP's, do the following:
    a) Create an emergency user with the Administrator rights: Ref OSS Note:669848
    Try to follow this route for SP's:
    From CD 6.30/6.40 -> SP04 -> SP07
    Apply SP04 first before applying SP07 (Recommended Approach).
    Refer the installation guide: SAP Web AS Support Package Guide 630SP2 to 640SP4.
    Use JDK1.4.2_05 to install SP04. You must reference the following OSS Notes and apply to your system accordingly, this is the key to an error free installation:
    a) OSS Note: 697535
    b) OSS Note: 709140
    c) OSS Note: 716604
    d) OSS Note: 706378
    You have to be really careful with SP04 installation, because it changes the version from 6.30 -> 6.40.
    Once you are able to install SP04 without any problems, you can directly apply SP07 or the highest 6.40 SP.
    Kind Regards,
    Buddha.

  • Need help on parsing xml file...

    Hi all,
    I need to collect some data from an Xml file using java. I have the following code with me but I am unable to get the required result. I am unable to get the data from the tags belonging to the header and footer elements. Please find the code and the sample xml file below.
    Program to parse XML:
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class JobLogDetails3{
         //No generics
         List myJobs;
         Document dom;
         public JobLogDetails3(){
              //create a list to hold the job objects
              myJobs = new ArrayList();
         public void runJobDetails() {
              //parse the xml file and get the dom object
              parseXmlFile();
              //get each joblog element and create a job object
              parseDocument();
              //Iterate through the list and print the data
              printData();
         private void parseXmlFile(){
              //get the factory
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              try {
                   //Using factory get an instance of document builder
                   DocumentBuilder db = dbf.newDocumentBuilder();
                   //parse using builder to get DOM representation of the XML file
                   dom = db.parse("test.xml");
              }catch(ParserConfigurationException pce) {
                   pce.printStackTrace();
              }catch(SAXException se) {
                   se.printStackTrace();
              }catch(IOException ioe) {
                   ioe.printStackTrace();
         private void parseDocument(){
              //get the root elememt
              Element docEle = dom.getDocumentElement();
              //get a nodelist of <joblog> elements
              NodeList nl = dom.getElementsByTagName("*");
              if(nl != null && nl.getLength() > 0) {
                   for(int i = 0 ; i < nl.getLength();i++) {
                        //get the joblog element
                        Element el = (Element)nl.item(i);
                        //get the joblog object
                        Job J = getJob(el);
                        //add it to list
                        myJobs.add(J);
         * I take an joblog element and read the values in, create
         * an joblog object and return it
         * @param JobEl
         * @return
         private Job getJob(Element JobEl) {
              //for each <joblog> element get text or int values of
              //name ,id, age and name
              String jobServer = getTextValue(JobEl,"server");
              String jobName = getTextValue(JobEl,"name");
              String jobClient = getTextValue(JobEl,"machine_name");
              String jobStart = getTextValue(JobEl,"start_time");
              String jobType = getTextValue(JobEl,"type");
              String jobEnd = getTextValue(JobEl,"end_time");
              String jobSize = getTextValue(JobEl,"new_processed_bytes");
              //Create a new Job with the value read from the xml nodes
              Job J = new Job(jobServer,jobName,jobClient,jobStart,jobType,jobEnd,jobSize);
              return J;
         * I take a xml element and the tag name, look for the tag and get
         * the text content
         * i.e for <employee><name>John</name></employee> xml snippet if
         * the Element points to employee node and tagName is name I will return John
         * @param ele
         * @param tagName
         * @return
         private String getTextValue(Element ele, String tagName) {
              String textVal = null;
              NodeList nl = ele.getElementsByTagName(tagName);
              if(nl != null && nl.getLength() > 0) {
                   Element el = (Element)nl.item(0);
                   textVal = el.getFirstChild().getNodeValue();
              return textVal;
         * Calls getTextValue and returns a int value
         * @param ele
         * @param tagName
         * @return
         private int getIntValue(Element ele, String tagName) {
              //in production application you would catch the exception
              return Integer.parseInt(getTextValue(ele,tagName));
         * Iterate through the list and print the
         * content to console
         private void printData(){
              System.out.println("No of Jobs '" + myJobs.size() + "'.");
              Iterator it = myJobs.iterator();
              while(it.hasNext()) {
                   System.out.println(it.next().toString());
         public static void main(String[] args){
              //create an instance
              JobLogDetails JLD = new JobLogDetails();
              //call run example
              JLD.runJobDetails();
    Job Class
    public class Job {
         private String jobServer;
    private String jobName;
    private String jobClient;
    private String jobStart;
    private String jobType;
    private String jobEnd;
    private String jobSize;
         public Job(){
         public Job(String jobServer,String jobName,String jobClient,String jobStart,String jobType,String jobEnd,String jobSize ) {
              this.jobServer = jobServer;
              this.jobName = jobName;
              this.jobClient = jobClient;
    this.jobStart = jobStart;
              this.jobType = jobType;
    this.jobEnd = jobEnd;
    this.jobSize = jobSize;
         public String getjobServer() {
              return jobServer;
         public void setjobServer(String jobServer) {
              this.jobServer = jobServer;
         public String getjobName() {
              return jobName;
         public void setjobname(String jobName) {
              this.jobName = jobName;
         public String getjobClient() {
              return jobClient;
         public void setjobClient(String jobClient) {
              this.jobClient = jobClient;
    public String getjobStart() {
              return jobStart;
         public void setjobStart(String jobStart) {
              this.jobStart = jobStart;
    public String getjobType() {
              return jobType;
         public void setjobType(String jobType) {
              this.jobType = jobType;
    public String getjobEnd() {
              return jobEnd;
         public void setjobEnd(String jobEnd) {
              this.jobEnd = jobEnd;
    public String getjobSize() {
              return jobSize;
         public void setjobSize(String jobSize) {
              this.jobSize = jobSize;
         public String toString() {
              StringBuffer sb = new StringBuffer();
    sb.append(getjobServer());
              sb.append(",");
    sb.append(getjobName());
              sb.append(",");
              sb.append(getjobClient());
              sb.append(",");
              sb.append(getjobType());
              sb.append(",");
              sb.append(getjobStart());
              sb.append(",");
              sb.append(getjobEnd());
              sb.append(",");
              sb.append(getjobSize());
              sb.append(",");
              return sb.toString();
    Sample XML File:
    <?xml version="1.0" encoding="UTF-16" ?>
    - <joblog>
    <job_log_version version="2.0" />
    - <header>
    <filler>======================================================================</filler>
    <server>Job server: TGBBAK</server>
    <name>Job name: TGBSAP4-SQL-SQL DB Servers S2T - High-Weekly Full Backup</name>
    <start_time>Job started: 26 September 2011 at 01:00:04</start_time>
    <type>Job type: Backup</type>
    <log_name>Job Log: GFD_TGBBAK_71887.xml</log_name>
    <filler>======================================================================</filler>
    </header>
    <media_mount_date>Drive and media mount requested: 26/09/2011 01:00:04</media_mount_date>
    - <media_drive_and_media_info>
    <media_mount_date>Drive and media information from media mount: 26/09/2011 01:00:39</media_mount_date>
    <robotic_library_name>Robotic Library Name: HP 1</robotic_library_name>
    <drive_name>Drive Name: LTO4_2</drive_name>
    <slot>Slot: 43</slot>
    <media_label>Media Label: 000059L</media_label>
    <media_guid>Media GUID: {a6ca0062-7a6f-4b4b-8144-732ca25f2f9d}</media_guid>
    <media_overwrite_date>Overwrite Protected Until: 25/10/2011 19:24:58</media_overwrite_date>
    <media_append_date>Appendable Until: 02/10/2011 14:00:30</media_append_date>
    <media_set_target>Targeted Media Set Name: Weekly Tape</media_set_target>
    </media_drive_and_media_info>
    - <backup>
    <filler>======================================================================</filler>
    <title>Job Operation - Backup</title>
    <append_or_overwrite>Media operation - append.</append_or_overwrite>
    <compression>Compression Type: Hardware [if available, otherwise none]</compression>
    <verify_option>WARNING: The option 'Verify after backup completes' was not selected. Performing a verify operation to make sure that media can be read after the backup has completed is recommended.</verify_option>
    <filler>======================================================================</filler>
    - <machine>
    <machine_name>TGBSAP4.Tetley.Grp</machine_name>
    <info>Network control connection is established between 10.22.2.18:3271 <--> 10.22.2.4:10000</info>
    <info>Network data connection is established between 10.22.2.18:3301 <--> 10.22.2.4:3094</info>
    - <set>
    <set_resource_name>TGBSAP4.Tetley.Grp</set_resource_name>
    <tape_name>Family Name: "Media created 25/09/2011 13:59:55"</tape_name>
    - <volume>
    <display_volume>Backup of "TGBSAP4.Tetley.Grp "</display_volume>
    </volume>
    <description>Backup set #45 on storage media #1 Backup set description: "Weekly Full Backup"</description>
    <backup_type>Backup Method: Full - Back up entire database or filegroup</backup_type>
    <agent_started>Microsoft SQL Server Agent: Started</agent_started>
    <start_time>Backup started on 26/09/2011 at 01:01:45.</start_time>
    - <database>
    <database>Database PRD</database>
    </database>
    - <database>
    <database>Database master</database>
    </database>
    - <database>
    <database>Database model</database>
    </database>
    - <database>
    <database>Database msdb</database>
    </database>
    <end_time>Backup completed on 26/09/2011 at 02:42:25.</end_time>
    - <summary>
    <backed_up_database>Backed up 4 databases</backed_up_database>
    <new_processed_bytes>Processed 573363576542 bytes in 1 hour, 40 minutes, and 40 seconds.</new_processed_bytes>
    <vlm_hist_rateformat2>Throughput rate: 5432 MB/min</vlm_hist_rateformat2>
    </summary>
    <filler>----------------------------------------------------------------------</filler>
    </set>
    </machine>
    </backup>
    - <footer>
    <filler>======================================================================</filler>
    <end_time>Job ended: 26 September 2011 at 02:43:12</end_time>
    <engine_completion_status>Job completion status: Successful</engine_completion_status>
    <filler>======================================================================</filler>
    <completeStatus>19</completeStatus>
    </footer>
    </joblog>

    1. your code does not compile (in your main method you try to create an instance of a class which does not exist).
    2. your XML document is not well formed.
    +[Fatal Error] test.xml:34:74: The content of elements must consist of well-formed character data or markup.+
    org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    Maybe there are other problems but you can start by fixing these.

  • Parse XML in a java stored proc

    I am trying to parse an xml document in a java stored procedure. Just following my nose, I have developed a stored proc that works fine in development (outside the database using JRE 1.4.1) using the Xerces 2.5 parser. But, after having transferred the xerces xercesImpl.jar, xmlapis.jar, and my implementation class into oracle using loadjava when I call my stored proc the code throws an exception trying to build the document with an error like:
    NoClassDef exception org.apache.xerces.jaxp.DocumentFactoryBuilderImpl
    My Code looks like this:
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    InputStream is = getXMLAsInputStream(xml);
    try {
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse( is );
    ... parse the document ....
    catch (FactoryConfigurationError e) {
    // unable to get a document builder factory
    The exception caught is a FactoryConfigurtionError.
    I'm not particularly attached to xerces, I'm really just looking for a way to parse XML inside my java stored proc, so any help to solve my problem, or an alternative suggestion will be greatly appreciated.
    thanks
    Dale

    I looked again and sure enough the xerces implementation classes were missing. I had run a .cmd file containing these two lines, but it looks like only the first one ran...
    loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xml-apis.jar
    loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xercesImpl.jar
    Now I've got everything working fine with Xerces!
    Dale

Maybe you are looking for

  • Who can help me use Time Machine to find some photos from a year ago?

    I need to know how to retrieve some photos from a year ago that should be stored on my ext. drive.  I have Time Machine....Mac OSX 10.9.1.  I have tried to do it and Time Machine tells me there is not enough room to download my old Picture Library. 

  • For users of Central Station or Big Knob....or passive speakers

    I've got a bit of a conundrum and would appreciate your expert input to try and solve it. I have two sets of passive monitors, and an alesis ra-100 amp. I'm looking at the central station by presonus, but something on their website left me a little c

  • Unknown Error Connection (8xE8000003) For Ipod Touch

    Hello, recenty I have not been able to connect my ipod to itunes. It won't even reconize it in MYCOMPUTER. It comes up with an unknow error thing. Please help tell me what to do step by step without having to loose any data for sure. Please help me,

  • CFolders and DMS Integration

    Hi, At present we have DMS. We are going in for cFolders now. How do we integrate cFolders and DMS? What are the pre-requisites / configurations needed? Where can I find the related documents? Regards, Rajesh

  • Trouble with Iweb SEO

    So I am finally catching up to the 21st century by getting into Google analytics and Stat tracker. I downloaded Iweb SEO tool from rage and did about 2 hours of work filling in all the correct titles, meta data, etc... I published (from Iweb SEO) to