parts of XML in hierarchical data (like a tree)

Hi all

I have a potential, big enough XML file, I need to present only parts in a tree structure. The XML is something like:

< scenes >

< scene id = "1" label = "label" >

< actors >

               ... stuff ...

< / actors >

< snapshots >

< instant label = "label" >

... content of the node.

< / snapshot >

< instant label = 'other label' >

... content of the node.

< / snapshot >

... maybe more instant...

< / snapshots >

< / scene >

< label scene = 'a' >

< actors >

... stuff...

< / actors >

< snapshots >

< instant label = "label" >

... content of the node.

< / snapshot >

< instant label = 'other label' >

... content of the node.

< / snapshot >

... maybe more instant...

< / snapshots >

< / scene >

... more scenes...

< / scenes >

I would like to have a tree-like representation of it so that only the labels 'scene' and the 'snapshot' labels are displayed.

I can't figure out how to ignore all subnodes without actually creating a copy of the XML file and the exhibitionist somehow. That I prefer not to do, because the link between the actual data and its visualization (tree) has more or less disappeared.

Suppose I am a little confused by all the possibilities... Maybe I can use a stripped XML but link selections or changes (node labels should be possible to be renamed and reorganized) the original data?

Can someone point me in a right direction?

Thanks in advance.

Manno

See ITreeDataDescriptor

Tags: Flex

