How to generate empty tag using XMLForest

Hi,
I am creating an XML document using XMLAgg, XMLForest and XMlElement functions.
At some point I have an XMLForest embedded in the other XMLForest
XMLForest( e.indicator as "col1",
           e.participant_id as "col2",
  XMLForest( tableAlias.col11 as "address1",
             tableAlias.col12 as "address2",            
           ) as "items",
)           and within the last one I have some expressions which are empty, so the XML tags are not generated, however I have to have an empty tags:
<address2></address2>I tried to replace an expression using "NVL" or "DECODE", but the results were the same.
I also tried to replace an embedded XMLForest with an XMLElement :
XMLForest( e.indicator as "col1",
           e.participant_id as "col2",
  *XMLElement("items"*
             *XMLElement("address1"),*
             *XMLElement("address2")*
           *) as "items",*)           however it created 2 <items> tags :
    <items>
         <items>
            <address1>value</address1>
            <address2></address2>
         </items>
     </items> I am working with Oracle 11.2.0 db.
Is there any way to generate an empty tag when using XMLForest function?
thank you in advance.
Edited by: user624274 on Apr 3, 2013 8:52 AM
Edited by: user624274 on Apr 3, 2013 8:53 AM

Hello Odie_63.
Your argument is valid, but it does not mean the solution I provided is bad.
If you are concerned about the size of the result, it is simple, you can use like:
REPLACE(XMLForest( NVL(e.indicator, '#NULLValue#') as "col1",  NVL(e.participant_id, '#NULLValue#') as "col2").getClobVal(), '#NULLValue#', '')
According to Oracle documentation, REPLACE is smart and will return a CLOB (not a varchar2) because it changes the type of return according to the type of the first parameter. So you will not have issues with size.
I believe the first question was related to use the final result to record to a table or send to another system (to use as integration). If it will be used just in a select field, it does not matter if it is not there or if it is there as NULL, the select of the field will always return ''.
Other hint, I never use xmltype to store on database, because it is not compatible with other databases or integration tools. I use CLOB because it is the natural serialization of the object and I can convert and work with it inside and outside Oracle.
But that is up to the architect and/or developer. If the system is running only on Oracle and there is no integration, maybe xmltype will save a lot of time in conversions.
Regards.
Rodolpho

