Blank Tag in XML

Hi,
I am using DBMS_XMLQuery package to generate XML (I am new to this feature)
The problem is, in the generated XML file, some tags are missing if there is no data. But my requirement is to print the tag even if there is no data for that column.
i.e., i am getting the following outputs
(With data)
<?xml version='1.0'>
<rowtag>
<col1>data1</col1>
<col2>data2</col2>
</rowtag>
(Without data in col2)
<?xml version='1.0'>
<rowtag>
<col1>data3</col1>
</rowtag>
(Expected output without data)
<?xml version='1.0'>
<rowtag>
<col1>data3</col1>
<col2></col2>
</rowtag>
Hope I didnt confused you
Any help will be appreciated
Regards,
Krrish

Or don't use dbms_xml at all:
SQL>  with t as
  select 'data1' col1, 'data2' col2 from dual union all
  select 'data3' col1,  null   col2 from dual
select xmlserialize(content xmlelement ("rowtag",
                   xmlelement ("col1", col1),
                   xmlelement ("col2", col2)
                  ) indent) xml
  from t
XML                                                                            
<rowtag>                                                                       
  <col1>data1</col1>                                                           
  <col2>data2</col2>                                                           
</rowtag>                                                                      
<rowtag>                                                                       
  <col1>data3</col1>                                                           
  <col2/>                                                                      
</rowtag> /* xmlserialize is just used for nicer formatting */

