Generate XML in PL/SQL format

I have a generated XML format:

Need help please to generate an XML file based on the XML format below

<? XML version = "1.0" standalone = 'no '? >

<! DOCTYPE tags SYSTEM "label.dtd" >

< labels _FORMAT = 'E:ASSET. ZPL"_QUANTITY ="1"_PRINTERNAME ="printer 1"_JOBNAME ="LBL101">

< label >

< variable name = "$$ PART_NUMBER$ $" > S123456789 < / variable >

< variable name = "$$ PART_NUMBER_DESCRIPTION$ $" > XXXXXXXXXXXXXXXXXXXXXXXXX < / variable >

< variable name = "Serial_number of $$$ $" > XXXXXXXXXX < / variable >

< / label >

< / Label >

Data are stored in the SQL table, right? So why do you need it in PL/SQL? But yes, you can wrap this selection in PL/SQL:

DECLARE

v_xml XMLTYPE.

BEGIN

SELECT XMLSERIALIZE)

DOCUMENT

XMLELEMENT)

"labels."

XMLATTRIBUTES)

' E:ASSET. ZPL "AS '_FORMAT',

"1" AS "_QUANTITY;

"Printer 1' AS '_PRINTERNAME ', '.

'LBL101' AS '_JOBNAME '.

),

XMLAGG)

XMLELEMENT ("label",

XMLELEMENT ("variable",

XMLATTRIBUTES)

"$$ PART_NUMBER$ $' AS 'name '.

),

PART_NUMBER

),

XMLELEMENT ("variable",

XMLATTRIBUTES)

"$$ PART_NUMBER_DESCRIPTION$ $' AS 'name '.

),

part_number_description

),

XMLELEMENT ("variable",

XMLATTRIBUTES)

"$$ SERIAL_NUMBER$ $' AS 'name '.

),

Serial_number

)

)

)

)

DASH SIZE = 2

) AS XMLCOLUMN

IN v_xml

OF test_tab_a;

END;

/

SY.

Tags: Database

