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));

Similar Messages

  • How to generate wsdl for complex type using wscompile?

    Hi
    Since couple of days I am trying to generate the the wsdl for following classes
    abstract class Key implements serializable{
    class sikeKey extends Key{
    int siteKey;
    class AddressKey extends siteKey{
    int addressId;
    class Model{
    AddressKey key = new AddressKey();
    }I am using following ant script for wscompile
          <wscompile
              fork= "true"
              base="${dest.dir}/war/WEB-INF/classes"
              server="true"   
              features="wsi"
              mapping="${dest.dir}/war/WEB-INF/Address_Mapping.xml"
              sourceBase="${war.dir}/WEB-INF/classes"
              optimize="false"
              debug="true"
              keep="false"
              verbose="true"
              xPrintStackTrace="true"
              config="${acws-config-dir}/Address_Config.xml">
              <classpath>
                            <pathelement path="${acws.classpath}"/>
                            <pathelement path="${war.dir}/WEB-INF/classes"/>
                   </classpath>
          </wscompile>
    <taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile">
        <classpath path="${acws.classpath}"/>
    </taskdef>It generates the wsdl but without all complex type.
    <complexType name="AddressWebServiceModel">
    <sequence>
    <element name="addKey" type="tns:AddressKey" nillable="true"/>
    </sequence>
    </complexType>
    <complexType name="AddressKey">
    <sequence>
    <element name="siteID" type="string" nillable="true"/>
    <element name="addressID" type="int"/>
    </sequence>
    </complexType>Here it should create the right mapping for classes siteKey so that the webservice call can be mapped with the response of this Model.
    Any one know how to configure the above script for proper mapping of complex type?

    Add the concrete subclasses of Key in an <AddtionalType> element in your config.xm. file.

  • 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

  • JSR 172 marshal exception for complex type

    Hi,
    Im trying to run a JSR 172 webservice but i always get marshall exception for complex types, below is my code:
    WSDL:
    <?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT. -->
    <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://newsletter.kp/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://newsletter.kp/" name="NewsService">
        <ns1:Policy xmlns:ns1="http://www.w3.org/ns/ws-policy" wsu:Id="NewsPortBinding_getNewslettersRemote_WSAT_Policy">
            <ns1:ExactlyOne>
                <ns1:All>
                    <ns2:ATAlwaysCapability xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/10/wsat"></ns2:ATAlwaysCapability>
                    <ns3:ATAssertion xmlns:ns4="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:ns3="http://schemas.xmlsoap.org/ws/2004/10/wsat" ns1:Optional="true" ns4:Optional="true"></ns3:ATAssertion>
                </ns1:All>
            </ns1:ExactlyOne>
        </ns1:Policy>
        <types>
            <xsd:schema>
                <xsd:import namespace="http://newsletter.kp/" schemaLocation="http://localhost:8080/NewsService/News?xsd=1"></xsd:import>
            </xsd:schema>
        </types>
        <message name="getNewslettersRemote">
            <part name="parameters" element="tns:getNewslettersRemote"></part>
        </message>
        <message name="getNewslettersRemoteResponse">
            <part name="parameters" element="tns:getNewslettersRemoteResponse"></part>
        </message>
        <portType name="News">
            <operation name="getNewslettersRemote">
                <ns5:PolicyReference xmlns:ns5="http://www.w3.org/ns/ws-policy" URI="#NewsPortBinding_getNewslettersRemote_WSAT_Policy"></ns5:PolicyReference>
                <input message="tns:getNewslettersRemote"></input>
                <output message="tns:getNewslettersRemoteResponse"></output>
            </operation>
        </portType>
        <binding name="NewsPortBinding" type="tns:News">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
            <operation name="getNewslettersRemote">
                <ns6:PolicyReference xmlns:ns6="http://www.w3.org/ns/ws-policy" URI="#NewsPortBinding_getNewslettersRemote_WSAT_Policy"></ns6:PolicyReference>
                <soap:operation soapAction="getNews"></soap:operation>
                <input>
                    <soap:body use="literal"></soap:body>
                </input>
                <output>
                    <soap:body use="literal"></soap:body>
                </output>
            </operation>
        </binding>
        <service name="NewsService">
            <port name="NewsPort" binding="tns:NewsPortBinding">
                <soap:address location="http://localhost:8080/NewsService/News"></soap:address>
            </port>
        </service>
    </definitions>Stub:
    public class NewsService_Stub implements NewsService, javax.xml.rpc.Stub {
        private String[] _propertyNames;
        private Object[] _propertyValues;
        public NewsService_Stub() {
            _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
            _propertyValues = new Object[] { "http://localhost:8080/NewsService/News" };
        public void _setProperty( String name, Object value ) {
            int size = _propertyNames.length;
            for (int i = 0; i < size; ++i) {
                if( _propertyNames.equals( name )) {
    _propertyValues[i] = value;
    return;
    String[] newPropNames = new String[size + 1];
    System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
    _propertyNames = newPropNames;
    Object[] newPropValues = new Object[size + 1];
    System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
    _propertyValues = newPropValues;
    _propertyNames[size] = name;
    _propertyValues[size] = value;
    public Object _getProperty(String name) {
    for (int i = 0; i < _propertyNames.length; ++i) {
    if (_propertyNames[i].equals(name)) {
    return _propertyValues[i];
    if (ENDPOINT_ADDRESS_PROPERTY.equals(name) || USERNAME_PROPERTY.equals(name) || PASSWORD_PROPERTY.equals(name)) {
    return null;
    if (SESSION_MAINTAIN_PROPERTY.equals(name)) {
    return new Boolean(false);
    throw new JAXRPCException("Stub does not recognize property: " + name);
    protected void _prepOperation(Operation op) {
    for (int i = 0; i < _propertyNames.length; ++i) {
    op.setProperty(_propertyNames[i], _propertyValues[i].toString());
    public newsletter[] getNewslettersRemote() throws java.rmi.RemoteException {
    Object inputObject[] = new Object[] {
    Operation op = Operation.newInstance( qnameoperation_getNewslettersRemote, typegetNewslettersRemote, typegetNewslettersRemoteResponse );
    _prepOperation( op );
    op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "getNews" );
    Object resultObj;
    try {
    resultObj = op.invoke( inputObject );
    } catch( JAXRPCException e ) {
    Throwable cause = e.getLinkedCause();
    if( cause instanceof java.rmi.RemoteException ) {
    throw (java.rmi.RemoteException) cause;
    throw e;
    return newsletter_ArrayfromObject((Object[])((Object[]) resultObj)[0]);
    private static newsletter[] newsletter_ArrayfromObject( Object obj[] ) {
    if(obj == null) return null;
    newsletter result[] = new newsletter[obj.length];
    for( int i = 0; i < obj.length; i++ ) {
    result[i] = new newsletter();
    Object[] oo = (Object[]) obj[i];
    result[i].setBody((String )oo[0]);
    result[i].setId((Long )oo[1]);
    result[i].setImageLocation((String )oo[2]);
    result[i].setTitle((String )oo[3]);
    return result;
    protected static final QName qnameoperation_getNewslettersRemote = new QName( "http://newsletter.kp/", "getNewslettersRemote" );
    protected static final QName qnamegetNewslettersRemote = new QName( "http://newsletter.kp/", "getNewslettersRemote" );
    protected static final QName qnamegetNewslettersRemoteResponse = new QName( "http://newsletter.kp/", "getNewslettersRemoteResponse" );
    protected static final Element typegetNewslettersRemote;
    protected static final Element typegetNewslettersRemoteResponse;
    static {
    typegetNewslettersRemote = new Element( qnamegetNewslettersRemote, _complexType( new Element[] {
    }), 1, 1, false );
    typegetNewslettersRemoteResponse = new Element( qnamegetNewslettersRemoteResponse, _complexType( new Element[] {
    new Element( new QName( "", "return" ), _complexType( new Element[] {
    new Element( new QName( "", "body" ), Type.STRING, 0, 1, false ),
    new Element( new QName( "", "id" ), Type.LONG, 0, 1, false ),
    new Element( new QName( "", "imageLocation" ), Type.STRING, 0, 1, false ),
    new Element( new QName( "", "title" ), Type.STRING, 0, 1, false )}), 0, Element.UNBOUNDED, true )}), 1, 1, false );
    private static ComplexType _complexType( Element[] elements ) {
    ComplexType result = new ComplexType();
    result.elements = elements;
    return result;
    }I tested the web service with the following xml
    input:<?xml version="1.0" encoding="UTF-8"?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Header/>
    <S:Body>
    <ns2:getNewslettersRemote xmlns:ns2="http://newsletter.kp/"/>
    </S:Body>
    </S:Envelope>
    output:bq. <?xml version="1.0" encoding="UTF-8"?> \\ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> \\ <S:Body> \\ <ns2:getNewslettersRemoteResponse xmlns:ns2="http://newsletter.kp/"> \\ <return> \\ <body>teste</body> \\ <id>1</id> \\ <imageLocation>testes</imageLocation> \\ <title>teste</title> \\ </return> \\ <return> \\ <body>mau</body> \\ <id>2</id> \\ <imageLocation>mau</imageLocation> \\ <title>mau</title> \\ </return> \\ <return> \\ <body>mau</body> \\ <id>3</id> \\ <imageLocation>mau</imageLocation> \\ <title>mau</title> \\ </return> \\ <return> \\ <body>mau</body> \\ <id>4</id> \\ <imageLocation>mau</imageLocation> \\ <title>teste</title> \\ </return> \\ <return> \\ <body>2</body> \\ <id>5</id> \\ <imageLocation>2</imageLocation> \\ <title>2</title> \\ </return> \\ <return> \\ <body>corpo</body> \\ <id>6</id> \\ <imageLocation>imagem</imageLocation> \\ <title>Titulo</title> \\ </return> \\ <return> \\ <body>corpos</body> \\ <id>7</id> \\ <imageLocation>imagem</imageLocation> \\ <title>Titulo</title> \\ </return> \\ <return> \\ <body>teste</body> \\ <id>8</id> \\ <imageLocation>teste</imageLocation> \\ <title>teste</title> \\ </return> \\ <return> \\ <body>rweqrrq</body> \\ <id>9</id> \\ <imageLocation>rwe</imageLocation> \\ <title>rewq</title> \\ </return> \\ </ns2:getNewslettersRemoteResponse> \\ </S:Body> \\ </S:Envelope> \\ but i always get a:
    java.rmi.MarshalException: Invalid URI From Server: , expected: http://schemas.xmlsoap.org/soap/envelope/
            at news.NewsService_Stub.getNewslettersRemote(NewsService_Stub.java:73)
            at hello.HelloMIDlet.getTextField(HelloMIDlet.java:168)
            at hello.HelloMIDlet.getForm(HelloMIDlet.java:132)
            at hello.HelloMIDlet.startMIDlet(HelloMIDlet.java:56)
            at hello.HelloMIDlet.startApp(HelloMIDlet.java:205)
            at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
            at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
            at com.sun.midp.main.Main.runLocalClass(Main.java:466)
            at com.sun.midp.main.Main.main(Main.java:120)
    Can you please help me find the problem?
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello,
    A bit late, but I'm sure others will use this answers. We encountered the same problem in our development and after some hours playing with our WSDL we found the source of the problem.
    The problem is having a field named "body" in the Object this apparently doesn't work well with SOAP we guess because of the Envelope having also a Body.
    So the solution is changing the field body to something like msgBody.
    Regards,
    Raanan Nevet

  • 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.

  • How to parse a specific inner element using SAX

    I would like to parse the values of <data> and store them but only the <data> values whose parent element is <process-type>.
    My xml file looks something like:
    <process-type id="IASPT" module-id="IASPT" working-dir="/apps/ora10G5/iaspt/bin">
         <port id="ajp" range="7501-7600"/>
         <process-set id="IASPT" numprocs="1"/>
    </process-type>
    <category id="stop-parameters">
          <data id="java-options" value="-Djava.awt.headless=true"/>
    </category>
    <process-type id="claimservices" module-id="OC4J" status="enabled">
         <environment>
               <variable id="DOCUMENTUM" value="/apps/dctmdev"/>
         </environment>
         <module-data>
               <category id="start-parameters">
                     <data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/claimservices/config/java2.policy"/>
               </category>
         </module-data>
    </process-type>
    <process-type id="ASG" module-id="custom">
          <process-set id="ASG" numprocs="1">
             <module-data>
                <category id="start-parameters">
                   <data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/sharedservices/config/java2.policy"/>
                </category>
             </module-data>
          </process-set>
    </process-type>
    ......I would like to read the value(s) of data which is within process-type. In this case:
    <data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/claimservices/config/java2.policy"/>
    <data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/sharedservices/config/java2.policy"/>I can read the elements, attributes and their values using SAX. The problem however is that when I read the file, it reads in not only the line I am interested in but also any <data> element within the XML file which is not what I want. I tried editing my code but it doesn't seem to work.
    The start element in my code looks like this:
    public void startElement(String name, String localName,
                   String qName, Attributes attr) throws SAXException {
              String processTypeId = "";
              String processTypeData = "";
              if (localName.equalsIgnoreCase("process-type")){
                   if (attr.getLocalName(0).equals("id")){
                        processTypeId = attr.getValue(0);
                        System.out.println("process_type/id: " + processTypeId);
              if (localName.equalsIgnoreCase("data")){
                   if (attr.getLocalName(1).equals("value")){
                        processTypeData = attr.getValue(1);
                        System.out.println("data/id: " + processTypeData);
    } Considering I have more than one process-type and that the first attribute of <data>, id, is the same for both, I should somehow tell SAX:
    1) Find process-type element
    2) Read its id attribute
    3) Read <data> element and its attributes under process-type if any
    4) Store <data> and attributes of each process-type (into possibly a map in the form of {process-type id, data value} pair??)
    I would appreciate your help with this very much.

    I thought the same. The good thing is that the first one is the one I want. The bad thing is that the first one might not necessarily be positioned at the top.
    What I mean is when I read this part of the XML file
    <process-type id="home" module-id="OC4J" status="enabled">
         <module-data>
               <category id="start-parameters">
                       <data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy"/>
               </category>
               <category id="stop-parameters">
                       <data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy"/>
               </category>
         </module-data>
    </process-type>I am interested in the value attribute of the <data> under <category> whose id attribute is "start-parameters". The thing is that the "start-parameters" and the "stop-parameters" postions could be switched so I cannot rely on the fact that my code reads the first one successfully.
    I tried editing my code like shown below but no luck
    if (localName.equalsIgnoreCase("process-type")){
                   //Extracting process-type attribute id
                   if (attr.getLocalName(0).equals("id")){
                        processTypeId = attr.getValue(0);
                        System.out.println("\nprocess_type/id: " + processTypeId);
              if (localName.equalsIgnoreCase("category")){
                   //Extracting process-type attribute id
                   if (attr.getLocalName(0).equals("id")){
                        categoryId = attr.getValue(0);
                        if (categoryId.equals("start-parameters")){
                             //System.out.println("\ncategory/id: " + categoryId);     
                             categoryStartParameters = categoryId;
                             startOfCategoryId = true;
              if (localName.equalsIgnoreCase("data")){
                   if (endOfProcessType){
                        if (startOfCategoryId /*&& (categoryStartParameters.equals("start-parameters"))*/){
                             if (attr.getLocalName(1).equals("value")){
                                  processTypeData = attr.getValue(1);
                                  System.out.println("\ndata/id: " + processTypeData);
                                  endOfProcessType = false;
         public void endElement(String uri, String localName, String qName) throws SAXException {
              if( localName.equalsIgnoreCase("process-type") ) {
                  endOfProcessType = true;
    ......Isn't there a more straightforward way to reading all the elements under a particular element in SAX?
    Please assume that all the variables are defined and initialised.

  • Not able to validate the xml document against DTD using SAX

    Hi ,
    i am not able to validate xml document against its DTD using SAX parser even after setting setValidating = true. even if the file is not correct according to DTD , it is not throwing any exception. what could be the reason.? please help..
    kranthi
    this is the code sample i used.
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
         try {
    factory.newSAXParser().parse(new File("sample.xml"), handler);
         } catch (SAXException e) {
         e.printStackTrace();                         System.exit(2);
         } catch (ParserConfigurationException e) {
    e.printStackTrace();
    }

    Hi karthik
    Thanks for your response
    Actually iam a beginner in java coding hence struggling to come up with the things
    I tried putting your code and onserver side i see it is returning 09:12:17,234 INFO [STDOUT] [root: null]
    actually the same program i wrote in java
    and the same method i was calling from the main
    and it is working fine and the xml document is getting displayed one important thing to be noted here is that the factory.newDocumentBuilder().parse(new File(filename));is returing XmlDocument
    and the printing takes place
    but the in same method public static Document parseXMLFile(String filename, boolean b) in servlet
    the line factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    and this creating problem , had it returned XmlDocument
    i would have printed the elements one one
    but as it is returning deferredimpl
    iam unable to print the elements
    could you please tell me why factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    in servlets but in plain java pogram it is returing XmlDocument
    Thanks
    Bhanu

  • Transforming XML into complex type in ADF/Java

    Hi all,
    Maybe a simple question for you all - maybe too simple for some of you - but not for me as a Java newbie. So I'd appreciate any help.
    I have used a WebService Proxy and created a new Pojo in order to create a Data Control. The WS proxy works quite good and I can get this XML response as expected.
    <ns0:kunden xmlns:ns0="http://www.oracle.com/hbv">
    <ns0:kunde>
    <ns0:Kundennummer>0000000047</ns0:Kundennummer>
    <ns0:Name>Laue</ns0:Name>
    <ns0:Vorname>Ingo</ns0:Vorname>
    <ns0:Straße>Kühnehöfe</ns0:Straße>
    <ns0:Hausnr/>
    <ns0:PLZ>22761</ns0:PLZ>
    <ns0:Ort>Hamburg</ns0:Ort>
    <ns0:Telefon>040/89091-456</ns0:Telefon>
    </ns0:kunde>
    <ns0:kunde>
    <ns0:Kundennummer>0000000048</ns0:Kundennummer>
    <ns0:Name>Brüning</ns0:Name>
    <ns0:Vorname>Arne</ns0:Vorname>
    <ns0:Straße>Kühnehöfe</ns0:Straße>
    <ns0:Hausnr/>
    <ns0:PLZ>22761</ns0:PLZ>
    <ns0:Ort>Hamburg</ns0:Ort>
    <ns0:Telefon>040/89091-220</ns0:Telefon>
    </ns0:kunde>
    </ns0:kunden>
    Now I want to transfer the XML into a complex type in Java, for instance
    ArrayList<MyKunde> retKundenliste = new ArrayList<MyKunde>();
    The type MyKunde is defined with all needed attributes and the corresponding getter/setter methods. My object getting the XML response from the WS is kundenliste of type javax.xml.soap.SOAPElement (defined by the WS proxy) . What method do I have to use to get all elements from the XML structure transformed into an array of MyKunde?
    I can imagine that this task is a standard but as I said I'm new in Java programming.
    Many thanks for your help
    Detlef

    I'm not sure but the Wizard should have created accessors for the char_list Adobe in the generated AbcXyzObj.java class. Check this class for the attributes and their getters and setters.
    Timo

  • To change vendor no for condition types using BAPI_PO_CHANGE

    Hii,
    how to change vendor no for certain condition types using BAPI_PO_CHANGE.
    Is it possible .
    Any parameter is there.
    Plz help urgent
    Title edited by: Alvaro Tejada Galindo on Jun 12, 2008 5:23 PM

    Hi,
       It is possible.
    wa_pocond-vendor_no = wa_konv-lifnr.
    wa_pocondx-vendor_no = 'X'.
       wa_pocond-condition_no = wa_konv-knumv.
        wa_pocond-itm_number = wa_konv-kposn.
        wa_pocond-cond_type = wa_konv-kschl.
        wa_pocondx-condition_no = wa_konv-knumv.
        wa_pocondx-itm_number = wa_konv-kposn.
        wa_pocondx-cond_type = 'X'.
        wa_pocondx-change_id = 'U'.
        APPEND wa_pocondx TO it_pocondx.
        CALL FUNCTION 'BAPI_PO_CHANGE'
          EXPORTING
            purchaseorder                = wa_konv-ebeln
          POHEADER                     =
          POHEADERX                    =
          POADDRVENDOR                 =
          TESTRUN                      =
          MEMORY_UNCOMPLETE            =
          MEMORY_COMPLETE              =
          POEXPIMPHEADER               =
          POEXPIMPHEADERX              =
          VERSIONS                     =
          NO_MESSAGING                 =
          NO_MESSAGE_REQ               =
          NO_AUTHORITY                 =
          NO_PRICE_FROM_PO             =
        IMPORTING
          EXPHEADER                    =
          EXPPOEXPIMPHEADER            =
         TABLES
           return                       = it_return
           poitem                       = it_poitem
           poitemx                      = it_poitemx
          POADDRDELIVERY               =
          POSCHEDULE                   =
          POSCHEDULEX                  =
          POACCOUNT                    =
          POACCOUNTPROFITSEGMENT       =
          POACCOUNTX                   =
          POCONDHEADER                 =
          POCONDHEADERX                =
           pocond                       = it_pocond
           pocondx                      = it_pocondx
          POLIMITS                     =
          POCONTRACTLIMITS             =
          POSERVICES                   =
          POSRVACCESSVALUES            =
          POSERVICESTEXT               =
          EXTENSIONIN                  =
          EXTENSIONOUT                 =
          POEXPIMPITEM                 =
          POEXPIMPITEMX                =
          POTEXTHEADER                 =
          POTEXTITEM                   =
          ALLVERSIONS                  =
          POPARTNER                    =
          POCOMPONENTS                 =
          POCOMPONENTSX                =
          POSHIPPING                   =
          POSHIPPINGX                  =
          POSHIPPINGEXP                =
          POHISTORY                    =
          POHISTORY_TOTALS             =
          POCONFIRMATION               =
        COMMIT WORK AND WAIT.

  • Photoshop Elements 6 and the XML for content type = frame

    Hello.
    I am working with XML files in Photoshop Elements 6.  I am trying to understand the structure for , frames, in the artwork palette.  These XML files are more complex than others so where can I get an explanation of this and other content types.
    Thank you
    David J. Krassen

    I have Leopard and PE6 and had no difficulty installing it. The only problem was with 'Bridge', which turned out to be a conflict with a file installed by the 'Opera' browser:
    Users/[username]/Library/Application Support/Opera/Widgets/widgets.dat
    If you have been using Opera you should remove this and note that if you run Opera again it will reinstall it. Earlier versions of Opera are OK. The presence of this file caused Bridge to hang when selecting 'Home'.
    Since removing that file I have had no problems whatever with PE6.

  • 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 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)

  • BPEL - not generating correct SOAP packet for complex types

    Hi,
    Below is a snippet from wsdl, correct SOAP request and reply packet (generated using a SOAP test tool) and finally BPEL generated SOAP request and error response (captured using TCP packet monitor)
    The problem is with element 'XActivationPackageArray', which is getting enclosed
    by itself again from Oracle BPEL PM.
    ------------------------W S D L S T A R T----------------------------------------------------
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" .......>
         <types>
              <schema>
                   <complexType name="XActivationPackageArray">
                        <sequence>
                             <element name="XActivationPackage" type="tns2:XActivationPackage" maxOccurs="unbounded"/>
                        </sequence>
                   </complexType>
                   <element name="XActivationPackageArray" type="tns2:XActivationPackageArray"/>
                   <complexType name="XActivationPackage">
                        <sequence>
                             <element name="activationPackage" nillable="true" type="xsd:string"/>
                        </sequence>
                   </complexType>
                   <complexType name="XActivationResponse">
                        <sequence>
                             <element name="unitId" nillable="true" type="xsd:string"/>
                             <element name="serviceId" nillable="true" type="xsd:string"/>
                        </sequence>
                   </complexType>
                   <element name="XActivationResponse" type="tns2:XActivationResponse"/>
              </schema>
         </types>
         <message name="activateServiceRequest">
              <part name="userId" type="xsd:string"/>
              <part name="companyCd" type="xsd:string"/>
              <part name="customerCd" type="xsd:string"/>
              <part name="stockAccountId" type="xsd:string"/>
              <part name="orderNumber" type="xsd:string"/>
              <part name="serviceType" type="xsd:string"/>
              <part name="location" type="xsd:string"/>
              <part name="unitId" type="xsd:string"/>
              <part name="serviceIdPool" type="xsd:string"/>
              <part name="serviceId" type="xsd:string"/>
              <part name="XActivationPackageArray" element="tns2:XActivationPackageArray"/>
         </message>
         <message name="activateServiceResponse">
              <part name="XActivationResponse" element="tns2:XActivationResponse"/>
         </message>
    </definitions>
    ------------------------W S D L E N D----------------------------------------------------
    ------------------------Correct SOAP packet ----------------------------------------------------
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sf2pwrapper.ws.sf2.p1.com">
    <soapenv:Body>
    <urn:activateService>
    <userId>XYZ</userId>
    <companyCd>999</companyCd>
    <customerCd>ABCDE</customerCd>
    <stockAccountId>FGHIJ</stockAccountId>
    <orderNumber>888999</orderNumber>
    <serviceType>AA</serviceType>
    <location>A</location>
    <unitId/>
    <serviceIdPool>XXX</serviceIdPool>
    <serviceId/>
    <XActivationPackageArray>
                   <XActivationPackage>
                        <activationPackage>MMGG</activationPackage>
                   </XActivationPackage>
    </XActivationPackageArray>
    </urn:activateService>
    </soapenv:Body>
    </soapenv:Envelope>
    ------------------------Correct reply ----------------------------------------------------
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <activateServiceResponse xmlns="urn:sf2pwrapper.ws.sf2.p1.com">
    <ns1:XActivationResponse xmlns:ns1="urn:model.sf2pwrapper.ws.sf2.p1.com">
    <unitId xmlns="">0642342</unitId>
    <serviceId xmlns="">83753710</serviceId>
    </ns1:XActivationResponse>
    </activateServiceResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    ------------------------BPEL generated SOAP packet--------------------------------------------------
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <ns1:activateService soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:sf2pwrapper.ws.sf2.p1.com">
    <userId xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">XYZ</userId>
    <companyCd xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">999</companyCd>
    <customerCd xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">ABCDE</customerCd>
    <stockAccountId xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">FGHIJ</stockAccountId>
    <orderNumber xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">888999</orderNumber>
    <serviceType xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">AA</serviceType>
    <location xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">A</location>
    <unitId xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string"></unitId>
    <serviceIdPool xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string">XXX</serviceIdPool>
    <serviceId xmlns:def="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="def:string"></serviceId>
    <XActivationPackageArray>
    <XActivationPackageArray xmlns="urn:model.sf2pwrapper.ws.sf2.p1.com">
    <XActivationPackage xmlns="">
    <activationPackage>MMGG</activationPackage>
    </XActivationPackage>
    </XActivationPackageArray>
    </XActivationPackageArray>
    </ns1:activateService>
    </soapenv:Body>
    </soapenv:Envelope>
    ------------------------BPEL error--------------------------------------------------
    <?xml version="1.0" encoding="utf-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <soapenv:Fault>
    <faultcode>soapenv:Server.userException</faultcode>
    <faultstring>org.xml.sax.SAXException: Invalid element in com.p1.sf2.ws.sf2pwrapper.model.XActivationPackage - XActivationPackage</faultstring>
    <detail>
    <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">c7g7mrs</ns1:hostname>
    </detail>
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>

    t

  • SAPUI - XML View - complex type information

    Hi,
    I have some issues to express my type information in XML views.
    The JS view would look like:
    new sap.m.Text({
         text: {
              path:"/number",
              type: new sap.ui.model.type.Integer({groupingEnabled: true, groupingSeparator: '.'})
    My current XML view looks like this:
    <Text text="{path:'/number', type:'sap.ui.model.type.Integer', constraints:{groupingEnabled: true, groupingSeparator: '.'}}" />
    or
    <Text text="{path:'/number', type:'sap.ui.model.type.Integer({groupingEnabled: true, groupingSeparator: '.'})'}" />
    or several other ideas, e.g. escpaing of the additional '.
    But nothing worked. And I could not find any documentation of how it might work.
    The diagnostic tool translates JS to XML, yes, but it ignores the complicated case. :-(
    I could use a formatter to group myself, but there are several cases, where I need such complicated XML views.
    E.g. if I want to use multiply paths as an array.
    In my index.html I added data-sap-ui-xx-bindingSyntax="complex".
    Hope you can help me out.
    Thanks and bests
    -Ben

    Hi Ben,
              This should work
    <!DOCTYPE html>
    <html><head>
      <meta http-equiv='X-UA-Compatible' content='IE=edge' />
      <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
      <title>Mobile App with XML View with JSON Data</title>
    <script id='sap-ui-bootstrap' type='text/javascript'
       src='/sapui5-internal/resources/sap-ui-core.js'
       data-sap-ui-theme='sap_bluecrystal'
       data-sap-ui-libs='sap.m'
       data-sap-ui-xx-bindingSyntax='complex'></script>
      <script id="myXml" type="text/xmldata">
       <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="myController" displayBlock="true">
       <App>
      <Page title="Hello">
      <Text text="{path:'/1/r', type:'sap.ui.model.type.Integer', formatOptions:{groupingEnabled: true , groupingSeperator : '.'}}" />
      <Button text="{/1/name}" press= "doSomething"/>
      </Page>
       </App>
       </mvc:View>
      </script>
    <script>
      sap.ui.controller("myController", {
      onInit: function() {
      var model = new sap.ui.model.json.JSONModel();
      model.setData([
      {lastName: "Dente", name: "Al", r  : 1232323.221212,checked: true, linkText: "www.sap.com", href: "http://www.sap.com", rating: 4},
      {lastName: "Friese", name: "Andy", r  : 111222.221212, checked: true, linkText: "www.spiegel.de", href: "http://www.spiegel.de", rating: 2},
      {lastName: "Mann", name: "Anita",  r  : 1.221212,checked: false, linkText: "www.kicker.de", href: "http://www.kicker.de", rating: 3}
      this.getView().setModel(model);
      doSomething: function() {
      alert("Hello World!");
      sap.ui.view({ viewContent: jQuery('#myXml').html(), type:sap.ui.core.mvc.ViewType.XML }).placeAt("content")
    </script>
    </head>
       <body class='sapUiBody'>
       <div id='content'></div>
    </body>
    </html>
    Thank you.
    Regards,
                   Pruthvi.

  • AQ table for complex type creation

    I have a type containing nested tables, it looks like that:
    create or replace type aq_student_reg_queue_type as object (
    XML_ID varchar2(16),
    trigger_name varchar2(32),
    tm_transaction_id varchar2(30),
    tm_transaction_type varchar2(30),
    person aq_person_tm_type,
    resources aq_community_resource_list);
    aq_community_resource_list is table of aq_community_resource
    aq_community_resource is another type containing table of resources
    When I'm trying to create queue table for such payload I have an error that I have to specify nested table column or attribute. How to do that ? I can't find it somehow.

    The problem is that you need to specify a storage clause for nested tables when you use a nested table inside a database table. When creating a queue, a table is created under the hood, which lacks a storage clause for the nested table. I don't know a way to provide this clause to AQ. A workaround is to use varrays instead. See this example:
    SQL> create or replace type aq_community_tm_type as object(
      2  resource_code varchar2(30)
      3  );
      4  /
    Type is aangemaakt.
    SQL> create or replace type aq_community_tm_list as table of aq_community_tm_type;
      2  /
    Type is aangemaakt.
    SQL> create or replace type aq_community_resource as object(
      2  subscriber varchar2(30),
      3  resource_list aq_community_tm_list
      4  );
      5  /
    Type is aangemaakt.
    SQL> create or replace type aq_community_resource_list as table of aq_community_resource;
      2  /
    Type is aangemaakt.
    SQL> create or replace type aq_person_tm_type as object (
      2  PERSON_LDAP varchar2(30),
      3  FIRST_NAME varchar2(30),
      4  MIDDLE_NAME varchar2(30),
      5  SURNAME varchar2(30),
      6  GENDER varchar2(1),
      7  TITLE varchar2(16),
      8  DATE_OF_BIRTH date,
      9  PREFERRED_EMAIL varchar2(100),
    10  PREFERRED_PHONE varchar2(20),
    11  ORIGINATING_GROUP varchar2(50),
    12  SUB_GROUP varchar2(2000),
    13  LMS_DOMAIN_ID integer,
    14  LMS_ROLE_ID integer,
    15  COURSE_CODE varchar2(16),
    16  COURSE_INSTANCE_CODE varchar2(16),
    17  COURSE_INSTANCE_DATE date,
    18  REGISTRATION_DATE date,
    19  REF_OBJECT_ID number
    20  );
    21  /
    Type is aangemaakt.
    SQL> create or replace type aq_person_queue_tm_type as object (
      2  XML_ID varchar2(16),
      3  trigger_name varchar2(32),
      4  tm_transaction_id varchar2(30),
      5  tm_transaction_type varchar2(30),
      6  person aq_person_tm_type,
      7  resources aq_community_resource_list
      8  );
      9  /
    Type is aangemaakt.
    SQL> begin
      2    dbms_aqadm.create_queue_table
      3    ( queue_table        => 'my_queue_table'
      4    , queue_payload_type => 'aq_person_queue_tm_type'
      5    );
      6  end;
      7  /
    begin
    FOUT in regel 1:
    .ORA-22913: must specify table name for nested table column or attribute
    ORA-06512: at "SYS.DBMS_AQADM_SYS", line 2830
    ORA-06512: at "SYS.DBMS_AQADM", line 58
    ORA-06512: at line 2This probably is the error you are experiencing (hint: next time please provide it with your question).
    When you use varrays, it will work:
    SQL> drop type aq_person_queue_tm_type
      2  /
    Type is verwijderd.
    SQL> drop type aq_person_tm_type
      2  /
    Type is verwijderd.
    SQL> drop type aq_community_resource_list
      2  /
    Type is verwijderd.
    SQL> drop type aq_community_resource
      2  /
    Type is verwijderd.
    SQL> drop type aq_community_tm_list
      2  /
    Type is verwijderd.
    SQL> drop type aq_community_tm_type
      2  /
    Type is verwijderd.
    SQL> create or replace type aq_community_tm_type as object(
      2  resource_code varchar2(30)
      3  );
      4  /
    Type is aangemaakt.
    SQL> create or replace type aq_community_tm_list as varray(100) of aq_community_tm_type;
      2  /
    Type is aangemaakt.
    SQL> create or replace type aq_community_resource as object(
      2  subscriber varchar2(30),
      3  resource_list aq_community_tm_list
      4  );
      5  /
    Type is aangemaakt.
    SQL> create or replace type aq_community_resource_list as varray(10) of aq_community_resource;
      2  /
    Type is aangemaakt.
    SQL> create or replace type aq_person_tm_type as object (
      2  PERSON_LDAP varchar2(30),
      3  FIRST_NAME varchar2(30),
      4  MIDDLE_NAME varchar2(30),
      5  SURNAME varchar2(30),
      6  GENDER varchar2(1),
      7  TITLE varchar2(16),
      8  DATE_OF_BIRTH date,
      9  PREFERRED_EMAIL varchar2(100),
    10  PREFERRED_PHONE varchar2(20),
    11  ORIGINATING_GROUP varchar2(50),
    12  SUB_GROUP varchar2(2000),
    13  LMS_DOMAIN_ID integer,
    14  LMS_ROLE_ID integer,
    15  COURSE_CODE varchar2(16),
    16  COURSE_INSTANCE_CODE varchar2(16),
    17  COURSE_INSTANCE_DATE date,
    18  REGISTRATION_DATE date,
    19  REF_OBJECT_ID number
    20  );
    21  /
    Type is aangemaakt.
    SQL> create or replace type aq_person_queue_tm_type as object (
      2  XML_ID varchar2(16),
      3  trigger_name varchar2(32),
      4  tm_transaction_id varchar2(30),
      5  tm_transaction_type varchar2(30),
      6  person aq_person_tm_type,
      7  resources aq_community_resource_list
      8  );
      9  /
    Type is aangemaakt.
    SQL> begin
      2    dbms_aqadm.create_queue_table
      3    ( queue_table        => 'my_queue_table'
      4    , queue_payload_type => 'aq_person_queue_tm_type'
      5    );
      6  end;
      7  /
    PL/SQL-procedure is geslaagd.
    SQL> begin
      2    dbms_aqadm.drop_queue_table('my_queue_table');
      3  end;
      4  /
    PL/SQL-procedure is geslaagd.Hope this helps.
    Regards,
    Rob.

Maybe you are looking for

  • Windows 8 Problems with Airport/Airtunes

    Installed Windows 8 from Windows 7, reinstalled latest version of iTunes and Airport Utility.  iTunes now no longer "sees" Airtunes speakers (connected through multiple Airport Express units throughout house).  Speakers are seen by all Apple devices

  • Problem with Bridge in CS4

    I have an interesting little glitch. I'm running CS4, updated through 11.02 on both  my main machine (Win 7) and my laptop (Win XP Pro). I shoot RAW with a Canon 450D/XSi.   Recently, when I bring up the RAW files in Bridge, I get perfect thumbnails

  • Documents Open in Browser Issue

    Hi All     I have strange issue, word document open in browser as expected. But a read permission user open up the document in browser and able to edit and save it.   Please advice Thank you Joe

  • How to transfer ipad2 contents without internet?

    Is there any way to transfer contents of my ipad2 without using the internet? I had hastily pressed the command erase all contents when I lost my iPad in the air Out. For some fortunate intervention I was able to retrieve my iPad. Is there anyway to

  • Host did not respond error in connecting the SAP Router from SERVICE PLACE

    Dear Sir, We renew the Router Certificate by October 2008.  We are using broadband connection in our office with firewall (ISA) . When we try to connect the sap router from SAP Service Market Place, It is connected and after some time, status is chan