Select XMLElement - want some whitespace or newlines!

Hi -
I'm using XML SQL psuedo functions to make an XML document. It's making valid XML, but it's hideous to read. The SQL select is actually a select ... into in a PL/SQL function. Is there any way to force some newlines or spaces after the end tags, so the message would be more readable in a text editor?
EXAMPLE:
SELECT XMLElement("OBSERVATION-DATA",
     XMLAttributes('http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
          'C:\Documents and Settings\rmercer\My Documents\Rick\projects\LAPHIN\Maps\canonical_v2\canonical_lab_v3.xsd' AS "xsi:noNamespaceSchemaLocation"),
XMLForest(
     XMLForest(
          c_SOURCEEXT     as "SOURCE-IDENT",
          c_SOURCEROOT     as "SOURCE-ROOT",
          c_SOURCEEXT     as "SOURCE-FACILITY-IDENT",
          c_SOURCEROOT     as "SOURCE-FACILITY-ROOT",
          ) as "SOURCE-INFORMATION", -- end of source info forest
     XMLForest(
          XMLConcat( XMLElement("PERSON-ID-NUMBER", MPERSON.PERSON_UID),
     ) -- end of main forest
     ) into v_OBSXML
FROM nbs_msgine.msgin_person MPERSON,
GIVES A REALLY LONG LINE OF OUTPUT:
<SOURCE-INFORMATION><SOURCE-IDENT>LABCORP</SOURCE-IDENT><SOURCE-ROOT>999.5.1.2.1</SOURCE-ROOT><SOURCE-FACILITY-IDENT>LABCORP</SOURCE-FACILITY-IDENT><SOURCE-FACILITY-ROOT>999.5.1.2.1</SOURCE-FACILITY-ROOT><RECVR-IDENT>LADOH</RECVR-IDENT><RECVR-ROOT>999.5.1.1.5</RECVR-ROOT><RECVR-FACILITY-IDENT>LADOH</RECVR-FACILITY-IDENT><RECVR-FACILITY-
Thanks!
Andy Russo

The SQL/XML functions do not pretty-print for performance reasons. Over a large document the amount of additional white space generated by pretty printing can be quite expensive.
There is a very simple way of forcing a pretting print
As can be seen in the example below the output is not pretty printed. It's technically correct but difficult to read.
SQL> select xmlElement
2 (
3 "Country",
4 xmlElement("Name",c.COUNTRY_NAME),
5 xmlAgg
6 (
7 xmlElement
8 (
9 "Department",
10 xmlElement("Name", d.DEPARTMENT_NAME),
11 ( select xmlAgg
12 (
13 xmlElement
14 (
15 "Employee",
16 xmlForest(e.FIRST_NAME as "FirstName", e.LAST_NAME as "LastName")
17 )
18 )
19 from HR.EMPLOYEES e
20 where e.DEPARTMENT_ID = d.DEPARTMENT_ID
21 )
22 )
23 )
24 ) as XML
25 from HR.COUNTRIES c, HR.DEPARTMENTS d, HR.LOCATIONS l
26 where l.COUNTRY_ID = c.COUNTRY_ID
27 and d.LOCATION_ID = l.lOCATION_ID
28 and c.COUNTRY_NAME = 'Canada'
29 group by c.COUNTRY_NAME
30 /
<Country><Name>Canada</Name><Department><Name>Marketing</Name><Employee><FirstNa
me>Michael</FirstName><LastName>Hartstein</LastName></Employee><Employee><FirstN
ame>Pat</FirstName><LastName>Fay</LastName></Employee></Department></Country>
In order to get pretty printed output we need to force a print & parse. It should be remembered that this is fairly expensive and so should only be done when debugging out etc. It can be done by adding .extract('/*') to the output of the outermost SQL/XML operator.
Eg
SQL> select xmlElement
2 (
3 "Country",
4 xmlElement("Name",c.COUNTRY_NAME),
5 xmlAgg
6 (
7 xmlElement
8 (
9 "Department",
10 xmlElement("Name", d.DEPARTMENT_NAME),
11 ( select xmlAgg
12 (
13 xmlElement
14 (
15 "Employee",
16 xmlForest(e.FIRST_NAME as "FirstName", e.LAST_NAME as "LastName")
17 )
18 )
19 from HR.EMPLOYEES e
20 where e.DEPARTMENT_ID = d.DEPARTMENT_ID
21 )
22 )
23 )
24 ).extract('/*') as XML
25 from HR.COUNTRIES c, HR.DEPARTMENTS d, HR.LOCATIONS l
26 where l.COUNTRY_ID = c.COUNTRY_ID
27 and d.LOCATION_ID = l.lOCATION_ID
28 and c.COUNTRY_NAME = 'Canada'
29 group by c.COUNTRY_NAME
30 /
<Country>
<Name>Canada</Name>
<Department>
<Name>Marketing</Name>
<Employee>
<FirstName>Michael</FirstName>
<LastName>Hartstein</LastName>
</Employee>
<Employee>
<FirstName>Pat</FirstName>
<LastName>Fay</LastName>
</Employee>
</Department>
</Country>

Similar Messages

  • I have a music library on an iMac and I got a new iPhone and a new MacBook Pro and I want some of the songs from the iMac library to be on my phone and my MacBook Pro and I have a new Apple ID on my phone and my Mac book pro

    I have a music library on an iMac and I got a new iPhone and a new MacBook Pro and I want some of the songs from the iMac library to be on my phone and my MacBook Pro and I have a new Apple ID on my phone and my Mac book pro, is this possible if so how do I do it?

    Providing specifics on all the ways to do this will take more time than I am willing to spend here these days.  You can do some of this with Home Sharing.  You can transfer the entire library from one computer to another, If you do that you can delete what you don't want from the transferred library.
    Quick answer if you use iTunes' default preferences settings: Copy the entire iTunes folder (and in doing so all its subfolders and files) intact to the other drive. Open iTunes and immediately hold down the option (alt) key (shift on Windows) so you get a prompt to select a library, then guide it to the 'iTunes Library.itl' file in the moved iTunes folder. If you put the copied iTunes folder in the default location of Macintosh HD > Users > *User Name* > Music then you don't even need to start with the option key held down, iTunes will automatically look for it there. (Make sure there isn't anything already in the iTunes folder there that you want to keep since you will be replacing it with the one you are moving.)
    You do not want to use a new AppleID.  Change the  AppleID on the new phone to the old ID.  Purchases made with one AppleID cannot be transferred to a different one and it will be a royal pain to manage two Apple IDs.
    Change iTunes Store account on an iOS device - Log out of your current account with Settings.app > Store (Settings > iTunes & App Stores on iOS 6) > tap on your AppleID. Log in with a different account. Note, turning on automatic downloads or re-download past purchases may tie the device to that account for 90 days - http://support.apple.com/kb/HT4627 https://discussions.apple.com/message/18484935 - "In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account") When you delete your account, all the data that is synced with iCloud will also be deleted from the device (but not from iCloud), but will be synced back to your device when you login again."

  • I want some help i do reset all content and setting and when i do it my ipad show mw a cercle an it do loading what i can do  ?

    i want some help i do reset all content and setting and when i do it my ipad show mw a cercle an it do loading what i can do  ?

    Have you tried connecting the iPad to your computer and using iTunes to restore to factory settings? These are the basic steps.
    You can read more here.
    http://support.apple.com/kb/HT1414
    Do not restore from a backup at the end if you want to restore as new.
    Connect your device to your computer.
    Select your iPhone, iPad, or iPod touch when it appears in iTunes under Devices. Select the Summary tab, and click the Restore button.
    Click Restore

  • Hey, I have $2350-2400 and I want some proper guidance for the macbook pro

    HEY!!!
    Guys I will try to make this as easy as possible!
    First let me tell you I am 15, I love graphics, music and literature and I have no credit card, my iTunes account has no money, I'm using an account that doesn't require credit cards! So (ugh) I buy all the free apps
    Anyway
    Dad gave me $2400 to buy a macbook pro and keep the change but since I live in Italy, I have to convert them to Euros.
    $2400-1821 EUR
    So I came up with 2 conclusions and I just want some opinions on which is the smarter decision.
    Well apparently there are 4 types of laptops I can get right now from the macs.....
    to make this as simple and as easy as possible (and to show off my ICT skills ) I made a table which includes
    1) the laptop mentioned
    2) the price in dollars (which I got directly from the apple store in the US)
    3) the price in euros (which I got directly from the apple store in Europe)
    Macbook Pro Kind
    Price in dollars
    Price in EUR
    13-inch: 2.5GHz
    $1119.00
    1249.00 EUR
    13-inch: 2.9GHz
    $1499.00
    1549.00 EUR
    13-inch: 2.5GHz with Retina Display
    $1499.00
    1549.00 EUR
    13-inch: 2.6GHz with Retina Display
    $1699.00
    1749.00 EUR
    But you can install somethings on to your laptop right there in the shop and I wanted two things,
    1) pages: I thought would help with my writing because I write poems, novels, stories, etc
    2) numbers: this program just deals with spreadsheets and charts and just the mathematical area and thought that this would help when doing A levels and GCSE math
    3)keynote: This is basically like power point and it just makes presentations.
    each of these programs are 18 EUR
    One more thing, since I am planning on using this laptop for several years, I change  changing countries often and so the laptop can come with an adapter that works in both European and American countries
    But thats 80 EUR
    The laptop (the edition i want) is 1749 EUR
    that means with all these additional stuff
    I calculated it on the apple store
    1749.00 EUR + 18 EUR + 18 EUR+ 18 EUR 80 EUR = 1883.01 EUR
    If we were in america then according to the website's store
    $1699 + $19.99 + $19.99 + $19.99 + $79.00=  $1847.96
    I'd be buying the SAME amount of things in the States for $1847.96 and I'd have 552 dollars change but in Italy everything would cost 1883.01 EUR which is the equivalent of $2481.61 which is more expensive than the US!
    BUT
    You have to consider the fact that this is with all the additional costs
    The additional things I thought I'd need
    If I said "no just buy the laptop"
    then the correct price in dollars is $1699
    the correct price in euros would be 1749 EUR
    the laptop only. No extra features.
    1749 EUR in Dollars would be $2305!
    Exactly $2305!
    That means I would only have had 95 dollars difference.
    Anyway the bottom line is all these additional things that I was talking about, the softwares and everything, they're going to help me in the near future, not RIGHT now.
    So what I can do is just buy the laptop and then as I progress in to year eleven, slowly by slowly, I can start buying the softwares.
    I'm sorry I'm unburdening ALL these different information on you, but I just wanted to approach this from as many angles and be as aware of all the variables as possible.
    SOOOOOOOOOOOOOOOOOOOOO
    (THIS IS THE CONCLUSION)
    OPTION ONE
    Buy the 13-inch: 2.6GHz with Retina Display Macbook Pro for 1749.00 EUR including all the additional features (the three softwares and the adapter which together have the total value of 134 EUR)
    Therefore the total amount of money we'd be spending is
    1883.01 EUR
    That means the total cost of everything would be $2481.62 and I'd get no difference
    OPTION TWO
    Buy the 13-inch: 2.6GHz with Retina Display Macbook Pro for 1749.00 EUR and then when I am 16 or 18 I buy these softwares with a credit card and apply them for my A levels later.
    That means the total amount we'll be spending is
    1749.00 EUR
    Which is $2305
    I will have $95 (72 EUR) pocket money.
    (BY THE WAY, MY PARENTS WORK FOR THE UNITED NATIONS AND DON'T PAY VAT OR SOMETHING AND SO WE KIND OF SOMEHOW GET A 20% DISCOUNT SO THE PRICES WILL BE A BIT OFF AND CHEAPER.... I JUST CAN'T BE BOTHERED TO DO ALL OF THE CALCULATIONS BUT YEAH.....................)
    Thanks for reading
    Please reply ASAP I'm buying the mac extremley soon.....

    Never heard of .MOD format, but generally VLC player will play most any format.
    It's free, open source so no harm in trying:
    http://www.videolan.org/vlc/

  • Multi provider we have many cubes,but i want some of that how to fllter?

    multi provider we have many cubes,but i want some of that how to fllter?

    In the queries bring the 0INFOPROV (infoprovider) characteristic and restrict it your desired infocube or dso used in multiprovider.
    Hope this helps.

  • I have brought a 17'' MacBook Pro 2.5ghz core 2 duo 2gb. Model A1261. It seems I can upgrade to either 8gb or 16gb ram! But since It's 2006'ish, I just want some advice on the best ram that would work for a good price. Thanks :)

    I have brought a 17'' MacBook Pro 2.5ghz core 2 duo 2gb. Model A1261. It seems I can upgrade to either 8gb or 16gb ram! But since It's 2006'ish, I just want some advice on the best ram that would work for a good price. Thanks :)

    Keiran420 wrote:
    8 gb will do I guess
    Based on the information that you have supplied, you have a Early or Late 2008 MBP.  Maximum RAM that it will accept is 6 GB with the following specifications:   200-pin PC2-5300 (667MHz) DDR2 SO-DIMM.
    The best sources for Mac compatible RAM are OWC and Crucial.
    Ciao.

  • Pro*c selecting XMLElement strangeness

    I've had a pro*c problem that I can't figure out. Hopefully, one of you might be able to do so. I am trying to create a XML output from a select statement. I having several problems, but the first one is that I can't get a simple XMLElement to work.
    Depending on how I do it, it either does not pre-compile or compiles - but does not work. Both queries work correctly in SQL*Plus.
    Pro*c Code >>>>>>>>>>>>
    EXEC SQL BEGIN DECLARE SECTION ;
    OCIClobLocator *xmltype_lob;
    EXEC SQL END DECLARE SECTION ;
    EXEC SQL ALLOCATE :xmltype_lob;
    EXEC SQL LOB CREATE TEMPORARY :xmltype_lob;
    EXEC SQL
    SELECT XMLElement("eligVerification", dummy ).getClobVal() <--line 125
    INTO :xmltype_lob
    FROM dual;
    if ( sqlca.sqlcode != 0 )
    fprintf (stderr, "Failed to get XML sqlca.sqlcode = %d\n" , sqlca.sqlcode ) ;
    fflush(stderr);
    exit ( EXIT_FAILURE ) ;
    <<<<<<<<<<<<
    This fails on the pre-compile:
    Syntax error at line 125, column 55, file tester.sc:
    Error at line 125, column 55 in file tester.sc
    XMLElement("eligVerification", dummy ).getClobVal()
    ......................................................1
    PCC-S-02201, Encountered the symbol "." when expecting one of the following:
    , * + - / | an identifier, a quoted string, at, date, into,
    as, count, from, day, extract, hour, interval, minute, month,
    second, time, timestamp, treat, trim, year, avg, max, min,
    sum, stddev, variance,
    ======================
    If I remove the .getClobVal(), the SELECT now looks like:
    Changed >>>>>>
    EXEC SQL
    SELECT XMLElement("eligVerification", dummy )
    INTO :xmltype_lob
    FROM dual;
    <<<<<<<<<<<<
    This does get thru the pre-compile and compiles just fine. At run time, I get this:
    Failed to get XML sqlca.sqlcode = -932
    From oerr, that is: 00932, 00000, "inconsistent datatypes: expected %s got %s"
    Any thoughts?
    We are using:
    SunOS 5.10 Generic_147440-27 sun4u sparc SUNW,SPARC-Enterprise
    Sun C 5.12 SunOS_sparc 2011/11/16
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    Pro*C/C++: Release 11.2.0.3.0
    Edited by: 989848 on Feb 22, 2013 12:43 PM

    SELECT XMLElement("eligVerification", dummy ).getClobVal()
    The syntax of this function call is wrong. XMLElement takes two parameters ("<NAME>", Identifier). You have added a call to GetClobVal(). You cannot do this!
    See how to use XMLElement here... http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions220.htm
    The second problem is a type mismatch in the data you are bringing back and the variable you are trying to store it in. Remember C and Oracle datatypes are not the same!
    Edited by: 996008 on 25-Mar-2013 08:15

  • Hi friends i want some project Title in J2EE

    hi iam doing my final year B.E and my wish is to do a better projet in J2EE(i know J2EE) and i want some help from u. That is if u found any projet ideas and titles in J2EE and if u feel that it was good to me please send to me
    My email is [email protected]
    thank u
    urs senthilnathan

    hi ,
    the title " hostel management project " this is the best data manegement project
    using java in this u can use photo also

  • New Lightroom catalog always selects and includes some files from folder Applications/Mail/Contents/Resources. Why? Mac Mini OS X 10.10.1. Lightroom 5.7

    Whenever I create a new catalog, Lightroom selects and includes some, but not all,  TIFF files from the folder Applications/Mail/Contents/Resources. Why does it do this: I don't select this folder to be included. Mac mini OS X 10.10.1. Lightroom 5.7.
    Help much appreciated.
    Regards
    Dan O'Neill

    Whenever I create a new catalog, Lightroom selects and includes some, but not all,  TIFF files from the folder Applications/Mail/Contents/Resources. Why does it do this: I don't select this folder to be included. Mac mini OS X 10.10.1. Lightroom 5.7.
    Help much appreciated.
    Regards
    Dan O'Neill

  • Truncation of result XML using Select xmlelement

    I am trying the new XMLELEMENT Function of Select, and the resulting XML is truncating. It appears that only very short XML strings return properly. All others truncate.
    Example:
    Table Token
    Token_Id Number;
    Token_load_id Varchar2(64);
    Table Batch
    Batch_Id Number;
    select xmlelement("Batch", xmlelement("BatchId" , b.batch_Id),
    xmlelement("Card", xmlelement("TokenId" , t.token_Id),
    xmlelement("TokenLoadId", substr(t.token_load_Id,1,20)))) as "XMLResult"
    from token t, token_batch b
    where t.batch_id = b.batch_id
    and token_id < 110;
    Result:
    XMLResult
    <Batch>
    <BatchId>1</BatchId>
    <Card>
    <TokenId>100</TokenId>
    <TokenLoa
    <Batch>
    <BatchId>1</BatchId>
    <Card>
    <TokenId>101</TokenId>
    <TokenLoa
    So why would the result truncate? I built the above query based on examples in the CD doc set.

    If you are using SQL*PLUS to execute your queries and view the results, then you need to modify the settings that govern output of CLOBS (the default type for those fatty XML strings) in SQL*PLUS. I believe the one you need is 'long'.
    A LONG, CLOB or NCLOB column's width defaults to
    the value of SET LONGCHUNKSIZE or SET LONG, whichever
    one is smaller.Try the following:
    SQL> Set long 1000
    Rich

  • Select xmlelement not reurning data

    All,
    When I run the below query in toad I get 1 record:
    select * from fnd_user
    WHERE user_name ='MSPNARENB';
    But, when I run the below query (trying to generate xml data) in toad I an getting null.
    SELECT XMLElement( "user_name"
    , user_name
    FROM fnd_user
    WHERE user_name ='MSPNARENB';
    I am not sure what is wrong.
    Please help me.

    Most likely your Toad version doesn't handle XMLType datatype correctly.
    Try serializing the result as CLOB explicitly :
    SELECT XMLElement( "user_name"
                   , user_name
                   ).getClobVal() as result
    FROM  fnd_user
    WHERE user_name ='MSPNARENB';

  • On windows 8. My daughter has an i phone but wants some of my music...sep ids but I pay all the bills...can we share, how do  I do it?

    we have previously had real problems with my daughters phone and my i phone sharing messages etc...decided to have sep ids and to wipe my daughters phone down...reset. My daughter wants some of my i tunes music though...can we do it? if so how?
    Im on windows 8

    http://support.apple.com/kb/HT1329 How to use your iPod to move your music to a new computer

  • [svn:osmf:] 10094: Fix some whitespace issues.

    Revision: 10094
    Author:   [email protected]
    Date:     2009-09-09 10:16:52 -0700 (Wed, 09 Sep 2009)
    Log Message:
    Fix some whitespace issues.
    Modified Paths:
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld2.as
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld3.as

    1. Spaces are allowed but not recommended. I would avoid using space(s) in account names.
    2. I do not understand what you have prevented from changing user name.
    3. For problems with 3rd pty programs ask support/forum of respective software vendors.
    4. If you feel like addressing Microsoft, use
    http://support.microsoft.com/contactus/?ln=en-us
    Regards
    Milos

  • HT4915 I want some music to not upload to iTunes Match. How do I do this?

    I want some music to not upload to iTunes Match. How do I do this?

    https://discussions.apple.com/thread/1343532?start=0&tstart=0
    This issue just the other way around its a hardware issue

  • New Zynq SoC Porting Guide is like a "Bridge Over Troubled Software." Want some help porting that code?

    So you have an embedded design all coded up for one microprocessor architecture and you’d love to take advantage of the significant additional processing power of the dual-core ARM Cortex-A9 MPCore processor/programmable logic combination available with the Xilinx Zynq SoC? Want some help porting that code?
    Help is available with the new “Zynq-7000 All Programmable SoC Architecture Porting Guide,” UG1181. Following a quick overview of the ARM Cortex-A9 processor features found in the Zynq PS (Processor System), the guide gives the following handy table highlighting the differences among five processor architectures including the ARMv7 architecture, PowerPC, MIPS, Renesas-SH, and x86:
    The document also includes a comparison of function-calling conventions, interrupt models, memory maps, register sets, and pointers to the ARM Web pages that provide detailed help in porting from these other processor architectures.

    Are you using the latest version of Silverkeeper? - v.2.0.2 is stated to be compatible with Snow Leopard.
    http://www.lacie.com/silverkeeper/
    If it's messing things up you could try asking LaCie Support for assistance.

Maybe you are looking for

  • Can't deploy a SINGLE bean in weblogic 6.1 SP2 w/o application reload

    Anyone know how to update a single bean in an application without redeploying the entire application? We have a project containing 101 beans (session and entity) and 372 jsps which we are deploying on weblogic 6.1, SP2 as a single application. The pr

  • CC error in RFC to File Scenario

    Hi , While am trying to do end-to-end test for a RFC to file Scenario. Am getting this below error. Please help me to proceed further. Could not process due to error: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception

  • SharePoint 2013 Labeling deprectaed

    Hello, we are using Label in "Information management policy settings" for libraries to show the document version inside office documents  with "{Version}". This feature seems to be deprecated in SharePoint 2013: https://support.office.com/en-US/Artic

  • 1057 Metadata error -  RepositoryLayer.RLRepository Error

    Hi In MSA when going to generate BDOCS on client via client console we are getting this message: Error creating object of RepositoryLayer.RLRepository Unknown Error 1057 Metadata Generation Failed. Generation would have failed for atleast 1 BDoc. Mak

  • Time Machine Error: Unable to complete backup. An error ocurred while copy

    Hi. Everytime Time Machine tries to update my backup copy is gives me the same error: "Unable to complete backup. An error ocurred while copying files to the backup volume." What's going on and how can I solve this? Thanks. Regards, Telmo