Similar Questions

  • Need help in generating XML data to a table in XML format

    Hi all

    I need help to generate an xml file using the data below.

    The table name is T_Data have 4 columns as shown below with data.

    Neighbourhood region Division
    ---------- ----------------------- ----------- -----------
    Northwest Northern California San Jose SJStore1
    Northwest Northern California San Jose SJStore2
    Northwest North of California to the North of THE LAStore1
    Northwest North of California to the North of THE LAStore2
    Northwest North of California to the North of THE LAStore3

    I want to generate an XML file using SQL/XML functions and the XML file should look like as below.

    <>region
    < name of region > Northwest < / name of the region >
    < Division >
    Northern California < division name > < / Division name >
    District of <>
    SanJose < district name > < / District name >
    <>store
    < store name > SJStore1 < / name >
    < store name > SJStore2 < / name >
    < / store >
    < / district >
    < / division >
    < / region >

    Very much appreciate your help here.

    Thank you.

    I tried to group the lines, but they did not then provide a correct output.

    To unflatten dataset, we can use nested GROUP-BY subqueries.

    The following will produce a line by region.
    If all regions must be grouped in a single root element (does not so appear according to the directives of the sample), we just add an another XMLAgg.

    SQL> with sample_data as
      2  (
      3    select 'Northwest' reg, 'Northern California' div, 'San Jose' district, 'SJStore1' st from dual union all
      4    select 'Northwest' reg, 'Northern California' div, 'San Jose' district, 'SJStore2' st from dual union all
      5    select 'Northwest' reg, 'Northern California' div, 'North LA' district, 'LAStore1' st from dual union all
      6    select 'Northwest' reg, 'Northern California' div, 'North LA' district, 'LAStore2' st from dual union all
      7    select 'Northwest' reg, 'Northern California' div, 'North LA' district, 'LAStore3' st from dual
      8  )
      9  select reg
     10       , xmlserialize(document
     11           xmlelement("Region"
     12           , xmlelement("RegionName", reg)
     13           , xmlagg( division_xml )
     14           )
     15           indent -- for display purpose
     16         ) as region_xml
     17  from (
     18      select reg
     19           , xmlelement("Division"
     20             , xmlelement("DivisionName", div)
     21             , xmlagg( district_xml )
     22             ) as division_xml
     23      from (
     24          select reg
     25               , div
     26               , xmlelement("District"
     27                 , xmlelement("DistrictName", district)
     28                 , xmlelement("Store"
     29                   , xmlagg(
     30                       xmlelement("StoreName", st)
     31                     )
     32                   )
     33                 ) as district_xml
     34          from sample_data
     35          group by reg
     36                 , div
     37                 , district
     38      )
     39      group by reg, div
     40  )
     41  group by reg ;
    
    REG       REGION_XML
    --------- --------------------------------------------------------------------------------
    Northwest 
                Northwest
                
                  Northern California
                  
                    North LA
                    
                      LAStore1
                      LAStore3
                      LAStore2
                    
                  
                  
                    San Jose
                    
                      SJStore1
                      SJStore2
                    
                  
                
              
     
    
  • form2xml generate xml files with '? ' for non-Latin characters

    I used form2xml in oracle 10 g costume to convert formulas 5 .fmb .xml. using the command:

    frmf2xml.bat OVERWRITE = YES myform.fmb

    Forms contains the set of Arabic characters, but the xml file is generated with the character "?", and the xml file is unusable ".

    What can I do to keep the Arabic characters in the generated xml files.

    Edit:

    I run form2xml on windows xp SP3 with Arabic support (codepage = 1256)

    The xml file is generated in UTF-8 format

    I solved the problem.

    Step 1: Search the registry for each NLS_Lang key and change its value to the codepage 1256 using regedit

    Step 2: in the Panel of control-region and language, I changed the language to be Arab

    Now everything is good

  • generate xml with levels data

    Hello

    I have a tlable like that

    Desription level value
    1 dept
    2 name of the King
    3 salary 3000
    3 something information

    So I want to generate xml according to the levels output, the output schould be
    < Dept >-> level 1
    < name > King-> level 2
    < > 3000 salary < / salary >-> Level3
    < Info > something < / info >-> Level3
    < / name >
    < / dept >

    I tried to use the XMLELEMENT function... without success, I realize that with Oracle xml functions?

    MDK.

    Please always provide your version of the database. It is easier for us to provide an appropriate response.

    Here are some ways that work on 10.2.0.4 (and probably high too):

    (1) implement a recursive function in XQuery
    (2) using the DBMS_XMLGEN.newContextFromHierarchy function

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as marc
    
    SQL>
    SQL> create table emp (
      2   lvl number,
      3   descr varchar2(30),
      4   val   varchar2(100)
      5  );
    
    Table created
    
    SQL> insert into emp values(1, 'dept', null);
    
    1 row inserted
    
    SQL> insert into emp values(2, 'name', 'King');
    
    1 row inserted
    
    SQL> insert into emp values(3, 'salary', '3000');
    
    1 row inserted
    
    SQL> insert into emp values(3, 'info', 'something');
    
    1 row inserted
    
    SQL> set long 500
    SQL>
    SQL> select xmlquery(
      2  'declare function local:getHierarchy($start-with as xs:integer)
      3   {
      4     for $i in ora:view("EMP")/ROW[LVL=xs:string($start-with)]
      5     return element {$i/DESCR}
      6     {
      7       $i/VAL/text(),
      8       local:getHierarchy(xs:integer($i/LVL)+1)
      9     }
     10   }; (: :)
     11   local:getHierarchy(1)'
     12   returning content
     13  ) as result
     14  from dual;
    
    RESULT
    --------------------------------------------------------------------------------
    
       King3000something
    
    
    
    SQL> select dbms_xmlgen.getXML(
      2    dbms_xmlgen.newContextFromHierarchy(
      3     'select level, xmlelement(evalname(descr), val) from emp
      4     connect by prior lvl = lvl-1 start with lvl = 1'
      5    )
      6  ) as result
      7  from dual;
    
    RESULT
    --------------------------------------------------------------------------------
    
    
      King
        3000
        something
      
    
     
    

    Published by: odie_63 on Dec 27. 2010 18:27

  • XML from Pl/sql output

    Hello
    I am beginner in XML, all points and references will help me greatly. I need to generate pl/sql xml output and validate data output against xml schema xml. Output XML contains a lot of child with them tags and tags parent. I may not be able to use dbms_xmlgen, because I have to put several tags with DBMS_XMLGEN.setRowTag.

    I enclose part of my xml output to get an idea.

    ITST:OrganizationName > a < / itst:OrganizationName >
    < oes:LookupDateTime > 2001-12-17 T 09: 30:47Z < / oes:LookupDateTime >
    < itst:SerialNumberIdentifier > 0 < / itst:SerialNumberIdentifier >
    < itst:SubscriptionListOfficialOnlyIndicator > true < / itst:SubscriptionListOfficialOnlyIndicator >
    < itst:SubscriptionListCompleteIndicator > true < / itst:SubscriptionListCompleteIndicator >
    -< itst:TelephoneSubscriptionCollection >
    -< itst:TelephoneSubscription >
    -< itst:TelephoneSubscriber >
    < itst:AnonymousPrepaidIndicator > true < / itst:AnonymousPrepaidIndicator >
    -< itst2:PersonNameStructure >
    < dkcc:PersonGivenName > one < / dkcc:PersonGivenName >
    < dkcc:PersonMiddleName > one < / dkcc:PersonMiddleName >
    < dkcc:PersonSurnameName > one < / dkcc:PersonSurnameName >
    < itst:EmploymentPositionName > one < / itst:EmploymentPositionName >
    -< itst:TelephoneSubscriptionAddress >
    -< xkom:AddressComplete >
    -xkom - 2:AddressAccess >
    < MunicipalityCode > 0000 < / MunicipalityCode >
    < StreetCode > 0000 < / StreetCode >
    < dkcc:StreetBuildingIdentifier > 1 < / dkcc:StreetBuildingIdentifier >
    < / xkom - 2:AddressAccess >
    -< xkom:AddressPostal >
    < dkcc:MailDeliverySublocationIdentifier > one < / dkcc:MailDeliverySublocationIdentifier >
    < dkcc2005:StreetName > one < / dkcc2005:StreetName >
    < StreetNameForAddressingName > one < / StreetNameForAddressingName >
    < dkcc:StreetBuildingIdentifier > 1 < / dkcc:StreetBuildingIdentifier >
    < dkcc:FloorIdentifier > 1 < / dkcc:FloorIdentifier >
    < dkcc:SuiteIdentifier > one < / dkcc:SuiteIdentifier >
    < dkcc2005:DistrictSubdivisionIdentifier > one < / dkcc2005:DistrictSubdivisionIdentifier >
    < dkcc2005 - 2:PostOfficeBoxIdentifier > 1 < / dkcc2005 - 2:PostOfficeBoxIdentifier >
    < dkcc2005:PostCodeIdentifier > 0000 < / dkcc2005:PostCodeIdentifier >
    < dkcc2005:DistrictName > one < / dkcc2005:DistrictName >
    < dkcc:CountryIdentificationCode scheme = 'iso3166-alpha2' > < / dkcc:CountryIdentificationCode >

    Please suggest me how I can generate xml output in these way of pl/sql.

    Thank you
    Rambeau

    Look at the features of SQL/XML, XMLElement, XMLForest, XMLAgg, etc. to generate your XML code. It will probably take a big SQL account to your sample, but it will be flexible. Regarding validation, see the FAQ on this forum.

  • Remove the first line xml generated xml to VO

    I am combining multiple xml files to generate the report using BIPublisher. I generated xml based on a VO by using VO.writeXML. How can I remove first row (<? xml version = "1.0"? >) in the xml file?

    Use the transformer and setOutputProperty to omit the first line.

    Transformer transformer = TransformerFactory.newInstance () .newTransformer ();
    transformer.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, 'yes');

    Edited by: Puthanampatti Dec. 6 2012 18:42

  • Need to remove the tags file Nullable while generating XML files

    Hello.

    I have a requirement where I have to generate an XML file, but the generated XML file does not display the tags when the column is null. An example below:

    CREATE TABLE emp_tab (emp_id NUMBER PRIMARY KEY
    name VARCHAR2 (20).
    dept_id NUMBER);
    Table created.
    INSERT INTO emp_tab VALUES (30, 'Scott', NULL);
    1 line of creation.
    INSERT INTO emp_tab VALUES (31, 'Mary', NULL);
    1 line of creation.
    INSERT INTO emp_tab VALUES (40, 'John', NULL);
    1 line of creation.
    COMMIT;

    When I generate the XML code, you can find the output like below:
    < EMPLOYEE >
    < EMP_ID > 30 < / EMP_ID >
    Scott < NAME > < / NAME >
    < / EMPLOYEE >

    I just the Worklfow Developer's Guide and the example above was taken from Page 561 and 562 by looking at the DBMS_XMLGEN.setNullHandling using DBMS_XMLGEN procedure. DROP_NULLS as a parameter.

    Now, I understand the concept, but my requirement is a little different. I get a record as my procedure parameter PLSQL type, but requires the choice of a base table, which means maybe I have to insert first the folder I get as parameter in a table of basic and then select in the same when you set the context, which is what I don't want in the DBMS_XMLGEN.newContext. This is an additional burden.

    I've previously planned to use XMLELEMENT and XMLFOREST to generate the XML file (and was rather more simple), but this requirement to remove the tags altogether when the values are NULL led me to believe that maybe I might have to go down the path of using the API DBMS_XMLGEN.

    Can you suggest a better way, replacement to achieve what I want? Or perhaps give an example on how I can get there using XMLDB?


    Thank you and best regards,
    JD

    Can I use just the XMLElement and XMLForest to achieve?

    Sure. As said, XMLForest does not create elements for NULL values:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb13gen.htm#ADXDB5006

    If the expression value is null, then no element is created for this expression.

    This is the code I wrote your above mentioned suggestion discussion forum

    Yes, but this solution is taken out of context.
    Here, it is obviously preferable to not generate empty items in the first place:

    SELECT XMLElement("Address"
           , XMLForest(
               lr_addr_rec.account_name     as "AccountName"
             , lr_addr_rec.address_line_1   as "Addressline1"
             , lr_addr_rec.lot_number       as "Addressline1"
             , lr_addr_rec.address_city     as "City"
             , lr_addr_rec.address_state    as "State"
             , lr_addr_rec.address_postcode as "PostCode"
             )
           )
    FROM dual;
    
  • XML report generates xml instead of output pdf output

    Hi all

    I've created a report using BI publisher. When I'm runnng report it's to show the xml output instaead of pdf format... The report is carried out with a warning message. I am able to see the other outputs (XML) reports in pdf format. But this report is having some problems, which I am not able to identify.
    Help, please...

    Thank you
    Djaruf

    Patch is 12395372 and can be downloaded from My Oracle Support. It isn't really a patch, but a special installation of Windows of BIP Office of EBS

    How to download Oracle XML Publisher Desktop 5.6.3 (BI Publisher 10g)? [556032.1 ID]

    HTH
    Srini

  • How to generate a letter in PDF format... (APEX 4.0)

    Hi all

    I want to generate a report in the format of the letter... the output format is PDF.

    For example, consider table EMP... of this im going to query and display the columns of

    EMP_NAME, ADDRESS, SALARY, APPOINTMENT

    And in this report, I'll be having a box for each line... If I check it for 5 employee gave the report... I have to generate a letters for employees who checked in PDF format.

    Output should be like:
                                                                    Date:
    EMPNAME:: employee1
    ADDRESS::xyz
    
    dear sir ,
      content .. xyz
    thanking you
                                                                    Date:
    EMPNAME:: employee2
    ADDRESS::xyz
    
    dear sir ,
      content .. xyz
    thanking you
                                                                    Date:
    EMPNAME:: employee3
    ADDRESS::xyz
    
    dear sir ,
      content .. xyz
    thanking you
    .
    .
                                                                    Date:
    EMPNAME:: employee5
    ADDRESS::xyz
    
    dear sir ,
      content .. xyz
    thanking you
    THANKS IN ADVANCE FOR YOUR HELP

    Kind regards
    Arumugam

    You may need to do this with Jasper, BI Publisher, or PL/PDF reports. Jasper is the free option. For details see http://www.opal-consulting.de/apex/f?p=20090928:4:2283604491057775:NO:

    Habib

  • How to generate Trace files in SQL * more

    Hi friends,

    How to generate Trace files in SQL * more?

    I have no idea



    Thank you

    REDA

    http://www.orafaq.com/wiki/SQL_Trace

  • the formatting generated XML using XMLELEMENT() my output approximates to a single line, I want to be in an XML format

    Hi I have a problem in the formatting of XML file, that I generated with xmlelement() when I run it gives me putput in one line

    is it possible that I got my output as an XML file...

    This is the expected behavior. PRETTY print (ing) is required for humans. XML parsers do not need XML to be pretty printed. If you open the XML file in a browser such as Windows Explorer or Firefox, the browser will display enough output for you.

    In all, the exit 'single line' is made for PERFORMANCE reasons (lack of useless end of line and CTRL line breaks etc.)

    SELECT xmlelement ("employee name", model ") as"RESULT XML.

    FROM DUAL;

    X

    SELECT xmlelement ("employee name", xmlelement ("name", false))

    , xmlelement ("LastName", dummy)

    ) as "RESULT XML.

    FROM DUAL;

    X X

    XMLSERIALIZE enough to print the result if necessary via indentation

    SELECT XMLSERIALIZE (SIZE of withdrawal CONTENT xmlelement ("Employee Name", xmlelement ("name", model), xmlelement ("LastName", false)) as CLOB = 1).

    FROM DUAL;

    X

    X

  • How to generate XML nested using PL/SQL data?

    I have an XML that looks like this file...

    <? XML version = "1.0"? >
    < TDefs >
    < ListItem >
    < TDef >
    < DisplayName > AFP < / DisplayName >
    < enabled > True < / enabled >
    < LISName > AFP < / LISName >
    < LOINC / >
    < PrintName > AFP < / PrintName >
    < CompatibilityCode > 1 < / CompatibilityCode >
    < details >
    < PatientReplicates > 1 < / PatientReplicates >
    < AutoReDilute > false < / AutoReDilute >
    < / details >
    < DilutionList >
    < TDefDilution >
    < dilution > 1 < / Dilution >
    < CalculationFactor > 1 < / CalculationFactor >
    < / TDefDilution >
    < / DilutionList >
    < TDefRange >
    < RangeList >
    < RangeInfo >
    < ID >
    < int > 6509 < / int >
    < /ID >
    < name >
    < string > check Range2 < / string >
    < / name >
    < Name_MessageID >
    < int >-1 < / int >
    < / Name_MessageID >
    < IsNull RepeatedlyReactiveData = "true" / >
    < IsNull RepeatedlyReactiveComments = "true" / >
    < CreatedByIM >
    < Boolean > true < / Boolean >
    < / CreatedByIM >
    < / RangeInfo >

    This is data that are from different tables. It is a multilevel nested nodes each other.
    How do I achieve using PL/SQL? What is the best way?

    I've only used to date dbms_xmlgen to generate data from a single table.
    Can anyone help?

    How do I achieve using PL/SQL? What is the best way?

    SQL/XML functions.

    For example: {message identifier: = 9670705}

    After a few data structures and table (DDL) samples if you need specific help on the query.

  • The decimal separator in the model generator XML Word formatting

    Hello
    I am a model in the XML Editor, for a report of accounts receivable in the E-Business Suite. So I use MS Word with the Publisher Oracle XML model builder plug-in software component.

    The data comes from the E-Business suite by using the comma as decimal separator. For example: 123,99
    My goal is to have the period as the decimal separator. For example: 123.99
    Does anyone know what code should I use to achieve this?
    Thanks colin

    in the next time use appropriate forum - Forum: Editor of BI - BI Publisher

    >
    The data comes from the E-Business suite by using the comma as decimal separator. For example: 123,99
    My goal is to have the period as the decimal separator. For example: 123.99
    >
    use

    
    

    where VAL is tag with 123,99

  • Generation of XML through PL/sqL

    Hello guys,.
    I am trying to generate an XML document using the Oracle table
    The table structure
    create table lb_XML 
    (
    lbUs             VARCHAR2(50),
    lbconttypId     VARCHAR2(100),
    lbcontId         VARCHAR2(100),
    lbFacename         VARCHAR2(100),
    lbTname           VARCHAR2(100),
    lbSyn          VARCHAR2(100),
    UsTypename       VARCHAR2(100),
    UsTypeOrder      VARCHAR2(100)
    ) 
    INSERT statement
    Insert into lb_XML  values ('WDD','RCP','74125','ING','EG','','','');
    Insert into lb_XML  values ('WDD','RCP','74125','ING','LM','','','');
    Insert into lb_XML  values ('WDD','RCP','74125','DT','BD','','','');
    Insert into lb_XML  values ('WDD','RCP','74125','PM','FD','','','');
    Insert into lb_XML  values ('WDD','RCP','84145','ING','EG','','','');
    Insert into lb_XML  values ('WDD','RCP','84145','ING','FRT','','','');
    Insert into lb_XML  values ('WDD','RCP','84145','ING','LM','','','');
    Insert into lb_XML  values ('WDD','RCP','84145','PM','BRD','','','');
    Insert into lb_XML  values ('WDD','VID','999991','ING','FRT','','','');
    Insert into lb_XML  values ('WDD','VID','999991','ING','LM','','','');
    Insert into lb_XML  values ('WDD','VID','999991','DT','CK','','','');
    Insert into lb_XML  values ('WDD','VID','999991','PM','BKD','','','');
    Insert into lb_XML  values ('WDD','VID','888823','ING','EG','','','');
    Insert into lb_XML  values ('WDD','VID','888823','PM','FD','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD/HLD','ING','EG','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD/HLD','ING','FRT','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD/HLD','ING','LM','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD/HLD','DT','CK','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD/HLD','PM','BKD','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD','ING','EG','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD','ING','FRT','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD','ING','LM','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD','DT','CD','','','');
    Insert into lb_XML  values ('WDD','ART','RCP/HLD','PM','BKD','','','');
    commit;
    Try something like this
    SELECT XMLELEMENT("USG", 
              XMLELEMENT("Contyps", 
                  XMLAGG(XMLELEMENT("Contyp",XMLATTRIBUTES(l.lbconttypId as ContypId),
                     XMLELEMENT("ContEle",
                         XMLELEMENT("Con", XMLATTRIBUTES(l.lbcontId  as ConId),
                            XMLELEMENT("Faces",
                               XMLELEMENT("Face" ,XMLATTRIBUTES(l.lbFacename as name),
                                   XMLELEMENT("Tgs",
                                       XMLELEMENT("Tg", XMLATTRIBUTES(l.lbtname as name),
                                           XMLELEMENT("Syns",
                                               XMLELEMENT("Syn", XMLATTRIBUTES(l.lbsyn as name),
                                                  XMLELEMENT("UsTypes",
                                                      XMLELEMENT("UsType", XMLATTRIBUTES(l.UsTypename as name ,l.UsTypeOrder  as lorder))
                                                  )
                                               )
                                           )
                                       )
                                   )
                               )
                            )                      
                         )
                     )
                  )
                 ) 
              )
           )
    AS XML FROM  lb_xml l    
    group by l.lbconttypId;
    Need something like
    <USG>
      <Contyps>
        <Contyp ContypId="RCP">
          <ContEle>
            <Con ConId="74125">
              <Faces>
                <Face name="ING">
                  <Tgs>
                    <Tg name="EG">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="LM">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="DT">
                  <Tgs>
                    <Tg name="BD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="PM">
                  <Tgs>
                    <Tg name="FD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
              </Faces>
            </Con>
            <Con ConId="84145">
              <Faces>
                <Face name="ING">
                  <Tgs>
                    <Tg name="EG">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="FRT">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="LM">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="PM">
                  <Tgs>
                    <Tg name="BRD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
              </Faces>
            </Con>
          </ContEle>
        </Contyp>
        <Contyp ContypId="VID">
          <ContEle>
            <Con ConId="999991">
              <Faces>
                <Face name="ING">
                  <Tgs>
                    <Tg name="FRT">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="LM">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="DT">
                  <Tgs>
                    <Tg name="CK">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="PM">
                  <Tgs>
                    <Tg name="BKD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
              </Faces>
            </Con>
            <Con ConId="888823">
              <Faces>
                <Face name="ING">
                  <Tgs>
                    <Tg name="EG">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="PM">
                  <Tgs>
                    <Tg name="FD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
              </Faces>
            </Con>
          </ContEle>
        </Contyp>
        <Contyp ContypId="ART">
          <ContEle>
            <Con ConId="RCP/HLD/HLD">
              <Faces>
                <Face name="ING">
                  <Tgs>
                    <Tg name="EG">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="FRT">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="LM">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="DT">
                  <Tgs>
                    <Tg name=" CK ">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="PM">
                  <Tgs>
                    <Tg name="BKD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
              </Faces>
            </Con>
            <Con ConId="RCP/HLD">
              <Faces>
                <Face name="ING">
                  <Tgs>
                    <Tg name="EG">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="FRT">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                    <Tg name="LM">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="DT">
                  <Tgs>
                    <Tg name="CD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
                <Face name="PM">
                  <Tgs>
                    <Tg name="BKD">
                      <SYNS/>
                      <UsTypes/>
                    </Tg>
                  </Tgs>
                </Face>
              </Faces>
            </Con>
          </ContEle>
        </Contyp>
      </Contyps>
    </USG>
    Help, please...

    Published by: user10647455 on November 1, 2011 12:42

    Apply the function on the root element, it formats the whole document:

    SQL> set long 1000
    SQL> set pages 100
    SQL> SELECT XMLSerialize(DOCUMENT
      2           XMLElement("Emps",
      3             XMLAgg(
      4               XMLElement("Emp", XMLAttributes(empno as "id"),
      5                 XMLElement("name", ename)
      6               )
      7             )
      8           )
      9           as CLOB INDENT
     10         ) as output
     11  FROM scott.emp
     12  WHERE deptno = 10
     13  ;
    
    OUTPUT
    ------------------------------------------------------------------
    
      
        CLARK
      
      
        KING
      
      
        MILLER
      
    
    
  • Remove unnecessary tags in XML using PL/SQL

    Hi friends

    the Sub XML, its build a SQL query complex, we need to remove all the tags of type objectand all the empty tags.

    Version PL/SQL Release 11.2.0.3.0 - Production

    < MajorLine >

    < MAJOR_LINE_OBJECT_TYPE > - need to remove these types of items showing in the XML file

    < LINEID > 143424538 < / LINEID >

    TC-ABC-123 < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < SERVICE / >-need to remove all empty tags

    < MINORLINE >

    < MINOR_LINE_OBJECT_TYPE > -need to remove these types of items showing in the XML file

    < LINEID > 143424799 < / LINEID >

    TCC - abc < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    <SERVICE/ >-need to remove all empty tags

    < MINOR_MINOR_LINES >

    < M_MINOR_LINE_TYPE > -Need to remove these types of items showing in the XML file

    < LINEID > 143424798 < / LINEID >

    SF15-abc-xyz < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < / M_MINOR_LINE_TYPE > -Need to remove these types of items showing in the XML file

    < / MINOR_MINOR_LINES >

    < / MINOR_LINE_OBJECT_TYPE >-need to remove these types of items showing in the XML file

    < / MINORLINE >

    < / MAJOR_LINE_OBJECT_TYPE >-need to remove these types of items showing in the XML file

    < / MajorLine >

    I tried one of the queries posted in this blog, PFB to remove empty tags, but it did not work for me unfortunately. Help, please.

    PFB

    WITH sample_data LIKE)

    SELECT xmltype ("< MajorLine >

    < MAJOR_LINE_OBJECT_TYPE >

    < LINEID > 143424538 < / LINEID >

    hijk < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < SERVICE / >

    < MINORLINE >

    < MINOR_LINE_OBJECT_TYPE >

    < LINEID > 143424799 < / LINEID >

    EFG < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < SERVICE / >

    < MINOR_MINOR_LINES >

    < M_MINOR_LINE_TYPE >

    < LINEID > 143424798 < / LINEID >

    ABC < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < / M_MINOR_LINE_TYPE >

    < / MINOR_MINOR_LINES >

    < / MINOR_LINE_OBJECT_TYPE >

    < / MINORLINE >

    < / MAJOR_LINE_OBJECT_TYPE >

    (< / MajorLine > ') xmldoc

    OF the double

    )

    SELECT deleteXML (t.xmldoc

    ', ' / MajorLine / * [. = "" or contains(.,"?") "].

    ) as a result

    OF sample_data t

    ;

    My email is [email protected] - you can reach me

    Thanks in advance... Arun thomas T

    Hi again,

    A few general suggestions first:

    -do not give your e-mail address here, unless you want to be spammed for the next few weeks.

    -Mark all your previous sons answered if you feel your questions have been answered, it'll help people focus on new questions.

    On your new question:

    How the XML is generated?

    When someone asks questions on how to remove nodes from an XML, I always say the best way is to not generate them in the first place.

    That's why the SQL/XML functions are most often the best way to generate specific structures using other facilities 'out-of-the-box' such as DBMS_XMLGEN.

    DELETEXML is obsolete, and anyway this method is useful for deleting nodes.

    XSLT or XQuery is suitable for structural change in this case, although I would look first to get the necessary structure in the first place.

Maybe you are looking for

  • Satellite A350D - 20K - FN keys not working is not Windows 7

    Hello I'm having a problem with my laptop, the fn keys do not work.I had this problem before, but when I reinstalled Windows 7 they worked again. Unfortunately after a few updates I had the same problems as before.I think it is really annoying, becau

  • slow start for windows xp

    I am running windows xp. It takes about 8 minutes to reach the top of the office, what is currently happening on a dell d600. left by 27% on the hard drive. takes about 5 minutes to connect to msn. What can I do to speed up the process.

  • small images in the icon on the desktop

    Sometimes when I create a shortcut on my desktop shows a white square with upper right corner folded down, but the real image of the shortcut is very low. For example: my icon for g-mail is a small envelope framed in red and my bing is a small orange

  • SERVICE PACK 2 INSTALLS BUT SOON BLOCK BIG TIME.

    SERVICE PACK 2 INSTALLS BUT SOON BLOCK BIG TIME. I tried to install it 4 times. Whenever he works initially but soon has a devastating accident. The screen freezes and goes to a pinkish color ill. I use the system restore and go back before the insta

  • No installation disk DVD when you buy a laptop. __

    Hello. I have a problem with a laptop. bought but did not, CD and DVD with the software most commonly gets to purchase, I knew from the drive and the software twrdym if something happened there, just press a button when the computer starts and alread