XML Literal select with multiple nodes

Hi there
can anybody tell the correct syntax for the following XML Literal:
        Dim x = <Test>
                    <%= From item In items Select
                         <top><%= item.X %></top>
                         <left><%= item.Y %></left>
                    %>
                </Test>
Which should result in something like the following valid xml:
<Test>
  <top>1</top>
  <left>2</left>
  <top>4</top>
  <left>6</left>
</Test>
Thanks in advance.
Paul

Hi,
using a classic loop is a possibility, but there are also LINQ solutions, using an array or an iterator:
Dim items As New List(Of Point) From {
New Point(1, 2),
New Point(4, 6)}
' Array versions
Dim result As XElement = New XElement("Test", items.Select(
Function(item)
Return {
New XElement("Top", item.Y),
New XElement("Left", item.X)}
End Function))
Console.WriteLine("Array LINQ Syntax: " & result.ToString())
Dim result2 As XElement =
<Test>
<%= items.Select(Function(item)
Return {
<Top><%= item.Y %></Top>,
<Left><%= item.X %></Left>}
End Function) %>
</Test>
Console.WriteLine("Array VB Syntax: " & result2.ToString())
' Iterator versions requires VB2012 or later
Dim result3 As XElement = New XElement("Test",
items.Select(
Iterator Function(item)
Yield New XElement("Top", item.Y)
Yield New XElement("Left", item.X)
End Function))
Console.WriteLine("Iterator LINQ Syntax: " & result3.ToString())
Dim result4 As XElement =
<Test>
<%= items.Select(
Iterator Function(item)
Yield <Top><%= item.Y %></Top>
Yield <Left><%= item.X %></Left>
End Function)
%>
</Test>
Console.WriteLine("Iterator VB Syntax: " & result4.ToString())
I would consider the Visual Basic syntax (results 2 and 4) at last, as they only add overhead.
The iterator variants require Visual basic 2012 or later. They are lazy evaluated, which has no use here, but in more complex scenarios there can be some advantages.
Regards, Elmar

