Help listing and selecting xml object

Hi there
I am having problems with "see the forrest" with this code. I am trying to sort a my xml elements by listing them , sorting them and moving them.
My problem is :
How do i make a list of all my elements in the "story" like a collection of indesign elements ?
How do i select the element and move it after "myXMLOld" ?
And if this is a "BAD" way to to this i will be interested to learn a better way ?
Regards
T'
var myDocument = app.documents.item(0);
    var myXML = myDocument.xmlElements.itemByName("Root").xmlElements.itemByName("Story")
      var myXmlList = new Array;
    var bb = myXML.xmlElements.length;
for(var myCounter = 0; myCounter < bb; myCounter++){
     var  myXmlElement= myXML.xmlElements.item(myCounter)
     var myXM_id = myXML.xmlElements.item(myCounter).id;
     var myXML_con = myXML.xmlElements.item(myCounter).contents;
     myXmlList[myCounter] = [[myXML_con , myXM_id]];
var ok = myXmlList;
myXmlList.sort ()
var myXMLOld=myXmlList[0][0][1];
  var myXMLElementA = myXML.xmlElements.itemByID(myXmlList[0][0][1]);
myXMLElementA.move(LocationOptions.atBeginning);
for(var myCounter = 1; myCounter < bb; myCounter++){
var test = myXmlList[myCounter][0][1];
var myXMLElementA = myXML.xmlElements.itemByID(test);
     myXMLElementA.move(LocationOptions.after, myXML.xmlElements.xmlElements.itemByID(myXMLOld));
      var myXMLOld=myXmlList[myCounter][0][1];
XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root>
<Story>
<Vidlex>Alger: En stor gruppe </Vidlex>
<Vidlex>Basalt: Sort finkornet /Vidlex>
<Vidlex>Cyanobakterier: Bakterier, </Vidlex>
<Vidlex>Dna: (Deoxyribonukleinsyre). Organisk molekyle, </Vidlex>
<Vidlex>Etolog: Person, der </Vidlex>
</Story>
</Root>

Unfortunately in my real scenario I don't know what the
element will be called. It could be in <foo> or <bar>
etc, so I need to be able to use a variable (in which the element
name is set beforehand). With "::" I can't use a variable, so
textXML.ns::findParis looks for a "findParis" element and not "b".
That's why I'm trying to use testXML.child(findParis) because
I can use a variable. I just can't figure out how to make it
incorporate the namespace as well.

Similar Messages

  • How to make new scop of list and selection parameter in ME2L or ME2M

    Hi,
      As there are many reports avaliable ,  in ME2L and ME2M  there is scope of list and selection parameter on the selection screen,  i want to know how we can create new scope of list and new selection parameter.
    regards,
    zafar

    IMG ---> Material Management ---> Purchasing ---> Reporting ---> Maintain Purchasing Lists ---> Scope of List ---> Define Scope of List

  • Shred XML and select XML column as multiple columns

    Hi,
    Kindly assist me.
    I need to split XML Column(XSD defined) and select as different columns.
    CREATE
    XML
    SCHEMA
    COLLECTION [dbo].[Groupers]
    AS
    N'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="grouper">
    <xsd:complexType>
    <xsd:complexContent>
    <xsd:restriction base="xsd:anyType">
    <xsd:sequence />
    <xsd:attribute name="payorid" type="xsd:anySimpleType" use="required" />
    <xsd:attribute name="version" type="xsd:anySimpleType" />
    <xsd:attribute name="type" type="xsd:anySimpleType" />
    <xsd:attribute name="payortag" type="xsd:anySimpleType" use="required" />
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="groupers">
    <xsd:complexType>
    <xsd:complexContent>
    <xsd:restriction base="xsd:anyType">
    <xsd:sequence>
    <xsd:element ref="grouper" minOccurs="0" maxOccurs="4" />
    </xsd:sequence>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>'
    GO
    CREATE
    TABLE TestTable1
    Groupers
    XML
    (CONTENT [dbo].[Groupers])
    NULL,
    Description
    varchar(255),
    insert
    into TestTable1
    values('<groupers><grouper
    payorid="1" version="30" type="A" payortag="36" /></groupers>','TestDescriptio1')
    /* This is NOT working , Please help here*/
    SELECT
    Groupers
    .value('(/groupers/grouper/@version)[1]',
    'varchar(50)')
    FROM TestTable1
    /* This way it is working */
    Declare
    @GroupersXML XML
    SELECT
    @GroupersXML
    = Groupers
    FROM TestTable1
    select @GroupersXML.value('(/groupers/grouper/@version)[1]',
    'varchar(50)')

    Hi Singh,
    Thanks for your solution, it is working good.
    But i stuck with different problem now, say my XML has three elements, then it is showing me records thrice, since we've done cross apply.
    Now what i need is to show only 1 record, and display the three elements from the XML as three columns.
    Kindly assist me.
    I assume you have ran my earlier scripts, please execute this
    Update
    testtable1 set groupers='<groupers>
    <grouper payorid="1" version="30" type="A" payortag="36" />
    <grouper payorid="3" version="20" type="C" payortag="9" />
    <grouper payorid="4" version="10" type="D" payortag="4" />
    </groupers>'
    where
    description='TestDescriptio1'
    For that use the same suggestion and apply PIVOT over it
    ie like
    ;With CTE
    AS
    SELECT tbl.Description,
    t.c.value('string(@version)', 'varchar(50)') as Version,
    t.c.value('@payorid', 'varchar(50)') as payorid
    FROM TestTable1 tbl
    CROSS APPLY Groupers.nodes('/groupers/grouper') as t(c)
    SELECT *
    FROM (SELECT ROW_NUMBER() OVER (PARTITION BY Description ORDER BY payorid) AS Seq,Description,Version
    FROM CTE)c
    PIVOT(MAX(Version) FOR Seq IN ([1],[2],[3],[4],[5]))p
    To make it dynamic see
    http://beyondrelational.com/modules/2/blogs/70/posts/10840/dynamic-pivot-in-sql-server-2005.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Using Dreamweaver CC 2014.1.1, when I select a set of paragraphs to turn into a Definition List, and select Format - Lists - Definition Lists, I get the dl tags but do not get the dt or dd tags?

    I have used this before in earlier versions of DW and it worked fin.  I tried tonight with CC 2014.1.1 in either design view or in codeview with the same results.  I would select the text from the starting <p> tag to the ending </p> tag, and then in the menu choose Format - List - Definition List and only get the <dl> tags.  Anyone else experience this?
    Thanks!

    That's how it works in CS6, too.  And it is not just for definition lists.  That is the expected outcome no matter which list type you use.   DW doesn't know where the DTs and DDs begin and end because you've highlighted an entire paragraph and asked DW to format it as a DL.
    I typically code my own Definition Lists.  It's faster.
    Nancy O.

  • Program with list and select button

    Hi,
    is there a program module that displays a list and when user selects an item and clicks on some button the program returnes selected item.
    I just want to use that kind of program as a template.
    Thank you.

    Hi,
    Try this program BCALV_GRID_02
    Cheers.
    ...Reward if useful

  • How can I select more than one bookmark at a time so that I can then open multiple bookmarks -- without the aggravation of going back to the list and selecting and opening each one.

    From my dozens of bookmarks, I often would like to open 5 or 6 of them at once -- perhaps a couple of weather reports, a couple of radio stations, a couple of other websites. But I see no way of doing this without laboriously finding a bookmark, selecting it, opening the website, then returning to the bookmarks, finding the second bookmark, selecting it, opening the website, and on and on. Surely there's a way for me to select multiple unrelated bookmarks and open them at the same time. Thanks much for your help. Don

    ''Actually there is a picture and better explanation in the corresponding History article''
    * ''http://kb.mozillazine.org/Viewing_the_browsing_history_-_Firefox ''
    Look where this picture is embedded in the article topic [http://kb.mozillazine.org/Viewing_the_browsing_history_-_Firefox#Selecting_history_items Selecting history items]
    * http://kb.mozillazine.org/images/Fx3_history_sidebar_selections2.png
    Selecting, viewing, and searching the sidebars and library lists is explained in both articles previously mentioned.
    Multiple selection is something built-in to a lot of applications and into all browsers, and yes you guessed correctly the favicon it the thing to the left of the bookmark and that is what is is called in all browsers. And if you look at selection you will find that it matches what you asked for, especially if you were to do a search from the search bar on the bookmark or history sidebar. But there is also no problem opening up a single bookmark or history item into a new tab, with either Ctrl+click or Ctrl+Shift+click in the area to the right of the favicon either.
    However I would suggest making a change to your configuration options so the the same keyboard shortcut is used from a link and from your bookmarks. See those keyboard shortcuts in the following along with the footnotes just below the table for them in
    * http://www.mvps.org/dmcritchie/firefox/keyboard.htm

  • List and selected item

    Hello,
    I’m having difficulty to understand list items,
    Here is what I need to do, I list item loaded from a table, all looks good
    Now when someone select the item from the list, I would like to put a code
    Behind button (mouse-click) and show selected item in text box (TEXT ITEM)
    Please don’t ask me to help file, I spent over two hours with no chance, looks help file
    Needs help.
    Thanks for any help in advance

    your question isn't clear at all.
    first: When you change the value of a listitem you can use the WHEN-LIST-CHANGED-trigger to do something.
    if you want to transfer the value of a list-item into another item, then you can write this code in the trigger WHEN-LIST-CHANGED
    BEGIN
      :my_block.my_item := my_block.my_listitem;
    END;or do you need something different?

  • HELP - SQL and Select and COUNT

    Hi Anyone or Everyone...
    I have created this SQL Statement in java
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE 'C%' GROUP BY #PART ORDER BY #PART
    this is the error I get....If I remove the Count(#PART) works fine so the column #PDESC is fine....what is wrong with this?? Thanks in advance!!
    [SQL0122] Column #PDESC or expression specified in SELECT list not valid.

    Hi Anyone or Everyone...
    I have created this SQL Statement in java
    SELECT #PART,#PDESC,COUNT(#PART) AS PCOUNT FROM MYLIB
    WHERE #PART LIKE 'C%' GROUP BY #PART ORDER BY #PART
    this is the error I get....If I remove the
    Count(#PART) works fine so the column #PDESC is
    fine....what is wrong with this?? Thanks in advance!!
    [SQL0122] Column #PDESC or expression specified in
    SELECT list not valid.Hi there
    When you are querying on a table, either you have to specify individual elements (columns) of the table or aggregations of the columns. In your case, the elements you are querying are : #PART, #PDESC and PCOUNT. Here, PCount is an aggregation that is calculated form COUNT(#PART) and #PART is also an aggregation as you are grouping the query results by #PART. But, What bout #PDESC? You are querying as individual column only and doing nothing with it. That was the problem.
    Tip: Try adding "GROUP BY #PDESC" or "COUNT(#PDESC)" to your query and I hope it shud work.
    May be It won't solve your problem and give the result that you need, but you will understand the point I am trying to explain.
    Cheers
    -Uday

  • List and selecting items in it ?

    I use List (element in building GUI). In emulators it works nicely and I have possibility to select one item from the list (I didn't code anything about selecting it) it was automatically added to menu. This is great.
    When running the same app in actual device (Nokia 7210), the "select" is not possible / provided by the phone...Theere is no such element at all. So I actually can't select an item out of list.
    In nokia 7650 this doesn�t occur.
    My mistake, need to program ? .. how to proceed ?
    P

    Funny that mine doesn't work and I have the same firmware version...
    My situation is that I have a List, with items that are ment to be selected.. I need to have commands generally concerning the whole application and commands that are available after user have selected one item from the list.
    This is now done so that I have one List (holding those selectable items...), select button then leads to another list, where I have list of actions available to selected item.
    The previous list also has Commands appended to it.
    These commands are always available, but in phone the List Select button is gone, and accesing that other list (with detailed actions concerning only the selected item) is then impossible.

  • I would like cut out an object using the quick select tool and drop the object into another picture. Can anyone help

    I am using background pictures and want to cut out objects from other jpegs using the quick select tool and drop them into the background picture. So if i have a banana and select the object i need to copy the banana into the other background.
    Hope this makes sense.
    Gary

    Select banana. Right click>layer via copy. Move tool. Click and drag to other file. Drop on image.
    OR: load the background and banana in one stack (File>Scripts>Load File Into Stack). Select banana and layer via copy or create layer mask.
    Benjamin

  • BPE doesn't activate XML Objects and Workflows

    Hi all.
    I have created some BPE Processes. The all are active and with status 0 in transaction SXI_CACHE.
    The odd thing is, when I trigger messenges the BPE_ADAPTER error 'No object type found for this message; check the activation of the corresponding process' pops up with a statement in the trace: 'could not create BPE proxy for message, no XML object definition found for message...'.
    I have checked the objects, the Proxies are created, what is missing are the Workflows and the XML Objects.
    When I access the the XML Object the message is a green 'Definition <XML Object Name> not available', it is created though.
    I created a similar process a month ago. This is running perfectly. The system is a 640 on SP17. How can it be that the object generation at activation is incomplete?
    Thanks in advance for your help.
    Jens

    Jens,
    I have experienced the same exception while using BPM. I tried to debug in all ways and could finally solve it.
    In case of BPM, receiver determination to be configured to set receiver as BPM. If you do mistake while configuring inbound interface (it should be abstract interface) under interface determination then you get this type of exception.
    I suggest you to to check the receiver determination and interface determination configuration again.
    Regards.

  • How to set BDCDATA table for a SELECT-OPTIONS object?

    Dear experts,
    I have a transaction with PARAMETERS and SELECT-OPTIONS objects. This transaction will be called by another program by using CALL TRANSACTION 'mytransaction' USING mybdcdata statement. Below is some of the called transaction's source code:
    DATA:
      date TYPE sflight-fldate.
    PARAMETERS:
      p_carid TYPE sflight-carrid,
      p_conid TYPE sflight-connid.
    SELECT-OPTIONS:
      so_date FOR date.
    This is what I wrote in the calling program to define the values of the called transaction PARAMETERS fields:
    DATA:
      wa_bdcdata TYPE bdcdata,
      it_bdcdata TYPE TABLE OF bdcdata.
    wa_bdcdata-program = 'MYPROGRAM'.
    wa_bdcdata-dynpro = '1000'.
    wa_bdcdata-dynbegin = 'X'.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam = 'P_CARID'.
    wa_bdcdata-fval = 'AA'.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam = 'P_CONID'.
    wa_bdcdata-fval = '017'.
    APPEND wa_bdcdata TO it_bdcdata.
    CALL TRANSACTION 'MYTRANSACTION' USING it_bdcdata.
    Unfortunately, I don't know how to set the values for the SELECT-OPTIONS screen fields. How to do this?
    I've Googled this and tried several guesses but none was found or successful. Thanks in advance.
    Regards,
    Haris

    Hi ,
      Better go for  SUBMIT report   instead of CALL transaction  ...
      find the name  of  report being called  on that transaction which you will be calling  . Use that report name in SUBMIT 
    Just take help from  below code .
    Before using do please read  by pressing f1 on SUBMIT  syntax .
    data:seltab     type table of rsparams,
             seltab_wa  like line of seltab.
        move: 'LANGU'  to seltab_wa-selname,
              'S'      to seltab_wa-kind,
              'I'      to seltab_wa-sign,
              'BT'     to seltab_wa-option,
              'D'      to seltab_wa-low,
              'I'      to seltab_wa-high.
        append seltab_wa to seltab.
        clear seltab_wa.
        move: 'E'      to seltab_wa-sign,
              'EQ'     to seltab_wa-option,
              'F'      to seltab_wa-low,
              space    to seltab_wa-high.
        append seltab_wa to seltab.
        clear seltab_wa.
        move: 'AUFNR' to seltab_wa-selname,
              p_aufnr to seltab_wa-low.
        append seltab_wa to seltab.
        clear seltab_wa.
        submit rkaep000  using selection-set 'VARIANT1'
                          with aufnr = p_aufnr
                          with selection-table seltab
                          exporting list to memory
                          and return .
    regards
    Deepak.

  • List implementation where remove(Object) is fast?

    Does anyone know of an implementation of the java.util.List interface where the the method boolean remove(Object o) is much faster than traversing through the list until it finds the right one? Perhaps something that takes advantage of the hash code of the object being removed?
    Thanks

    So you want a List that acts like a Map?
    Couldn't you just use a Map?
    Explain your problem domain better and we shall help
    you see the light.
    Well no - I would simply like a List that acts like a List, and whose remove(Object) method is faster than just scanning through each element.
    I only mentioned use of the hash code as one way this could be implemented. To expand on that: Currently the LinkedList class internally maintains a list of Entry objects. Each of these objects has a reference to the previous and next Entry and the 'current' list element object. The problem is that the remove(Object) method has to go through each Entry one by one, searching for a list element that equals the object to be removed. To fix this problem the list implementation could also maintain a HashMap whose 'keys' are the list elements and whose 'values' are a (secondary) list of Entry objects associated with that key. Now the remove(Object) method could use the object to be removed to look up the 'list of associated Entry objects'. The first Entry in this (secondary) list is the one that needs to be removed.
    But perhaps it's best if I describe the overlying problem: I want to write a program that randomly generates integers at the rate of about 10 per second. For each integer the program should calculate how many times in the past hour that number has been generated. What's the fastest way to calculate this?

  • Selecting an object in panel

    hi everyone..
    can someone help me to select an object in a panel...I have draw a circle in panel.. now i want to select it... can someone help me regarding this...
    thanks in advance...
    Regards
    Deepak

    Rodney_McKay wrote:
    Puce wrote:
    I've written already a simple layout editor based on wrapped swing components. It also supported moving, resizing, cut, copy and paste for image- and shape-icons. Performance was not that bad. But agian: it depends what you want to do.Images and shapes are not the same thing.
    If you want to work with non rectangular shaped objects you will not get so many things for free when using swing components.Well, I've written a ShapeIcon, which works as an adapter between shapes and icons:
    http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/icon/package-summary.html
    (the library is Open Source: http://www.softsmithy.org/ )
    -Puce

  • Is there a way to shift select multiple objects in layer palette, not just highlight multiple object

    Hi,
    Is there a way to shift select multiple objects in layer palette, not just highlight multiple objects?
    I would want to do this when I have a bunch of objects hidden under some other objects on the artboard. This feature is available in PSD, so I assume Illustrator should have it.
    Thanks!

    Thanks for the reply, Harron.
    I'm using CS4 & below.
    Highlighting object - click on object in layers palette & it turns blue
    Select object - click on object in layers palette to the right of the circle, which creates a square, and selects the object on the artboard
    How do I shift-select multiple objects in the layers palette...select 50 objects with a click, then a shift-click? Shift-select works for highlighting, but not selecting. On most programs shift-select is used to grab a bunch of stuff...:0)
    In the past I have inadvertently selected multiple objects in the layers palette, by somehow alt?-dragging over the layers...or something...I can't re-create it.

Maybe you are looking for

  • IWeb site with domain name

    I have created a website using iWeb and have uploaded it to my .Mac account. Now I would like to create another one but use my own domain name. Can I do that?

  • Troubled by simple array creation

    here is the code : public class Thing<T> {      // Ok just wanted to check      // does not compile (but specs says page 12 : should be unchecked WARNING!)      //  T[] table = new T[25] ;      // compiler says unchecked cast to type T !      T[] tab

  • Cisco 526 Wireless express controller and Guest setup

    We are going to implement a small (2-3 APs) wireless network and we wanted gust to have access too. My question is how do we implemetn the guest setup and separate that accessf rom our network. How does the 526 do it. Do we need a separate internet a

  • Webllogic8to10migration-SAXValidationExc Couldnot locate bean ejb-jar.xml

    Please help me out here.. Failed to parse descriptor at 'META-INF/weblogic-ejb-jar.xml' for module 'PAMaintenanceBean.jar': javax.xml.stream.XMLStreamException: weblogic.xml.process.SAXValidationException: Could not locate bean with ejb-name "PAMaint

  • How to configure "permitted actions" on bpel human task

    Hi, I trying to call suspendTask at human task from bpel. I get this message "Permitted actions are: [VIEW_SUB_TASKS, VIEW_PROCESS_HISTORY, RESUME, VIEW_TASK, WITHDRAW, VIEW_TASK_HISTORY]" Where i configure this "permitted actions" ? Thanks Victor Ja