XQuery Mapper - leave out tags with empty values, how to?

Hi everybody,
I am using the XQueryMapper to map 2 XML schemas and get an output for a Webservice but I am unable to get rid off the tag elements that are empty (i.e. there is no content within the tag).
For example:
If my output is:
<customer>
<first_name>John</first_name>
<last_name></last_name>
<title></title>
<company>1BRN</company>
<customer>
What I would like to obtain is:
<customer>
<first_name>John</first_name>
<company>1BRN</company>
<customer>
What do you have to do to avoid that? If I do NOT use XQuery then that happens as a default behaviour.
Unfortunately I have to use it.
Cheers,
Manuel Silva

I found the solution to the problem. To avoid getting tags with no content the way to do it is defining properly your schema. Just adding minOccurs="0" if the element is optional, when it returns with no content, it does not come up in the output.
<xs:element name="order_type" minOccurs="0" maxOccurs="1" type="xs:string"/>
XQuery builds different constructs behind the scenes depending how your elements are defined.
Cheers,
Manuel
Message was edited by manuel.silva at Aug 27, 2004 1:58 AM

Similar Messages

  • Tags with empty body can't work in WLS 7.0SP5

    Hi, I'm now using WLS 7.0 SP5. In my JSPs, I have the following tag with empty body:
              <jsp:setProperty name="xxxForm" property="style123" value="abc"/>
              It doesn't work. The script works if I change that into:
              <jsp:setProperty name="xxxForm" property="style123" value="abc"></jsp:setProperty>
              However I have found that this problem should be fixed in WLS 7.0 SP1 already. (http://support.bea.com/application?namespace=askbea&origin=ask_bea_answer.jsp&event=link.view_answer_page_solution&answerpage=solution&page=wls/S-13458.htm) Any hint about this strange problem? Thanks in advance!

    HI,
    I am using RangeTimeStep for displaying data in time range. I dont know understand whats wrong with this code as it displays graph with some other criteria that I donot specify in RangeTimeStep. The member of Day is like 02/16/2003 and member value is DAY_460. Although I passed both the values but still getting the same graph.
    Would you please tell me whats wrong in the code?
    Presentation graph1 = (Presentation)pageContext.findAttribute("ahb_country_pres1");
    ThinGraph bubbleGraph = (ThinGraph)graph1.getView();
    QueryClient query = (QueryClient) bubbleGraph.getDataSource();
    String strTimeDim = "MDM!D_RMI_RIM_OWNER.TIME";
    String strStandardHier = "MDM!D_RMI_RIM_OWNER.TIME.TIME_HIER";
    Vector vec = new Vector();
    vec.addElement("MDM!D_RMI_RIM_OWNER.TIME.TIME_HIER.L.DAY");
    Selection sel1 = query.findSelection(strTimeDim);
    RangeTimeStep rangeTimestep1 = new RangeTimeStep(strTimeDim,strStandardHier, vec, new Integer (2), RangeTimeStep.BEFORE,"DAY_460");
    rangeTimestep1.setAction(RangeTimeStep.KEEP);
    sel1.removeAllSteps();
    sel1.addStep (rangeTimestep1);
    query.applySelections(new Selection[]{sel1});
    query.refreshAll();
    Regards,
    Aamir

  • Cfprocparam type="OUT" brings back empty value

    ISSUE OBJECTIVE:
    After conversion from CF 5 to CFMX 7, <cfprocparam
    type="OUT" brings back empty value
    OUR STORED PROC:
    <cfstoredproc procedure="sp_rass_user_guidance"
    datasource="#rass_data_source#" returncode="YES">
    <cfprocparam type="IN" dbvarname="@status" value="2"
    cfsqltype="CF_SQL_INTEGER">
    <cfprocparam type="IN" dbvarname="@addname"
    value="#form.newVersionName#" cfsqltype="CF_SQL_CHAR">
    <cfprocparam type="IN" dbvarname="@userid"
    value="#client.userid#" cfsqltype="CF_SQL_CHAR">
    <cfprocparam type="OUT" dbvarname="@rc" variable="rc"
    cfsqltype="CF_SQL_SMALLINT">
    <cfprocparam type="OUT" dbvarname="@reason"
    variable="reason" cfsqltype="CF_SQL_VARCHAR">
    <cfprocresult name="retrieveVersions">
    </cfstoredproc>
    In SQL query anylizer this stored proc brings back some
    values for variables rc and reason, but empty values on CF pages.
    Cf gurus please help

    Something sounds fishy. I'm not sure what more you could do
    at the database, since PL/SQL VARCHAR2 variables have a max length
    of 32,767 (as opposed to the VARCHAR2 data type limit of 4000
    bytes). Should let you return more than 900 bytes! Perhaps you may
    need to look into your kernal parameters, or Oracle parameters like
    sga_max_size, etc.
    You say that "Long Buffer Varchar is checked and set to
    max"... what value? Also, what version of ColdFusion are you using,
    as I can not "check" Long Text Buffer (chr) but only supply a
    value, or I can check CLOB (or BLOB), where checking CLOB will
    override the Long Text Buffer (chr) value.
    Phil

  • Show rows with empty values

    Hello,
    We are creating a cross tab report, with products as the columns, and relationship managers with direct and shared revenue displayed across the rows.
    For Eg
    Relationship Manager    Coverage         Product1   Product2   Product3   Product4
    Bob                                Direct                 100,           0,               35,            50
                                          Shared                0,              0,               15,            0
    Alex                               Direct                  15,            25,             40,            10
                                          Shared                5,              0,               5,               0
    George                          Direct                  0,               0,              0,               30
                                          Shared                0,               0,              0,               5
    The problem lies when either one of the products has no values, or one of the relationship managers has no direct or shared revenues. If one of the products has no revenues, it disappears, and also when one of the RMs has no direct or shared revenues, the Direct or Shared row disappears.
    I have tried to create a second query just included the Coverage variable, and using this variable in Query 2 with the RM variable from query 1, along with checking the "Show Rows with Empty Measure values", "Show Rows with Empty Dimension Values" and "Show when empty", but it still does not appear to work.
    It only shows rows with values in them, and shows the rows with empty values at the end with no RM.
    I have not tried to solve for empty columns yet.
    Help with this would be much appreciated!!!!!!!!
    Thank you

    Hi ,
    I think you can resolve this issue following ways ,
    you need create another query  ( Ex :Qauery2 ) add Product object and RM (Direct,shared) object only without  conation. So now query2 result wil have all product and RM(Direct,shared).
    Merge the Product object and RM  between query1 and query2
    Now create table using Product and RM from query2 and measure value from query1.  Now you will get row even there is no data.
    If you want try this sample report using efasion unvierse.
    1) Add year ,state and Discount objects  and apply condition Year Not in list "2004"  and state Not in list "California "
    2) run this query and create the cross tab table . Now you will not get 2004 column  and California row in table.
    3) Create query2 add Year and State only without any condition , run the query. Now query 2 will display all state and year .
    4) Merge the column Year and State between query1 and query2
    4) Create the cross table ussing Year and state from query2 and Discount from Query1
    Now cross table will show 2004 and California ,even there is not in query 1.
    I hope this will help you.
    Ponnarasu
    Edited by: ponnarasuk on Dec 7, 2011 12:48 PM

  • Records with a picklist field with empty values can't be seen from a report

    Records with a picklist field with empty values can't be seen from a report. I've created a report that have a picklist as a column. When there is no values the record(s) associated to this picklist don't appear. Do you know what are the common causes for this event?
    Regards
    Arturo

    Hi samrat chakraborty ,
    go to SUIM > roles > roles by complexselection criteria>
    under the selection according to authorization values give the object's  form SU53 screen and press enter it will asks the values for given object pass the values as per the SU53 and execute it will give the list of roles.... capture the roles. The user gets access if you give the any one of the listed roles is assigned, assign the role as per your approval process.
    Check with the below link for more assistence:
    http://help.sap.com/saphelp_erp2004/helpdata/EN/71/8fba30840c6e4d90da3526971cc684/frameset.htm
    Regards,
    S.Manu.

  • How to set an attribute of a HTML tag with a value in the Servlet

    I have a HTML page and a Servlet.
    The HTML page sends a request to the Servlet.
    The Servlet has to read the contents of the HTML page. When the Servlet encounters the body tag it should set the bgcolor attribute of the body tag with a string(For eg.a string called color with a value blue) in the servlet.
    After doing this the Servlet has to update the original HTML page with the changes (in the body tag).
    I need a help on this.

    Hi sangee,
    you could get what you want to do by using a Java Server Page instead of both a HTML page and a Servlet.
    I should code something like this:
    <%Strung color="yourColor"%>
    <html><head><title></title></head>
    <body bgcolor="<%=color%>
    </body>
    </html>

  • Smartform table with empty value in cell

    Hi,
    in my smartform i´ve got a table with four fields:
    e.g. MATERIAL QUANTITY BAGS TEXT
    the question is that if value of field BAGS is initial the smartform displays
    the value of field TEXT in the cell of field bags,
    that is, if BAGS = INITIAL i would get:
    MATERIALl QUANTITY TEXT
    (the value of field TEXT has been shifted to the left)
    What do i have to do in order to avoid the shifting of values to the left if one
    of the cells has an empty value?
    Best regards.

    Hi,
       I guess you are using tabs to print the four fields of tables.
    As those are fields of tables make use of  TABLES concept in smartform instead of tabs. Then it will print in the exact location.
    Give each field as one cell in the table.
    Br,
    Laxmi.

  • Display xml- tags with NULL - value

    Hello
    is there a way to display a tag while the value is null in this matter :
    select
    xmlforest(AFRAGNR_1, AFRAGNR_2 , AFRAGNR_3 ,AFRAGNR_4 )
    AS XML
    FROM VIEW_ABC WHERE x = v1 and y = v2
    -- result: :AFRAGNR_3 and AFRAGNR_4 is null and not displayed:
    XML
    &lt;AFRAGNR_1&gt;J&lt;/AFRAGNR_1&gt;&lt;AFRAGNR_2&gt;J&lt;/AFRAGNR_2&gt;
    -- by using this, its not the result I want to get,
    select
    xmlelement( "AFRAGNR_1" , AFRAGNR_1 ) AFRAGNR_1
    ,xmlelement( "AFRAGNR_2" , AFRAGNR_2 ) AFRAGNR_2
    ,xmlelement( "AFRAGNR_3" , AFRAGNR_3 ) AFRAGNR_3
    ,xmlelement( "AFRAGNR_4" , AFRAGNR_4 ) AFRAGNR_4
    FROM VIEW_ABC WHERE x = v1 and y = v2
    another way ?
    regards Norbert
    Edited by: astramare on Nov 20, 2008 12:32 PM

    I have the same problem:
    - I need to generate XML in format <element id="1" />
    - I need to pass some null values:
    SELECT XMLElement ( "ShipToAddress"
    , XMLAttributes ( customer_id as "CustomerNo"
    , '' as "Code"
    , substr(name,1,30) as "Name"
    , '' as "Name2"
    , substr(street||' '||house_nr,1,30) as "Address"
    , '' as "Address2"
    , city as "City"
    , last_name ||' '|| first_name as "Contact"
    , phone as "PhoneNo"
    , '' as "CountryCode"
    , fax as "FaxNo"
    , zip_cd||' '||postal_code_extention as "PostCode"
    , '' as "County"
    , email as "EMail"
    , website as "HomePage")) customer
    FROM customers;
    result should be:
    <ShipToAddress CustomerNo="100001004" Code="3" Name="4C
    Cons" Name2="" Address="Metrologielaan" Address2="" City="BRUSSEL" Contact="" PhoneNo="" CountryCode="BE" FaxNo="" PostCode="1130" County="" EMail="" HomePage="" />
    and NOT (this is my result at the moment):
    <ShipToAddress CustomerNo="100001004" Code="3" Name="4C
    Cons" Address="Metrologielaan" City="BRUSSEL" CountryCode="BE" PostCode="1130"></ShipToAddress>;
    Can someone help me with this please?
    Edited by: willeha on Mar 5, 2009 7:18 AM

  • Can I use c:out JSTL tag with int values?

    I am attempting to c:out an int variable in my JSP using a JSTL core tag. First is it possible to do c:out an int? Second, if it is...can anyone see anything wrong with my code?
    This is the error log I am getting:
    <Oct 7, 2008 10:20:29 AM MDT> <Error> <HTTP> <BEA-101017> <[ServletContext(id=20
    462449,name=rconnect,context-path=/rconnect)] Root cause of ServletException.
    javax.servlet.jsp.JspException: ServletException in '/WEB-INF/pages/signup/summa
    ry.jsp': An error occurred while evaluating custom action attribute "value" with
    value "${orderForm.numOtaModulesSelected}": Unable to find a value for "numOtaM
    odulesSelected" in object of class "com.echostar.rconnect.struts.formbeans.Order
    FormBean" using operator "." (null)
    This is the code:
    <c:out value="${orderForm.numOtaModulesSelected}" />where numOtaModulesSelected is defined as a private member variable of the OrderFormBean
    I have included the taglib.
    Thanks to anyone who can help

    Your OrderFormBean class needs to implement a getNumOtaModulesSelected method for that to work. The expression language won't let you get at fields, you need to access it via JavaBeans properties.

  • Parse XML file, read a tag with whitespaces value.

    Hi all,
    I've got a problem with reading a spaced value record from xml file using sys.xmltype.
    My xml file contains the following:
    <?xml version = '1.0'?>;
    <ROWSET>
    <ROW num="1">
    <FIRSTNAME>Nik</FIRSTNAME>
    <LASTNAME> </LASTNAME>
    <AGE>30</AGE>
    </ROW>
    </ROWSET>
    As you see last name contains four spaces!
    Now when I'm trying to read value from LASTNAME record I'm getting a NULL value, but I want it to return me those 4 spaces as they are.
    Here is a short code description of what I'm doing:
    declare
         xml sys.xmltype;
    str1 varchar2(100);
    str2 varchar2(100);
    begin
         xml := sys.xmltype.createxml(fileContentClob); -- I copy the file content into the fileContentClob variable.
         If xml.existsnode('//ROW['1']/LASTNAME') > 0 Then -- This condition evaluates as true
    str1 := xml.extract('//ROW['1']/LASTNAME/text()'); -- str1 gets NULL value :(, I want spaces as they are in the file.
    str2 := xml.extract('//ROW[' || 1 || ']/LASTNAME').getstringval; -- str2 gets <LASTNAME/> null tag :(.
         End If;     
    end;
    Seems like when it createxml from the fileContentClob it ignores the spaces and find LASTNAME as a null field.
    Do you have any suggestions on how can I fix that, so I can read whitespaces as they are in the file?
    I generate the file also using a xml toolpackage from oracle:
    declare
    strSqlStmt Varchar2(300);
    varCtxHdl dbms_xmlquery.ctxhandle;
    varClob Clob;
    begin
    strSqlStmt := 'SELECT FIRSTNAME,LASTNAME,AGE FROM USERS WHERE ROWNUM =1';
    varCtxHdl := dbms_xmlquery.newcontext(strSqlStmt);
    varClob := dbms_xmlquery.getxml(varCtxHdl);
    dbms_xmlquery.closecontext(varCtxHdl);
    End;

    Even if the STORE AS CLOB clause is used to store the data and preserve whitespace for the XML, the actual extraction of data seems to be removing whitespace...
    SQL> ed
    Wrote file afiedt.buf
      1* create table t (xml xmltype) xmltype xml store as clob
    SQL> /
    Table created.
    SQL> ed
    Wrote file afiedt.buf
      1  insert into t (xml)
      2  values (q'[<?xml version = '1.0'?>
      3  <ROWSET>
      4  <ROW num="1">
      5  <FIRSTNAME>Nik</FIRSTNAME>
      6  <LASTNAME>    </LASTNAME>
      7  <AGE>30</AGE>
      8  </ROW>
      9* </ROWSET>]')
    SQL> /
    1 row created.
    SQL> select * from t;
    XML
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <FIRSTNAME>Nik</FIRSTNAME>
    <LASTNAME>    </LASTNAME>
    <AGE>30</AGE>
    </ROW>
    </ROWSET>
    SQL> set null NULL
    SQL> select x.rnum, x.firstname, x.lastname, x.age
      2  from t
      3      ,xmltable('/ROWSET/ROW'
      4                PASSING t.xml
      5                COLUMNS rnum      NUMBER       PATH '/ROW/@num'
      6                       ,firstname VARCHAR2(10) PATH '/ROW/FIRSTNAME'
      7                       ,lastname  VARCHAR2(10) PATH '/ROW/LASTNAME'
      8                       ,age       NUMBER       PATH '/ROW/AGE'
      9               ) x
    10  /
          RNUM FIRSTNAME  LASTNAME          AGE
             1 Nik        NULL               30
    SQL>

  • Issue with empty value of LOV of first row after clicking on add row button

    JDeveloper 11.1.14
    I have a page with table-form layout.
    In the form I have two detail tables on the same page (tabbed).
    I have an issue with using model-choicelist LOV's in the detail tables.
    I am able to add a new row in the detail table, select a value from the model-choiceList LOV (which is required) and save the new row.
    After adding another row in this table the value of the model-choiceList LOV in the previous row is suddenly empty on the screen. It is not empty in the database,
    I have checked it in the datbase. Only the value of the LOV of the first row on the page is being cleared after clicking on the add row button.
    After saving the new row I get the following error on the screen:
    Error: a selection is required. --> first row
    Does anyone have a suggestion how to solve this issue?

    After adding another row in this table the value of the model-choiceList LOV in the previous row is suddenly empty on the screen. It is not empty in the database, Is the complete LOV blank or only the selected value .. can you try putting autoSubmit=true in the LOV and try ? Also check if you have any partialTriggers on the LOV from the add button ?

  • PHP+MySQL query with empty value

    Hi!
    Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP
    4.2.3.
    We had problem when a submitted value for 'regionID' in the
    submit page
    was left blank and the following error message appears in the
    result page:
    "You have an error in your SQL syntax. Check the manual that
    corresponds
    to your MySQL server version for the right syntax to use near
    'LIMIT 0,
    3' at line 1"
    The problem was solved by adding at the top of the page:
    <?php
    if (isset($_POST['regionID']) &&
    empty($_POST['regionID'])) {
    $_POST['regionID'] = '0';
    ?>
    How to change the above code to retrieve ALL records when an
    empty \
    blank value is submitted for 'regionID'?
    TIA
    Nanu

    bbgirl wrote:
    > Something I picked up at a PHP/MySQL seminar...
    $_REQUEST works in place of
    > either $_GET or $_POST. It basically means use either
    get or post. But it is
    > less precise because it can pick up either variable and
    has to think about the
    > request...
    I'm afraid you've picked up rather poor information.
    $_REQUEST relies on
    register_globals being turned on. Since register_globals is
    considered a
    major security risk, the default setting has been off since
    April 2002.
    Many hosting companies have turned register_globals on, in
    spite of the
    security problems, because so many poorly written scripts
    rely on it.
    The PHP development team has decided to resolve this security
    issue once
    and for all by removing register_globals from PHP 6.
    Forget $_REQUEST. Use $_POST and $_GET always. It's safer,
    and it's
    futureproof.
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • DMEE - How to supress tags with no values

    Hi,
    I have created a payment format tree using transaction DMEE and the values are getting generated as required. But the problem is, when i dont have any values in a given node, I dont want to display the tag for that particular node.
    For example,
    say, for my format tree is as below:
    PmtInf
    --> PmtTpInf
           --> Cd
    Say, Cd has a value of 2, in XML it is displayed as <Cd>2</Cd>.
    When Cd is empty, it is displayed as <Cd/>.
    In case I dont have value in the node, I dont want to display this tag.
    Any idea on how to achieve this?
    We tried using the field "Status" in the Attributes by setting it as 2. [ 2 - Optional: if object has no value, object is skipped].
    Still it doesnt work, and the empty tag gets displayed in the XML file.
    Any help is highly appreciated.
    Thanks a lot.
    Regards,
    Suganya

    Hi Shannon,
    I understand that it is possible using conditions tab of the given node.
    Can you exactly tell me the condition that you used?
    I am using some exit function module to populate my node.
    So what should be the condition that I should put there to chck that the value fetched from the exit FM is not blank?
    Thanks a lot for your help.
    Regards,
    Suganya

  • How to replace namespace tag with new value using -JAVA MAPPING

    Hi Guys,
    I need to replace namespace Tag in Target xml with a new value.
    For Eg: My namespace Tag is - <ns0:TestHeader xmlns:ns0="http://0020.TestHeader.SS.com">
    I want My target xml to have value- <ns0:TestHeader>
    How can i achieve it using JAVA mapping?
    Can you provide me the code to do so.

    Sarjana,
    Not well-formed XML is only possible by Java Mapping. Please use below replace logic in Java map.
    inputContent.replaceAll("<ns0:TestHeader xmlns:ns0=\"http://0020.TestHeader.SS.com\">", "<ns0:TestHeader>");
    Link1, Link2.

  • Filter out datasets with empty field

    Hi Experts,
    I want to filter a Table: Filter out all datasets where the FieldXY is empty. I tried with the filteroperator with expressions like '... is equal to NOT NULL' or '... is equal to NOT ''', but without result! Can some one give me the right expression?
    Kind regards, Bernd

    Hi Bernd,
    This was a bug in SP04
    I tried the
    =!ISNULL(@FieldXY)
    on SP05 and it worked.
    Sorry for the confusion.
    Best Regards,
    Udi

Maybe you are looking for

  • Need help to display geo-characteristics on a map in SAP BW report

    Hello all, Currently I am struggling to display plants on a map of Germany in a SAP BW report, using dynamic geo-characteristics in SAP BW. We do not have the ESRI software ArcView (my superior does not want to buy it), so I have to be successful wit

  • How can I upload photos fromiPhoto on iPad 3 to an iMac?

    Hi I have just purchased an iPad3 and have used iPhoto for iPad to edit photos and add captions.  Via Photostream all the original unedited photos uploaded have now been synced with iPhoto on my iMac. What I want to do is to upload the edited iPad  i

  • I thought FCP X 10.1.1 could handle non-standard frame sizes?

    Yesterday I was demonstrating FCP X 10.1.1 to a friend. As time was limited I imported the nearest piece of video I could find, which happened to be part of an H.264  video tutorial with a frame size of  960 x 600 and a frame rate of 30fps. I hit the

  • HTML Help in a JAVA Application?

    Hope someone can answer this question. I thought that there was a way to use HTML Help with a JAVA application, but I am being advised by my programmer that I must use JAVA Help. I don't have a problem with using RoboHelp to convert my HTML Help file

  • Oracle DB on Redhat 5 connectivity with MS sql Server

    Dear All, Env. Oracle EBS R12 – DB 10gR2 with RAC on Redhat linux 5 We want to connect OracleDB10gR2 to MS sql Server 2000/2005 on Windows 2003. What is the way or which utility(ODBC) can be used to do this, anybody help us with detail?? Regards