Similar Messages

  • Select the multiple nodes in a tree

    Hi Experts,
    We need to select the multiple nodes in a tree.Whatever we are selecting,that has to be added in the table as a tree structure itself.
    For ex:
    A
    |--A1
        |--B1
    If We select the A then A,A1 and B1 has to be added in a table.Please help me out for this.
    Regards
    Nutan
    Edited by: Armin Reichert on Jan 29, 2008 2:33 PM

    Hi,
    You have to create a recursive node and use the tree by nesting UI component
    Following tutorial will be of use
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20tutorials%20and%20articles%20archive/constructing%20a%20recursive%20and%20loadable%20web%20dynpro%20tree.pdf
    Recursive Node
    http://help.sap.com/saphelp_nw70/helpdata/en/5d/97384162316532e10000000a1550b0/frameset.htm
    TreeByNesting
    http://help.sap.com/saphelp_nw70/helpdata/en/92/12a74046033913e10000000a155106/content.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#31 [original link is broken]
    Regards
    Ayyapparaj

  • Using the opmn:ormi protocol with multiple nodes

    Hi
    If I use the opmn:ormi protocol with multiple nodes, will it load balance between the nodes or will it simply try to connect to the first node and if it can't it will connect to the second node?.
    Instead of specifying multiple nodes can I set the host to point to a load balancer?
    Which solution is best?

    repost

  • How to generate xml file with multiple nodes using sqlserver as database in SSIS..

    Hi ,
    I have to generate the xml file using multiple nodes by using ssis and database is sqlserver.
    Can some one guide me on to perform this task using script task?
    sudha

    Why not use T-SQL for generating XML? You can use FOR XML for that
    http://visakhm.blogspot.in/2014/05/t-sql-tips-fun-with-for-xml-path.html
    http://visakhm.blogspot.in/2013/12/generating-nested-xml-structures-with.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • BW 3.5 works with multiple nodes for authorizations

    Hi,
    Does BW 3.5 allow to do authorizations on mutiple nodes? It seems that from the How to wotk with hierarchy authorizations paper, the variable can only allow filtering 1 node. for 2.0B. We have requirements to allow viweing multiple nodes in a hierarchy.
    Thanks
    Will

    Hi Will,
    creat a hierarchy-node variable fill by authorizations in the frontend. The type has to be multiple entries (not single value). In RSSM at the hierarchy authorization creation you have to use the F4 for selecting nodes. The F4 allows to drag more nodes into the right frame.
    Cheers
    Peter

  • SQL Script - error in executing the select with multiple conditions

    Hi gurus,
    I'm having trouble in the command syntax below:
    SELECT * FROM "TEST_RVS"."VH_TEST"  WHERE   "AUFNR" = 20210807 AND  "BWART" = 101.
    WHAT IS THE CORRECT SYNTAX WHERE TO CONDITION WITH MULTIPLE FIELDS?
    Thanks !

    What is the error you are getting?  Did you try wrapping the values with quotes?
    SELECT * FROM "TEST_RVS"."VH_TEST"  WHERE   "AUFNR" = '20210807' AND  "BWART" = '101'.
    Cheers,
    Rich Heilman

  • How to create the query with multiple node types

    Hi,
    I am having an issue in creating a query to search multiple node types.
    The requirement is to query documents/pages of the type dam:Asset and cq:Page present under a path.
    I tried the following code snippet with no luck .
    path=/content
    1_type=cq:Page
    2_type=dam:Asset
    property=jcr:content/metadata/@cq:tags
    property.1_value=<tag Name>
    I was able to write a query with single type. However i could not find any documents/ materials with multipe types as shown above.
    Thanks in advance.
    Regards
    Sudhi

    I don't think multiple type is possible. Instead use super type like nt:base that will cover both page and asset.
    Yogesh
    www.wemblog.com

  • Handeling mapping with multiple nodes

    Hi,
                We are doing an IDOC to SOAP scenario, in which we have multiple nodes in source structure. In destination structure we have one node having multiple occurences (1..99). We are trying to do the mapping in such a way that on the basis of no. of nodes at source side, nodes at destination side should be created.
                                  Any idea how to perform this mapping? Is it necessary to use BPM for this?

    1. Node 1 -> count ->
    2. Node 2 -> count ->
    3. Use ADD(std function) 1 and 2
    4. then after step 3 use UDF given below and then mapp to target node
    create advance UDF function and click on radio button "Queue".
    in the imports section enter java.lang.;java.util.;java.lang.reflect.;java.io.;
       //write your code here
    String e = a[0];
      int b = Integer.parseInt(e);
    for(int i=0;i<b;i++)
    result.addValue("1");
    result.addContextChange();
    This is working for me...
    suppose node1 occurs 3 times and node2 occurs 2 times the target node will occur 3 + 2 = 5 times
    Giving points is another way to say thanks
    Edited by: Tarang Shah on Mar 4, 2009 2:06 PM

  • SUn Cluster with multiple nodes

    Hi,
    I am planning to setup Sun Cluster with 3+ nodes.
    is it possible to configure sun cluster with just two network interfaces on each box. (One for Public access and second for cluster interconnection via dedicated switch)?
    Thanks in advance for the help.

    Yes, but only if the adapters support VLAN tagging.
    That way you would be able to create two tagged VLANs on each adapter, one for public and one for private traffic. You'd also need a switch that supported VLAN tagging, but I think these are fairly common now.
    If your NICs do not support tagging then you'd need to get another adapter to allow Sun Cluster to install.
    Regards,
    Tim
    ---

  • How to use For-Each Structure with Multiple node XML structure

    Hi,
      How to use for-each (BPEL 2.0) construct for Multinode XML structure.
    Here is the easy case: I have list of suppliers specified by supplier
    <supplierList>
    <supplier>1</supplier>
    <supplier>2</supplier>
    <supplier>3</supplier>
    </supplierList>
    Now there is a web service http://hostname/getsupplierdetails/wsdl which accepts one supplier at a time.
    like
    <supplier>1</supplier>
    reponse object is
    <message> notfound/found </message>
    But how can I use for each of XML node to call this service and collect the result like
    <supplierList1>
         <Suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
        <suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
    </supplierlist1>
    Thanks

    For looping you use foreach loop and , loop for the number of occurences and when constructing response, adding a new element you have to use bpelx:append.  Good sample at Enterprise Integration: Oracle SOA Suite 11g: Populating a list or an array in BPEL without using XSLT.

  • XML Structured Index with multiple namespaces

    Hi,
    I'm having some trouble creating an xmlindex with structured component on a clob xmltype column without registered schema, whose data uses multiple namespaces.
    The code I'm using atm:
    CREATE TABLE "DECLARATIONS"
        "ID" NUMBER(19,0),
        "XML" "SYS"."XMLTYPE"
    CREATE INDEX decl_header_ix ON "DECLARATIONS"(xml) INDEXTYPE IS XDB.XMLINDEX
      PARAMETERS ('PATHS (INCLUDE (/emcs:emcsDeclaration/emcs:header//*)
                          NAMESPACE MAPPING (xmlns:emcs="http://www.myurl.eu/myapp/schema/emcs/nl"))');
    INSERT INTO "DECLARATIONS" VALUES (1,'
    <?xml version = ''1.0'' encoding = ''UTF-8'' standalone = ''yes''?>
    <emcs:emcsDeclaration xsi:schemaLocation="http://www.myurl.eu/myapp/schema/emcs/nl emcs_domain.xsd"
    xmlns:common="http://www.myurl.eu/myapp/schema/common"
    xmlns:emcs="http://www.myurl.eu/myapp/schema/emcs/nl"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <emcs:header>
          <common:identifier>70</common:identifier>
          <common:declarationSequenceNumber>54566</common:declarationSequenceNumber>
          <common:dateCreated>2010-10-21-01:00</common:dateCreated>
          <common:status>01 Draft e-AAD in preparation</common:status>
       </emcs:header>
    </emcs:emcsDeclaration>');A this moment it's not desirable for us to register the schemas used in oracle. According to the documentation I should be able to add a structured component to the index as follows:
    BEGIN
          DBMS_XMLINDEX.registerParameter('MY_XSI_GROUP_PARAMETER'
                  , 'ADD_GROUP GROUP MY_XSI_GROUP
                   XMLTABLE decl_header
                   XMLNAMESPACES (''http://www.myurl.eu/myapp/schema/emcs/nl'' AS emcs,
                           ''http://www.myurl.eu/myapp/schema/common'' AS common),
                        COLUMNS
                  status VARCHAR2(30)  PATH ''/emcs:emcsDeclaration/emcs:header/common:status/text()''
       END;
    ALTER INDEX DECL_HEADER_IX PARAMETERS('PARAM MY_XSI_GROUP_PARAMETER');However this results in an ORA-00904: invalid identifier. After some experimenting it seems that oracle tries to parse the namespace URLs as identifiers (even tho http://download.oracle.com/docs/cd/E14072_01/appdev.112/e10492/xdb_indexing.htm#BCGJAAGH & http://download.oracle.com/docs/cd/E14072_01/appdev.112/e10492/xdb_xquery.htm#BABJCHCC specify the former), so I swapped them around:
    BEGIN
          DBMS_XMLINDEX.dropParameter('MY_XSI_GROUP_PARAMETER');
          DBMS_XMLINDEX.registerParameter('MY_XSI_GROUP_PARAMETER'
              , 'ADD_GROUP GROUP MY_XSI_GROUP
              XMLTABLE decl_header
              XMLNAMESPACES (emcs ''http://www.myurl.eu/myapp/schema/emcs/nl'',
              common ''http://www.myurl.eu/myapp/schema/common''),
              COLUMNS
              status varchar2(30)  PATH ''/emcs:emcsDeclaration/emcs:header/common:status/text()''
       END;
    ALTER INDEX DECL_HEADER_IX PARAMETERS('PARAM MY_XSI_GROUP_PARAMETER');Oracle seems to get a bit further with this, resulting in a ORA-19102: XQuery string literal expected. Here I pretty much hit a dead end. Removing the xmlnamespaces declaration altogether leads to a ORA-31013: Invalid XPATH expression. Going through the examples on http://www.liberidu.com/blog/?p=1805 works fine, but as soon as I try to add namespaces to it they stop working as well.
    So my question is: how do I get xmlnamespaces (with non-default namespaces) to work in a structured xmlindex component?

    If you want, I can help you tomorrow. Call me at my nieuwegein office or mail me at marco[dot]gralike[at]amis[dot]nl
    I have some time tomorrow, so I can help you with this. My next presentation for UKOUG will be on XML indexes strategies anyway...
    In the meantime and/or also have a look at:
    XML Howto's (http://www.liberidu.com/blog/?page_id=441) specifically:
    XML Indexing
    * Unstructured XMLIndex (part 1) – The Concepts (http://www.liberidu.com/blog/?p=228)
    * Unstructured XMLIndex (Part 2) – XMLIndex Path Subsetting (http://www.liberidu.com/blog/?p=242)
    * Unstructured XMLIndex (Part 3) – XMLIndex Syntax Dissected (http://www.liberidu.com/blog/?p=259)
    * Unstructured XMLIndex Performance and Fuzzy XPath Searches (http://www.liberidu.com/blog/?p=310)
    * Structured XMLIndex (Part 1) – Rules of Numb (http://www.liberidu.com/blog/?p=1791)
    * Structured XMLIndex (Part 2) – Howto build a structured XMLIndex (http://www.liberidu.com/blog/?p=1798)
    * Structured XMLIndex (Part 3) – Building Multiple XMLIndex Structures (http://www.liberidu.com/blog/?p=1805)
    The posts were based on Index for XML with Repeated Elements maybe that is a bit better to read than on my notepad on the internet (aka blog)
    Edited by: Marco Gralike on Oct 28, 2010 7:51 PM

  • Trying to retrieve the editValue of a list box selection with multiple selections

    I have a requirement to display the text and the value of a multiple choice list box but as soon as there are multiple selections the value displayed is the rawValue.
    My code is something like this:
    verifSubTaskDescID.addItem(this.editValue);
    verifSubTaskDesc.addItem(this.rawValue);
    When "this" which is a list box with ["a","first"],["b","second"] is set to a or b it works perfectly, displaying "a" in the ID and "first" in the Desc as follows:
    a          first
    OR
    b          second
    but when I select both this list looks like this:
    first          first
    second     second
    Any ideas on how to preserve the letters without making the code too complex or hard to maintain??
    Thanks!!!

    Hi,
    you can use a for loop to get all selected values from a choice list.
    This could look like this.
    This sample script goes to the exie event of the choice list.
    It refers to the dataNode which holds the multiple values.
    The for loop the then extracts the selected values and their associated display items.
    var r = ""
    for i = 0 upto $.dataNode.nodes.length - 1 do
              r = Concat(r, $.dataNode.nodes.item(i).value, " ", $.getDisplayItem(i + 1) )
    endfor
    Textfield1 = r

  • XML document selection with internet explorer IE 6

    I am running teststand 4, with labview 8.2.1 and the IE version is 6.0.2900.2180
    I try selecting the xml document as a report type and it keeps telling me i need IE6. This didn't occur with teststand 3.5. Do i need to do something or do i actually need a different version of IE?
    Any help would be great.

    Hi there,
    Have you tried updating your IE? There could be some settings that aren't compatible with TS 4. You could try reinitialising the settings to default.
    Sarah
    Applications Engineer | National Instruments | UK & Ireland

  • 11i EBS XML Publisher Report with Multiple Data Source

    I need to create XML Publisher report in 11i EBS pulling data from another 10.7 EBS Instance as well as 11i EBS in single report.
    I am not allowed to create extract or use db links.
    My problem is how to create Data Source Connection using Java Concurrent Program.
    The approach I am trying is
    1. create Java concurrent program to establish connection to 10.7 instance.
    2. Will write the SQL queries in Data Tempalete with 2 Data Source 1 for 11i EBS and 2 for 10.7 EBS
    3. Template will show the data from both query in 1 report..
    Is there any other way to proceed using datasource API...
    thanks

    option1:
    The query should be same @ detail level, only the template has to be different for summary and details.
    @runtime, user can choose to see the detail/summary
    Disadvantage, if the data is huge,
    advantage , only one report.
    option2:
    create two separate reports summary and details
    and create diff data and diff layout and keep it as different report
    Advantage, query will perform based on the user run report, summary/detail, so that you can write efficient query.
    Dis advantage , two reports query/template to be maintained.

  • Extract specific value of a Clob column with multiple nodes,similar name

    Hi,
    There is a clob column in the table USER_DETAILS which hold the values similar to the one given below, i would like to form a query which should fetch the entire record where the age<30, as all the child nodes are with similar name i couldn't fetch it out using xmltype.extract. Also the order of the node values may change for eg. age may follow salary or age can be the first node in the list. Please help me to fetch the desired details.
    <Details>
    <parameter>
    <enter>
    <value>name</value>
    <value>jacob</value>
    </enter>
    <enter>
    <value>Age</value>
    <value>30</value>
    </enter>
    <enter>
    <value>Salary</value>
    <value>20000</value>
    </enter>
    <enter>
    <value>DOB</value>
    <value>12091980</value>
    </enter>
    Thanks, gilbert

    Let's start with the easy part.
    Cells on a Numbers table can contain data entered directly, or can contain a formula. They can't contain both. That means you cannot 'type the conditions into a single cell' in column A ("the left header" cell) AND have a formula which sets that cell to TRUE if the typed in data contains an "A".
    There's no problem doing this using column A as the key holder and columns B:Z to hold the TRUE/FALSE results, staring in both cases on row 2.
    Here's an example
    The column header cells (row 1) contain the letter corresponding to that column.
    The row header cells (starting at row 2) contain the 'bunch of letters' you describe. Note (A4) that the letters do not have to be entered in any particular order, and that extraneous characters (eg. a space) are ignored.
    The formula shown is entered B2, and filled down and right from there.
    =IFERROR(FIND(B$1,$A2)>0,FALSE)
    FIND returns the position of the first occurrence of the target string (in this case, the single letter at the top of the column) in the search string, then compares that with the value zero. For any letter that is included in the search string, the find value will be at least 1, so the comparison will return TRUE. If the target letter is not found, FIND returns an error. IFERROR traps this and returns FALSE.
    Since the target depends on the letter at the top of the column, all that's needed to extend the range of possible letters to the full alphabet is to enter an A in cell B1, then run through the alphabet A to Z, with Z in cell AA1.
    Depending what you want to do with the TRUE or FALSE values in these 26 columns, it may be possible to skip the auxiliary column step and use a formula similar to the one above as the condition argument of an IF(condition,do-if-true,do-if-false) statement.
    Regards,
    Barry

Maybe you are looking for