the analysis for the XML child nodes

Hello

I have the following XML

' < AllocSimulation >
elements <>
< > 76 ItemNo < / ItemNo >
< DisplayCodes >
< DisplayCode > 1 < / DisplayCode >
< DisplayCode > 2 < / DisplayCode >
< / DisplayCodes >
< / object >
elements <>
< > 767 ItemNo < / ItemNo >
< DisplayCodes >
< DisplayCode > 3 < / DisplayCode >
< DisplayCode > 5 < / DisplayCode >
< / DisplayCodes >
< / object >
< / AllocSimulation > '

How can I extract elements such as

No display item code
76 1.2
767 3.5



I ran the following query
     Select  * From
xmltable('AllocSimulation/items'  passing  xmltype('<AllocSimulation>
<items>
     <ItemNo>76</ItemNo>     
     <DisplayCodes>
          <DisplayCode>     1     </DisplayCode>
          <DisplayCode>2     </DisplayCode>     
     </DisplayCodes>
  </items>
  <items>
     <ItemNo>767</ItemNo>     
     <DisplayCodes>
          <DisplayCode>     3     </DisplayCode>
          <DisplayCode>5     </DisplayCode>     
     </DisplayCodes>
  </items>
</AllocSimulation>')      columns       
     Item Varchar2(10) Path  'ItemNo',
  display xmltype path '//DisplayCode');
result
76 < DisplayCode > 1 < / DisplayCode > < DisplayCode > 2 < / DisplayCode >
767 < DisplayCode > 3 < / DisplayCode > < DisplayCode > 5 < / DisplayCode >

Manjusha Muraleedas wrote:
It is one of the solutions... any solution straight forwatd for this?

That's the one that I would have suggested too.

Another possibility would be to expand the collection in a subquery using the MULTISET operator, but I prefer the first approach.

To summarize (assuming that the document is stored in the TMP_XML table):

SELECT x.itemno
     , cast(
         multiset(
           select code, min, max
           from XMLTable('DisplayCodes/DisplayCode'
                 passing x.display
                 columns
             code  varchar2(100) path 'code'
                 , Min   number(10)    path 'Min'
                 , Max   number(10)    path 'Max'
          )
         )
         as displaycodes_vtt
       ) as display_collection
FROM tmp_xml t
   , XMLTable('/purchase/items'
       passing t.object_value
       columns
      ItemNo  varchar2(30) path 'ItemNo'
       , display xmltype      path 'DisplayCodes'
     ) x
;

or,

SELECT d.itemno
     , cast(collect(displaycode(p.code, p.Min, p.Max)) as displaycodes_vtt) as display_collection
FROM tmp_xml t
   , XMLTable('/purchase/items'
       passing t.object_value
       columns
      ItemNo  varchar2(30) path 'ItemNo'
       , display xmltype      path 'DisplayCodes'
     ) d
   , XMLTable('DisplayCodes/DisplayCode'
       passing d.display
       columns
      code  varchar2(100) path 'code'
       , Min   number(10)    path 'Min'
       , Max   number(10)    path 'Max'
     ) p
GROUP BY d.itemno
;

Tags: Oracle Development

Similar Questions

  • How to select only the last child nodes in a piece of XML via XMLTABLE?

    Hello

    I use Oracle 10.2.0.4.

    I have the following XML:
    with sd as (select xmltype('<Fruits>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Granny Smith</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Anjou</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Comice</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Plum</FruitType>
                                    <FruitSubtype>Victoria</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Bramley</FruitSubtype>
                                  </Fruit>
                                </Fruits>') fruit_xml from dual)
    select *
    from   sd;
    and I want to choose the last child nodes where the FruitType is Apple or pear.

    So far, I've got:
    with sd as (select xmltype('<Fruits>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Granny Smith</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Anjou</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Comice</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Plum</FruitType>
                                    <FruitSubtype>Victoria</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Bramley</FruitSubtype>
                                  </Fruit>
                                </Fruits>') fruit_xml from dual)
    select x.*
    from   sd,
           xmltable('//Fruits/Fruit[FruitType=''Apple'' or FruitType=''Pear'']'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path '//FruitType',
                           fruit_subtype VARCHAR2(25) path '//FruitSubtype') x;
    
    FRUIT_TYPE                FRUIT_SUBTYPE
    ------------------------- -------------------------
    Apple                     Granny Smith
    Pear                      Anjou
    Pear                      Comice
    Apple                     Bramley
    but I just want to finish with the last child node by FruitType, for example:
    FRUIT_TYPE                FRUIT_SUBTYPE
    ------------------------- -------------------------
    Pear                      Comice
    Apple                     Bramley
    Is it possible to do through XMLTABLE, or I have to number each of the lines that results from (what I know how to do) and then create a group to prove XMLTABLE? The latter seems awkward to me, so I'd avoid it if possible, but if this is the way to go, I can do it.

    Thank you.

    Is it possible to do through XMLTABLE, or I have to number each of the lines that results from (what I know how to do) and then create a group to prove XMLTABLE?

    Indeed, it is a possible way:

    select x.fruit_type,
           min(fruit_subtype) keep(dense_rank last order by rn) as fruit_subtype
    from   sd,
           xmltable('/Fruits/Fruit'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path 'FruitType',
                           fruit_subtype VARCHAR2(25) path 'FruitSubtype',
                           rn for ordinality) x
    where fruit_type in ('Apple','Pear')
    group by fruit_type
    ;
    

    Other options, should push the logic of consolidation in the XQuery:

    select x.*
    from sd,
         xmltable('/Fruits/Fruit[FruitType="Apple"][last()] |
                   /Fruits/Fruit[FruitType="Pear"][last()]'
                  passing sd.fruit_xml
                  columns fruit_type VARCHAR2(25) path 'FruitType',
                          fruit_subtype VARCHAR2(25) path 'FruitSubtype'
         ) x
    ;
    

    or,

    select x.*
    from   sd,
           xmltable('for $i in distinct-values(/Fruits/Fruit/FruitType)
                     return /Fruits/Fruit[FruitType=$i][last()]'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path 'FruitType',
                           fruit_subtype VARCHAR2(25) path 'FruitSubtype'
                           ) x
    where x.fruit_type in ('Apple','Pear')
    ;
    

    or,

    select x.*
    from   sd,
           xmltable('/Fruits/Fruit[not(following-sibling::Fruit/FruitType=./FruitType)]'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path 'FruitType',
                           fruit_subtype VARCHAR2(25) path 'FruitSubtype'
                           ) x
    where x.fruit_type in ('Apple','Pear')
    ;
    

    Edited by: odie_63 APR 17. 2012 17:56 - added latest example

  • Hide the "open child node" hierarchy Viewer

    How to hide the button ' Show/hide' If node has no child nodes,
    hierarchy viewer node
    similar to the example:

    Hierarchy - Structure of custom node and node comparison demo Viewer

    Thank you

    You do not check it to a bean. The hierarchy is eradicated, so check this is a method of bean would not help that the check is at the end.

    Checkbox in the node itself. The hierarchy works on a model which is to build nodes. Each node must know itself and if there are children. Depending on your model, you implement a method in the node class, which returns true if there are children, and false otherwise. The method is named hasChildren() in the example from my previous post.

    Timo

  • Duplicate content XML child nodes

    Hi all

    I received below XML Developer example data and they need to load the data in table in the Oracle (10g) database.

    < table >

    < lines >

    < row >

    < CellCount > 3 < / CellCount >

    cells <>

    Tom John < cell > < / cell >

    < cell > [email protected] < / cell >

    < cell > 2013 - 08 - 30 12:20:37.0 < / cell >

    < / cells >

    < / row >

    < row >

    < CellCount > 3 < / CellCount >

    cells <>

    < cell > Micky Mouse < / cell >

    < cell > [email protected] < / cell >

    < cell > 2013 - 08 - 30 12:20:37.0 < / cell >

    < / cells >

    < / row >

    < / rows >

    < /table >

    But I had the problem because child node which is duplicated name and developer use a tool to generate only and cannot change the tag before sending to me.

    How can I do for this case?

    Thanks in advance.

    Hiko

    SELECT name, email, sign_date
    FROM XMLTable('/Table/Rows/Row/Cells'
      -- hard-coded XML as unsure where your data comes from
                  PASSING XMLTYPE('
      
       3
      
       John Tom
       [email protected]
       2013-08-30 12:20:37.0
       
       
       
      3
      
       Micky Mouse
       [email protected]
       2013-08-30 12:20:37.0
      
      
       
    ') COLUMNS name VARCHAR2(30) PATH 'Cell[1]', email VARCHAR2(30) PATH 'Cell[2]', sign_date VARCHAR2(22) PATH 'Cell[3]'); -- sign_date is neither a date nor a timestamp for Oracle default conversion so will need to to_date it yourself

    That should help you get started.  XMLTable was part of 10.2.0.1.  Are there opportunities to spend at least 10.2.0.5 just to pick up corrections of bugs/new features?

  • Read attribute with the XML DOM node.

    Hello, I have a XML file like this:
    <? XML version = "1.0" encoding = "ISO-8859-15? >
    < Datenexport >
    < Codeliste Nr = "1" >
    < Entry >
    < code > < code > J
    < Decodierung_DE > Already < / Decodierung_DE >
    < Decodierung_EN / >
    < / Entry >
    < Entry >
    < code > < code > N
    < Decodierung_DE > NEIN < / Decodierung_DE >
    < Decodierung_EN / >
    < / Entry >
    < / Codeliste >
    < Codeliste Nr = "3" >
    < Entry >
    < code >? < code >
    < Decodierung_DE > Code noch festzulegen < / Decodierung_DE >
    < Decodierung_EN > Code to define < / Decodierung_EN >
    < / Entry >
    ...

    I read the file with DOM and it works fin.
    It is a sample of my code:

    Start

    INDOMDOC: = DBMS_XMLDOM. NEWDOMDOCUMENT (xml_doc. GETclobVAL());

    l_nl: = dbms_xslprocessor.selectNodes (dbms_xmldom.makeNode (indomdoc),'/ Datenexport ',' xmlns:xiz = "http://www.bvl.bund.de/Schema/2010/xiz" ');

    FOR cuta to 0... dbms_xmldom.GetLength (l_nl) - 1
    LOOP

    l_n: = dbms_xmldom.item (l_nl, cur);
    l_nl2: = dbms_xmldom.getchildnodes (l_n);
    lv_value: = dbms_xmldom.getnodename (dbms_xmldom.getfirstchild (l_n));

    FOR cur2 IN 0... dbms_xmldom.GetLength (l_nl2) - 1
    LOOP
    l_n2: = xmldom. ITEM (l_nl2, cur2);
    nodename_val: = dbms_xmldom.getnodename (l_n2);
    dbms_output.put_line ('NodenameAntrag: ' | nodename_val);
    lv2_value: = dbms_xmldom.getnodevalue (dbms_xmldom.getfirstchild (l_n2));
    dbms_output.put_line ('NodeValue: ' | lv2_value);

    IF nodename_val = "Codeliste", THEN number_val: = dbms_xmldom. ??? ;
    ...

    Now, I need to read the number of the "Codeliste" (< Codeliste Nr = "1" >).
    But I haven´t find the right function.
    Anbody help me?

    Always do not use XMLTable for this? ;)

    OK, using DOM, for example:

    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    doc       xmltype;
      3    indomdoc  dbms_xmldom.domdocument;
      4    l_nl      dbms_xmldom.DOMNodeList;
      5    l_n       dbms_xmldom.DOMNode;
      6    lv_value  varchar2(30);
      7  begin
      8    doc := xmltype('
      9  
     10  
     11  
     12  J
     13  JA
     14  
     15  
     16  
     17  N
     18  NEIN
     19  
     20  
     21  
     22  
     23  
     24  ??
     25  Code noch festzulegen
     26  Code to be defined
     27  
     28  
     29  ');
     30
     31
     32    indomdoc := dbms_xmldom.newdomdocument(doc);
     33
     34    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/Datenexport/Codeliste');
     35
     36    FOR cur IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
     37       l_n := dbms_xmldom.item(l_nl, cur);
     38       --lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_n));
     39       dbms_xslprocessor.valueOf(l_n, '@Nr', lv_value);
     40       dbms_output.put_line('Nr : '||lv_value);
     41    END LOOP;
     42
     43    dbms_xmldom.freeDocument(indomdoc);
     44
     45  end;
     46  /
    
    Nr : 1
    Nr : 3
    
    PL/SQL procedure successfully completed
     
    
  • Adjust the position of the child node in a StackPane

    Hello

    I have a question on the setting the positions of child nodes in a StackPane.
    I added 2 child nodes to a StackPane.
    For the 1st child node, I need to be always as big as the parent StackPane.
    For the 2nd child node, it should be as large as necessary to place a few small pictures and it must always be "anchored" to the upper right of the parent StackPane.
    2 childs nodes will be overlapping always.
    Is this doable with a StackPane or would it be better to use another class of component?

    Thank you.

    Yes, you can do it in a StackPane.
    The first node of a subclass of component and ensure that it has an unlimited width and max height and it will completely fill the available surface of the StackPane.
    Use the static StackPane.setAlignment (node, Pos) method to position the knot 2.

    import javafx.application.Application;
    import javafx.geometry.Pos;
    import javafx.scene.Scene;
    import javafx.scene.layout.*;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    
    public class StackPanePositioning extends Application {
      public static void main(String[] args) throws Exception { launch(args); }
      @Override public void start(final Stage stage) throws Exception {
        Pane n1 = new Pane();
        n1.setPrefSize(200, 120);
        n1.setStyle("-fx-background-color: green;");
        Rectangle n2 = new Rectangle(50, 50,   Color.RED);
        StackPane.setAlignment(n2, Pos.TOP_RIGHT);
    
        StackPane stack = new StackPane();
        stack.getChildren().addAll(n1, n2);
        stage.setScene(new Scene(stack));
        stage.show();
      }
    }
    
  • [JS/CS6] How can I reach or remove text remains which is stuck in the XML Structure

    Sometimes, the remnants of the deleted text are found at a parent level or root of the XML structure. How can I 'find' scripts?

    Capture1.PNG

    Above, a sample image. The root should be just '<>' and there may be hundreds of items marked under the root, which should not be deleted. The only thing that needs to be removed is the text that shows inside the element root, because it is not in use anywhere.

    To fix it as I want, I can manually drag the document root, enter the editor mode (Ctrl + Y) and delete the text. I do in the editor mode to avoid the deletion of all the other child nodes of the root, which happens easily if I delete all the text in the textframe. When I delete the textframe, after you remove the top-level text which has been 'stuck' before, everything is nice.

    I'd like one to write a script that deletes the text which has got stuck in the root of the way which is shown in the picture (the root is not in the page, it should be empty in case I'm on).

    Defining the content of the xmlElement to "translates in all of the sub-elements being deleted (not what I want).

    Thank you

    Andreas

    It of not elegant, but should work. I can't think of a way to distinguish the 0xFEFFs that "contain" children of other 0xFEFFs that you may have in the history of the root, so that would leave all the ones you hang out.

    var root = app.activeDocument.xmlElements[0],
        i, character;
    
    if (root.parentStory.constructor.name === 'XmlStory') {
        for (i = root.xmlContent.characters.length - 1; i >= 0; i--) {
            character = root.xmlContent.characters[i];
            if (character.contents.charCodeAt(0) !== 65279) {
                character.remove();
            }
        }
    }
    

    Jeff

  • Get XML child elements

    Dear Indesign scripting,

    This script is made of all the tags XML ParagraphStyles.

    But he refuses to take the child to the elements. What do I have to use the XPath expression? And how?

    function main() {  
      var xes, n, doc, ps, xe;  
      if ( !app.documents.length ) return;  
      doc = app.activeDocument;
      xes = doc.xmlElements[0].xmlElements;  
      n = xes.length;  
      while ( n-- ) {  
      xe = xes[n]; 
      st = doc.paragraphStyles.itemByName (xe.markupTag.name );  
      !st.isValid && doc.paragraphStyles.add({name:xe.markupTag.name});  
      }  
    }  
      
      
    main(); 
    

    The XML code

    <Workbook>  
         <Element_A_01>  
              <Element_A_01></Element_A_01>  
         </Element_A_01>  
         <Element_B_02>  
              <Element_B_02></Element_B_02>  
         </Element_B_02>  
    </Workbook> 
    

    Greetings from Holland

    The code creates two paragraph styles namely Element_A_01 and Element_B_02. These two are created for the immediate child nodes of the workbook node. Now, it seems you are trying to create pstyles for all nodes in the XML document, which in your case would be even these two as Element_A_01 has a child node that is also named Element_A_01 and what is the case for Element_B_02.

    If I get your straight stitch then you need to create 4 pstyles if all nodes have different names, but who doesn't. For that you recursively through each node that you receive from the fixed code [n].

    The code to be something like this

    1. main() {} function
    2. fixed var n, doc, ps, xe;
    3. If (! app.documents.length) return;
    4. doc = app.activeDocument;
    5. fixed = doc.xmlElements [0] .xmlElements; This gives the immediate children nodes of the workbook node, where the length in the next statement 2
    6. n = xes.length;
    7. While (n)-{}
    8. XE = set [n];   Here you need to recursively through the xe node
    9. The number of child elements of the xe can be obtained as xe.xmlElements.length
    10. First element can be obtained by xe.xmlElements [0]
    11. }
    12. }
    13. main();

    Hope this fixes the problem

  • XML E4X nodes select based on the attribute of the child node.

    Hey,.

    I'm making a selection on the following XML code.

    I want to retrieve the list of the variable node when its child nodes metadata attribute 'name' is not equal to "transitional". I have read the documentation, but have not been able to solve this problem, and it should be pretty simple. So far, I tried with something like.

    variable var: XMLList = classInfo.variable. (the metadata. (@name! = "transitoire")) ;

    variable var: XMLList = classInfo.variable. (metadata.@name! = "transitional");

    But he returns all the nodes variable.

    "< name =" type com.sca.dataModel::PresentationDataEntity"base =" com.sca.dataModel::BaseEntity "isDynamic ="false"isFinal ="false"isStatic ="false">
    < extendsClass type="com.sca.dataModel::BaseEntity"/ >
    < extendsClass type = 'Object' / >
    < variable name = "subtitle" type = "string" >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/PresentationDataEntity.as"/ >
    < arg key = "pos" value = "128" / >
    < / metadata >
    < / variable >
    < variable name = "id" type = "Number" >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/BaseEntity.as"/ >
    < arg key = "pos" value = "153" / >
    < / metadata >
    < / variable >
    < variable name = "tableName" type = "String" >
    < name of metadata = "transitional" / >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/BaseEntity.as"/ >
    < arg key = 'pos' value = '118' / >
    < / metadata >
    < / variable >
    < variable name = "db_SortAsc" type = "Boolean" >
    < name of metadata = "transitional" / >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/BaseEntity.as"/ >
    < arg key = "pos" value = "281" / >
    < / metadata >
    < / variable >
    < variable name = "title" type = "String" >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/PresentationDataEntity.as"/ >
    < arg key = "pos" value = "100" / >
    < / metadata >
    < / variable >
    < method name = "setData" declaredBy = "com.sca.dataModel::BaseEntity" returnType ="*" > "
    < parameter index = '1' type = 'Object' optional = "false" / >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/BaseEntity.as"/ >
    < arg key = "pos" value = "330" / >
    < / metadata >
    < / method >
    < name of metadata = "__go_to_ctor_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/PresentationDataEntity.as"/ >
    < arg key = "pos" value = "167" / >
    < / metadata >
    < name of metadata = "__go_to_definition_help" >
    < arg key = 'file' value="/Users/jonas/projects/SCA-CMS/src/com/sca/dataModel/PresentationDataEntity.as"/ >
    < arg key = "pos" value = "42" / >
    < / metadata >
    < / type >

    Try classInfo.variable. ([email protected] (.indexOf("transient')) is

    (- 1).

  • Remove the XML node

    Dear adobe experts,

    I have a requirement to remove a node in the XML interface of a form of adobe (not only by removing a subform in the form). It must be a deletion, an empty node does not work (I read this in another post).

    The XML structure looks like this:

    < ITEM >

    < DATA >

    < ROW_IID > 0 < / ROW_IID >

    < PARENT > 0 < / PARENT >

    < CHILD > 0 < / CHILD >

    < / DATA >

    < DATA >

    < ROW_IID > 1 < / ROW_IID >

    < PARENT > 0 < / PARENT >

    < CHILD > 0 < / CHILD >

    < / DATA >

    < / ITEM >

    I want to, for example, to remove the second node of data including the underlying elements: row_iid, parent & child. Already tried: xfa.record.nodes.remove (oRemoveNode); I got it from http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pd f and several messages in this forum, but I get the following message appears in the error console: remove failed. I know that the somexpression is correct.

    Here's the code I used to try to remove the node.

    var node_loc;

    var del_node;

    [node_loc = ' xfa.record.ELEMENT.DATA [1 '];

    del_node = xfa.resolveNode (node_loc);

    xfa.record.Nodes.Remove (del_node);

    Anyone know what I am doing wrong?

    Kind regards

    Niels

    Hi Steve,.

    I fixed it myself. I adjusted my code a little, so the node, including the elements is successfully deleted.

    Here is the way that I fixed it:

    var node_loc;

    var del_node;

    [node_loc = ' xfa.record.ELEMENT.DATA [1 '];

    del_node = xfa.resolveNode (node_loc);

    xfa.record.ELEMENT.nodes.remove (del_node);

    Thanks for the help!

    Kind regards

    Niels

  • How to find the child nodes of XMLDoc where-&gt; var XMLDoc = subform.datanode.saveXML("pretty");

    Hi all

    I am very new to the designer of the ADEP.  Please help me with this problem.

    Let's say that the Subform.datanode.saveXML () returns a XML as below.

    < test >

    < Paper1 > English < / Document1 >

    Science < paper2 > < / paper2 >

    History of < paper3 > < / papier3 >

    < test >

    In the script:

    var XMLDoc = subform.datanode.saveXML ("pretty");

    for (nodeCount = 0; nodeCount < XMLDoc.nodes.length; nodeCount ++)

    Returns an error "error: null is not an object.  But I was able to access the values by specifying directly "XMLDoc.paper1 [0] m:System.NET.SocketAddress.ToString ();"

    Can someone please suggest a way to know the number of child nodes in this context?

    Hello

    You can count the knots by:

    subform.datanode.nodes.item(0).nodes.length;
    
  • Using the overall table for the XML results

    I'm new in the flash script and it drives me crazy...

    I searched the internet and I could not find a solution for this.

    I am trying to load XML, analyze the values in the global table and use this picture later in my code... it does not work.

    _Global.AutoID = Array ();

    function ParsingXML() { }

    var pokXML:XML = new XML();

    pokXML.ignoreWhite = true;

    pokXML.onLoad = function (loaded) { }

    If (loaded) { }

    var full_niz:Array = pokXML.firstChild.childNodes;

    len:Number=full_niz.length-1//getting the number of child nodes var

    for (var i: Number = 0; i < = len; i ++) //looping hollow values

             {

    _global.AutoID [i] = full_niz [i] Sublst.ChildNodes(1).ChildNodes(0) [0] .firstChild;

              }

    trace (_global.autoid);  Back table OK

    out of //function return _global.autoid;

         }else{

    trace ("not OK");

         }

    } //end function (loaded)

    pokXML.load ("my.xml");

    } //end ParsingXML function

    ParsingXML();  return empty array [virtue]

    How to make this work?

    Sorry for my English (bad)

    Try:

    _Global.AutoID = new Array();

    function ParsingXML() {}

    var pokXML:XML = new XML();

    pokXML.ignoreWhite = true;

    pokXML.onLoad = {function (loaded)}

    If {(responsible)

    var full_niz:Array = pokXML.firstChild.childNodes;

    var len:Number=full_niz.length-1//getting the number of child nodes

    for (var i: Number = 0; i<=len;i++) looping="" trough="" the="">

    {

    AutoID [i] = full_niz [i] Sublst.ChildNodes(1).ChildNodes(0) [0] .firstChild;

    }

    Table //return OK track (_Global.AutoID)

    Return _global.autoid; pokXML.onLoad is asynchronous if it does not make sense to have a return.

    } else {}

    trace ("not OK");

    }

    } //end function (loaded)

    pokXML.load ("my.xml");

    } //end ParsingXML function

    ParsingXML();  return empty array [virtue]

  • Insert the parent/Child records in an xml file...

    XML file pasted below:

    I loaded the xml file in a table called xml_demo that has a column of type xmltype donnees_xml.

    The Select to parent record is thus, and it works:

    INSERT INTO balit_submissions (balitdoc, documentversion, datetime_from, job_id, status, creation_datetime)
    (SELECT 'MOL'
    ((, to_number(extract(x.xml_data,'/MolDocument/DocumentVersion/@v'))
    (, to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
    "yyyy-mm-dd HH24" T"")
    123456
    "CREATED",
    NULL VALUE
    OF xml_DEMO x WHERE
    (([existsnode(x.xml_DATA,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1).
    /

    Having problem creating records child. From this file, I expect to create 3 folders.

    insert into balit_energy_blocks
    (
    SO_ID,
    DATETIME_FROM,
    DIRECTION,
    BLOCK_NUMBER,
    ENERGY,
    LAST_SUBMIT_DATETIME,
    PRICE_POUNDS,
    PRICE_EUROS,
    BALIT_REF,
    STATUS,
    LAST_EDIT_DATETIME,
    MOL_REASON,
    ACQUIRING_SO_AREA)
    (SELECT 'TEN'
    (, to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
    "yyyy-mm-dd HH24" T"")
    (, DECODE(extract(x.xml_data,'/MolDocument/MolTimeSeries/Direction/@v'),'AO1','Up','Down')
    (, to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
    ((, to_number(extract(x.xml_data,'/MolDocument/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
    sysdate
    , null - price books
    , null - price euro
    (, extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v')
    "PRESENTED".
    , "A96.
    NULL - acquisition of area
    sysdate
    OF xml_DEMO x WHERE
    (([existsnode(x.xml_DATA,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1).
    /

    For example, there are 3 ContractIdentification tags. Example 1:

    < ContractIdentification v = "RTE_20100331_1500_16" / >

    I expect this selection to snatch the last issue of this string. In this case, 16.
    The selection was:
    TO_NUMBER(substr(extract(x.xml_DATA,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))

    The result I got was:

    16RTE_20100331_1500_20NG_20100331_1500_6

    All values of contractident are concatnated and returns posted 19 go.

    Can someone help me to extract the last number of each tag value of ContractIdentification and create the 3 files

    Thank you

    James Sathiaraj

    <? XML version = "1.0" encoding = "UTF-8"? >
    < MolDocument DtdVersion = "3" DtdRelease = "0" >
    < DocumentIdentification v = "MOL_20100331_1500_1600" / >
    < DocumentVersion v = "1" / >
    < V DocumentType = "A43" / >
    < CodingScheme = v "A01" SenderIdentification = "17X100Z100Z0001H" / >
    < SenderRole v = "35" / >
    < ReceiverIdentification codingScheme = v "A01" = "10XFR-TEN - Q" / >
    < ReceiverRole v = "A04" / >
    < CreationDateTime v = "2010-03 - 31 T 14: 10:00Z" / >
    < ValidTimeInterval v = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < codingScheme domain = "A01" v = "10YDOM-1001A001A" / >
    < MolTimeSeries >
    < ContractIdentification v = "RTE_20100331_1500_16" / >
    < ResourceProvider codingScheme = v "A01" = "10XFR-TEN - Q" / >
    < CodingScheme = v "A01" AcquiringArea = "17Y100Z100Z00013" / >
    < ConnectingArea codingScheme = v "A01" = "10YFR-TEN - C" / >
    < AuctionIdentification v = "AUCTION_20100331_1500_1600" / >
    < BusinessType v = "10" / >
    < BidTimeInterval v = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < MeasureUnitQuantity v = "MAW" / >
    < v currency = "EUR" / >
    < MeasureUnitPrice v = "MWH" / >
    < v direction = "A02" / >
    < MinimumActivationQuantity v = "50" / >
    < v status = "A06" / >
    < period >
    < v TimeInterval = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < resolution v = "PT60M" / >
    <>interval
    < v pos = "1" / >
    < v Qty = "50" / >
    < character v = "50.45" / >
    < / interval >
    < / period >
    < / MolTimeSeries >
    < MolTimeSeries >
    < ContractIdentification v = "RTE_20100331_1500_20" / >
    < ResourceProvider codingScheme = v "A01" = "10XFR-TEN - Q" / >
    < CodingScheme = v "A01" AcquiringArea = "17Y100Z100Z00013" / >
    < ConnectingArea codingScheme = v "A01" = "10YFR-TEN - C" / >
    < AuctionIdentification v = "AUCTION_20100331_1500_1600" / >
    < BusinessType v = "10" / >
    < BidTimeInterval v = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < MeasureUnitQuantity v = "MAW" / >
    < v currency = "EUR" / >
    < MeasureUnitPrice v = "MWH" / >
    < v direction = "A02" / >
    < MinimumActivationQuantity v = "50" / >
    < v status = "A06" / >
    < period >
    < v TimeInterval = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < resolution v = "PT60M" / >
    <>interval
    < v pos = "1" / >
    < v Qty = "50" / >
    < character v = "50.48" / >
    < / interval >
    < / period >
    < / MolTimeSeries >
    < MolTimeSeries >
    < ContractIdentification v = "NG_20100331_1500_6" / >
    < ResourceProvider codingScheme = v "A01" = "10X1001A1001A515" / >
    < CodingScheme = v "A01" AcquiringArea = "17Y100Z100Z00013" / >
    < CodingScheme = v "A01" ConnectingArea = "10YGB - A" / >
    < AuctionIdentification v = "AUCTION_20100331_1500_1600" / >
    < BusinessType v = "10" / >
    < BidTimeInterval v = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < MeasureUnitQuantity v = "MAW" / >
    < v currency = "EUR" / >
    < MeasureUnitPrice v = "MWH" / >
    < v direction = "A01" / >
    < MinimumActivationQuantity v = "50" / >
    < v status = "A06" / >
    < period >
    < v TimeInterval = "2010-03 - 31 T 15: 00Z / 2010-03 - 31 T 16: 00Z" / >
    < resolution v = "PT60M" / >
    <>interval
    < v pos = "1" / >
    < v Qty = "50" / >
    < character v = "17.0" / >
    < / interval >
    < / period >
    < / MolTimeSeries >
    < / MolDocument >

    Hello

    The result I got was:

    16RTE_20100331_1500_20NG_20100331_1500_6

    In the query have you tried, access you a single record if you can not expect to get three rows of "magic". The EXTRACT function works as planned, it retrieves the nodes required, but the result is always a fragment of XML (a scalar value).
    To achieve your goal, you must divide the sequence MolTimeSeries in relational lines.

    Two similar solutions are possible, XMLTable (10gr 2 and more) or Table/XMLSequence.
    In your other post, you mentioned db version 10.1, so I guess we go with XMLSequence:

    SELECT 'RTE'
           ,to_date(substr(extractvalue(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),'yyyy-mm-dd"T"hh24:mi')
           ,decode(extractvalue(x2.column_value,'/MolTimeSeries/Direction/@v'),'A01','Up','Down')
           ,to_number(regexp_substr(extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v'),'\d+$'))
           ,to_number(extractvalue(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
           ,sysdate
           ,null
           ,null
           ,extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v')
           ,'SUBMITTED'
           ,'A96'
           ,null
           ,sysdate
    FROM xml_demo x,
         table(
           xmlsequence(
             extract(x.xml_data, '/MolDocument/MolTimeSeries')
           )
         ) x2
    WHERE existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1;
    

    Also note the use of instead of the ordinary SUBSTR REGEXP_SUBSTR because he has not worked for "NG_20100331_1500_6".

    Hope that helps.

    Published by: odie_63 on June 24, 2010 21:18 - comment added regexp

  • Check the value of the attribute of a child node to xmltype data type.

    Hello

    I have a xml stored in the column with the data type as "XMLTYPE.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Settings>
      <Setting Name="A1" Value="N"/>
      <Setting Name="A2" Value="N"/>
      <Setting Name="A3" Value="SOMEVALUE"/>
      <Setting Name="A4" Value="N"/>
      <Setting Name="A5" Value="Y"/>
      <Setting Name="A6" Value="N"/>
    </Settings>
    I don't want to loop in each child node. But want to know if the value of the A5 parameter is Y or N? Is there a way I can find it without making the child node extract "Setting" and then a loop of each node to find the value?

    Kind regards

    You specify your Oracle version then here are two options. If 10.2 or higher, use XMLTable, otherwise use the option of ExtractValue.

    -- The WITH simply simulates your existing table that I do not have.
    WITH fake_tab AS
    (SELECT XMLTYPE('
    
      
      
      
      
      
      
    
    ') tab_col
      FROM dual)
    -- For 10.2 and higher use this SELECT
    SELECT a5
      FROM fake_tab,
           XMLTABLE('/Settings'
                    PASSING fake_tab.tab_col
                    COLUMNS
                    a5   VARCHAR2(10)  PATH 'Setting[@Name="A5"]/@Value');
    
    -- For 10.1 and before
    SELECT ExtractValue(tab_col, '/Settings/Setting[@Name="A5"]/@Value')
      FROM fake_tab;
    
  • regular expression for the xml tags

    Dear smart people of the labview world.

    I have a question about how to match the names of xml text elements.

    The image that I have some xml, for example:

    Peter

    13

    and I want to match all of the names of elements, that is to say: no, son, grandson, age, regardless of any attribute have these items. There is a regular expression, I can loop, that can do this? (Something like "\<.+\> ". "") It is no good because it matches the entire xml string.) I'd really only two different expressions, one for the match start elements, e.g. and one for the correspondence of the elements, for example.

    Thanks for your help in advance!

    Paul.

    The site Of regular Expressions will be very convenient.

    They have some good tutorials on regexp with a demo of the XML tags:

    Here is a small excerpt:

    The regular expression <\i\c*\s*>matches an opening of the XML without the attributes tag corresponds to a closing tag. <\i\c*(\s+\i\c*\s*=\s*("[^"]*"|'[^']*'))*\s*>corresponds to an opening with a number any attributes. Put all together, <(\i\c*(\s+\i\c*\s*=\s*("[^"]*"|'[^']*'))*| i\c*)\s*="">corresponds to an opening with attributes or a closing tag.  (source)

    If you want advanced XML analysis I suggest JKI XML toolkit.

    Tone

Maybe you are looking for

  • Safari &amp; Flash Player

    So, now when I run Safari to watch a movie on TCM, I get the message that it requires Flash Player. I already have Flash Player. I read that I can activate it, but no instructions available on how to turn it on. I've never had this problem before abo

  • Bootcamp - cannot download the support software

    First of all, I cannot network, like many similar questions in this community seem to have. I have a problem with my Windows partition, mainly the lack of support for keys F (volume, brightness, etc), so I found this article on the Apple support whic

  • Problems with the level of Zoom in Version 9.0.3 (11601.4.4)

    I use the Version 9.0.3 (11601.4.4) and X.11.3 El Capitan, normal notice even tiny text and I'll have to hit ⌘ - + 4 or 5 times just to get the size of normal play. Another notice that?

  • Cannot install HWsetup or value-added package on Windows 7 64 bit

    I've upgraded to Windows 7 pro 64-bit, and I found FN (function) button does not work, so I re-installed PVAT several times, but nothing.then I checked HWSetup for activate the FN key, but he could not find in the Panel, I found it in the folder of T

  • Do you have an iCloud account or an account for each device purchased iCloud?

    I am trying to understand my situation to iCloud.  I have an iPhone 6s +, an iPad 2 Air and a new Mac.  I would expect to have an iCloud account with 5 GB of free storage for each of these three devices for a total of 15 GB of free storage space, or