Problem of generation of XML?

Hi, I'm relatively new to Flex 2 and I have a question.

I am generating a view of oracle xml file and I hope to use it as a base for a grid of data in the chart.

My generation yields process data something like this:
< list >
< product name = 'Laptop' total = '0' >
< name of the warehouse = onhand 'California' = "10" / >
< name of the warehouse = onhand "Virginia" = "20" / >
< name of the warehouse = onhand 'Washington' = '0' / >
< / product >
< product name = "Desktop computer" total = '0' >
< name of the warehouse = onhand 'Washington' = '9' / >
< / product >
< / list >

I took this generated XML and put it in a local file for now.

When I try to load this data, I get this error:
TypeError: Error #1009: cannot access a property or method of a null object reference.
to the TestFileAccess / TestFileAccess::resultHandler()
to TestFileAccess / __srv_result)
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
...
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

My mxml file looks like this:
<? XML version = "1.0" encoding = "utf-8"? >
"" "< mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout ="absolute"xmlns =" "*" paddingTop = "3" creationComplete = "initApp ()" pageTitle = 'Warehouse levels' >
< mx:Script >
<! [CDATA]
Import mx.collections.ArrayCollection;
Mx.rpc.events import. *;
[Bindable]
private var commodData:Array;
[Bindable]
private var warehouseData:Array;
[Bindable]
public var slicedCommodData:ArrayCollection;

private function initApp (): void
{
SRV. Send();
slicedCommodData = new ArrayCollection();
}
private void resultHandler(event:ResultEvent):void
{
commodData = event.result.list.name.source in the table;
warehouseData = new Array (commodData.length);
slicedCommodData.source = commodData;

var commodTotal:Number;
for (var x: Number = 0; x < commodData.length; x ++)
{
warehouseData [x] = {name: commodData [x] .name, onhand:0};
var warehouses: Array = commodData [x].warehouse.source in the table;
commodTotal = 0;
for (var j: Number = 0; j < warehouses.length; j ++)
{
commodTotal += warehouses [j] .onhand;
}
.total commodData [x] = commodTotal;
}
}
[]] >
< / mx:Script >
< mx:HTTPService id = "srv" url = "result.xml" useProxy = "false" result ="resultHandler (event)" / > "
< mx:Panel layout = "absolute" >
< mx:ColumnChart id = dataProvider = "{slicedCommodData.source"WarehouseTotals"}" >
< mx:horizontalAxis >
< mx:CategoryAxis dataProvider = "{slicedCommodData.source}" categoryField = "Name" / > "
< / mx:horizontalAxis >
< mx:series >
< mx:ColumnSeries xField = "Name" yField = "Total" / >
< / mx:series >
< / mx:ColumnChart >

< mx:DataGrid dataProvider = "{slicedCommodData.source}" >
< mx:columns >
< mx:DataGridColumn headerText = "Commodity" dataField = "Name" / >
< mx:DataGridColumn headerText = "Total" dataField = "Total" / >
< / mx:columns >
< / mx:DataGrid >
< / mx:Panel >
< / mx:Application >

I wonder if something is wrong with my generated xml data or if his thing. I noticed that my generation xml product still not 3 labels warehouse for each product. Could be the problem?
Also, the reason for which the label of the products of total is always 0 in the xml file is because this information is not in the view... I use mxml to calculate that.

Thank you!

It seems that I played with him for a while and that fixed it. The problem was my xml data and format that my httpservice returned. First of all my xml data to be surrounded and no Tags no and tags. Then my httpservice to be a result of e4x format. It also made me to change how I manage myself properties individual xml data.

In any case, the fixed code looks like this for anyone who cares and got a similar error.

"http://www.adobe.com/2006/MXML" xmlns = "" * "paddingTop ="3"creationComplete =" initApp () ' pageTitle 'Warehouse levels' = >

Import mx.collections.XMLListCollection;
Mx.rpc.events import. *;
[Bindable]
private var commodData:XMLList;
[Bindable]
public var slicedCommodData:XMLListCollection;

private function initApp (): void
{
SRV. Send();
}
private void resultHandler(event:ResultEvent):void
{
commodData = event.result.commodity;
slicedCommodData = new XMLListCollection (commodData);
var commodTotal:Number;
var nextNum:Number;
for (var x: Number = 0; x)< commoddata.length();="">
{
var warehouses: XMLList = commodData [x] .warehouse as XMLList;
commodTotal = 0;
for (var j: Number = 0; j< warehouses.length();="">
{
nextNum = 0;
nextNum = new Number (warehouses [j] .@onhand);
commodTotal = commodTotal + nextNum;
}
var firstItem:Object = slicedCommodData.getItemAt (i);
firstItem.@total = commodTotal;
}
}
]]>




















Thanks for all your help!

Tags: Flex