Similar Messages

  • How to generate addm report using grid

    Hi,
    how to generate addm report using grid, please provide any relevant doc/links etc.
    Thanks in advance.

    how to generate addm report using grid, please provide any relevant doc/links etc.When you start with the wrong question, no matter how good an answer you get, it won't matter very much.
    what is best way to divide board into 2 pieces using a hammer?
    Edited by: sb92075 on Oct 25, 2010 7:22 AM

  • How to generate multiple sheets using xml publisher

    Hi,
    how to generate multiple sheets using xml publisher.
    Thanks,
    Nur

    http://lmgtfy.com/?q=how+to+generate+multiple+sheets+using+xml+publisher

  • How to generate Webservices.xml using tool in Sun One App Server?

    How to generate Webservices.xml using tool in Sun One App Server?

    Hi,
    The build.xml file should be in a directory from where
    you are running the asant command.
    To resolve the common.xml file not found error,
    open your build.xml and check from which location the common.xml file is incuded.
    In the sample application it is four directories above
    the directory where build.xml is located.
    You can copy the common.xml in the current directory and then change the following in your build.xml
    <!ENTITY include SYSTEM "../../../../common.xml">
    to <!ENTITY include SYSTEM "common.xml">
    Hope this helps.
    Get back in case you have more issues

  • How to generate pwm pulse using NI DAQ in MATLAB

    hi everyone. please tell me how to generate pwm pulses using Ni DAQ card in MATLAB Simulink. if through coding is possible then post the corresponding code.....reply me 

    Make sure you have installed the Measurement studio support for VB 6.0 then you will be able to find examples in the folder below on win7 and 8.
    C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples
    Narrow down to Analog Output and choose update voltage example for measurement studio.
    You also have the possibility to use DAQ assistant if you have measurement studio installed. This function is a configuration type programming. After going through the configuration Wizard code is automatically scripted for you so that you can output the voltage you need. Read more about DAQ assistant in the blow link.
    http://www.ni.com/white-paper/4652/en/
    Best Regards
    Jonas Mäki
    Applications Engineering
    National Instruments

  • How to remove empty tags respecting the schema contraints?

    Hi,
    I'm generating an XML document with XSLT. This document have some empty tags. My question is about to remove all empty tags only if they are defined as optionnals in the schema.
    Is this possible with the DOM?
    Thanks in advance,
    Philippe

    With DOM3 validation api, elements/attributes may be checked if they may be removed.
    -Check if the element is empty; getFirstChild() method returns null.
    -Check if the element may be removed with DOM 3 Validation API.

  • How to remove empty tags from XML

    Hello,
    I have a XML file which contains some empty tags and some values with "?". I need to remove all empty tags and tags which have a value "?".
    Sample Data:
    <a>
    <b></b>
    <c> Hello </c>
    <d>world ?</d>
    <e>oracle</e>
    </a>
    Expected result:
    <a>
    <c> Hello </c>
    <e>oracle</e>
    </a>
    Thank you for your time.
    Thanks,
    Edited by: 850749 on Apr 7, 2011 6:25 PM

    Dear Odie,
    May I make your example a bit more complicated by adding an additional complexType, please:
    ---Original ----
    <DEPT>
    <EMPID>1</EMPID>
    <EMPNAME>Martin Chadderton</EMPNAME>
    <SALARY>??</SALARY>
    <SALARYq></SALARYq>
    </DEPT>
    ----- New ----
    <DEPT>
    <EMPID>1</EMPID>
    <EMPNAME>Martin Chadderton</EMPNAME>
    <SALARY>??</SALARY>
    <SALARYq></SALARYq>
    <EMPLMNT_HISTORY>
    <DEVISION>1</DEVISION>
    <FROM_DATE>2011-01-01 </FROM_DATE>
    <TO_DATE></TO_DATE>
    </EMPLMNT_HISTORY>
    </DEPT>
    Your solution works perfectly for <SALARY>, but how would you suggest also to deal with <TO_DATE> ?
    Massive thanks for your help!
    N.B. Just to emphasise, in my case I have 3 levels (complexType > complexType > complexType) and many elements and I would like to know if there is any generic option to say
    to remove all the empty elements from the result, as it causes to the SSJ (Systinet) Webservice to crash.

  • How to identify empty InfoObjects used in a Cube

    Hello Gurus!
    I need some help. How do I find empty InfoObjects used in a Cube?
    I have 20+ Cubes and I need to identify those objects in the cubes, which are empty /not filled/. Statistics
    Except writing an ABAP
    Thanks in advance
    Martin

    Thank you for such fast response!
    @Tarak: unfortunately in the TX: LISTCUBE /or display data via RSA1/ you cannot display all characteristics for 'larger' cubes. Additionally you would have to select filter on each characteristics separately.
    @Aduri: could you please give me a more detailed hint? I know cube statistics for load requests, for storage space, for DB time, for IO in report use, but not for IO data, no data.
    @Analyst: Transactional data. Well, to check each mapping for 20+ cubes is a possibility. I have hoped to find a faster way, however.

  • How to remove empty tag.

    Hi,
    I have a scenario IDOC-XI-JDBC
    From IDOC we are using change pointers and when something has been changed then those fields are being sent out but other few empty fields were coming out and to avoid that I used mapWithDefault to avoid the empty tags as  target system used to error out.
    But now when any field is empty coming from change pointer is also being caught in mapWithDefault....whereas it is expected to send blank.
    Can anyone of you suggest any solution.
    Regards
    Ria

    Hi Ria,
    You can use if without else and check the field exist or not in the source and then map it to target.
    This is a bit tricky & if you dont feel comfortable with it, then use advanced UDF, and explicitely check ResultList.SUPPRESS object and remove it in UDF and form an output stream.
    You can use any of the two.
    Regards,
    Shri.
    <removed by moderator>
    Edited by: Mike Pokraka on Jul 28, 2008 5:05 PM

  • Validate empty tags using xquery

    Hi All,
    I have a question regarding xquery flwor exrpession. My scenarion is I need to validate an xml input file wether one of its elements is empty so I created an xquery to validate. However, I receive an error when I try to make an input file that has a repeating element.
    Below is my xquery for validating empty tags:
    declare namespace cred="http://www.pldt.com.ph/eai/service/component/CreditService/";
    declare namespace com="http://www.pldt.com.ph/eai/Common";
    declare variable $inputdata as element(cred:PushQuote) external;
    let $QuoteNumber := data($inputdata/PushQuote/com:QuoteNumber)
    let $AccountNumber := data($inputdata/PushQuote/com:CustomerAccountNumber)
    let $QuoteLineItemList := $inputdata/PushQuote/com:LineItemList
    for $data in $inputdata
    return
    if (fn:string-length($QuoteNumber) > 0 and
    fn:string-length($AccountNumber) > 0)
    then
    for $quoteLineItem in $QuoteLineItemList
    return
    if (fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:LineNumber)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:ProductCatalogId)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:Product)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:Quantity)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:Mrc)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:Currency)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:LastUpdateDate)) > 0 and
    fn:string-length(data($quoteLineItem/com:QuoteLineItem/com:LastUpdatedBy)))
    then
    "0"
    else
    "1"
    else
    "1"
    Below is my input xml document:
    <cred:PushQuote xmlns:com="http://www.pldt.com.ph/eai/Common" xmlns:cred="http://www.pldt.com.ph/eai/service/component/CreditService/">
    <PushQuote>
    <com:QuoteNumber>ZXCV-233</com:QuoteNumber>
    <com:CustomerAccountNumber>1213654889</com:CustomerAccountNumber>
    <!--Optional:-->
    <com:LineItemList>
    *<!--1 or more repetitions:-->*
    <com:QuoteLineItem>
    <com:LineNumber>3</com:LineNumber>
    <com:ProductCatalogId>string</com:ProductCatalogId>
    <com:Product>asdf</com:Product>
    <com:Quantity>string</com:Quantity>
    <com:Mrc>3</com:Mrc>
    <com:Currency>USD</com:Currency>
    <com:LastUpdateDate>string</com:LastUpdateDate>
    <com:LastUpdatedBy>string</com:LastUpdatedBy>
    </com:QuoteLineItem>
    <com:QuoteLineItem>
    <com:LineNumber>3</com:LineNumber>
    <com:ProductCatalogId>string</com:ProductCatalogId>
    <com:Product>1234</com:Product>
    <com:Quantity>string</com:Quantity>
    <com:Mrc>3</com:Mrc>
    <com:Currency>USD</com:Currency>
    <com:LastUpdateDate>string</com:LastUpdateDate>
    <com:LastUpdatedBy>string</com:LastUpdatedBy>
    </com:QuoteLineItem>
    <com:QuoteLineItem>
    <com:LineNumber>3</com:LineNumber>
    <com:ProductCatalogId>string</com:ProductCatalogId>
    <com:Product></com:Product>
    <com:Quantity>string</com:Quantity>
    <com:Mrc>3</com:Mrc>
    <com:Currency>USD</com:Currency>
    <com:LastUpdateDate>string</com:LastUpdateDate>
    <com:LastUpdatedBy>string</com:LastUpdatedBy>
    </com:QuoteLineItem>          
    </com:LineItemList>
    </PushQuote>
    </cred:PushQuote>

    atheek1 wrote:
    Try this:
    <ResultDoc>
    for data in $inputData/PushQuote
    return
    if( put all your if conditions here) then
    <result> 1</result>
    else
    <result>0</result>
    </ResultDoc>
    This will return a xml :
    <ResultDoc>
    <result>1</result> <!.. one result per PushQuote in input !>
    <result>0</result>
    </ResultDoc>yup I've tried that, and now I'm able to get result, my problem now is I can't get the result that is equal to 1 even if I use xpath.
    please see my updated code:
    declare namespace cred="http://www.pldt.com.ph/eai/service/component/CreditService/";
    declare namespace com="http://www.pldt.com.ph/eai/Common";
    declare function local:CheckValidation($PushQuote as element(cred:PushQuote))
    let $QuoteNumber := data($PushQuote/PushQuote/com:QuoteNumber)
    let $AccountNumber := data($PushQuote/PushQuote/com:CustomerAccountNumber)
    let $QuoteLineItemList := $PushQuote/PushQuote/com:LineItemList/com:QuoteLineItem
    return
    <status>
    for $QuoteLineItem in $QuoteLineItemList
    return
    if (fn:string-length(data($QuoteNumber)) > 0 and
    fn:string-length(data($AccountNumber)) > 0 and
    fn:string-length(data($QuoteLineItem/com:Quantity)) > 0 and
    fn:string-length(data($QuoteLineItem/com:Product)) > 0 and
    fn:string-length(data($QuoteLineItem/com:Mrc)) > 0 and
    fn:string-length(data($QuoteLineItem/com:Currency)) > 0 and
    fn:string-length(data($QuoteLineItem/com:LastUpdateDate)) > 0 and
    fn:string-length(data($QuoteLineItem/com:LastUpdatedBy)) > 0)
    then
    <code>0</code>
    else
    <code>1</code>
    </status>
    declare variable $PushQuote as element(cred:PushQuote) external;
    let $returnValue := local:CheckValidation($PushQuote)
    return
    $returnValue
    $returnValue[code=1]/code
    I've tried putting xpath like this to get result = 1 but no luck :)

  • How to generate localized chars using code point in Solaris 10?

    Hi All,
    Do enybody know how to generate localized chars (for example Japanese) using code points in Solaris 10?
    Like in the following web page:
    http://www.isthisthingon.org/unicode/index.phtml
    Unicode, shift-jis
    U+4e2f 87a3 �N
    U+4e3b 8ee5 ��
    U+4e3c 98a5 �S
    U+4f5c 8dec ��
    Thanks,
    Daniel

    I have found a "Code Point Input Method" tool in the following page:
    http://java.sun.com/products/jfc/tsc/articles/InputMethod/inputmethod.html
    Using this tool user can enter hexadecimal code point and the output is some char.
    But this tool doesn't work. I run this in the follwoing way:
    # java -jar CodePointIM.jar
    After this error message appers:
    Failed to load Main-Class manifest attribute from
    codepointim.jar
    If anybody could help I will be appreciate.
    Regards,
    Daniel

  • How to remove empty tags from a config file

    Hi all,
    I have a task where we need to run a Java program to remove tags which do not contain ny information from the config files. The format of the file is as under:
    <roleManager>
         <providers>
              <add name="AspNetSqlRoleProvider" b03f5f7f11d50a3a" />
              <add name="AspNetWindowsTokenRoleProvider" PublicKeyToken=b03f5f7f11d50a3a" />
         </providers>
    </roleManager>
    <httpModules>
    </httpModules>
    In the above lines <roleManager> is a tag which contains some data, while <httpModules> is an empty tag and does not conatin any data. The resultant should be:
    <roleManager>
         <providers>
              <add name="AspNetSqlRoleProvider" b03f5f7f11d50a3a" />
              <add name="AspNetWindowsTokenRoleProvider" PublicKeyToken=b03f5f7f11d50a3a" />
         </providers>
    </roleManager>
    Please suggest how can we achieve this?
    Thanks in advance

    I ususally do that type of thing with a state machine... read a token, look for what is next, and if it's the closing token, I don't write it out. You have well defined opening token syntax and closing token syntax, so it should be relatively easy.

  • How to generate Java source using clientgen WL8.1?

    Hi, does anybody know how to generate Java source code using clientgen task on WL 8.1 Sp4 or SP5? I know WL 9.0 clientgen can do this, but we are still on SP5. Basically I want to look at the source code (I was wondering why it didn't work if I initialize a service impl by passing the WSDL URL string different than the URL specified in the original WSDL file that the clientgen is run against.)
    Does anybody also know how get web service client developed on Axis work on WebLogic without conficting the web service developed on WebLgoic that is running in the same box?
    Thanks for your help!

    hi ,
    As mentioned in the Question, I am unable to find the "Java Proxy Generattion" link in the Int builder.
    Also the help doc says:
    Java proxy generation is no longer supported in subsequent releases. For new developments or when making significant changes to a service interface, use Java proxy generation in SAP NetWeaver Studio instead. More information: Creating Outside-In Web Services, SAP NetWeaver Developer Studio.
    Does that mean that I can no longer generate java proxy from Int builder?
    regards,
    Piyush

  • How to generate DBMS_RANDOM Timestamp using procedure

    Hi,
    I got a copy from askTom site for the store procedure of creating random numbers in a table:
    create or replace procedure clone( p_tname in
    varchar2, p_records in number )
    authid current_user
    as
    l_insert long;
    l_rows number default 0;
    begin
    execute immediate 'create table clone_' || p_tname ||
    ' as select * from ' || p_tname ||
    ' where 1=0';
    l_insert := 'insert into clone_' || p_tname ||
    ' select ';
    for x in ( select data_type, data_length,
    rpad( '9',data_precision,'9')/power(10,data_scale) maxval
    from user_tab_columns
    where table_name = 'CLONE_' || upper(p_tname)
    order by column_id )
    loop
    if ( x.data_type in ('NUMBER', 'FLOAT' ))
    then
    l_insert := l_insert || 'dbms_random.value(1,' || x.maxval ||
    elsif ( x.data_type = 'DATE' )
    then
    l_insert := l_insert ||
    'sysdate+dbms_random.value+dbms_random.value(1,1000),';
    else
    l_insert := l_insert || 'dbms_random.string(''A'',' ||
    x.data_length || '),';
    end if;
    end loop;
    l_insert := rtrim(l_insert,',') ||
    ' from all_objects where rownum <= :n';
    loop
    execute immediate l_insert using p_records - l_rows;
    l_rows := l_rows + sql%rowcount;
    exit when ( l_rows >= p_records );
    end loop;
    end;
    Can somebody tell me how to generate a random TIMESTAMP?
    I try to change "sysdate" to systimestamp" and it give me an error:
    ERROR at line 1:
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    Please help!!
    Message was edited by:
    eecow
    Message was edited by:
    eecow
    null

    Can you give me an example of doing this?
    The other question is:
    Can the store procedure code (above) check other things other than data type?
    For example:
    if attributeName = 'percentage' --> create a random number from 0 to 100
    The reason is because I am trying to generate some more "realistic" data. Some fields can be unrelistic, but fields like "percentage" should be within 0-100 and should not have something like 200 :)
    Please advise.
    Thanks!

  • How to generate Serial numbers using JAVA SCRIPT

    how to generate serial numbers(incrementing by 1) using JAVA SCRIPT
    thanking you,
    pola pradeep

    i am afraid that whether ur looking for this. bcoz its a simple for loop
    <script language="JavaScript">
    //count = limit value for u
    for(i=0;i<count;++i){
         alert(i);
    </script>
    or if ur looking for something else, pls mention ur requrment precisely
    aleena

Maybe you are looking for

  • How to install original 10.5.5 disk on erased hard drive in macbook pro

    Macbook pro 5,1 late 2008 was running SL 10.6.8 Formatted hard drive in target mode from a mavericks mbp (mid 2012) original 10.5.5 disk will not install. gray screen with question mark press option and disk mounts but does not open-blue screen

  • Kernel panic caused when saving Photoshop file

    Hi all, Wondering if someone can help out with this kernel panic sitaution? We've got two Creatives in the office who have recently both upgraded their iMac's to Mavericks 10.9. They both use Photoshop CS5 extended (12.1 x64). We have a Windows 2008R

  • Requirement of ZMCRP

    Dear Friends, I have to edit the standard report MCRP to provide an additional column for difference of Requirement Qty and Withdrawal Qty. Can anyone suggest how can I achieve that? I opened the code of the same in se38 but couldn't make out where s

  • MRKO - consignment invoice blocking

    All, Is it possible to configure consignment to block?   In looking at configuraion under mm->LIV-> invoice block There is an amount check block that has consignment as an option transaction OMRI amount check. I've done the following:      -  omr9  r

  • How to change predefine bar code size in smartform style

    hi, in smartstyles--character setting, when we define barcode, there is one bar code "BC_C128B" with width 9CM. May i know how to change it into smaller size. Thanks. regards, BK