Set xsi:nill="true" attribute in XML

Hi,
I'm trying to set the xsi:nill attribute in an XML element by scripting. (Javascript)
The setAttribute method doesn't work. And manually adding a new and empty element doesn't work either.
When I leave a field which has binding empty, the nill attribute is automatically set to true.
Why can't I reproduce this by scripting? Does someone have a clue?
Thanks in advance!
Regards,
Kristof

Hi Kristof,
I think you can only do this with a loadXML method, makes it very clumsy by the following code;
var dataItems = xfa.datasets.createNode("dataGroup","items");
xfa.datasets.data.nodes.append(dataItems);
dataItems.loadXML('<item xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>',false,true);
Will produce the following xml
<items>
      <item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</items>
Good Luck
Bruce

Similar Messages

  • XMLBeans - how to get rid of xsi:nill="true"

    Hi,
    I am using the XMLBeans framework bundled with Weblogic. If any element is not set or set to null, the toString method of the complex element returns with an attribute xsi:nill="true" alongf wit the namespace definition for xsi in the XML header. Is there any way to suppress this xsi:nill="true" and the xsi namespace definition. My element entry in the XSD is "<xs:element name="zip" type="xs:string"/>"
    Thanks
    Saran

    Saran
    Were you able to find a solution for this issue please?
    TIA,
    Jaya

  • Xsi:nil="true" in XSLT Map breaks "choose"-"when" loops - annoying

    Hello,
    Handling "nil" element in choose loops breaks my XSLT tranformation.
    As soon as the element is set to nil, either the "otherwise" branch is executed (wrongly) or the XSLT processing stops.
    I test with "count" for the existence of the element. Depending on if it is nil,
    other elements have to be processed in sub-loops.
    I have an XSLT Mapping in JDeveloper.
    It processes a SOAP request in the form:
    <result>
    <customerNew>CUSTOMER_NEW_NAME</customerNew>
    <customerCurrent>CUSTOMER_NAME</customerCurrent>
    </result>
    which can also be:
    <result>
    <customerNew xsi:nil="true">
    </customerNew>
    <customerCurrent>CUSTOMER_NAME</customerCurrent>
    </result>
    To check for Nil I use:
    <xsl:when test='not(boolean(count(/ns0:changeCustomer/result/customerNew))) and contains(/ns0:changeCustomer/result/customer,"USER_NAME_SOME_BODY")'>
    (the xslt maps between two xsd files and we have quite strict schema definitions)
    As soon as I use the test statement in a loop, it breaks, even if I test for "true" and do not simply check for count<1 etc.
    How can I work with the <customerCurrent> Element, even if the previous element is nilled?
    I talked to several experienced developers and nobody could help. They can do checks in plain xsl with xalan, but not in JDeveloper.
    This took me five days already...who can advice?
    Your help is appreciated very much.

    hi user570144
    You write "They can do checks in plain xsl with xalan, but not in JDeveloper.". Could you describe in detail what it is you (would like to) do "in JDeveloper" and how that is different from "plain xsl with xalan"?
    The "contains" function in your xsl:when test example has the expression "/ns0:changeCustomer/result/customer", but in the xml examples you gave there is no "customer" element inside the "result" element, only "customerNew" and "customerCurrent" elements.
    (tip : You can use "Your Control Panel" to make your name visible in forum posts.)
    regards
    Jan Vervecken

  • Setting adapter specific message attributes

    hi xi guroos.
    i just got one doubt in a file to file scenario.
    if i set adapter specifec message attributes in sender file CC.
    and if  i enabled file name checkbox.
    some xi prof saying that the file at recievr directory will get created with the same filename which we r using at source directory .
    if this is the case then no need to create any UDF for getting same file name i n mapping and one more doubt is
    then what is the use of typing filename at reciever file adapter.
    u r anwer will be appreciated.
    waiting for u.
    bey.
    regards.
    seeta ram.

    <i>some xi prof saying that the file at recievr directory will get created with the same filename which we r using at source directory .</i>
    Its true.
    <i>if this is the case then no need to create any UDF for getting same file name i n mapping and one more doubt is</i>
    By marking the checkbox, at receiver u could have the same filename as that of sender. But this is the only requirement, UDF is not required.
    However if u want the filename as a value in Message mapping, u need the UDF. And moreover, there r many more header parameters that could be accessed in UDF
    <i>then what is the use of typing filename at reciever file adapter.</i>
    If u doesnt tick the checkbox (in most of the cases), then XI should know with which name file should be created
    Hope each doubt is cleared
    <i>[Reward if helpful]</i>
    Regards,
    Prateek

  • Spec oversight? Using dynamic-attributes in XML tag files

    I have a couple of tagfiles that generate form elements with specific conventions for the 'name' and 'value' attribute. Basically, a data binding framework.
    Dynamic attributes are useful because you can delegate all the usual html attributes to the generated HTML form element: SELECT, INPUT, id, class etc.
    The usual way to do this is to concatenate all the "pass-through" attributes to a string, and append this string to the element generated:
    <input type="hidden" name="foo" ${dynattrs}/>I'm wondering how to do this in a tagfile in XML format (mytag.tagx), since the XML format forbids syntax like in the example above.
    jsp:attribute won't help much, if it's nested inside a c:forEach: it won't apply to the right element.

    Ran into the same problem with 'optional attributes'. (see post "JSP 2.0 Tag files outputting elements with conditional attributes" http://forum.java.sun.com/thread.jspa?forumID=45&threadID=681033)
    Found a solution that is not very elegant but does work and saves you the trouble of reverting to Java Tags. Consider the following tag-file that outputs an html input-tag with conditional attributes:
    <?xml version="1.0" encoding="utf-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"
         xmlns:c="http://java.sun.com/jsp/jstl/core">
         <jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
         <jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="value" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="disabled" required="false" type="java.lang.Boolean"/>
         <jsp:directive.attribute name="hint" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="cssClass" required="false" type="java.lang.String"/>
         <jsp:text><![CDATA[<input type="text" name="]]><c:out value="${name}"/><![CDATA["]]></jsp:text>
         <c:if test="${!empty id}"><![CDATA[ id="]]><c:out value="${id}"/><![CDATA["]]></c:if>
         <c:if test="${!empty cssClass}"><![CDATA[ class="]]><c:out value="${disabled?(cssClass + '-disabled'):cssClass}"/><![CDATA["]]></c:if>
         <c:if test="${disabled}"><![CDATA[ disabled="disabled"]]></c:if>
         <c:choose>
              <c:when test="${!empty value}"><![CDATA[ value="]]><c:out value="${value}"/><![CDATA["]]></c:when>
              <c:when test="${!empty hint}"><![CDATA[ value="]]><c:out value="${hint}"/><![CDATA[" onfocus="if(this.value==']]><c:out value="${hint}"/><![CDATA[')this.value='';"]]></c:when>
         </c:choose>
         <jsp:text><![CDATA[/>]]></jsp:text>
    </jsp:root>In answer to your question: Yes, it looks like an oversight. Using the jsp:attribute tag in a c:forEach doesn't work because the attribute is then applied to the forEach tag. You would have to put the attribute-tag inside a jsp:body tag (inside the forEach). Then it would apply not to the forEach tag but to the tag enclosing the forEach. However, this doesn't work either, or at least it doesn't work in Tomcat 5.5. Could be a bug though, JSP 2.0 is still very buggy (for instance, using a tagfile inside another tagfile from the same taglib doesn't seem to work either...)
    Anyway, if you ever find a good solution please let me know by posting to this topic!
    TIA

  • Aassign xsi:nill values from element to BPEL variable - Urgent..Plz..

    Hi all,I have a BPEL process which calls a Webservice,and at the end it transforms the output of the Webservice to the Output Variable in my BPEL process,but the thing is this process retuns elements with xsi:nil="true" and I get an error which says
    *Could not initiate the BPEL process because the input xml is not well formed, the reason is :
    Error parsing envelope: (4, 3679) Namespace prefix &apos;xsi&apos; used but not declared. Please correct the input xml.*
    I have verified the WSLD,.bpel file,the xsd..they all have xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    Heres the code of the assign
    <from xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    variable="Invoke_P_getlV_OutputVariable"
    part="parameters"
    query="/ns7:getCViewResponse/ns7:getCViewReturn"/>
    <to xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    variable="outputVariable" part="payload"
    query="/ns1:GetOfferResponse/ns1:getCVResponse/ns1:getCViewReturn"/>
    Please temme how do I get this to wrk...I need to get this working immediatly..

    If you need to "clean" some xml from null values (empty tags) you can create an XSLT (like RemoveNullTags.xsl) with the following code:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <xsl:apply-templates select="@*|node()"/>
    </xsl:template>
    <xsl:template match="@*|node()">
    <xsl:choose>
    <xsl:when test="normalize-space(.)">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:when>
    <xsl:when test="count(./*)">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:when>
    <xsl:otherwise>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>
    This xslt will remove all the empty tags on your XML. So after you create this and paste it on your project, you need to use it into an ASSIGN activity like this:
    <assign name="Remove_Nulls">
    <copy>
    <from expression="ora:processXSLT('RemoveNullTags.xsl',bpws:getVariableData('inputVariable','payload'))"/>
    <to variable="inputVariable" part="payload"
    query="/ns2:writeCollectedDeleteElement"/>
    </copy>
    <copy>
    <from expression="ora:processXSLT('RemoveNullTags.xsl',bpws:getVariableData('inputVariable','payload'))"/>
    <to variable="inputVariable" part="payload"
    query="/ns2:writeCollectedDeleteElement"/>
    </copy>
    </assign>
    As you can see in this sample, i make 2 copy operations because i have xml arrays, so i need a copy operation for each child the xml element have.
    HTH,
    Andres

  • element xsi:type="T3" attribute="USD" 1.99 /element mapping error ......

    Dear All,
    I have following source structure from WSDL file which cannot be change.
    I have map it with target structure by one to one mapping. But getting following error.
    Please guide me do I need to use some node function/technique to map this element with target?
    because direct mapping is giving error.
    Structure         Occurance     Type
    -<Node>             1..1                T1
    --<element>        1..1                T2
    ---<attribute>      1..1                T3
    <element xsi:type="T3" attribute="USD">1.99</element>    it is mapped one to one graphical mapping with   <element></element>
    But in mapping test I am getting error:
    The prefix "xsi" for attribute "xsi:type" associated with an element type "<element>" is not bound.
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: The prefix "xsi" for attribute "xsi:type" associated with an element type "<element>" is not bound.
    at com.sap.aii.mappingtool.tf7.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:253)
    at com.sap.aii.mappingtool.tf7.rt.xparser.XParser.run(XParser.java:79)
    Caused by: org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" associated with an element type "<element>" is not bound.
    Regards

    Hi Raj,
    Thanks for reply..
    I am not trying to map attribute to target element.
    I am trying to map element (having value like 1.99) to the target element.
    This element having type as well as attribute.
    But in testing getting error"The prefix "xsi" for attribute "xsi:type" associated with an element type "element" is not bound."
    But when I am removing type declaration from WSDL then there is no error: example following
    <element attribute="USD">1.99</element> <<-mapped with>> <target element>
    error is coming when source structure is like:
    <element xsi:type="T3" attribute="USD">1.99</element> <<-mapped with>> <target element>
    i.e. source structure is having both type & attribute.
    Regards

  • How to set isIdentityAssertion to true in the SampleLoginModuleImpl code

    I was looking into this sample code.
    http://edocs.beasys.com/wles/docs42/dvspisec/examples.html#1054478
    In the code, how can I make isIdentityAssertion to true.
    How or from where in Client / Webapp can I set the isIdentityAssertion to Options hashmap.
    I want to set isIdentityAssertion to true in certain conditions and sometimes not via the client/app
    Thanks

    In that example the isIdentityAssertion value is determined by code in the SimpleSampleAuthenticationProviderImpl class - which is the actual authentication provider.
    The key methods are getLoginModuleConfiguration and getAssertionModuleConfiguration.
       * Create a JAAS AppConfigurationEntry (which tells JAAS
       * how to create the login module and how to use it) when
       * the simple sample authenticator is used to authenticate (vs. to
       * complete identity assertion).
       * @return An AppConfigurationEntry that tells JAAS how to use the simple sample
       * authenticator's login module for authentication.
      public AppConfigurationEntry getLoginModuleConfiguration()
        // Don't pass in any special options.
        // By default, the simple sample authenticator's login module
        // will authenticate (by checking that the passwords match).
        HashMap options = new HashMap();
        return getConfiguration(options);
       * Create a JAAS AppConfigurationEntry (which tells JAAS
       * how to create the login module and how to use it) when
       * the simple sample authenticator is used to complete identity
       * assertion (vs. to authenticate).
       * @return An AppConfigurationEntry that tells JAAS how to use the simple sample
       * authenticator's login module for identity assertion.
      public AppConfigurationEntry getAssertionModuleConfiguration()
        // Pass an option indicating that we're doing identity
        // assertion (vs. authentication) therefore the login module
        // should only check that the user exists (instead of checking
        // the password)
        HashMap options = new HashMap();
        options.put("IdentityAssertion","true");
        return getConfiguration(options);
      }Also, if your client app is a web app, make sure to add this to your web.xml
       <login-config>
          <auth-method>CLIENT-CERT</auth-method>
          <realm-name>Legacy_ThisElementIsIgnored</realm-name>
        </login-config>

  • How to set adapter specific message attributes on Pi 7.1 inside a Java map.

    Hello,
    how can I set adapter specific message attributes in a Java mapping on PI 7.1.? The TransformationInput grants access to the DynamicConfiguration but the TransformationOutput doesn't. I have found threads refering to the old way of implementing Java mappings (e.g. Get dynamic filename in a Java Mapping (NOT UDF)). But there doesn't seem to be one refering to the actual PI.
    Kind regards,
    Heiko

    Using DynamicConfiguration from the TransformationInput works.

  • Setting Adapter-Specific Message Attributes in an Adapter Module

    Hi!
    I want to set Adapter-Specific Message Attributes in an Adapter Module. Is it possible to configure the Variable Transport Binding in this way?
    Best regards,
    Daniel

    I'd like to know it as well.
    I've checked out the XI AF API but didn't find much.
    One thing that I've observed is that since Module API can treat any Message Class (not only XI Messages), I guess it won't have any specific methods for XI messages (hence, no dynamic configuration). But you could try to get the message object and then treat it as an XI Message (you would be doing the steps that the Java Mapping API do before it calls a Java Mapping class) to get the Map objects (which include the parameters).
    Good luck on it, and let us know if you have any progress!
    Regards,
    Henrique.

  • Any java experts pls help me in converting attribute to XML formats

    Pls help me oh my god i am a newbie here and i am given this project.
    I had just written a XML doc. which looks like this
    <ConsumerTransfer>
    <TransactionId>
    123:123
    </TransactionId>
    <Billingoption>
    cash
    </Billingoption>
    </ConsumerTransfer>
    I need to make this to attributes like
    private String TransactionId()
    private String BillingOption()
    and so on.....
    I need to convert this attributes to XML format
    can any show me an example or the source codes for this
    Really, I appreciate it.
    JimmyKnot

    For such node level operations I think that DOM would be a good idea. So here you go. Look for some nice tutorial for DOM and you got it.
    salut

  • Required Attribute style XML input from BPEL

    Hi all,
    We are integrating JDE 811 with BPEL using ORACLE SOA Suite 10133.
    As per the documentation given http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28996/bpel_pm.htm#CDEICHJB, we created the BPEL process to support transacation from BPEL to JDE 811. As given in the document we generated the WSDL in attribute style. For testing the BPEL Process, they have given the XML input in the document in the format of attribute style as given below :
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/GetYearDescription_SYNC">
    <ns1:jdeRequest type="callmethod">
    <callMethod name="GetYearDescription" runOnError="no">
    <params>
    <param name="mnCalendarYear">58</param>
    </params><onError abort="yes"/>
    </callMethod>
    </ns1:jdeRequest>
    </soap:Body>
    </soap:Envelope>
    and the output we received as
    <GetYearDescription_SYNCProcessResponsehttp://xmlns.oracle.com/GetYearDescription_SYNCPSFTcallmethodDV811*ALL>
    <callMethodGetYearDescriptionnourn:iwaysoftware:jde/services/JDEJAVA_CMFGBASE/B3000260/GetYearDescription>
    <params>
    <parammnCalendarYear>58</param>
    <paramszYearDescription>2058</param>
    </params>
    </callMethod>
    </GetYearDescription_SYNCProcessResponse>
    But, if we use the current schema and give input using normal HTML form on the BPELConsole then the error comes like
    WSIF JCA Execute of operation 'GetYearDescription' failed due to: Error in processing the input document.; nested exception is: javax.resource.ResourceException:
    Error in processing the input document.</summary>
    </part><part name="detail"><detail>javax.resource.ResourceException: Error in processing the input document.
    that is why for outbound integration we need to give raw XML during runtime as input to the bpel process in bpel console manually. and that input looks like
    Also in real time scenario, we are receiving the XML input from a third party software/Adapter that may be a flat file/.xml flat file/DB and we need to pass the similar data in BPEL to the JDE 811. Here we are not able to pass the data to JDE as the adapter accepts the input in attribute style XML.
    If we are trying to enter that input through a flat .xml file then it returns no data, as nothing is passed to that process.
    Any idea how we can process this without giving raw xml input manually during run time, means using normal HTML Form.
    if it is not possible then please tell me what will be the required XML that we have to pass as input in that flat file.
    Thanks,
    Anindya

    Hi All,
    SOAP based input is required for any BPEL process for testing in BPEL Console.
    We have created a BPEL process which is successfully receiving data from 3rd party and it is not in a SOAP format.
    That is why we are entering input manually (I have already described input in above post) while testing that BPEL process. and we can receive proper output (i have already specified what i am getting as output in my above post.)
    But in real time scenario we cant give input manually.
    how can we achieve SOAP based invocation during runtime??
    I hope my question is clear to all.
    please suggest me if anybody have any idea about this.
    Regards
    Anindya

  • How to remove elements/attributes from XML using Xpath in XSLT ??

    Hello ,
    Is there anyway or method of Xpath from which I can delete the elements and attributes from XML at runtime ??
    Like I have such XML and I have to remove per attribute highlighted below
    <person per="and">
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    And want a result like this
    <person>
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    Thanks

    To achieve this you can use the bpelx:remove function: http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHJBJFD
    your assign will look like:
    <bpel:assign>
    <bpelx:remove>
    <target variable="person" query="/person/@per" />
    </bpelx:remove>
    </bpel:assign>
    Regards,
    Melvin

  • Setting up JNDI resources in web.xml only

    Hi,
    I'm using Tomca 4.0 LE and JDK 1.4.0_01.
    I've been using a database connection pool on my local machine by editing the server.xml file and web.xml. However, I need to move the webapp onto a web hosting compaines server (same tomcat and jdk version). I cannot edit the server.xml file, so I need to set up my JNDI resource in web.xml only.
    I have done this (in web.xml):
    <resource-ref>
          <res-ref-name>jdbc/ocb_clients</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
      </resource-ref> Now, before when I had this all set up in web.xml, I had a list of <ResourceParams> within the <context> element:
    <ResourceParams name="jdbc/ocb_clients">
        <parameter>
          <name>factory</name>
          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <parameter>
         <name>username</name>
         <value>username_here</value>
        </parameter>
        <parameter>
         <name>password</name>
         <value>password_here</value>
        </parameter>          
        <parameter>
           <name>driverClassName</name>
           <value>org.gjt.mm.mysql.Driver</value>
        </parameter>       
        <parameter>
          <name>url</name>
          <value>jdbc:mysql://localhost:3306/ocb_clients</value>
        </parameter>
      </ResourceParams>These parameters are obviously needed for the datasource to work. How can I set these up just using web.xml?
    Also, this code is from a servlet that I have loading on tomcat startup. Will this still work with the new configuration?
    public void init() throws ServletException
         DataSource ds = null;       
         try
           //Set up the inital context
           Context ctx = new InitialContext();
           //Look up the database
           ds = (DataSource) ctx.lookup("java:comp/env/jdbc/ocb_clients");
         catch(NamingException nameE)
           System.err.println("Error looking up database: " + nameE);
         //Add the datasource to the application scope
         getServletContext().setAttribute("ocbDatabase", ds);
      }Any help is greatly appricated,
    Thanks, Mel.

    I am Having exactly the same problem with tomcat 5.0. I have tried to do everything mention as solutions at different fourums but I failed.
    BTW I am using MySQL
    Thanks
    Dibakar

  • "Unterminated value for attribute '' in XML Tag ''.(SBL-UIF-00265)"

    Getting this message when I do Edit Web Layout for a view in Siebel tools 7.8.2 "Unterminated value for attribute '' in XML tag ''.(SBL-UIF-00265)"...Anyone have any idea why I am getting this message?

    Thanks Joseph,
    Actually I looked at the Refer ID 1280569.1 before also, some how I could not figured it out the exact location as I was searching for two "(double quotes).
    Today I tried again and finally I found out the culprit. In my case actually there was no two double quotes, instead the " (double quote) was missing.
    Thanks again.
    Edited by: user624054 on Oct 5, 2011 8:10 AM

Maybe you are looking for