Similar Questions

  • Problem with XMLSerialize / indented XML

    My problem is that my XML output is only a line like:
    <? XML version = "1.0" encoding = "ISO-8859-15? > < rss version = "2.0" > < channel > < title > Test < / title > < / channel > < / rss >

    IAM want to export xml like this:
    <? XML version = "1.0" encoding = "ISO-8859-15? >
    < rss version = "2.0" >
    .. < String >
    ... < title > Test < /title >
    .. < / channel >
    < / rss >


    I heard from xmlserialize that should be used like this:
    Select xmlserialize (DOCUMENT xmltype (' <? xml version = "1.0" encoding = "ISO-8859-15"? > < rss version = "2.0" > < channel > < title > Test < /titre > < / channel > < / rss > ')) twice;

    but its no change in my outings.
    Can someone help me?

    Published by: Oliver L the 07.11.2008 14:15

    You are interested in the concept called "pretty printing".
    http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14259/xdb04cre.htm#sthref469

    If you're on 11, you can use one of the examples posted by mdrake to Re: generation of XML using XMLGEN

    The concept of printing enough has been discussed in this forum before and I think that the SQL and PL/SQL forum as well.

    select xmltype('Test').extract('*')
     from dual
    

    The question to ask is "do you really need to? Compliant systems do not care if the XML of entry is a string unique or nice print.

  • Generation of XML in the query

    IM generation of xml from a table which works very well. Here is an example of what Im doing.


    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product

    create table ("VTEST"
    VARCHAR2 (50 BYTE) "NUMERO_PROJET."
    VARCHAR2 (50 BYTE) "ORDER_NUMBER"
    VARCHAR2 (50 BYTE) "PART_NUMBER",.
    VARCHAR2 (50 BYTE) "COMPANY."
    VARCHAR2 (50 BYTE) "PART_DESCRIPTION."
    VARCHAR2 (50 BYTE) "PART_DETAILS."
    VARCHAR2 (50 BYTE) "SUB_NUMBER".
    )
    -DROP TABLE VTEST

    INSERT INTO vtest VALUES (12345, 111, 19, '1', 'DESC1', 'DETAILS1', 999);
    INSERT INTO vtest VALUES (12387, 111, 25, 'COMPANY2', 'DESC2', 'DETAILS2', 888);
    INSERT INTO vtest VALUES (12343, 569, 96, 'COMPANY3', 'DESC3', 'Détails3', 777);
    INSERT INTO vtest VALUES (12340, 274, 13, 'Mémorandum4', 'DESC4', 'DETAILS4', 666);
    INSERT INTO vtest VALUES (15645, 385, 13, 'COMPANY5', 'DESC5', 'DETAILS5', 555);
    INSERT INTO vtest VALUES (22347, 996, 13, 'COMPANY6', 'DESC6', 'DETAILS6', 444);
    INSERT INTO vtest VALUES (35622, 825, 13, '1', 'DESC7', 'DETAILS7', 333);
    INSERT INTO vtest VALUES (42335, 111, 19, '1', 'DESC8', 'DETAILS8', 222);

    -SELECT * FROM VTEST

    SELECT
    XMLElement ("APP",
    XMLAttributes (VTEST as "NAME")
    , XMLElement ("WEB",
    XMLAgg)
    XMLElement ("numero_projet",
    XMLAttributes (NVL("ORDER_NUMBER",' ') AS ORDER_NUMBER,
    NVL("PART_NUMBER",' ') ACE PART_NUMBER,
    NVL("COMPANY_NAME",' ') ACE COMPANY_NAME,
    NVL("PART_DESCRIPTION",' ') AS PART_DESCRIPTION,
    NVL("PART_DETAILS",' ') AS PART_DETAILS,
    NVL("SUB_NUMBER",' ') AS SUB_NUMBER
    ),

    XMLForest)
    NVL("ORDER_NUMBER",' ') ACE ORDER_NUMBER,
    NVL("PART_NUMBER",' ') ACE PART_NUMBER,
    NVL("COMPANY_NAME",' ') ACE COMPANY_NAME,
    NVL("PART_DESCRIPTION",' ') AS PART_DESCRIPTION,
    NVL("PART_DETAILS",' ') AS PART_DETAILS,
    NVL("SUB_NUMBER",' ') AS SUB_NUMBER
    )
    )
    )
    )
    )

    OF VTEST


    It works very well.
    But I also want to generate xml data a second where each item is listed with unique values as follows:

    < APP NAME = "VTEST" >
    < WEB >
    < ORDER_NUMBERS >
    < > 111 ORDER_NUMBER < / ORDER_NUMBER >
    < > 569 ORDER_NUMBER < / ORDER_NUMBER >
    < > 274 ORDER_NUMBER < / ORDER_NUMBER >
    < > 385 ORDER_NUMBER < / ORDER_NUMBER >
    < > 996 ORDER_NUMBER < / ORDER_NUMBER >
    < > 825 ORDER_NUMBER < / ORDER_NUMBER >
    < / ORDER_NUMBERS >
    < PART_NUMBERS >
    < PART_NUMBER > 19 < / PART_NUMBER >
    < PART_NUMBER > 25 < / PART_NUMBER >
    < > 96 PART_NUMBER < / PART_NUMBER >
    < PART_NUMBER > 13 < / PART_NUMBER >
    < / PART_NUMBERS >
    < COMPANY >
    company 1 < COMPANY_NAME > < / COMPANY_NAME >
    COMPANY2 < COMPANY_NAME > < / COMPANY_NAME >
    COMPANY3 < COMPANY_NAME > < / COMPANY_NAME >
    COMPANY4 < COMPANY_NAME > < / COMPANY_NAME >
    COMPANY5 < COMPANY_NAME > < / COMPANY_NAME >
    COMPANY6 < COMPANY_NAME > < / COMPANY_NAME >
    < / COMPANIES >
    < PART_DESCRIPTIONS >
    DESC1 < PART_DESCRIPTION > < / PART_DESCRIPTION >
    DESC2 < PART_DESCRIPTION > < / PART_DESCRIPTION >
    DESC3 < PART_DESCRIPTION > < / PART_DESCRIPTION >
    < PART_DESCRIPTION > DESC4 < / PART_DESCRIPTION >
    < PART_DESCRIPTION > DESC5 < / PART_DESCRIPTION >
    < PART_DESCRIPTION > DESC6 < / PART_DESCRIPTION >
    < PART_DESCRIPTION > DESC7 < / PART_DESCRIPTION >
    < PART_DESCRIPTION > DESC8 < / PART_DESCRIPTION >
    < / PART_DESCRIPTIONS >
    < PART_DETAILS >
    < PART_DETAILS > DETAILS1 < / PART_DETAILS >
    < PART_DETAILS > DETAILS2 < / PART_DETAILS >
    < PART_DETAILS > details3 < / PART_DETAILS >
    < PART_DETAILS > DETAILS4 < / PART_DETAILS >
    < PART_DETAILS > DETAILS5 < / PART_DETAILS >
    < PART_DETAILS > DETAILS6 < / PART_DETAILS >
    < PART_DETAILS > DETAILS7 < / PART_DETAILS >
    < PART_DETAILS > DETAILS8 < / PART_DETAILS >
    < / PART_DETAILS >
    < SUB_NUMBERS >
    < SUB_NUMBER > 999 < / SUB_NUMBER >
    < SUB_NUMBER > 888 < / SUB_NUMBER >
    < SUB_NUMBER > 777 < / SUB_NUMBER >
    < SUB_NUMBER > 666 < / SUB_NUMBER >
    < SUB_NUMBER > 555 < / SUB_NUMBER >
    < SUB_NUMBER > 444 < / SUB_NUMBER >
    < SUB_NUMBER > 333 < / SUB_NUMBER >
    < SUB_NUMBER > 222 < / SUB_NUMBER >
    < / SUB_NUMBERS >
    < / WEB >
    < / APP >


    Ive been trying and just can't understand it. Thus, each section formularies its unique values.
    Thanks for any help.

    A similar technique that your previous question - deduplicate each section by itself:

    select
    xmlelement(
       app
     , xmlattributes('VTEST' as name)
     , xmlelement(
          web
        , xmlforest(
             (
                select xmlagg(xmlelement(order_number,order_number) order by order_number)
                  from ( select distinct order_number from vtest )
             ) as order_numbers
           , (
                select xmlagg(xmlelement(part_number,part_number) order by part_number)
                  from ( select distinct part_number from vtest )
             ) as part_numbers
           /* etc */
          )
       )
    )
    from dual
    /
    

    I just got the order_numbers and part_numbers and leave the rest for you ;-)

    Maybe it's not the most effective method that it accesses the table several times. But xmlagg does not support a 'distinct' clause, as for example to count (distinct order_number), so I can't think offhand of a more effective solution.

    Maybe if you are very strong to create XLS stylesheets to transform your original XML output for output desired using XQuery - then perhaps it could be done without access to the table several times. But probably it would be more effective anyway, because it would then do a job a lot of in-memory (or TEMP).

  • Problem of generation of Sync trigger in several synchronization USRP RIO 2943R problem

    Generation problem shutter Sync in several synchronization USRP RIO 2943R problem.

    Previous SR you may already know I'm stacked in USRP RIO multiple synchronization problem, especially in the mode based on the signal. Now I can cut down, the problem is mainly due to the outbreak of sync signals generation.

    First of all, I read the article and the discussion in the following two links:
    http://forums.NI.com/T5/USRP-software-radio/how-to-synchronize-multiple-USRP-Rio-294x-devices/TD-p/3...
    http://zone.NI.com/reference/en-XX/help/373380D-01/usrphelp/synchronization/

    and I did my connection of the material according to the suggestions in the second link. My system schematic is shown in the following image:

    I checked OctColck and SMU 6674 T connections. They are all connected correctly and the cable are fine. I use the niUsrpRio200_XcvrSyncPps.lvbitx.
    According to the description of documents and discussion forum, the USRP RIO 1st in the list of devices are considered to be the USRP Master. Then, the FPGA to master USRP RIO released "trigger of sync" signal through the 'PPS Trigger Out' SMA port in RIO USRP box.
    Based on the my analysis of the system, the first impression I have is the USRP Master does not export the 'sync trigger' correctly. The host VI reports the error like this:

    I was trying to measure the "synchronization trigger" using oscilloscope, but I found that it is impossible, because the host VI can not yet run, so there is that no signal can be seen from port 'PPS Trigger OUT.
    So I think that if I can watch this signal "sync trigger" in home VI by importing this signal from FPGA to host VI. I did some changes on the FPGA VI as shown in the following image to watch this signal of façade of the host VI. but not so successful. the rx.start tragger relaxation and tx.start do not appear on the host vi read/write control function.


  • HOW TO SOLVE MY PROBLEM WITH MICROSOFT OPEN XML CONVERTER. WHEN AN E-MAIL CANO'T OPEN THE ATTACHMENTE

    Every time to enter an e-mail address, when have an attachmente I have intention to open but bring a dialog box telling me: 'Microsoft Open XML Converter.  Click here to open bring another dialog box telling me: "Save."  In the final, a small dialog box tell me: not recorded in any file. What should I do?

    Hi MarioVidal

     

    1. what email program are you using? What is windows live mail, Hotmail, Gmail, etc.?

    2. meet the issue only with some specific files types with come as attachments or with each of them?

    3. during how long have you had this problem?
    4. the problem occurs for all e-mail programs?


    Let us know the answers to help you best.

  • problem with getting some xml UTF-8 characters

    Hello

    Please help me solve the following problem. I need to parse the XML string that contains the currency symbol (for example pound sign, see the code example). In the result of the variable currSign contains '? What's wrong?

    {} public static Sub test()

    try {}

    String data ="" +

    "0.00";

    ByteArrayInputStream is = new ByteArrayInputStream (data.getBytes ());

    DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();

    DocumentBuilder builder = factory.newDocumentBuilder ();

    Doc document = builder.parse (is);

    Root element = doc.getDocumentElement ();

    String currSign = root.getAttributes () .getNamedItem ("unit"). getNodeValue();

    }

    catch (Exception e) {}

    }

    }

    Ah. I think I see the problem. You want to convert the string into a byte array data using the version without getBytes() argument. Which uses the default encoding (which is ISO-8859-1). You must call getBytes ("UTF-8") or specify ISO-8859-1 for the xml declaration.

  • problem with the app.xml

    Hi, I'm having headaches with the air sdk.

    I'm the "porting" an air for Microsoft device emulator application.  The app.xml has a node of , but if I try to deploy, I get the following error:

    Error: Cannot find node: versionNumber
    

    When I remove the node and replace it with I get the following error:

    Launching error: Packaging failed: 1
    ...app.xml(28): error 103: application.versionNumber is an unexpected element/attribute
    ...app.xml(139): error 104: application.version is required
    ERROR: AIR validation failed
    

    When I have two and I get the following error after logging in to the debugger out (perhaps unrelated)

    Packaging failed: 1
    ...app.xml(28): error 103: application.versionNumber is an unexpected element/attribute
    Error: AIR validation failed
    

    AIR 2.5 removing support for the field and replaced with two fields. et .

    versionNumber is the one required by the BB SDK. It has a few limitations - numbers between 0 and 999 only, and you must have 3 sections (that is to say 1.0.0 - or - 0.5.957). -Change to and make sure your version number is within the limits, and you shouldn't have the problem more.

    The error messages are confusing and make believe that the version label is always supported by 2.5, even if it is not.

  • ColdFusion 10 problem with cfhttp postype xml

    We do a cfhttp call.

    We submit xml data. We are able to send information from Server A to Server B, but Server B gives us no answer.

    Our code works for coldfusion 8 and 9, but it does not work for coldfusionh 10.

    This is the snippet of code

    "< cfhttp method = 'post' url =" "#httpURL #" timeout = "3000" useragent = "#CGI.http_user_agent #" >

    < cfhttpparam type = "XML" value = "" #xmlRequest # "name ="CLRCMRC_XML">"

    < / cfhttp >

    The content of server B can be access by

    < cfdump var = '#cfhttp. FileContent #">."

    Note This works in coldfusion 8 and 9, but we get all the data from Server B using coldfusion 10

    Problem solved.

    It was to change this line

    to use the PROTOCOL = '1 '.

  • Problem to access the XML

    Here is my XML file

    <? XML version = "1.0" encoding = "utf-8"? >

    < data >

    < country >

    < = "Algeria" flag = country name "algeria.png" group = "H" > < / country > "

    < = 'Argentina' flag = country name "argentina.png" group = "F" > < / country > "

    < name of the country = "Australia" flag = "australia.png" group = "B" > < / country > "

    < / country >

    < / data >

    It has loaded completely and I am able to trace

    trace (XMLobject)

    Tracks complete XML

    trace (xmlObject.countries.Country)

    Traces

    < = "Algeria" flag = country name "algeria.png" group = "H" > < / country > "

    < = 'Argentina' flag = country name "argentina.png" group = "F" > < / country > "

    < name of the country = "Australia" flag = "australia.png" group = "B" > < / country > "

    But when I trace

    trace(xmlObject.countries.Country[1]);

    traces of anything.

    With the help of AS3.0, Player 10.2 and Flash cs5.5.

    Please help me.

    I think the problem has to do with there is not anything between the tags of the country.  If there's nothing there, it will draw.

  • Generation of XML Document

    Dear all

    I have a requirement to generate the XML data as shown in the light of the definition of XML schema. I did it by using oracle developer report to generate put them in the xml document.

    My question is that it is important to attribute sequences for example

    XSD has attribute
    ------------------------
    Name
    Address
    phoneno
    ------------------------

    But when I generate the XML using oracle report developer he changes the order of the attributes like this

    -------------------------
    phoneno
    address
    name
    ------------------------


    Please guide this poor sequence of attribute have a problem during the validation of xml with xsd document.

    Concerning

    XML 1.0 specification:

    http://www.w3.org/TR/REC-xml/#sec-StartTags

    The name the start end-tags and gives the type of the element. [Definition: the name-AttValue pairs are referred to as the specification of attribute of the element], [definition: with the name in each pair referred to as the attribute name] and [definition: the content of the AttValue (the text between the "or"delimiters) as the attribute value.] Note that the order of specification of attribute in a start tag or empty element tag is not significant.

  • problem to run build.xml

    I downloaded the Demo Application Fusion Store Front "FusionOrderDemo_R2.zip" of

    I am facing following problem.



    BUILD FAILED
    C:\JDeveloper\mywork\Sherman_FOD\Infrastructure\Ant\build.XML:51: The following error occurred during the execution of this line:
    C:\JDeveloper\mywork\Sherman_FOD\Infrastructure\DBSchema\build.XML:91: The following error occurred during the execution of this line:
    C:\JDeveloper\mywork\Sherman_FOD\Infrastructure\DBSchema\build.XML:56: The following error occurred during the execution of this line:
    C:\JDeveloper\mywork\Sherman_FOD\Infrastructure\DBSchema\build.XML:28: Class not found: oracle.jdbc.OracleDriver JDBC driver could not be loaded


    Thank you
    Prateek

    When you went to the page where you downloaded FOD, namely http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html

    Did you read at the top where it says «this will not work in earlier versions...» See the bottom of this page for older versions? »

    And when you went to the bottom of the page, you have found a link.

    And when you follow this link, you have found a page for the 11.1.1.5 version of the demo.

    And at the bottom of this page you find links to previous versions, so

    A Little reading goes a long way {noformat} :) {noformat}

    John

  • Problem of child length XML?

    The following data are my xmldata.  I need to know child length is equal to 3.

    " < studentlist xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance ">
    < namelist >
    Fox Rithick < name > < / name >
    21 <>< / Age >
    Male < sex > < / sex >
    < address > 5 / 15 St of Vinayagar Kovil, Chennai. < / address >
    < / namelist >
    < namelist >
    Kumar < name > < / name >
    < 19ans > < / Age >
    Male < sex > < / sex >
    < address > Newno: 45, street of KEB, Chennai. < / address >
    < / namelist >
    < namelist >
    < name > Ravimumar < / name >
    < 12 > < / Age >
    Male < sex > < / sex >
    < address > 378, Grass Land Street, Pune. < / address >
    < / namelist >
    < / studentlist >

    Please help me tom solve this problem. I used the child (0) .length that it did not work...

    var loader: URLLoader = new URLLoader();
    configureListeners (loader);
    Loader.Load (new URLRequest ("YourXMlName.xml"));

    function configureListeners(dispatcher:IEventDispatcher):void {}
    dispatcher.addEventListener (Event.COMPLETE, completeHandler);
    }

    function completeHandler(event:Event):void {}

    var xml = new XML (event.target.data);

    trace (XML. NameList.length ());

    }

  • Problem with dynamic arrays, XML and JavaScript patterns

    With the applied XML schema my JavaScript does not correctly work when it is added a 2nd row at my dynamic table. Instead of an added empty line 1st row data is copied on the 2nd line and if you change the data in the 2nd row it modifies data in the 1st row also. It works fine if the XML schema data connection is well removed.

    No idea what I can do to get this working with the schema that is applied in the same way, it works without the schema?

    Thanks for your help,

    Brian

    There you go. Its not a problem.

  • Help in what concerns the generation of XML using SQL/XML

    I wrote the following SQL to generate a XML report. Tb_ken_lg_mstr of the table is the primary table of the workforce. Tb_ken_loans_base and tb_ken_cards_base tables are tables containing the cards and loans to sales by sales in tb_ken_lg_mstr people.

    The problems that I face, is that:

    1. even when there are sales people have not made a sale, that is, they have no documents tb_ken_cards_base and tb_ken_loans_base, yet their records are appearing the XML. I want to avoid this and only dirty people who have the list sales. A workaround is to use NOT EXISTS in the outer query more with tb_ken_lg_mstr. Is there a better way?

    2 can anyone confirm that the approach used to combine the tables tb_ken_cards_base and tb_ken_loans_base is correct or not. Basically, I want to publish a report of sales person (tb_ken_lg_mstr) and all its sales (tb_ken_cards_base and tb_ken_loans_base).

    3. the XML output is coming in a single line rather than in a hierarchical format.

    I use 10.2 g
    WITH TB_KEN_LG_MSTR AS(
    SELECT 97 SALES_CODE , 'Christine' NAMES, 'LOANS' SPECIALIZATION, '03-SEP-07' DATE_REPORTED, TO_DATE('30-JUN-2010') SYSTEM_DATE FROM DUAL UNION ALL 
    SELECT 112, 'Winn ', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL  UNION ALL 
    SELECT 093, 'Lydh ', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL  UNION ALL 
    SELECT 107, 'Nai ', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL  UNION ALL 
    SELECT 065, 'Jat', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010')  FROM DUAL UNION ALL 
    SELECT 980, 'Mreen ', 'LOANS', '27-AUG-07', TO_DATE('30-JUN-2010') FROM DUAL ),
    TB_KEN_CARDS_BASE AS(
    SELECT 97 SALES_CODE,  46766 REFERENCE_NUMBER, 'BC' PRODUCT_TYPE, 'DECLINE' CURRENT_STATUS, 'I' APPLICANT_IS, TO_DATE('30-JUN-2010') SYSTEM_DATE FROM DUAL UNION ALL 
    SELECT 97, 46374, 'BC', 'DECLINE', 'I', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL 
    SELECT 112, 46106, 'BC', 'DECLINE', 'I', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL 
    SELECT 112, 44263, 'BC', 'APPROVAL', 'I' , TO_DATE('30-JUN-2010')FROM DUAL UNION ALL 
    SELECT 112, 46269, 'BC', 'APPROVAL', 'I', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL 
    SELECT 093, 4618, 'BC', 'DECLINE', 'I', TO_DATE('30-JUN-2010') FROM DUAL) ,
    TB_KEN_LOANS_BASE AS(
    SELECT 093 SALES_CODE, 16 BRANCH_NUMBER, '18512' ACCOUNT_NUMBER, '8' ACCOUNT_TYPE, 'DECLINED' FINAL_DECISION, '2000000' LOAN_AMOUNT, '-1' TOP_UP_AMOUNT, TO_DATE('30-JUN-2010') SYSTEM_DATE FROM DUAL UNION ALL 
    SELECT 093, 3, '14719', '3', 'DECLINED', '100000', '172.65' , TO_DATE('30-JUN-2010') FROM DUAL UNION ALL 
    SELECT 107, 9, '11444', '7', 'AUTHORISED', '200000', '-1', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL 
    SELECT 107, 75, '1570', '8', 'AUTHORISED', '2000000', '1626670.3', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL 
    SELECT 066, 40, '10229', '7', 'AUTHORISED', '288000', '228478.35', TO_DATE('30-JUN-2010') FROM DUAL)
    select xmlelement("SALES_DATA",
           xmlagg(
                  xmlelement("SALES_CODE",
                             xmlattributes(c.sales_code),
                             xmlforest(c.names,
                                       c.specialization,
                                       c.date_reported),
                             (select xmlagg(
                                           xmlelement("CARD_DETAILS",
                                                      xmlattributes(a.reference_number),
                                                      xmlforest(a.product_type,
                                                                a.current_status,
                                                                a.applicant_is)
                                                     )
                                           )
                               from tb_ken_cards_base a
                               where system_date=TO_DATE('30-JUN-2010')
                               and a.sales_code = c.sales_code),
                               (select xmlagg(
                                           xmlelement("LOAN_DETAILS",
                                                      xmlattributes(b.branch_number, b.account_number),
                                                      xmlforest(b.account_type,
                                                                b.final_decision,
                                                                b.loan_amount,
                                                                b.top_up_amount)
                                                     )
                                           )
                               from tb_ken_loans_base b
                               where system_date=TO_DATE('30-JUN-2010')
                               and b.sales_code = c.sales_code)
                               )
                 )
                    )
    from tb_ken_lg_mstr c
    where system_date=TO_DATE('30-JUN-2010');

    Using NOT EXIST would be to do the scan of table twice. What I don't understand is why Oracle is picking up Sales_Codes missing in tb_ken_loans_base or tb_ken_cards_base, even if I do an inner join?

    You do not have an inner join, you only access TB_KEN_LG_MSTR in the main query.
    What you do in the SELECT part are scalar subqueries just on each of your tables of the child, who is unable to filter the main table in the first place.

    NOT EXISTS is indeed a solution, or consider doing all of the joins in the FROM clause, as I suggested above, like this:

    ...
    FROM TB_KEN_LG_MSTR c
         LEFT OUTER JOIN tb_ken_cards_base a ON a.sales_code = c.sales_code
         LEFT OUTER JOIN tb_ken_loans_base b ON b.sales_code = c.sales_code
    WHERE a.sales_code IS NOT NULL
    OR b.sales_code IS NOT NULL
    ...
    

    But then the subgroups becomes more difficult with this approach.

    Regarding the third question, how I format in Oracle? If not possible in Oracle then what other ways are?

    10.2, you can use this trick to format the output:

    SELECT xmlelement( ... ).extract('/*').getClobVal() FROM ...
    
  • Problem with loading of XML document

    Hello
    I have to load XML document uploaded on the web in XML DB and validate against the schema. The problem is, that:
    schemaLocation still looks like in the document like this:

    P1:schemaLocation = "SPDS. IFR.i009.pl http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; rc % 3aSchema = True'

    and cannot be changed.

    I registered schema by using the command:
    BEGIN
    DBMS_XMLSCHEMA.registerSchema
    (
    SCHEMAURL = >
    -UTL_URL. UNESCAPE
    ('http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; % 3aSchema rc = True'),
    SCHEMADOC = > BFILENAME ("TEST_DIR',"test.xsd").
    FORCE = > TRUE
    );
    END;

    (ORACLE inquired about the variable & amp, I set myself to & amp course :)))

    I used the FORCE to omit the error:
    ORA-31000: resource ' http://inetsqlcg:82/ReportServer?/ReportPublisher/spds.ifr.009.PL & amp; RS: Format = XML & amp; RC:schema = True' is not a document of schema XDB

    Now I have the schema with SCHEMA_URL
    Select SCHEMA_URL in the user_xml_schemas;
    http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.IFR.009.pl & amp; RS % 3aFormat = XML & amp; RC % 3aSchema = true

    but when I try to load the document like this
    INSERT INTO THE REP
    VALUES
    (
    XMLType
    (
    BFILENAME ("TEST_DIR", "test.xml"),
    NLS_CHARSET_ID ("AL32UTF8")
    )
    );

    There is an error:
    ORA-19007: Schema - does not http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; % 3aSchema rc = True expected.


    test.xsd is:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < xmlns = "spds.ifr.009.PL schema" xmlns: XS = "http://www.w3.org/2001/XMLSchema" xmlns:xdb = "http://xmlns.oracle.com/xdb" targetNamespace = "spds.ifr.009.PL" > "
    < xs: element name = "Report" xdb:defaultTable = "REP" >
    < xs: annotation >
    < intention > report < / intention >
    < / xs: annotation >
    < complexType xdb:SQLType = "REP_T" >
    < xs: Sequence minOccurs = "0" maxOccurs = "unbounded" >
    < xs: ELEMENT ref = "Detail" minOccurs = "0" maxOccurs = "unbounded" xdb:SQLName = "DETAILS" xdb:SQLCollType = "DETAILS_C" / >
    < / xs: SEQUENCE >
    < name XS: attribute = use 'REPORTNAME1' 'optional' = >
    < xs: annotation >
    XYZ abc < intention > < / intention >
    < / xs: annotation >
    < xs:simpleType >
    < xs:restriction base = "XS: String" / >
    < / xs:simpleType >
    < / xs: attribute >
    < / xs: complexType >
    < / xs: element >
    < xs: element name = "Details" xdb:defaultTable = "" >
    < xs: annotation >
    Details of < intention > < / intention >
    < / xs: annotation >
    < complexType xdb:SQLType = "DETAILS_T" >
    < name XS: attribute = "VALUATE" type = "xs: String" use = "optional" >
    < xs: annotation >
    < intention > Valuate < / intention >
    < / xs: annotation >
    < / xs: attribute >
    < name XS: attribute = "ISIN" use = "optional" >
    < xs: annotation >
    < intention > ISIN < / intention >
    < / xs: annotation >
    < xs:simpleType >
    < xs:restriction base = "XS: String" / >
    < / xs:simpleType >
    < / xs: attribute >
    < / xs: complexType >
    < / xs: element >
    < / xs: Schema >

    test.XML is:

    <? XML version = "1.0" encoding = "UTF-8"? >
    "< report xmlns:p1 ="http://www.w3.org/2001/XMLSchema-instance"xmlns ="spds.ifr.009.PL"p1:schemaLocation =" spds.ifr.009.PL http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; % 3aSchema rc = True "REPORTNAME1 ="abc abc abc">
    < detail ISIN = "AB0123456789" / >
    < detail ISIN = "XY0123456789" VALUE = "2" / >
    < / report >

    Version of the database is:
    11.1.0.7.0
    but probably I'll have to do the same thing on 10.2.0.3.0


    Any suggestion, please.

    And thanks in advance.

    Looks like we cannot manage this value of the schema location indicator... Not even sure we should, to be honest...

    You can use a workaround like this...

    SQL> VAR XMLSCHEMA CLOB
    SQL> VAR INSTANCE CLOB
    SQL> VAR SCHEMAURL VARCHAR2(700)
    SQL> --
    SQL> set define off
    SQL> --
    SQL> begin
      2     :SCHEMAURL := 'http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL&rs%3aFormat=XML&rc%3aSchema=True';
      3    :XMLSCHEMA :=
      4  '
      5  
      6     
      7             
      8                     Report
      9             
     10             
     11                     
     12                             
     13                     
     14                     
     15                             
     16                                     abc xyz
     17                             
     18                             
     19                                     
     20                             
     21                     
     22             
     23     
     24     
     25             
     26                     Details
     27             
     28             
     29                     
     30                             
     31                                     Valuate
     32                             
     33                     
     34                     
     35                             
     36                                     ISIN
     37                             
     38                             
     39                                     
     40                             
     41                     
     42             
     43     
     44  ';
     45    :INSTANCE :=
     46  '
     47  
     48  
     49  
     50  ';
     51  end;
     52  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.04
    SQL> --
    SQL> set define on
    SQL> --
    SQL> BEGIN
      2    DBMS_XMLSCHEMA.registerSchema
      3    (
      4       SCHEMAURL => :SCHEMAURL,
      5       SCHEMADOC => :XMLSCHEMA
      6    );
      7  END;
      8  /
    BEGIN
    *
    ERROR at line 1:
    ORA-31000: Resource
    'http://inetsqlcg:82/ReportServer?/ReportPublisher/spds.ifr.009.PL&rs:Format=XML
    &rc:Schema=True' is not an XDB schema document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 72
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 33
    ORA-06512: at line 2
    
    Elapsed: 00:00:00.04
    SQL> desc REP
    ERROR:
    ORA-04043: object REP does not exist
    
    SQL> --
    SQL> INSERT INTO REP VALUES ( XMLTYPE(:INSTANCE ))
      2  /
    INSERT INTO REP VALUES ( XMLTYPE(:INSTANCE ))
                *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    Elapsed: 00:00:00.01
    SQL> --
    SQL> set define off
    SQL> --
    SQL> begin
      2     :SCHEMAURL := 'http://inetsqlcg:82/ReportServer';
      3    :XMLSCHEMA :=
      4  '
      5  
      6     
      7             
      8                     Report
      9             
     10             
     11                     
     12                             
     13                     
     14                     
     15                             
     16                                     abc xyz
     17                             
     18                             
     19                                     
     20                             
     21                     
     22             
     23     
     24     
     25             
     26                     Details
     27             
     28             
     29                     
     30                             
     31                                     Valuate
     32                             
     33                     
     34                     
     35                             
     36                                     ISIN
     37                             
     38                             
     39                                     
     40                             
     41                     
     42             
     43     
     44  ';
     45    :INSTANCE :=
     46  '
     47  
     48  
     49  
     50  ';
     51  end;
     52  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.01
    SQL> --
    SQL> set define on
    SQL> --
    SQL> BEGIN
      2    DBMS_XMLSCHEMA.registerSchema
      3    (
      4       SCHEMAURL => :SCHEMAURL,
      5       SCHEMADOC => :XMLSCHEMA
      6    );
      7  END;
      8  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:08.71
    SQL> desc REP
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
    TABLE of SYS.XMLTYPE(XMLSchema "http://inetsqlcg:82/ReportServer" Element "Report") STORAGE Object-relational TYPE "REP_T"
    
    SQL> --
    SQL> set long 10000
    SQL> select updateXML(XMLTYPE(:INSTANCE),'/Report/@p1:schemaLocation','spds.ifr.009.PL http://inetsqlcg:82/ReportServer','xmlns:p1="http://www.w3.org/2001/XMLSc
    hema-instance" xmlns="spds.ifr.009.PL"')
      2    from dual
      3  /
    
    UPDATEXML(XMLTYPE(:INSTANCE),'/REPORT/@P1:SCHEMALOCATION','SPDS.IFR.009.PLHTTP:/
    --------------------------------------------------------------------------------
    
    
      
      
    
    
    Elapsed: 00:00:00.03
    SQL> INSERT INTO REP VALUES ( updateXML(XMLTYPE(:INSTANCE),'/Report/@p1:schemaLocation','spds.ifr.009.PL http://inetsqlcg:82/ReportServer','xmlns:p1="http://www
    .w3.org/2001/XMLSchema-instance" xmlns="spds.ifr.009.PL"'))
      2  /
    
    1 row created.
    
    Elapsed: 00:00:00.01
    SQL> select * from REP
      2  /
    
    SYS_NC_ROWINFO$
    --------------------------------------------------------------------------------
    
    
      
      
    
    
    Elapsed: 00:00:00.56
    SQL>
    

Maybe you are looking for

  • Cancel the Parental control, because I'm the Parent: but not Administrator of my computer

    I myself blocked on my computer. I didn't know that Apple was the administrator of the computer, and I was a user. I turned on the 'enable parental control' to limit the spending of my adolescence, while using my apple ID. I didn't know I was putting

  • Re: Satellite P500 - 1C7 do not wake up after adding memory

    HelloI replaced the original memory of 2 x 4 GB 2x2gb. It works fine except that the PC doesn't wake up after a break.I have win7 64.How is that possible?

  • Enable/disable debugging for all vi in project

    The question is quite simple. Is there a way globally enable and disable debugging. I know there is a slight performance penalty to have it activated, and I'm trying to figure out how much I can get out of my algorithm performance. Would be nice if I

  • ACER monitor professional

    Is that the monitors can be pivot and pivot? I'm looking for a picture monitor. ACER should do more details on the specification.

  • unidentified customers

    I have what appears to be invited not identified on my network, I don't know if these are the names of the devices I have connected or neighbors using my network access. Is there a way to know which is which?