Handling empty values during xml validation

Hello experts,
I have a file to file scenario in PI 7.1.  I am using xml validation to validate the incoming source file. There are various types of fields in the incoming file including int, decimal and string. They can have a certain enumeration of values but can also have a blank value.
For example field 'Num' of type int can have values 1,2,3 or a blank value.
But I am not able to define a blank value for the field in the enumeration during definition. Therefore a blank value in the input file fails during the validation stage.
Is there any workaround for this?
Thanks!
RR

This is a basic problem. When you define a field as integer you cannot declare blank space which represents String type.
So for your case make the value 'zero' instead of blank, if you want do declare the field as integer and as below...
<xs:element name="Num">
  <xs:simpleType>
    <xs:restriction base="xs:integer">
      <xs:pattern value="[0-3]"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
Also refer this page for further reference.
http://www.w3schools.com/schema/schema_facets.asp

Similar Messages

  • Java.lang.Exception error during XML validation by Integration Engine

    Hi professionals,
    We are trying to use XML validation by the Integration Engine.
    Step 1:
    We created an appropriate directory structure where we had to store the structure (xsd).
    \usr\sap\<system id>\SYS\global\xi\runtime_server\A\B\C\D\E\F
    A - validation
    B - schema
    C - GUID of the SWCV where service interface reside.
    D - Repository Namespace where Service Interface is created.
    E - Service Interface Name
    F - Repository Namespace where Message Type or External Definition is
    assigned.
    Step 2:
    We also changed the references in the xsd to exclude all the subdirectory references.
    e.g folder1/folder2/abc.xsd is become abc.xsd only
    Step 3:
    We stored both xsdu2019s (schema xsd and referenced xsd to the directory created in step 1)
    Step 4:
    We changed the directory and xsdu2019s permissions to 777 (we chose 777 for testing purpose).
    Step 5:
    We changed the property schema validation of the sender agreement to Validation by Integration Engine.
    Step 6:
    We checked RFC destination for AI_VALIDATION_JCOSERVER on AS ABAP and AS Java and establish an successful connection test.
    RESTULTS
    The result of those steps is an error message in the message monitor of PI with the error tekst:
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="XML_VALIDATION_INB">CX_XMS_SYSERR_VALIDATION</SAP:Code>
      <SAP:P1>java.lang.Exception</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>not used at the moment.</SAP:AdditionalText>
      <SAP:Stack>System error occurred during XML validation</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Please assist in how to solve this issueu2026.
    Regards, Sjaak.

    I would suggest follow Appendix A to know the exact path and since you have one XSD referring other XSD check the steps mentioned in Appendix B .... there seems to be some error in referencing ...Appendix A and B are on page 12 & 13 of this document:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1?quicklink=index&overridelayout=true
    Regards,
    Abhishek.

  • "semantic checks during XML Validation"

    What did SAP pepole ment saying the above subject  in the XML validation page of PI 7.3?
    Does PI supprots only "shallow" validation of structure rather then "deep validaiton" of data type patterns for example?
    if not duiring validation then when?
    http://help.sap.com/saphelp_nw74/helpdata/en/44/0bf1b3ec732d2fe10000000a11466f/frameset.htm
    Appreciate your insights.

    This is a basic problem. When you define a field as integer you cannot declare blank space which represents String type.
    So for your case make the value 'zero' instead of blank, if you want do declare the field as integer and as below...
    <xs:element name="Num">
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:pattern value="[0-3]"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
    Also refer this page for further reference.
    http://www.w3schools.com/schema/schema_facets.asp

  • How to handle empty value coming to PI

    Hi Experts,
    My scenario is ABAP proxy to File. ABAP program is sending data to PI with blank value. But in PI payload that field is not showing at all.
    Suppose customer number value is blank in ABAP internal table, in PI payload customer number xml tag is not showing at all in source structure.
    Have used one to one mapping and in content conversion we have used.
    .addHeaderLine      0
    .fieldSeparator     ;
    endSeparator     'nl'
    and also I need - if any value in the source structure is coming empty we need to replace it with semi colon.it is not for a specific field, it might be any field of source structure.
    please help on this.
    Thanks,
    Swapnashree

    Hi,
              Before you call the message mapping in interface mapping, u need a java mapping code. This code will check if the required tag is absent. In case the required XML tag is missing, the java mapping code will insert the tag under proper parent node. This is best accomplished using DOM parser. If you need any further guidance from forum members on how to achieve this, then you need to publish following information
    1. Version of PI you are working on.
    2. Source XML structure.
    3. Target XML structure.
    You may refer to various java mapping blogs in SDN for further information on the topic.
    Else try this mapping of the source field
    Source field--------Exists ------> if  ----------------- target field
    if the condition evaluates true    then  map  source field -------> target else  constant (";") ------->target.
    regards
    Anupam
    Edited by: anupamsap on Sep 20, 2011 2:42 PM

  • XML validation in WS adapter

    Hi experts,
    I get the following error message in SXMB_MONI while processing a message through a WS sender adapter:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <!-- Error Message -->
    <n0:Fault xmlns:n0="http://schemas.xmlsoap.org/soap/envelope/">
         <faultcode>n0:Server</faultcode>
         <faultstring xml:lang="en">SRT: Failure in SOAP processing occurred</faultstring>
         <detail>
              <ns:SystemFault xmlns:ns="http://www.sap.com/webas/710/soap/runtime/abap/fault/system/">
                   <Host>Integration Server Entry</Host>
                   <Component>COREMSG</Component>
                   <ChainedException>
                        <Exception_Name>CX_XMS_XI_SYS_ERR</Exception_Name>
                        <Exception_Text>System error</Exception_Text>
                   </ChainedException>
                   <ChainedException>
                        <Exception_Name>CX_XMS_SYSERR_VALIDATION</Exception_Name>
                        <Exception_Text>System error occurred during XML validation</Exception_Text>
                   </ChainedException>
              </ns:SystemFault>
         </detail>
    </n0:Fault>
    This is strange, because I didn't configure any XML validation. I didn't configure that explicitly.
    However, I noticed that the step "XML Validation Inbound Channel Request ( CENTRAL )" is executed every time I send messages to PI. Normally this is successful, so the message flow is not interrupted. But even in the successful case the xml header is always cut off (so the line "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>" in the beginning). I checked other messages with different adapters, and this step is never executed.
    I would like to know whether this step can be switched off somewhere or whether it is performed by default. Does anybody know more about this topic?
    Best regards,
    Jörg

    Hi Hema,
    As per understanding you need to check one or few fields value is integer or not.
    You can achieve in 2 ways :
    Case1:Using inbuilt xml validation options.
    For 7.11 and below
    1)In ESR/Message type/Export the xsd to local machine.
    2)Insert the xsd file in the below loc
    /usr/sap/<sid>/DVEBMGS00/j2ee/cluster/server0/validation/schema/
    <guid>/<namespace1>/<service_interface_name>/<namespace2>
    <sid>: System ID of the server instance.
    <guid>: The GUID of the SWCV.
    <namespace1> : The namespace within which the service interface is defined.
    <service_interface_name> : The name of the service interface.
    <namespace2>
    : The namespace of the Message Type used by the service interface. In many
    instances, namespace1 and namespace2 are the same.
    Italic path folders need to create by you.
    For 7.3 and above
    Michal's PI tips: XML validation - changes in 7.3
    Case 2 :Handling using simple UDF.
    Input-->UDF-->Output
    try {
       Integer.parseInt(input);
       return input ;
    catch(NumberFormatException e) {   
    throw new StreamTransformationException( "Input field value for xyz field "+input+"is not in integer format.Plz correct it"); 
    Regards
    Venkat

  • How to obtain XML error node after  XML validation

    Hello,
    We are developing a web application which uses XML documents.
    We try to obtain the exact error which occurs during XML validation against a schema in order to alert users with a proper message - for example: "Invalid value for element date".
    We validate our XML documents using DBMS_xmlparser. But it only retuns a string message indicating there is an error and document cannot be validated. What can we use to reference to the node object which contains the error?
    We develop our application under Oracle 9.2.0.4.
    Any help will be appreciated.

    Validate with a DOMParser or a SAXParser.
    Set a ErrorHandler on the parser.
    The custom ErrorHandler class should override the startElement & endElement methods of the DefaultHandler class.
    private class Validator extends DefaultHandler     
           public boolean  validationError = false;     
           public SAXParseException saxParseException=null;
           public void error(SAXParseException exception) throws SAXException     
               validationError = true;     
               saxParseException=exception;
           public void fatalError(SAXParseException exception) throws SAXException          
                validationError = true;     
                saxParseException=exception;     
           public void warning(SAXParseException exception) throws SAXException          
           public void startElement(String uri,
                             String localName,
                             String qName,
                             Attributes attributes)
                      throws SAXException{
             System.out.println("Start Element: "+qName);
             public void endElement(String uri,
                           String localName,
                           String qName)
                    throws SAXException{
             System.out.println("End Element: "+qName);

  • Regarding error in xml validation 7.1

    Hi
    I am doing file to idoc scenario. In the sender agreement i selected validation by Adapter and uploaded the particular xsd.after executing the scenario in runtime workbench it is showing sucessfully processed  but in the MDT audit log I am getting following error.without validation the file is posting in target system.but when I check the validation by adapter it is giving following error.
    Received XI System Error. ErrorCode: CX_XMS_SYSERR_VALIDATION ErrorText: not used at the moment. ErrorStack: System error occurred during XML validation
    Transmitting the message to endpoint http://orcdapp1.edfapps.edfenergy.net:51100/sap/xi/engine?type=entry using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: CX_XMS_SYSERR_VALIDATION:not used at the moment..
    Please give me your inputs.
    Regards
    venkat.

    Hi Venky,
    This error due to incorrect path So please check whether you have used the correct path or not?
    Create appropriate directories structure where we have to save your structure (xsd).
    \usr\sap\<system id>\SYS\global\xi\runtime_server\A\B\C\D\E\F
    A - validation
    B - schema
    C - GUID of the SWCV where service interface reside.
    D - Repository Namespace where Service Interface is created.
    E - Service Interface Name
    F - Repository Namespace where Message Type or External Definition is assigned.
    Note: if your ESR namespace contains special character then do replace it with u201C~u201D in folder name.
    If namespace is http://abc.com/XI/FileToFile then folder name should be replace with httpabc.comXI~FileToFile
    Export schema from the ESR and save it in folder u201CFu201D with name <<RootElementOfMessageType>>.xsd. So in this case it is MT_File_Sender.xsd
    Regards,
    Sameer
    Edited by: sameer Khanna on May 27, 2009 10:14 AM

  • Using Convert to handle NULL values for empty Strings ""

    After having had the problem with null values not being returned as nulls and reading some suggestion solution I added a converter to my application.
      <converter>
        <converter-id>NullStringConverter</converter-id>
        <converter-for-class>java.lang.String</converter-for-class>
        <converter-class>com.j2anywhere.addressbookserver.web.NullStringConverter</converter-class>
      </converter>
    ...I then implemented it as follows:
      public String getAsString(FacesContext context, UIComponent component, Object object)
        System.out.println("Converting to String : "+object);
        if (object == null)
          System.out.println("READING null");
          return "NULL";
        else
          if (((String)object).equals(""))
            System.out.println("READING null (Second Check)");
            return null;       
          else
            return object.toString();
      public Object getAsObject(FacesContext context, UIComponent component, String value)
        System.out.println("Converting to Object: "+value+"-"+value.trim().length());
        if (value.trim().length()==0 || value.equals("NULL"))
          System.out.println("WRITING null");
          return null;
        else
          return value.toUpperCase();
    ...I can see that it is converting my values, however the object to which the inputText fields are bound are still set to empty strings ""
    <h:inputText size="50" value="#{addressBookController.contactDetails.information}" converter="NullStringConverter"/>Also when reading the object values any nulls are already converted to empty strings before ariving at the converter. It seems that there is a default converter handling string values.
    How can I resolve this problem as set nulls when the input value is an empty string other then checking every string in my class individually. I would really hate to pollute my object model with empty string tests.
    Thanks in advance
    Edited by: j2anywhere.com on Oct 19, 2008 9:06 AM

    I changed my converter as suggested :
      public Object getAsObject(FacesContext context, UIComponent component, String value)
        if (value == null || value.trim().length() == 0)
          if (component instanceof EditableValueHolder)
            System.out.println("SUBMITTED VALUE SET TO NULL");
            ((EditableValueHolder) component).setSubmittedValue(null);
          else
            System.out.println("COMPONENT :"+component.getClass().getName());
          System.out.println("Converting to Object: " + value + "< to " + null);
          return null;
        System.out.println("Converting to Object: " + value + "< to " + value);
        return value;
      }which produces the following output :
    SUBMITTED VALUE SET TO NULL
    Converting to Object: < to null
    Info : The INFO line however comes from my controller object where I print out the set value :
    package com.simple;
    import java.util.ArrayList;
    import java.util.List;
    public class Controller
      private String information;
      /** Creates a new instance of Controller */
      public Controller()
        System.out.println("Createing Controller");
        information = "Constructed";
      public String process()
        System.out.println("Info : "+getInformation());
        return "processed";
      public String reset()
        setInformation("Re-Constructed");
        System.out.println("Info : "+getInformation());
        return "processed";
      public String setNull()
        setInformation(null);
        System.out.println("Info : "+getInformation());
        return "processed";
      public String getInformation()
        return information;
      public void setInformation(String information)
        this.information = information;
    }I also changes my JSP / JSF page a little. Here is the updated version
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%--
        This file is an entry point for JavaServer Faces application.
    --%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
      </head>
      <body>
        <f:view>
          <h:form>
            <h:inputText id="value" value="#{Controller.information}"/>
            <hr/>
            <h:commandLink action="#{Controller.process}">
              <h:outputText id="clicker" value="Process"/>
            </h:commandLink>             
            <hr/>
            <h:commandLink action="#{Controller.reset}">
              <h:outputText id="reset" value="Reset"/>
            </h:commandLink>             
            <hr/>
            <h:commandLink action="#{Controller.setNull}">
              <h:outputText id="setNull" value="Set Null"/>
            </h:commandLink>             
          </h:form>
        </f:view>
      </body>
    </html>The converter is declared for the String class in the faces configuration file. From the log message is appears to be invoked, however the object is not set to null.
    I tested this with JSF 1.2_04-b20-p03 as well as 1.2_09-b02-FCS.
    any other suggestions what could be causing this.

  • Error during XML = ABAP conversion, empty tag

    Hi.
    Im sending data from a Data Base to a proxy using BI.
    But when I get an empty response from the data base wich gives me an empty XML tag the proxy shows me an error:
    -PARSE_APPLICATION_DATA Error during XML => ABAP conversion (Response  Message; error ID: CX_ST_MATCH_ELEMENT;
    -Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
    -System expected the end of the element 'STMT_DC_response'          
    This is the message that originates the fail:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns0:MT_PRV23_BS_desg_response xmlns:ns0="urn:tompla-com:xi:ventas_SD">
    <STMT_response>
      <row>
       <TIPO>P</TIPO>
       <NUM_OT>55062330</NUM_OT>
       <NUM_DESGLOSE>1</NUM_DESG>
       <CANT_DESG>1724000</CANT_DESG>
      </row>
    </STMT_response>
    <STMT_DC_response />
    </ns0:MT_PRV23_BD_desg_response>
    In case that the tag is filled runs ok
    <?xml version="1.0" encoding="utf-8" ?>
    <ns0:MT_PRV23_BD_desg_response xmlns:ns0="urn:tompla-com:xi:ventas_SD">
      <STMT_response>
       <row>
        <TIPO>P</TIPO>
        <NUM_OT>55062330</NUMERO_OT>
        <NUM_DESG>1</NUM_DESG>
        <CANT_DESG>1724000</CANT_DESG>
       </row>
      </STMT_response>
      <STMT_DC_response>
       <row>
        <TIPO>P</TIPO>
        <NUMERO_OT>55062330</NUMERO_OT>
        <NUMERO_DESGLOSE />
        <COD_CAR_ADICIONA>8</COD_CAR_ADICIONA>
        <PORC_CAR_ADICION>1</PORC_CAR_ADICION>
      </row>
      </STMT_DC_response>
    </ns0:MT_PRV23_BD_desg_response>
    The definition for the data is:
    STMT_DC_response        0..1
      row                               0..n
        tipo                             0..1
    Thanks for the help you can give me about my problem with empty tags.

    I moved this question to other forum
      Expert Forums  » SAP NetWeaver  » Exchange Infrastructure 

  • Cannot set selectOneChoice value during reload (value auto become null)

    Dear all,
    I have a problem that getting null value in the SelectOneChoice field in a table binded to
    a view object. If I change that SelectOneChoice to inputText, it works perfectly. The details
    of the situation is described as follows:
    I've binded a view objects with 8 attributes to a af:table, then I manually change
    2 of the inputText fields inside 'Column' fields of the table to inputlistofvalue and
    selectOneChoice. The code is as follow:
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.AcNo.name}"
    sortable="false"
    headerText="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
    id="c1" width="180"
    inlineStyle="font-family:'Times New Roman', 'Arial Black', times, Serif; font-size:medium;">
         <af:inputListOfValues value="#{row.bindings.AcNo.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
              required="#{bindings.OpenBalanceVO1.hints.AcNo.mandatory}"
              columns="#{bindings.OpenBalanceVO1.hints.AcNo.displayWidth}"
              maximumLength="#{bindings.OpenBalanceVO1.hints.AcNo.precision}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.AcNo.tooltip}"
              id="it1"
              model="#{bindings.AcNo2.listOfValuesModel}"
              autoSubmit="false"
              returnPopupListener="#{backingBeanScope.backing_ImportOpenBalance.returnListener}">
              <f:validator binding="#{row.bindings.AcNo.validator}"/>
         </af:inputListOfValues>
    </af:column>
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.CurrencyCode.name}"
         sortable="false"
         headerText="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
         id="c2">
         <af:selectOneChoice value="#{row.bindings.CurrencyCode.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.CurrencyCode.tooltip}"
              id="it2" autoSubmit="false"
              partialTriggers="cb1 cb2">
              <f:selectItems value="#{loginInfo.activeCurrencies}" id="currenciesList"/>
         </af:selectOneChoice>
    </af:column>
    And I have binded the returnPopupListener to returnListerner event handler to automatically
    set the Currency field (2nd field) after the user chose the Account field (1st field) from
    the input list of value:
    public void returnListener(ReturnPopupEvent returnPopupEvent) {
         RichInputListOfValues lovField = (RichInputListOfValues)returnPopupEvent.getSource();
         ListOfValuesModel lovModel = lovField.getModel();
         CollectionModel collectionModel = lovModel.getTableModel().getCollectionModel();
         JUCtrlHierBinding treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
         RowKeySet rks = (RowKeySet)returnPopupEvent.getReturnValue();
         List tableRowKey = (List)rks.iterator().next();
         DCIteratorBinding dciter = treeBinding.getDCIteratorBinding();
         Key key = (Key)tableRowKey.get(0);
         Row row = dciter.findRowByKeyString(key.toStringFormat(true));
         DCBindingContainer bc = getBindingContainer();
         DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
         OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
         FacesContext fctx = FacesContext.getCurrentInstance();
         ExpressionFactory elFactory = fctx.getApplication().getExpressionFactory();
         ValueExpression ve = elFactory.createValueExpression(fctx.getELContext(), "#{loginInfo}", LoginInfo.class);
         LoginInfo loginInfo = (LoginInfo)ve.getValue(fctx.getELContext());
         System.out.println("Return place: search date:" + loginInfo.getSearchDate());
         Row newRow = viewObject.createRow();
         String selectedAcNo = row.getAttribute("AcNo").toString();
         String selectedCurrency = row.getAttribute("CurrencyCode").toString();
         newRow.setAttribute("AcNo", selectedAcNo);
         newRow.setAttribute("CurrencyCode",selectedCurrency);
         newRow.setAttribute("OpenBal", 300);
         newRow.setAttribute("AvailBal", 200);
         newRow.setAttribute("CreateDate", new Date());
         newRow.setAttribute("EffectiveDate", loginInfo.getSearchDate());
         newRow.setAttribute("LockStatus", "N");
         viewObject.insertRowAtRangeIndex(rowIndex, newRow);
    The problem occurs when I use a 'createInsert' button to create a new row in the table,
    and then choose a value from the inputListOfValues. The new row refresh and get the value
    I chose in the first column in the new row. But the second column (currency field) is left
    as empty (null value). If I change the second column frmo selectOneChoice to inputText,
    the correct Currency value (e.g. "HKD" or "USD") can be shown. So I wonder if there is any
    additional tricks in order to set the selectOneChoice value during refresh.
    Additionally I have tried to check the state of the view object attributes during the refresh
    lifecycle and found that the following reload method (else place) is being reached 3 times after I click
    the 'ok' button in the popup up in the inputListOfValue.
    public void beforePhase(PagePhaseEvent event) {
         //System.out.println("i am here inside backing bean : before phrase 1 phrase ID:" + event.getPhaseId());
         if (event.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
              if (!isPostback()) {
              } else {
                   System.out.println("Post Back on Page Load!");
                   DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
                   OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
                   RowSetIterator iterator = viewObject.createRowSetIterator(null);
                   iterator.reset();
                   while (iterator.hasNext()) {
                        //Row row = viewObject.getCurrentRow();
                        Row row = iterator.next();
                        System.out.print("Account:" + row.getAttribute("AcNo"));
                        System.out.print(",AvailBal:" + row.getAttribute("AvailBal"));
                        System.out.print(",OpenBal:" + row.getAttribute("OpenBal"));
                        System.out.print(",CurrencyCode:" + row.getAttribute("CurrencyCode"));
                        System.out.print(",EffectiveDate:" + row.getAttribute("EffectiveDate"));
                        System.out.print(",UserCreate:" + row.getAttribute("UserCreate"));
                        System.out.println("");
                        if (row.getAttribute("UserCreate").toString().equals("<current user>")) {
                             System.out.println("Match <current user> in preload");
                             //row.setAttribute("CurrencyCode", "USD");
                   System.out.println("end of reload");
    During the 1st time, the CurrencyCode field was set currently, but then in the 2nd and 3rd
    times, it's value suddenly changed to 'null'. If I use inputText, all the 3 times currencyCode
    field is showing correctly without the null issue.
    Anyone can kindly give me some hints? Thanks a lot!!!

    Dear all,
    I have a problem that getting null value in the SelectOneChoice field in a table binded to
    a view object. If I change that SelectOneChoice to inputText, it works perfectly. The details
    of the situation is described as follows:
    I've binded a view objects with 8 attributes to a af:table, then I manually change
    2 of the inputText fields inside 'Column' fields of the table to inputlistofvalue and
    selectOneChoice. The code is as follow:
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.AcNo.name}"
    sortable="false"
    headerText="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
    id="c1" width="180"
    inlineStyle="font-family:'Times New Roman', 'Arial Black', times, Serif; font-size:medium;">
         <af:inputListOfValues value="#{row.bindings.AcNo.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
              required="#{bindings.OpenBalanceVO1.hints.AcNo.mandatory}"
              columns="#{bindings.OpenBalanceVO1.hints.AcNo.displayWidth}"
              maximumLength="#{bindings.OpenBalanceVO1.hints.AcNo.precision}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.AcNo.tooltip}"
              id="it1"
              model="#{bindings.AcNo2.listOfValuesModel}"
              autoSubmit="false"
              returnPopupListener="#{backingBeanScope.backing_ImportOpenBalance.returnListener}">
              <f:validator binding="#{row.bindings.AcNo.validator}"/>
         </af:inputListOfValues>
    </af:column>
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.CurrencyCode.name}"
         sortable="false"
         headerText="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
         id="c2">
         <af:selectOneChoice value="#{row.bindings.CurrencyCode.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.CurrencyCode.tooltip}"
              id="it2" autoSubmit="false"
              partialTriggers="cb1 cb2">
              <f:selectItems value="#{loginInfo.activeCurrencies}" id="currenciesList"/>
         </af:selectOneChoice>
    </af:column>
    And I have binded the returnPopupListener to returnListerner event handler to automatically
    set the Currency field (2nd field) after the user chose the Account field (1st field) from
    the input list of value:
    public void returnListener(ReturnPopupEvent returnPopupEvent) {
         RichInputListOfValues lovField = (RichInputListOfValues)returnPopupEvent.getSource();
         ListOfValuesModel lovModel = lovField.getModel();
         CollectionModel collectionModel = lovModel.getTableModel().getCollectionModel();
         JUCtrlHierBinding treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
         RowKeySet rks = (RowKeySet)returnPopupEvent.getReturnValue();
         List tableRowKey = (List)rks.iterator().next();
         DCIteratorBinding dciter = treeBinding.getDCIteratorBinding();
         Key key = (Key)tableRowKey.get(0);
         Row row = dciter.findRowByKeyString(key.toStringFormat(true));
         DCBindingContainer bc = getBindingContainer();
         DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
         OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
         FacesContext fctx = FacesContext.getCurrentInstance();
         ExpressionFactory elFactory = fctx.getApplication().getExpressionFactory();
         ValueExpression ve = elFactory.createValueExpression(fctx.getELContext(), "#{loginInfo}", LoginInfo.class);
         LoginInfo loginInfo = (LoginInfo)ve.getValue(fctx.getELContext());
         System.out.println("Return place: search date:" + loginInfo.getSearchDate());
         Row newRow = viewObject.createRow();
         String selectedAcNo = row.getAttribute("AcNo").toString();
         String selectedCurrency = row.getAttribute("CurrencyCode").toString();
         newRow.setAttribute("AcNo", selectedAcNo);
         newRow.setAttribute("CurrencyCode",selectedCurrency);
         newRow.setAttribute("OpenBal", 300);
         newRow.setAttribute("AvailBal", 200);
         newRow.setAttribute("CreateDate", new Date());
         newRow.setAttribute("EffectiveDate", loginInfo.getSearchDate());
         newRow.setAttribute("LockStatus", "N");
         viewObject.insertRowAtRangeIndex(rowIndex, newRow);
    The problem occurs when I use a 'createInsert' button to create a new row in the table,
    and then choose a value from the inputListOfValues. The new row refresh and get the value
    I chose in the first column in the new row. But the second column (currency field) is left
    as empty (null value). If I change the second column frmo selectOneChoice to inputText,
    the correct Currency value (e.g. "HKD" or "USD") can be shown. So I wonder if there is any
    additional tricks in order to set the selectOneChoice value during refresh.
    Additionally I have tried to check the state of the view object attributes during the refresh
    lifecycle and found that the following reload method (else place) is being reached 3 times after I click
    the 'ok' button in the popup up in the inputListOfValue.
    public void beforePhase(PagePhaseEvent event) {
         //System.out.println("i am here inside backing bean : before phrase 1 phrase ID:" + event.getPhaseId());
         if (event.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
              if (!isPostback()) {
              } else {
                   System.out.println("Post Back on Page Load!");
                   DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
                   OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
                   RowSetIterator iterator = viewObject.createRowSetIterator(null);
                   iterator.reset();
                   while (iterator.hasNext()) {
                        //Row row = viewObject.getCurrentRow();
                        Row row = iterator.next();
                        System.out.print("Account:" + row.getAttribute("AcNo"));
                        System.out.print(",AvailBal:" + row.getAttribute("AvailBal"));
                        System.out.print(",OpenBal:" + row.getAttribute("OpenBal"));
                        System.out.print(",CurrencyCode:" + row.getAttribute("CurrencyCode"));
                        System.out.print(",EffectiveDate:" + row.getAttribute("EffectiveDate"));
                        System.out.print(",UserCreate:" + row.getAttribute("UserCreate"));
                        System.out.println("");
                        if (row.getAttribute("UserCreate").toString().equals("<current user>")) {
                             System.out.println("Match <current user> in preload");
                             //row.setAttribute("CurrencyCode", "USD");
                   System.out.println("end of reload");
    During the 1st time, the CurrencyCode field was set currently, but then in the 2nd and 3rd
    times, it's value suddenly changed to 'null'. If I use inputText, all the 3 times currencyCode
    field is showing correctly without the null issue.
    Anyone can kindly give me some hints? Thanks a lot!!!

  • XML validation in sender file adapter

    Hi
    I am using FCC on the sender file adapter ....i need to make sure that one of the fields should always be integer else the sender adapter should give error
    Can i use xml validation with FCC on the sender file adapter?

    Hi Hema,
    As per understanding you need to check one or few fields value is integer or not.
    You can achieve in 2 ways :
    Case1:Using inbuilt xml validation options.
    For 7.11 and below
    1)In ESR/Message type/Export the xsd to local machine.
    2)Insert the xsd file in the below loc
    /usr/sap/<sid>/DVEBMGS00/j2ee/cluster/server0/validation/schema/
    <guid>/<namespace1>/<service_interface_name>/<namespace2>
    <sid>: System ID of the server instance.
    <guid>: The GUID of the SWCV.
    <namespace1> : The namespace within which the service interface is defined.
    <service_interface_name> : The name of the service interface.
    <namespace2>
    : The namespace of the Message Type used by the service interface. In many
    instances, namespace1 and namespace2 are the same.
    Italic path folders need to create by you.
    For 7.3 and above
    Michal's PI tips: XML validation - changes in 7.3
    Case 2 :Handling using simple UDF.
    Input-->UDF-->Output
    try {
       Integer.parseInt(input);
       return input ;
    catch(NumberFormatException e) {   
    throw new StreamTransformationException( "Input field value for xyz field "+input+"is not in integer format.Plz correct it"); 
    Regards
    Venkat

  • Xml validation ---- file system of PI ???

    hi all ,
         i read the xml validation concept of PI7.1 . iam unable to find any practical explanation about the following
    "To validate the structure of a PI message payload, you should export the schemas from the ESR and save them in the file system of PI. "
    save them in the file system of pi ... where does this mean to be stored ?.
    will it be necessary for both the ADAPTER ENGINE & INTEG ENGINE VALIDATION?
    Please give any other important aspect of this validation concept which u came across  during ur practical implementation
    THANKS IN ADVANCE

    Hi Netaji,
      Validating the XML documents is a new feature introduced in SAP NetWeaver Process Integration 7.1. The validation can be performed at two different locations - Integration Server or the Adapter Engine. Validations can be done in both synchronous and asynchronous operations.
    In the synchronous scenario or using an adapter that can handle synchronous messages (e.g. HTTP and SOAP adapters), when a validation error occurs, the error message will be returned to the sender. In the case of asynchronous scenarios (e.g. file adapter), the error message will be logged to the SXI_MONITOR when the validation is done in the Integration Server or to the Runtime Workbench (RWB) when the validation is done in the Adapter Engine. In both cases, the messaging will be terminated with error.
    Both Integration Server and Adapter Engine can be used for validating XML from the sender. However, only the Integration Server can be used to validate the XML when sending to the receiver. The XML validation configurations are done in either the Sender Agreement or the Receiver Agreement.
    In the current release, as of PI 7.1, the XML schema (or XSD) to be used for the XML validation has to reside in a file directory under the JEE. The XSD file has to be explicitly copied into a specific directory, depending on where the validation is to be performed.
    Regards,
    Leela

  • XML validation against registered XSD

    I have registered XSD into oracle database, while validating xml against this xsd I got stuck with non-mandatory tags.
    Below is the tag-XSD structure:
    Status field as String:
    <xs:element name="Status" nillable="false"> <xs:annotation> <xs:documentation>Values are 'N' or 'E'</xs:documentation>
    </xs:annotation>
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="1"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    idnumber tag field as Integer:
    <xs:element name="idnumber" type="xs:int" nillable="false">
    <xs:annotation>
    <xs:documentation>id value </xs:documentation>
    </xs:annotation>
    </xs:element>
    As status tag is of string type and I have mentioned it as nillable = "False", but even though when I am passing this tag as <status/>, then also its validating xml.... but as i mentioned nillable property as false then it should not validate it ..... please correct me if i m wrong..
    In case of idnumber tag it is of int type. In this case <idnumber/> will not work in either case even it is nillable = true or false. Means we cannt pass null values in integer field..... right?
    Please suggest me how to make tag of string datatype as not nillable.
    Is there any significance of using nillable = "false" in int datatype tag. Means if we want to make it as optional then need to mention it as minoccurs = 0..... is it correct?
    Requirement is simple:
    Just want to make some tag as optional and some as mandatory, tag can be of integer or string type.
    Thanks in advance.....
    Edited by: 959352 on 15-Oct-2012 00:45

    As status tag is of string type and I have mentioned it as nillable = "False", but even though when I am passing this tag as <status/>, then also its validating xml.... but as i mentioned nillable property as false then it should not validate it ..... please correct me if i m wrong.. The nillable attribute doesn't work that way. It's easy to look that up in any tutorial.
    nillable = "true" means you allow the element to have a NULL content (different from empty string) by specifying an explicit null attribute :
    <Status xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>nillable = "false" is the default behaviour.
    Please suggest me how to make tag of string datatype as not nillable.
    Is there any significance of using nillable = "false" in int datatype tag. Means if we want to make it as optional then need to mention it as minoccurs = 0..... is it correct?
    Requirement is simple:
    Just want to make some tag as optional and some as mandatory, tag can be of integer or string type. You have to be careful about the vocabulary.
    In my mind, an "optional" element means you can omit it entirely in the instance document (minOccurs="0"), whereas an empty element means the start tag and end tag are there but with no content.
    There are multiple ways to allow for empty or non-empty elements.
    e.g. for a non-empty string :
    <xs:minLength value="1"/>or, as in your example, if the content is actually constrained to a list of values, use enumerations.
    xs:int datatype doesn't allow empty values (unless you use xsi:nil).
    A possible solution is to build a new type by unioning (xs:union) an xs:int and an empty string type.

  • SAX Parser XML Validation Problems

    Hi,
    I’m having problems getting an xml document to validate within Weblogic 8.1. I am trying to parse a document that references both a dtd and xsd. Both the schema and dtd reference need to be substituted so they use local paths. I specify the schema the parser should use and have created an entityResolver to change the dtd reference.
    When this runs as a standalone app from eclipse the file parses and validates without a problem. When deployed to the app server the process seems to be unable read the contents of the dtd. Its not that it cannot find the file (no FileNotFoundException is thrown but this can be created if I delete the dtd) rather it seems to find no declared elements.
    Initial thought was that the code didn’t have access to read the dtd from its location on disk, to check I moved the dtd to within the deployed war and reference as a resource. The problem still persists.
    Code Snippet:
    boolean isValid = false;
    try {
         // Create and configure factory
    SAXParserFactory factory = SAXParserFactoryImpl.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    // To be notified of validation errors in the XML document,
    // add a custom error handler to the document builder
    PIMSFeedFileValidationHandler handler
    = new PIMSFeedFileValidationHandler();
         // Create and Configure Parser
    SAXParser parser = factory.newSAXParser();
    parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
    parser.setProperty(NAMESPACE_PROPERTY_KEY, getSchemaFilePath());
         // Set reader with entityResolver for dtd
    XMLReader xmlReader = parser.getXMLReader();
    xmlReader.setEntityResolver(new SAXEntityResolver(this.dtdPath));
    // convert file to URL, as it is a remote file
    URL url = super.getFile().toURL();
    // Open an input stream and parse
    InputStream is = url.openStream();
    xmlReader.setErrorHandler(handler);
    xmlReader.parse(new InputSource(is));
    is.close();
    // get the result of parsing the document by checking the
    // errorhandler's isValid property
    isValid = handler.isValid();
    if (!isValid) {
    LOGGER.warn(handler.getMessage());
    LOGGER.debug("XML file is valid XML? " + isValid);
    } catch (ParserConfigurationException e) {
    LOGGER.error("Error parsing file", e);
    } catch (SAXException e) {
    LOGGER.error("Error parsing file", e);
    } catch (IOException e) {
    throw new FeedException(e);
    return isValid;
    See stack trace below for a little more info.
    2005-01-28 10:24:09,217 [DEBUG] [file] - Attempting validation of file 'cw501205.wa1.xml' with schema at 'C:/pims-feeds/hansard/schema/hansard-v1-9.xsd'
    2005-01-28 10:24:09,217 [DEBUG] [file] - Entity Resolver is using DTD path file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/
    VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
    2005-01-28 10:24:09,227 [DEBUG] [file] - Creating InputSource at: file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
    2005-01-28 10:24:09,718 [WARN ] [file] - org.xml.sax.SAXParseException: Element type "Hansard" must be declared.
    org.xml.sax.SAXParseException: Element type "Session" must be declared.
    org.xml.sax.SAXParseException: Element type "DailyRecord" must be declared.
    org.xml.sax.SAXParseException: Element type "Volume" must be declared.
    org.xml.sax.SAXParseException: Element type "Written" must be declared.
    org.xml.sax.SAXParseException: Element type "WrittenHeading" must be declared.
    org.xml.sax.SAXParseException: Element type "Introduction" must be declared.
    … continues for all the elements in the doc
    2005-01-28 10:24:10,519 [DEBUG] [file] - XML file is valid XML? false
    2005-01-28 10:24:10,519 [WARN ] [file] - Daily Part file 'cw501205.wa1.xml' was not valid XML and was not processed.
    Has anybody seen this behavior before with weblogic and if so how have you resolved the issue.
    Thanks in Advance
    Adam

    Hi David,
    I have checked the ejb-jar.xml file and there is no duplicate values in it and the other things is that the same application is been deployed on OAS 10G and websphere and its working fine. In the forum someone has replied to a similar problem that there is bug in Weblogic 10.3 and its CR no 376292. I am not sure about it, does anyone any information about it.
    Thanks and Regards
    Deepak Dani

  • Want to retrieve null value from xml?

    i m writing this code to get the tag name and values from xml file.
    Now the problem is that
    if my xml file contain any tag whose value is not defined like
    <root>
    <firsttag>first</firsttag>
    <Second></Second><Third>third</Third>
    </root>
    Now look if second tag doesnt contain anything ,then i want to add "null" to vector,but it throws null pointer exception because second tag is empty.
    Vector<String> CSWFinfo = new Vector<String>();
              try {
                   DocumentBuilderFactory factory = DocumentBuilderFactory
                             .newInstance();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   Document doc = builder.parse(new File(xml));
                   Element root = doc.getDocumentElement();
                   NodeList node = root.getChildNodes();
                   for (int i = 0; i < node.getLength(); i++) {
                        Node currentNode = node.item(i);
                        if (isTextNode(currentNode))
                             continue;
                        CSWFinfo.addElement(currentNode.getNodeName());
                        if (null != currentNode.getFirstChild().getNodeValue()) {
                             CSWFinfo.addElement(currentNode.getFirstChild()
                                       .getNodeValue());
                        } else {
                             CSWFinfo.addElement("null");
                   }//end of for loop block
                   System.out.println(CSWFinfo);
              } catch (Exception e) {
                   e.printStackTrace();
                   // TODO: handle exception
              }I am using dom parser .
    Can any one know how to do it????
    Edited by: chauhan2003 on 16 Jun, 2008 12:06 PM

    Are you sure that all currentNode have a firstChild ????
    If your node has no value, it has no child
    So i 'd change code to like look something like:
    if (currentNode.getFirstChild() != null) {
         CSWFinfo.addElement(currentNode.getFirstChild().getNodeValue());
    } else {
         CSWFinfo.addElement("null");
    }

Maybe you are looking for