Similar Questions

  • the problem display of hierarchical data on table tree of ADF 11 g

    We try to display hierarchical data tree ADF tabletop.
    our table a (id, parant_id, name) columns and an open relationship between id and id columns adorning it.
    We create module OT, vo and app. Jdev automatically creates connection object and Association.
    In the editor view, drag us and drop our table as a tree of ADF table.
    In table tree aditor rool we add a rool Association name.
    When we launch the application data display incorrectley. For example if the data as

    1 aaa 0
    2 1 BBB
    3 ccc 2
    4 2 ddd

    We want to display the structure of the tree as

    1
    -> 2
    -> 3
    -> 4

    but it shows the possibilities of something like (lines "BOLD" incorrectly) added.


    1
    -> 2
    -> 3
    -> 4
    * 2 *
    -> 3
    -> 4
    * 3 *
    * 4 *


    (We have 10g. But in the table tree 11g have a different configuration. )

    Thank you...

    I think that if you want to limit the list of records shown at the first level of the tree to those without a father - you'll need create a VO that this query - and then add a viewlink to the full list.
    For example by using the employees table in the HR schema, which would be something like a VO with 'where manager_id is null' for the first level, as well as a link from there to the VO used to get other levels.

  • Filtered hierarchical data - previous available ancestor?

    I'm trying to find a solution to a problem with hierarchical data and the concept of the closest available ancestor – my platform is gr 10, 2 and 11 GR 2.  I give myself a few hierarchical data (in its simplest form it is in the form ID, NAME, PARENT_ID, where of the PARENT_ID since ID links).

    For example:

    with qryData like)

    Select 1 as ID, 'Bert' as NAME, to_number (null) as PARENT_ID from dual union

    Select 2 as ID, 'Brand', 1 double Union

    Select 3 as ID, 'Brenda', 1 double Union

    Select option 4 as ID, 'Mike', 3 double Union

    Select 5 as ID, 'Steve', 4 double Union

    Select 6 as ID, 'John', 2 double Union

    Select 7 as ID, 'Jo', 6 double Union

    Select ID, "Jim", 2 double Union 8

    Select 9 as ID, 'Jane', the double 7

    )

    Select q.*, sys_connect_by_path (ID, ' /') ID_PATH

    of qryData q

    Start by parent_id is null

    Connect ID PARENT_ID = prior

    /

    ID NAME PARENT_ID ID_PATH

    ---------- ------ ---------- ----------------

    1 Bert 1

    2. Mark 1/1/2

    6 Jean 2/1/2/6

    7 Jo 6/1/2/6/7

    Jane 9 7/1/2/6/7/9

    8 Jim 2/1/2/8

    3 Brenda-1/1/3

    4 mike 3/1/3/4

    5 Steve 4/1/3/4/5

    In reality, this data set can be several thousand rows with dozens of levels of nesting, the several nodes to start without parent but especially often filtered, so some arbitrary lines are missing.  When this happens, I need to find the closest available ancestor that appears in the list. "The closest available ancestor" is closest relationship to ancestor in your family tree which still exists in the filtered list found from parent, then upward contuniing to grandparent, great-grandparent... nth grandparent grand until an ancestor is found.


    For example:

    ID NAME PARENT_ID ID_PATH AVAIL_ANCESTOR_ID

    ---------- ------ ---------- ------------- -----------------

    1 Bert 1

    Jean 6 2 1 1/2/6

    Jim 8 2 1 1/2/8

    Jane 9 7 6 1/2/6/7/9

    Brenda 3 1 1 1/3

    Steve 5 4 3 1/3/4/5

    For example.  Who is Steve closest ancestor in the filtered list?

    Steve's family tree is: / Bert/Brenda/Mike/Steve

    Mike (ID = 4) is not in the filtered list, so we move on Brenda, what is.  Brenda, ID = 3, so ANCESTOR_ID = 3

    I have access to the original table, so that can join the list filtered to the full table, I can also ask other columns (such as ROWID, and ROWNUM, LEVEL SYS_CONNECT_ROOT) to be included in the filtered set.  I tried various methods to achieve this, but all seem to be quite poor in performance (the columns ID and PARENT_ID indexed as appropriate) or does not quite give the correct result, such as...

    1. the analysis of the ID_PATH and the treewalking on this basis and to join the list...

    Select distinct CUSTOMER_ID, regexp_substr (ID_PATH, "[^ /] +', 1, level") as ANCESTOR_ID

    of qryData

    connect regexp_substr (ID_PATH, "[^ /] +', 1, level") is not null

    2 anti-assemblage to return to the full list in order to identify the missing elements, then for those treewalking.

    3 write a function that return treewalks.

    It of a difficult problem, so someone can think a solution that works well?  Ideally, I try to find a SQL based solution?

    Hello

    paulzip wrote:

    It is a clever solution!  The only problem I have is that I wouldn't be able to generate "good_id_path" as part of the filtered list, filtering is not done by me and is done once the id_path is generated.  I have to join the most complete list list filtered back to generate, unless there is a tweak to do?

    I see it; You are given connect_by_results (with id_path), and that's what you have to work with, in addition to the original table.

    Here's one way:

    SELECT d.id d.name, d.parent_id, d.id_path

    MIN (a.id) DUNGEON (DENSE_RANK LAST ORDER BY a.id_path) AS avail_ancestor_id

    OF connect_by_results d

    LEFT OUTER JOIN connect_by_results has the d.id_path AS a.id_path. '/%'

    GROUP BY d.id d.name, d.parent_id, d.id_path

    ORDER BY d.id_path

    ;

    The fastest way depends on a lot of things, some may not be known until the moment of execution.  The query above could be better if the number of rows in the result set is small, but you don't know anything else about them (for example, if all have a common ancestor).

  • Hierarchical data, how to aggregate over levels in hierarchical query?

    Hello

    I hope someone can help me.

    I held in a data table ("" what part was built in what other part of when when? "')
    ID parent_id build_in build_out
    1 NULL NULL NULL
    2/1 2010 2012
    3 2 2011 2013
    4 2 2013 NULL

    What are the parts is stored in a separate table.

    Now I want to know when when which part was built in the first level, in the example, I want to know that
    1 was simply a part of 1
    2 was part of 1 between 2010 and 2012
    3 was part of 1 between 2011 and 2012
    4 has never been a part of 1

    I tried several approaches - if there is a fixed number of levels between the types, I am interested I can do using joins and more/less (similarly as some nvl). Unfortunately this is not always the case (some parts appear on several levels).
    If I'm only interested in the parts that are never deleted, I can get by using a style of connect request and get the current configuration. But I can't seem to understand the time connecting part to the high level in such a query, or even filtering absurd combinations (like "4 in 1" in the example above). I could deal with the data recovered outside the database, but I prefer not.

    Is there a way to obtain the hierarchical data with an aggregate (min, max) for all levels?

    What version of Oracle you are on?

    In 11.2.x, you can use the recursive subquery factoring. Something like

    with t (id, parent_id, build_in, build_out) as (
    select 1, null, null, null from dual union all
    select 2, 1, 2010, 2012 from dual union all
    select 3, 2, 2011, 2013 from dual union all
    select 4, 2, 2013, null from dual
    )
    , c1 (root_id, id, parent_id, build_in, build_out) as (
    select id, id, parent_id, 0, 9999
    from t
    where parent_id is null
    union all
    select root_id, t.id, t.parent_id
    , greatest(nvl(t.build_in,0), nvl(b.build_in,0))
    , least(nvl(t.build_out,9999), nvl(b.build_out,9999))
    from c1 b, t
    where b.id = t.parent_id
    )
    select * from c1
    where build_in < build_out
    ;
    ROOT_ID ID    PARENT_ID  BUILD_IN  BUILD_OUT
    ------- ----- ---------- --------- ----------
    1       1                0         9999
    1       2     1          2010      2012
    1       3     2          2011      2012      
    

    With a hierarchical query by using the syntax connection, you could do something like

    select * from (
    select connect_by_root id as root, id
    , greatest(nvl(build_in,0), nvl(prior build_in,0)) as max_in, least(nvl(build_out,9999), nvl(prior build_out,9999)) as min_out
    from t
    start with parent_id is null
    connect by parent_id = prior id
    )
    where max_in < min_out
    ;
    

    but it is not powerful enough. This version compares the dates between a current and previous levels, but the recursive subquery is to compare the dates in the current level for the winners of the comparisons to the previous level. Not sure if it's an important distinction for your needs, however.

    If you are on 11.2 I advise to use the recursive subquery factoring. If this isn't the case, you can try the link by version.

    Kind regards
    Bob

  • Apply CSS to XML in AS3 data

    I know that this subject has been repeated several times, but despite having looked at a lot of discussions and web pages on the topic, I was not able to understand why mine does not work, I'm looking for help.

    Here is my code:

    CSS:

    @charset "utf-8";

    / * CSS document * /.

    {p}

    are-family: Arial;

    are-size: 25px;

    color: #000;

    }

    XML:
    <? XML version = "1.0" encoding = "utf-8"? >
    < tbContent >
    < slide > <! - 0 - >
    < title > contents < /title >
    content of < type > < / type >
    < content > <! [CDATA [< p > what is a Test of Mantoux skin? < /p >]]
    < p > how to administer a Mantoux skin Test < /p >
    < p > how to read a Mantoux skin Test < /p >
    < p > how to interpret the reading < /p >]] > < / content / >
    < image > Blank.jpg < / image >
    < popup > 0 < / popup >
    < reference > 0 < / reference >
    < / slide >
    < / tbContent >
    AS3:
    var container: content_mc = new content_mc();
    Implement xml file objects
    var xmlData:XML = new XML();
    XML.ignoreWhitespace = true;
    var xmlLoader:URLLoader = new URLLoader();
    External CSS document
    var cssLoader:URLLoader = new URLLoader();
    var cssRequest:URLRequest = new URLRequest ("css.css");
    var style: StyleSheet = new StyleSheet();
    cssLoader.load (cssRequest);
    cssLoader.addEventListener (Event.COMPLETE, onCSSComplete);
    function onCSSComplete(e:Event):void {}
    styles.parseCSS (cssLoader.data);
    xmlLoader.load (new URLRequest ("xml.xml"));
    xmlLoader.addEventListener (Event.COMPLETE, LoadXML);
    trace ("CSS has loaded.");
    }
    function LoadXML(e:Event):void {}
    xmlData = new XML (e.target.data);
    parseFile (xmlData);
    }
    function parseFile(xmlContent:XML):void {}
    stage.addChild (container);
    var content: TextField = new TextField();
    contents.styleSheet = styles;
    contents.htmlText = xmlContent.slide.content.text () [slide].
    contents.width = xW;
    contents.x = xSet.
    contents.y = ySet;
    contents.antiAliasType = "Advanced";
    contents.multiline = true;
    contents.autoSize = 'left ';
    contents.wordWrap = true;
    container.addChild (happy);
    }
    The text appears on the scene, but without formatting. I don't get any errors. If anyone can help with this it would be greatly appreciated.

    The default parser doesn't like the VAT statement charset in css:

    @charset "utf-8";

    Deletion of line of the file and you should be ok. Otherwise, you could write your own parser - or strip the statement on.

  • Hierarchical data model

    Hello!

    I need to create data model that describes hierarchical data in table t (something like this in sql: select * t log in prior t.id_parent = t.id).

    How to describe with JDeveloper?

    (Then it will be used in the table of the tree)
    JDeveloper 11.1.1.1

    Thank you!

    Simply create an association 1-* t.id to t.parent_id, then create viewLink based on this association.

  • Hierarchical data where the records on a given level point to next level

    WITH
        Data(Entity, Next_Entity, Datum)
    AS
        (
         SELECT 'A', 'B', 'Edward'    FROM Dual UNION ALL
         SELECT 'B', 'C', 'Lorina'    FROM Dual UNION ALL
         SELECT 'C', 'D', 'James'    FROM Dual UNION ALL
         SELECT 'C', 'D', 'Alice'    FROM Dual UNION ALL
         SELECT 'D', 'E', 'Edith'    FROM Dual UNION ALL
         SELECT 'D', 'E', 'Rhoda'    FROM Dual UNION ALL
         SELECT 'A', 'F', 'Albert'    FROM Dual UNION ALL
         SELECT 'F', 'G', 'Violet'    FROM Dual UNION ALL
         SELECT 'F', 'G', 'Frederick'    FROM Dual UNION ALL
         SELECT 'G', 'H', 'Lionel'    FROM Dual
        )
    SELECT
        Entity,
        Next_Entity,
        Datum
    FROM
        Data
    START WITH
        Entity = 'A'
    CONNECT BY
        Entity = PRIOR Next_Entity;
    

    Results in:

    E N DATUM

    - - ---------

    An Edward B

    B C Lorina

    C D James

    D E Edith

    D E Rhoda

    C D Alice

    D E Edith

    D E Rhoda

    An Albert F

    F G Violet

    G H Lionel

    F G Frederick

    G H Lionel

    What I want is:

    E N DATUM

    - - ---------

    An Edward B

    B C Lorina

    C D James

    C D Alice

    D E Edith

    D E Rhoda

    An Albert F

    F G Violet

    F G Frederick

    G H Lionel

    Each record points to one or more children.

    For any level, children, stressed are the same.

    I only go to any given child, once.

    Hello

    CONNECTION BY ordering the release, so that the children come immediately after their parents.

    If you SEPARATE the outcomes, so we know not what order the results are in.  You can get the resutls you purely by chance, especially in a small set of data, but it is still just a coincidence.

    I think you need something like this:

    WITH distinct_data AS

    (

    SELECT DISTINCT entity

    next_entity

    FROM the data

    )

    tree AS

    (

    SELECT entity

    next_entity

    ROWNUM AS r_num

    OF distinct_data

    START WITH entity = "A".

    Entity = next_entity PRIOR CONNECTION

    )

    SELECT t.entity

    t.next_entity

    d.datum

    TREE t

    JOINING data d = d.next_entity t.next_entity

    ORDER BY r_num

    ;

    Here, the SEPARATE operation is done before CONNECT you, so you don't have to worry about destroying the order of the CONNECT BY query.

  • Bij het openen van mijn photoshop elements 8 via het bureaublad squeeze ik of fusion: doing 6 en zou ik computer opnieuw opstarten maar dat like closer ook niet.

    Bij het openen van mijn photoshop elements 8 via het bureaublad squeeze ik of fusion: doing 6 en zou ik computer opnieuw opstarten maar dat like closer ook niet. Wie kan mij helpen?

    HEB wel een laptop PS6 weniger gedownload die Super first nog wel maar nu ook niet meer.

    If this is the exit code 6, photoshop elements: http://helpx.adobe.com/premiere-elements/kb/updated-installation-instructions-premiere-ele ments.html

  • How to remove hierarchical data?

    Hello

    I have a table with hierarchical data. I want to remove the data based on a condition, but maybe that this condition is present only in the upper hierarchy.

    In my example, I have identified by id lines and a changed_by containing the id of the row that has replaced (invalidated) this line. Of these, I want to delete data where descr in end-nodes is 'A '.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    DROP TABLE test_del;
    CREATE TABLE test_del)
    CONSTRAINT pk_del PRIMARY KEY (id)
    id NUMBER
    changed_by NUMBER
    CONSTRAINT fk_del
    REFERENCES test_del (id)
    , descr VARCHAR2 (10)
    )
    /
    INSERT INTO test_del (id, changed_by, descr)
    VALUES (3, NULL, 'A');
    INSERT INTO test_del (id, changed_by, descr)
    VALUES (2,3, 'A');
    INSERT INTO test_del (ID, changed_by, descr)
    VALUES (1, 2, NULL);

    INSERT INTO test_del (id, changed_by, descr)
    VALUES (6, NULL, 'A');
    INSERT INTO test_del (id, changed_by, descr)
    VALUES (5.6, 'A');

    INSERT INTO test_del (id, changed_by, descr)
    VALUES (10, 'B', NULL);
    INSERT INTO test_del (id, changed_by, descr)
    VALUES (9, 10, 'B');
    INSERT INTO test_del (id, changed_by, descr)
    VALUES (8,9, 'B');
    COMMIT;

    SELECT *.
    OF test_del
    CONNECT BY PRIOR ID = changed_by
    START WITH descr = 'A' changed_by AND IS NULL;

    ID CHANGED_BY DESCR
    ---------- ---------- ----------
    3            A
    2 3
    1          2
    6            A
    3 p

    DELETE FROM test_del WHERE the descr = "A";
    ORA-02292: integrity constraint (FE. FK_DEL) violated - book of the foundling

    Of course, I get ORA-02292 in this case, but how can I write a correct statement that deletes the data displayed by the select?

    Concerning

    Marcus

    You must follow the hierarchy:

    DELETE FROM test_del

    WHERE ROWID IN)

    SELECT THE ROWID

    OF test_del

    CONNECT BY PRIOR ID = changed_by

    START WITH descr = "A".

    AND changed_by IS NULL);

  • Reading XML using XSLT data

    I have a problem of reading xml using XSLT data. There is a CASE - 900000016, has two sequences. SEQ NO1 and NO2 SEQ. Each sequence has an activity. I try to display the info of the activity under corresponding sequences.

    SEQ 01

    Activity

    SEQ 02

    Activity

    This is the xml file.

    <? XML version = "1.0" encoding = "utf-8" standalone = "yes"? >
    < case >
    < EventList >
    < PAEvent >
    < CASENO > 900000016 < / CASENO >
    < > 01 SEQ_NO < / SEQ_NO >
    APPROVED < STATUS > < / STATUS >
    < REASON > < / REASON >
    < PR_NO > 506024 < / PR_NO >
    < SRV_BEG_DAT > 11/02/2010 < / SRV_BEG_DAT >
    < SRV_END_DAT > 11/02/2010 < / SRV_END_DAT >
    < / PAEvent >
    < PAEvent >
    < CASENO > 900000016 < / CASENO >
    < > 02 SEQ_NO < / SEQ_NO >
    APPROVED < STATUS > < / STATUS >
    < TYPE > < / TYPE >
    < REASON > < / REASON >
    < PR_NO > < / PR_NO >
    < SRV_BEG_DAT > 11/02/2010 < / SRV_BEG_DAT >
    < SRV_END_DAT > 28/02/2010 < / SRV_END_DAT >
    < / PAEvent >
    false < hasErrors > < / hasErrors >
    < / EventList >
    < ActivitiesList >
    < PAActivity >
    < CASE_NO > 900000016 < / CASE_NO >
    < > 01 SEQNO < / SEQNO >
    < ACTVTY_LN_NO > 03 < / ACTVTY_LN_NO >
    < ACTVTY_TYP >: < / ACTVTY_TYP >
    < UNIT_PRC > 16.2500 < / UNIT_PRC >
    < / PAActivity >
    < PAActivity >
    < CASE_NO > 900000016 < / CASE_NO >
    < > 02 SEQNO < / SEQNO >
    < ACTVTY_LN_NO > 01 < / ACTVTY_LN_NO >
    < ACTVTY_TYP > P < / ACTVTY_TYP >
    < UNIT_PRC > 0.0000 < / UNIT_PRC >
    < / PAActivity >
    false < hasErrors > < / hasErrors >
    < / ActivitiesList >
    < / Cases >


    XSLT code

    <? XML version = "1.0" encoding = "utf-8"? >
    < xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" >
    < xsl: template match = "Case" >
    < div Id = "dvEvents" align = "center" >
    <!--list of events-->
    < table width = "75%" border = "0" >
    < style tr = "text-align: left;" background-color: gray; ">
    < td colspan = "8" class = "SmallBlackFontBolder" >
    < b > < /b > events
    < table >
    < /tr >
    < xsl: for-each select = "EventList/PAEvent" >
    < b >
    < class td = "SmallBlackFontBold" style = "" text-align: left; "width ="8% "> Seq No.: < table >"
    < class td = "SmallGreenFontBold" align = "left" width = "10%" >
    < xsl: value-of select = "SEQ_NO" / >
    < table >

    < class td = "SmallBlackFontBold" align = "left" width = "8%" > status: < table >
    < td align = "left" width = "11%" >
    < xsl: value-of select = "STATUS" / >
    < table >
    < /tr >

    < b >
    < td >
    <!--get the list of activities-->
    < xsl: for-each select = "Case/ActivitiesList/PAActivity" >
    < xsl: if test = "Case, EventList, PAEvent, SEQ_NO = case, ActivitiesList, PAActivity, SEQNO" >
    < table width = "75%" >
    < b >
    < class td = "SmallBlackFontBold" style = "" text-align: left; "width ="8% "> Seq No.: < table >"
    < class td = "SmallGreenFontBold" align = "left" width = "10%" >
    < xsl: value-of select = "Case, ActivitiesList, PAActivity, SEQNO" / >
    < table >
    Unit price < td >: < table >
    < td align = "left" width = "11%" >
    < xsl: value-of select = "Case, ActivitiesList, PAActivity, UNIT_PRC" / >
    < table >
    < /tr >
    < /table >
    < / xsl: if >
    < / xsl: foreach >
    <!--get the list of activities-->
    < table >
    < /tr >

    < b >
    < class td = "SmallBlackFontBold" align = "left" width = "8%" > reason: < table >
    < td align = "left" width = "20%" >
    < xsl: value-of select = "PAEvent/EventList/reason" / >
    < table >
    < td > < table >
    < td > < table >
    < class td = "SmallBlackFontBold" align = "left" width = "14%" > PR_NO: < table >
    < td align = "left" width = "18%" >
    < xsl: value-of select = "PAEvent/EventList/PR_NO" / >
    < table >
    < /tr >

    < / xsl: foreach >
    < /table >

    < / div >
    < / xsl: template >
    < / xsl: stylesheet >

    Published by: 837989 on April 25, 2013 14:13
  • Problem (hierarchical data) resolved by using SQL

    Hi I have hierarchical data stored in a table with 3 columns
    Item1, item2, relationship

    relationship column defines if the element1 is parent of item2 or item1 item2 Chile

    I have a fourth column in the same table indicating the entire hierarchy of the family separated by colons;

    example: a1, a2, child then output will be a1:a2.

    I have tried a lot of things to do with a sql but failed and finally did using the recursive function

    Hoping someone can solve the problem in sql

    You will find examples of data to work with as well as the desired result:
    select 'p1' as element1, 'p2' as element2, 'parent' as relationship, 'p1' as output  from dual
    union all
    select 'p2', 'p1', 'child', 'p1:p2' from dual
    union all
    select 'p1', 'p3', 'parent', 'p1' from dual
    union all
    select 'p3', 'p1', 'child', 'p1:p3' from dual
    union all
    select 'p2', 'p4', 'parent', 'p1:p2' from dual
    union all
    select 'p4', 'p2', 'child', 'p1:p2:p4' from dual
    union all
    select 'p2', 'p5', 'parent', 'p1:p2' from dual
    union all
    select 'p5', 'p2', 'child', 'p1:p2:p5' from dual
    union all
    select 'p3', 'p6', 'parent', 'p1:p3' from dual
    union all
    select 'p6', 'p3', 'child', 'p1:p3:p6' from dual
    union all
    select 'p5', 'p7', 'parent', 'p1:p2:p5' from dual
    union all
    select 'p7', 'p5', 'child', 'p1:p2:p5:p7' from dual
    union all
    select 'p5', 'p8', 'parent', 'p1:p2:p5' from dual
    union all
    select 'p8', 'p5', 'child', 'p1:p2:p5:p8' from dual
    union all
    select 'b1', 'b2', 'parent', 'b1' from dual
    union all
    select 'b2', 'b1', 'child', 'b1:b2' from dual
    union all
    select 'b2', 'b3', 'parent', 'b1:b2' from dual
    union all
    select 'b3', 'b2', 'child', 'b1:b2:b3' from dual
    union all
    select 'c1', 'c2', 'parent', 'c1' from dual
    union all
    select 'c2', 'c1', 'child', 'c1:c2' from dual
    union all
    select 'c1', 'c3', 'parent', 'c1' from dual
    union all
    select 'c3', 'c1', 'child', 'c1:c3' from dual
    union all
    select 'c3', 'c5', 'parent', 'c1:c3' from dual
    union all
    select 'c5', 'c3', 'child', 'c1:c3:c5' from dual
    union all
    select 'c3', 'c6', 'parent', 'c1:c3' from dual
    union all
    select 'c6', 'c3', 'child', 'c1:c3:c6' from dual
    union all
    select 'c3', 'c7', 'parent', 'c1:c3' from dual
    union all
    select 'c7', 'c3', 'child', 'c1:c3:c7' from dual
    union all
    select 'a1', null, 'parent', 'a1' from dual
    Kind regards
    Amit

    don't worry, I fixed it...

    with t as(
    select 'p1' as element1, 'p2' as element2, 'parent' as relationship  from dual
    union all
    select 'p2', 'p1', 'child' from dual
    union all
    select 'p1', 'p3', 'parent'from dual
    union all
    select 'p3', 'p1', 'child' from dual
    union all
    select 'p2', 'p4', 'parent' from dual
    union all
    select 'p4', 'p2', 'child' from dual
    union all
    select 'p2', 'p5', 'parent' from dual
    union all
    select 'p5', 'p2', 'child' from dual
    union all
    select 'p3', 'p6', 'parent' from dual
    union all
    select 'p6', 'p3', 'child' from dual
    union all
    select 'p5', 'p7', 'parent' from dual
    union all
    select 'p7', 'p5', 'child' from dual
    union all
    select 'p5', 'p8', 'parent' from dual
    union all
    select 'p8', 'p5', 'child' from dual
    union all
    select 'b1', 'b2', 'parent' from dual
    union all
    select 'b2', 'b1', 'child' from dual
    union all
    select 'b2', 'b3', 'parent' from dual
    union all
    select 'b3', 'b2', 'child' from dual
    union all
    select 'c1', 'c2', 'parent' from dual
    union all
    select 'c2', 'c1', 'child' from dual
    union all
    select 'c1', 'c3', 'parent' from dual
    union all
    select 'c3', 'c1', 'child' from dual
    union all
    select 'c3', 'c5', 'parent' from dual
    union all
    select 'c5', 'c3', 'child' from dual
    union all
    select 'c3', 'c6', 'parent' from dual
    union all
    select 'c6', 'c3', 'child' from dual
    union all
    select 'c3', 'c7', 'parent' from dual
    union all
    select 'c7', 'c3', 'child' from dual
    union all
    select 'a1', null, 'parent' from dual
    ), p as (
    select * from t where relationship='parent')
    ,q as (
    select * from t where relationship='child'
    )
    select element1,element2,relationship,path from (select path,element1,'parent' relationship,element2 from (
    select path,element1,element2,row_number() over (partition by element1,element2 order by length(path) desc) rnum from (
    select ltrim(sys_connect_by_path(element1,':'),':') path,element1,element2 from p connect by prior element2=element1
    )) where rnum=1
    union all
    select path,element1,'child' relationship,element2 from (
    select path,element1,element2,row_number() over (partition by element1,element2 order by length(path) desc) rnum from (
    select ltrim(connect_by_root element2||sys_connect_by_path(element1,':'),':') path,element1,element2 from q connect by prior element1=element2
    )) where rnum=1)
    

    Ravi Kumar

  • Hierarchical data in the component of the tree should not be visible

    JDeveloper version - 11.1.1.7.0

    Default in the ADF, the performance of a page with a tree component, existing hierarchies are displayed as trees.


    For my requirement the TRIE hierarchies will not be displayed and component of the tree must be empty when the page runs.

    Why not just use the executeEmptyRowSet(), as described here:

    http://www.jobinesh.com/2010/05/displaying-empty-table.html

  • How to query these data as a tree structure

    Hi, how to write a query to manipulate data like tree structure report? The rules for the structure of the tree are: CORE is always a node root (level 1), level 2 is a location any is not have "/" exclude those beginning of slot with PWR. This tree structure can continue to level 3 and so on

    POSITION OF SLOT
    CORE
    F1
    FAN
    PWR/1
    1
    2
    1/0
    1/1
    1/2
    1/0/0
    1/0/1
    G1
    G4
    G4/0
    G4/1

    Output, * the order of level 2 is not necessary must begin with the F1, it can be any value of level 2

    CORE

    F1

    FAN

    PWR/1

    1

    1/0

    1/0/0

    1/0/1

    1/1

    1/2

    2

    G1

    G4

    G4/0

    G4/1

    Hello

    If you want to CONNECT BY queries, you need to know the parent of each element.  Here's a way to do it:

    WITH got_parent AS

    (

    SELECT slot_position

    CASE

    WHEN slot_position = 'CORE '.

    THEN NULL

    WHEN slot_position NOT LIKE "% / %".

    OR slot_position LIKE '% PWR '.

    THEN THE "HARD CORE".

    Of OTHER SUBSTR (slot_position

    1

    , INSTR (slot_position, ' / ', - 1)-1

    )

    END AS parent

    FROM table_x

    )

    SELECT LPAD (' ', 4 * (LEVEL - 1))

    || slot_position AS padded_slot_position

    OF got_parent

    START WITH parent IS NULL

    Parent = slot_position PRIOR CONNECTION

    ;

    If you would care to post CREATE TABLE and INSERT instructions for the sample data, and then I could test this.

    An alternative to CONNECT BY would generate a string similar to slot_position, but including all ancestors, such as:

    CORE

    CORE/1

    CORE/1/0

    CORE, 1, 0, 0

  • Loading XML file where data structure may vary

    Hi guys,.

    I'm trying to load a XML data file in an Oracle table, with some success, but it will fail to load certain lines when an element is missing. Here is an example of two rows of data:

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

    < ReportDetails >

    < ReportRequest >

    < ExtractDate > 25/03/2010 < / ExtractDate >

    < CaseNoReportRequest > 1234567 < / CaseNoReportRequest >

    individual details < IndividualDetailsText > < / IndividualDetailsText >

    < IndividualDetails >

    < CaseNoIndividual > 1234567 < / CaseNoIndividual >

    < title > < /title > MR

    <>men < / Type >

    Steve < FirstName > < / name >

    < Name > test < / name >

    Detail of < occupation > < / Occupation >

    < / IndividualDetails >

    Information about insolvency < CaseDetailsText > < / CaseDetailsText >

    < CaseDetails >

    < CaseNoCase > 1234567 < / CaseNoCase >

    STEVE TEST < CaseName > < / CaseName >

    Court of County of Preston < > < / Court >

    Bankruptcy of < CaseType > < / CaseType >

    < / CaseDetails >

    < InsolvencyContactText > of insolvency services contact information < / InsolvencyContactText >

    < InsolvencyContact >

    < CaseNoContact > 1234567 < / CaseNoContact >

    Blackpool < InsolvencyServiceOffice > < / InsolvencyServiceOffice >

    Bureau of investigation < contact > < / Contact >

    < / InsolvencyContact >

    < / ReportRequest >

    < ReportRequest >

    < ExtractDate > 25/03/2010 < / ExtractDate >

    < CaseNoReportRequest > 8901234 < / CaseNoReportRequest >

    individual details < IndividualDetailsText > < / IndividualDetailsText >

    < IndividualDetails >

    < CaseNoIndividual > 8901234 < / CaseNoIndividual >

    < title > < /title > MISS

    Female < sex > < / Type >

    Francesca < FirstName > < / name >

    < Name > test < / name >

    Clerk Administration < occupation > < / Occupation >

    < / IndividualDetails >

    < BankruptcyRestrictionsDetails >

    < RestrictionsType > BANKRUPTCY RESTRICTIONS ORDER (BRO) < / RestrictionsType >

    < RestrictionsStartDate > 19/07/2005 < / RestrictionsStartDate >

    < RestrictionsEndDate > 19/07/2012 < / RestrictionsEndDate >

    < / BankruptcyRestrictionsDetails >

    Practitioner of the insolvency of < InsolvencyPractitionerText > contact information < / InsolvencyPractitionerText >

    < IP >

    < CaseNoIP > 8901234 < / CaseNoIP >

    < MainIP > Kevin Morrison < / MainIP >

    < /IP >

    < InsolvencyContactText > of insolvency services contact information < / InsolvencyContactText >

    < InsolvencyContact >

    < CaseNoContact > 8901234 < / CaseNoContact >

    Cardiff < InsolvencyServiceOffice > < / InsolvencyServiceOffice >

    Bureau of investigation < contact > < / Contact >

    < / InsolvencyContact >

    < / ReportRequest >

    < / ReportDetails >

    It is the PL/SQL that I use to try to load it:

    DECLARE

    acct_doc XMLTYPE: = XMLTYPE (BFILENAME('FLA','data_file.xml'), NLS_CHARSET_ID ('AL32UTF8'));

    BEGIN

    INSERT INTO target_table)

    extract_date,

    case_no_report_request,

    case_no_individual,

    title,

    gender,

    first name,

    family name,

    occupation,

    case_no_case,

    case_name,

    Court,

    case_type,

    case_no_contact,

    insolvency_service_office,

    contact

    )

    SELECT x1.extractdate,

    x1.casenoreportrequest,

    X2.casenoindividual,

    X2.title,

    x 2. Gender,

    x 2. FirstName,

    x 2. Surname,

    X2.occupation,

    x 3 .case_no_case,

    x 3 .case_name,

    X3.Court,

    x 3 .case_type,

    x 4 .case_no_contact,

    x 4 .insolvency_service_office,

    X4.contact

    FROM XMLTABLE)

    ' / ReportDetails/ReportRequest.

    PASSAGE acct_doc

    COLUMNS header_no to ORDINALITE,

    extractdate PATH VARCHAR2 (10) "ExtractDate."

    casenoreportrequest NUMBER of path 'CaseNoReportRequest '.

    ) x 1,

    XMLTABLE)

    "$d/ReportDetails/ReportRequest [$hn] / ' IndividualDetails"

    PASSAGE acct_doc "d."

    x 1 .header_no LIKE "hn".

    Casenoindividual COLUMN NUMBER PATH "CaseNoIndividual."

    title VARCHAR2 (20) PATH "Title."

    sex VARCHAR2 (20) PATH "Gender."

    First name VARCHAR2 (30) PATH "First name",

    name VARCHAR2 (30) PATH "name."

    occupation VARCHAR2 (50) PATH "Profession".

    ) x 2,

    XMLTABLE)

    "$d/ReportDetails/ReportRequest [$hn] / ' CaseDetails"

    PASSAGE acct_doc "d."

    x 1 .header_no LIKE "hn".

    Case_no_case COLUMN NUMBER PATH "CaseNoCase."

    case_name PATH VARCHAR2 (50) "CaseName"

    VARCHAR2 (40) path 'Court',

    case_type PATH VARCHAR2 (40) "CaseType.

    ) x 3.

    XMLTABLE)

    "$d/ReportDetails/ReportRequest [$hn] / InsolvencyContact'"

    PASSAGE acct_doc "d."

    x 1 .header_no LIKE "hn".

    Case_no_contact COLUMN NUMBER PATH "CaseNoContact."

    insolvency_service_office PATH VARCHAR2 (20) "InsolvencyServiceOffice."

    Contact PATH VARCHAR2 (30) "Contact".

    ) x 4;

    COMMIT;

    END;

    The first row of the loads fine, but the second row is not at all responsible. I expected he would charge what information there but with NULL values for the missing "CaseDetails" element but it charge nothing at all. If I change the data and manually add it in an element 'CaseDetails', line load. Can someone explain to me how I can get all the lines to load even if some parts are missing?

    Wrong approach altogether.

    There is no need to join via a positional predicate in this case, just use a single query:

    SQL> SELECT x.*
      2  FROM XMLTABLE (
      3         '/ReportDetails/ReportRequest'
      4         PASSING xmltype(bfilename('XML_DIR','data_file.xml'), nls_charset_id('AL32UTF8'))
      5         COLUMNS extractdate                VARCHAR2(10) PATH 'ExtractDate'
      6               , casenoreportrequest        NUMBER       PATH 'CaseNoReportRequest'
      7               , casenoindividual           NUMBER       PATH 'IndividualDetails/CaseNoIndividual'
      8               , title                      VARCHAR2(20) PATH 'IndividualDetails/Title'
      9               , gender                     VARCHAR2(20) PATH 'IndividualDetails/Gender'
     10               , firstname                  VARCHAR2(30) PATH 'IndividualDetails/FirstName'
     11               , surname                    VARCHAR2(30) PATH 'IndividualDetails/Surname'
     12               , occupation                 VARCHAR2(50) PATH 'IndividualDetails/Occupation'
     13               , case_no_case               NUMBER       PATH 'CaseDetails/CaseNoCase'
     14               , case_name                  VARCHAR2(50) PATH 'CaseDetails/CaseName'
     15               , court                      VARCHAR2(40) PATH 'CaseDetails/Court'
     16               , case_type                  VARCHAR2(40) PATH 'CaseDetails/CaseType'
     17               , case_no_contact            NUMBER       PATH 'InsolvencyContact/CaseNoContact'
     18               , insolvency_service_office  VARCHAR2(20) PATH 'InsolvencyContact/InsolvencyServiceOffice'
     19               , contact                    VARCHAR2(30) PATH 'InsolvencyContact/Contact'
     20       ) x ;
    
    EXTRACTDATE CASENOREPORTREQUEST CASENOINDIVIDUAL TITLE    GENDER     FIRSTNAME     SURNAME    OCCUPATION              CASE_NO_CASE CASE_NAME    COURT                 CASE_TYPE    CASE_NO_CONTACT INSOLVENCY_SERVICE_OFFICE CONTACT
    ----------- ------------------- ---------------- -------- ---------- ------------- ---------- ----------------------- ------------ ------------ --------------------- ------------ --------------- ------------------------- ---------------
    25/03/2010              1234567          1234567 MR       Male       Steve         Test       Retail                       1234567 STEVE TEST   Preston County Court  Bankruptcy           1234567 Blackpool                 Enquiry Desk
    25/03/2010              8901234          8901234 MISS     Female     Francesca     Test       Administration Clerk                                                                         8901234 Cardiff                   Enquiry Desk
    
  • Merging XML but my date is so broken!

    I have data to an XML file.  It merges with my PDF template read-only.  The date from XML is formatted as follows:

    YYYY-MM-DD-06:00

    The 'extra' at the end is a zone code.  It is stored in the database like this.

    In my form, I have a read-only which displays the date above - the problem, it's that way, too!

    Anyway for me to format?  I set the type field to date and the entry value and formats - nothing works.  I use 8.0.  I tried to 'script' something, but I guess I'm pretty smart to know where these scripts would reside, nor what they should say, because I spent the day and none of my attempts gave me everything except the output above.

    Thank you!

    Hi ronini,

    You should be able to use the following database on your date field;

    date {YYYY-MM-DD?}

    Input data should match the part of YYYY-MM-DD, but the characters corresponding to questions marks will be ignored.

    On the output, you would end up with spaces where question marks.

    Bruce

Maybe you are looking for

  • AddressCollection

    Hello I want to use the FindListeners function to get a list of devices that are attached to the gpib. How to use the AddressCollection object and an object addresslist for the primary addresses and secondarry of all devices on the bus. Here's what I

  • HP Envy 27 ":" computer Will fire when left on 24/7?

    With my previous desk top, I left the pc on 24/7. I prefer to do the same thing with all of this in a single computer from the MS updates send automatically to the best time for me, i.e. 03:00 to 06:00 This would cause more heating in this model? Thi

  • net.rim.device.api.io.ConnectionClosedException: closed stream

    Hi guys, I'm a ConnectionClosedException: stream is closed when reading an input stream taken after a response received from the side server. This problem is on a single device of BB 9860. Here is the code: DeviceMiniPcProtocol response = null; Outpu

  • How to specify the location of the SD card by program

    Hello I need to start the SD card at the beginning of my application, so I can write a file above. So is there anyway to do? Thank you!

  • HP pavilion g6 power on password forgotten it please help

    Hello. I forgot pass for hp pavilion on g6.   the code is 87907145 87907145. Help, please. ANUK