Similar Messages

  • Extra Blank page in XML Publisher report

    Hi,
    I am getting extra blank page in XML publisher report.
    The RTF has two pages and each page has one table.These two tables will be populated with data based on some if condtion.
    eg:
    In RTF:
    for each Header
    if PMA='Y' THEN
    Table1 data in 1st page
    end if;
    pageBreak
    IF OTC='Y' then
    Table2 data in 2nd page
    END IF;
    end for each
    And also another issue is: The data is starting from the same page instead of new page.
    Please help me in solving the issue.
    Thanks,
    Srinivas

    Hi,
    Thanks for reply.
    I am using <xsl:attribute name="break-before">page</xsl:attribute> page break.
    I tried split-by-page-break also,but still its not resolved.
    Today I have noticed one thing: When generating this report locally,then there is no blank page coming.But when generating from APPS then blank page is coming.
    Please help me to resolve this issue.
    Thanks,
    Srinivas

  • How to Include html tag in xml

    Hi,
    Is there any way to include html tags in xml?
    For Example, I'm using xsl to get the value of FIELD_1 from fetch.xml
    In fetch.xml, I have the tag
    <FIELD_1>
    <font color='#8080ff'>&#160;<font face='Times New Roman, Times' size='28'>Testing font and color</font></font>
    </FIELD_1>
    But If I tried to read the value from xsl like <xsl:value-of select="FIELD_1"/> I'm just gettig the display 'Testing font and color' without the specified font and color....
    How to achieve this?
    Thanks
    Selva.

    Hi,
    Thanks for the input.
    I tried with the below code
    <fo:block space-after="5mm" font-family="Arial"><xsl:copy-of select="FIELD_1"/></fo:block>
    But I'm getting the below error...
    "An invalid XML character (Unicode: 0xa0) was found in the element content of the document."
    Below is the code included in the xsl....
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="Values"><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
    <fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="3cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
    <fo:region-body/>
    </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="simpleA4">
    <fo:flow flow-name="xsl-region-body">
    <fo:block space-after="5mm" font-family="Arial"><xsl:copy-of select="FIELD_1"/></fo:block>
    </fo:flow> </fo:page-sequence> </fo:root> </xsl:template></xsl:stylesheet>
    Is there any mistakes in the above code?
    Regards,
    Selva.

  • How can we get  tag of XML file using SAX

    Hi ,
    I'm parsing one SAX parser , I'have almost done this parsing. i have faced problem for one case, i'e how can we get tag from XML file using SAX parser?
    XML file is
    <DFProperties>
    <AccessType>
    <Get/>
    </AccessType> <Description>
    gdhhd
    </Description>
    <DFFormat>
    <chr/>
    </DFFormat>
    <Scope>
    <Permanent/>
    </Scope>
    <DFTitle>gsgd</DFTitle>
    <DFType>
    <MIME>text/plain</MIME>
    </DFType>
    </DFProperties>
    I want out like GET and Permanent... means this one tag which is present inside of another tag.
    Handler class like
    public void startElement(String namespaceURI, String localName,
                   String qName, Attributes atts) throws SAXException {
    if(_ACCESSTYPE.equals(localName)){
                   accessTypeElement=ACCESSTYPE;
    public void characters(char[] ch, int start, int length)
                   throws SAXException {
    if (_ACCESSTYPE.equals(_accessTypeElement)) {
                   String strValue = new String(ch, start, length);
                   System.out.println("Accestype-----------------------------> " + strValue);
                   //System.out.println(" " + strValue);
    public void endElement(String namespaceURI, String localName, String qName)
                   throws SAXException {
    if (_ACCESSTYPE.equals(localName)) {
                   _accessTypeElement = "";
    . please any body help me

    Hi ,
    I have one problem,Please help me.
    1. How can I'll identify where exactly my Node is ended,means how how can we find corresponding nodename? in partcular place
    <Node> .............starttag1
    <NodeName>Test</NodeName>
    <Node>................starttag2
    <nodeName>test1</NodeName>
    </Node>..................endtag2
    <Node>.....................starttag3
    <NodeName><NodeName>
    <Node> .........................starttag4
    <NodeName>test4</NodeName>
    </Node>.......enddtag4
    </Node>...........end tag3
    </Node>............endtag1
    my code is below
    private final String _NODENAME = "NodeName";
    private final String _NODE = "Node";
    private String _nodeElement = "";
         private String _NodeNameElement = "";
    public void startElement(String namespaceURI, String localName,
                   String qName, Attributes atts) throws SAXException {
    if (_NODENAME.equals(localName)) {
                   NodeNameElement = NODENAME;
    if(_NODE.equals(localName)){
         System.out.println("start");
         if (_NODENAME.equals(localName)) {
                   NodeNameElement = NODENAME;
    public void characters(char[] ch, int start, int length)
                   throws SAXException {
    if (_NODENAME.equals(_NodeNameElement)) {
                   String strValue = new String(ch, start, length);
                   String sttt=strValue;
                   System.out.println("NODENAME: ************* " + strValue);
    if(_NODE.equals(_nodeElement)){
                   if (_NODENAME.equals(_NodeNameElement)) {
                        String strValue = new String(ch, start, length);
                        String sttt=strValue;
                        System.out.println("nodevalue********** " + strValue);
    public void endElement(String namespaceURI, String localName, String qName)
                   throws SAXException {
    if (_NODENAME.equals(localName)) {
                   _NodeNameElement = "";
    if(_NODE.equals(localName)){
                   System.out.println("NODENAME: %%%%%%%%%");
    please help me. How can I figure node ending for particular nodename

  • Remove XML tags from XML element in Oracle

    Hi,
    I have a requirement where I have to remove all the xml tags from xml element with banks, currently I'm using replace 4 times to replace all different types of xml tags, performance is really bad. is there any better option to remove xml tags from xml data leaving the actual data. please find the example data below.
    select
    TO_CLOB(REPLACE(REPLACE(REPLACE(REPLACE
    ('<Concatcolumn><ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>','<ConcatGroupID>'),'<Concatcolumn>'),'</ConcatGroupID>',';'),';</Concatcolumn>')) AS Concatcolumn
    from dual
    **************Out put*************
    MyText Data goes here ;Data agian

    One way is to use xquery:
    SQL> with t as
    select xmltype('<Concatcolumn>
                          <ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>'
       ) xml from dual
    select xmlquery('string-join(//text(), ";")' passing xml returning content).getclobval() xml from t
    XML                                                              
    MyText Data goes here ;Data agian                                
    1 row selected.

  • How to make the tags in XML file case insensitive

    Hi,
    I have a ReadXML class which reads an xml file. This class also has a method which receives a string-child from another class and uses this string-chile to match it with the child tag in the xml file, and returns the child tag's value.
    Now, my problem is this, the child tag in xml may be in a case different from the case of the string-child received from another class.
    How do I modify it, so the program does not return a null pointer exception because the strings did not match for want of uppercase or lowercase letters.
    Thanks
    Sangeetha

    I'm not sure what you are getting at. Is a string child the contents of a node treated as text?
    If you are trying to match a child node regardless of case I doubt this is possible as the XML standard says an XML document is case sensitive so if your parser ignored case it would not be XML complient.
    Hope this helps.

  • Changing data in XML variable and appending tags in XML  document

    Hi all,
    I am new to weblogic Integrator . can any one help me concerning following problem
    1. I get input XML message to my workflow which I stores in XML variable. after
    some processing i want to change value of one tag in XML stored in XML variable.
    How I can do thaat ?
    2. I have some XML like
    <root>
    <child>
    <a> </A>
    </child>
    <child>
    </child>
    </root>
    and i want to append multiple such tag at run time . how i can do the same
    in wli
    Please let me know your suggestion
    Kiran

    For both cases I suggest you use XSLT.
    Mike
    "Kiran" <[email protected]> wrote in message
    news:3c720cd2$[email protected]..
    >
    Hi all,
    I am new to weblogic Integrator . can any one help me concerning followingproblem
    1. I get input XML message to my workflow which I stores in XML variable.after
    some processing i want to change value of one tag in XML stored in XMLvariable.
    How I can do thaat ?
    2. I have some XML like
    <root>
    <child>
    <a> </A>
    </child>
    <child>
    </child>
    </root>
    and i want to append multiple such tag at run time . how i can do thesame
    in wli
    Please let me know your suggestion
    Kiran

  • How use forEach tag in xml tag library

    Hi,
    Can u please explain the procedure for using forEach tag for displaying the parsed xml tags?
    This is the code snippet
    <%@ page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <html>
    <body>
         <c:import url="\books.xml" var="url" />
         <x:parse xml="${url}" var="doc" />
              <x:forEach var="n" select="${doc}/books/book">
                   <x:out select="${n}/title"/>
                   <x:out select="${n}/author" />
         </x:forEach>
    </body>
    </html>
    but I got the fallowing error.
    java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
         at org.apache.taglibs.standard.tag.common.xml.ForEachTag.prepare(ForEachTag.java:51)
         at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:262)
         at jsp_servlet.__index._jspService(__index.java:197)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    Just the same way as you do in JSP. Since JSF 1.2 you can use unified EL #{ } in c:forEach.
    You can also use Tomahawk's [t:dataList|http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_dataList.html] by the way. It is more efficient.

  • Closing tag in xml transformation

    Hi experts,
    I have the following ABAP code:
    ABAP itab to XML string
      CALL TRANSFORMATION id SOURCE data = ti_stocks[]
                             RESULT XML    ps_output.
    The result in ps_output should be an xml like this
    <?xml version="1.0" encoding="utf-16" ?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <DATA>
    <ZTABLE_STO>
      <FIELD1 /> ABC</FIELD1>
      <FIELD2 />0300</FIELD2>
      <FIELD3 />1</FIELD3>
      </ZTABLE_STO>
    etc.
    However, if my internal table ti_stocks contains the field1 with an empty value then the xml is incorrect without its corresponding closing tag:
    <?xml version="1.0" encoding="utf-16" ?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <DATA>
    <ZTABLE_STO>
      <FIELD1 />
      <FIELD2 />0300</FIELD2>
      <FIELD3 />1</FIELD3>
      </ZTABLE_STO>
    etc.
    How can I resolve this problem? I would like to have an open tag and a closing tag for every field.
    FIELD1 is a char type field.
    Thank you,
    Oscar
    Edited by: Oscar Arranz on Jan 26, 2012 2:46 PM

    Hello everyone, sorry for my english, I had the same requeriment for the end tag, the simple transformation give this result <xxx/> when the value was empty, and I did something similar to Oscar,
    i did the simple transformation and the result whas and xstring, i used a function to pass it to string, and then I make a replacement.
    here is some code:
    *  Genera XML
       data: xml_xstring          type xstring.
       data: w_xml                 type string.
       data: ixml                    type ref to if_ixml,
               streamfactory      type ref to if_ixml_stream_factory,
               encoding             type ref to if_ixml_encoding,
               ixml_ostream      type ref to if_ixml_ostream.
       data: resstream           type ref to if_ixml_ostream.
    ****Create an instance of the Ixml Processor
       ixml = cl_ixml=>create( ).
    *  ****Create the Stream Factory
       streamfactory = ixml->create_stream_factory( ).
    *  ****Create an Endcoding and Byte Order
       encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
    *  *  ****Create the output stream with a pointer to our binary string
       ixml_ostream = streamfactory->create_ostream_xstring( xml_xstring ).
    *  ****Set the Encoding into a stream
       ixml_ostream->set_encoding( encoding = encoding ).
    ****Call simple Transformation
       call transformation zdte_libros
       source zcaratula = x_doc
       result xml ixml_ostream.
    *From xstring to string.
       call function 'HR_RU_CONVERT_HEX_TO_STRING'
              exporting
                     xstring = xml_xstring
              importing
                     cstring = w_xml.
    * <xxx/> to <xxx><xxx/>
       replace all occurrences of regex '<([^><\s]+)( [^><]+)?/>' in w_xml with '<$1$2></$1>'.
    Hope it helps someone with the same problem .

  • How to add extra blank space in xml

    I open the xml file in notepad I get this
    <XXON_EXT_BANK_ACCOUNT_NAME>創名聯合會計師事務所                                        </XXON_EXT_BANK_ACCOUNT_NAME>
    But when I open the xml file in html format the blank space is gone.
    How can I add extra blank space in xml?

    Hi
    Why do you need the extra space for?
    This difference in display that you see between your browser and notepad/notepad++
    will not affect your generated report.
    Bogdan 

  • Reading jsp  tag using xml

    Hello friends,
    I have a problem.
    I have a jsp page in that i have to find a particular tags. using xml
    but i dont know about dtd and. please help me
    example.
    <input type ="text" value= "ss">
    now i want to find the above tag using xml
    so please give me the logic how to find a tag in jsp using xml. ?
    please help me.

    A JSP is for displaying data. Read after me:D-I-S-P-L-A-Y-I-N-G. It has no business parsing or
    reading or calculating anything.
    I don't know what the OP want's to do. Maybe he
    want's to write a application which replaces some
    html tags in JSP files.
    His post can also be interpreted that he want's to
    use JavaScript (DOM)) to find any particular tag.Hello,
    my problem is in our application some programmers have written hardcode in <intput tag> like <input type name ="hardcode" instead taking values from database dictonary.
    so now i have to find the line no. where they have written the hard code.
    for that my pl is asked to solve using dom.
    for that i need to find the html tags.
    but i m not able to do that.
    can u suggest me.
    Regards

  • How to insert blank spaces in XML tag?

    Hi Experts,
    I have a variable of type char and lenght 10 with value "ABCDE".  When I write this value in xml tag <TEXT> using simple transformation it ignores the trailing blank spaces and the result xml string looks as <TEXT>ABCDE</TEXT>.
    I want the xml tag with trailing blank spaces i.e. it should be like <TEXT>ABCDE     </TEXT>. And suppose if the variable does not contain any value, the xml tag should contain 10 blank spaces like <TEXT>          </TEXT>.
    I have tried using the solution given in this link
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/f52846257a0485e10000000a155369/frameset.htm
    but unfortunately it doesn't work.
    Please guide me to achieve this.
    Regards,
    Ravi

    ABAP prog:
    DATA: text(10)    TYPE c VALUE 'ABCDE',
          xml_xstring TYPE string.
    CALL TRANSFORMATION z_test SOURCE root = text
                            RESULT XML xml_xstring.
    WRITE xml_xstring.
    Transformation:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="ROOT"/>
    <tt:template>
          <Text tt:value-ref="ROOT"/>
    </tt:template>
    </tt:transform>
    Result in xml string:
    <?xml version="1.0" encoding="utf-16"?>#<Text>ABCDE</Text>
    Also tried transformation using:
    <tt:template>
          <Text>
               <tt:value length="10" ref="ROOT"/>
          </Text>
    </tt:template>
    Thanks.

  • Blank field in XML file

    Hi Friends,
    I have a requirement where in I have to create an XML file using deep structure.  Now some fields of the structure may have data and some fields may not. But the XML file generated should contain both blank fields as well as fields with data.
    To create it, I am using:
      g_ixml = cl_ixml=>create ( ).
      m_document = g_ixml->create_document( ).
    Then with the function modules, the XML file gets created.
    SDIXML_DATA_TO_DOM
    SDIXML_DOM_TO_XML
    But the fields without values are not added in the XML file.
    Please help .. It is very urgent ..
    Rdgs,
    Namita.

    Hi Tony,
    We just released a new version 1.1.0 of XMLSQL utility which
    takes care of empty tags. i.e. leaving out the tag would be the
    same as having an empty <name></name> field for scalars.
    Thx
    Murali
    Tony (guest) wrote:
    : Hi:
    : It seems to me that in xml file, if there is a blank field,
    such
    : as <name/> or <name></name>, then OracleXMLSave.insertXML
    wound
    : not work. I know that you may try use dummy values or if the
    : field is blank, then leave the field out of the xml file. Any
    : other work around? Is my claim that <name/> and <name></name>
    : wound not work righ?
    : Please help!
    : Thanks.
    : Tony
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Error for fetching long text in xml tag for xml publisher report

    My requirement is to fetch a large document which is in text format in XML output which can be printed in PDF format by using RTF method to generate PDF.But during XML ouput i got the following error-
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh
    button, or try again later.
    The following tags were not closed: XXBG_EAMWRREP_V1, LIST_G_WO_ACTIVITY_CODE, G_WO_ACTIVITY_CODE, LIST_G_MEDIA_ID1,
    G_MEDIA...
    XXBG_EAMWRREP_V1 is the rdf and LIST_G_WO_ACTIVITY_CODE, G_WO_ACTIVITY_CODE, LIST_G_MEDIA_ID1, G_MEDIA are the groups name. In the group
    G_MEDIA i am fetching long_text from attahcment in application. In Database table the datatype of the text attachment is 'long' and there is a huge text
    data loaded in large data editor of that column. If the text data volume is small enough then there is no problem for fetching the xml output.
    If we change the output format as HTMl then there is no problem for fetching the output for long text but for xml output format we are unable to fetch the data
    in xml tag.
    One thing to mention the oracle report is the copy of Maintenance Work Order Detail Report. The seeded report is HTML format in 11i. The requirement is to make it in xml report.
    Please help.

    Hi,
    Actually clob datatype is not available in oracle report builder datatype lov. Could you pls tell the other ways of converting that to clob in oracle report...

  • How to Avoid Blank Page in  XML Publisher oracle report

    Hi,
    I am running a report in xml publisher. The output of the report prints 2
    pages, one page with correct report output and other page is a blank page
    with header details.
    I want to avoid this blank page. Is there something wrong? Please help to fix this issue!
    Thanks!

    I am running a report in xml publisher. The output of the report prints 2
    pages, one page with correct report output and other page is a blank page
    with header details.
    I want to avoid this blank page. Is there something wrong? Please help to fix this issue!Is the issue with this specific XML Publisher report only?
    Do you have all the patches in (Overview of Available Patches for Oracle XML Publisher embedded in the Oracle E-Business Suite [ID 1138602.1]) applied? -- Search for "blank page".
    Thanks,
    Hussein

Maybe you are looking for