Join XMLs Question

I have 5 games of XMLs that are generated by a single package to places like CLOB diiferent...
On the 5th, the first is a straight select query and the rest are from the SYS_refcursors
I was wondering how I can I join all those who, under a start and end tag

Well, if they are already in form CLOB, why not just create a new CLOB where you add on the required node start and end, such as

l_new_clob := '' || l_clob_1 || l_clob_2 || '';

or if they are in the format XMLType, you can use XMLElement and XMLConcat of them for putting it all together

SQL> SELECT XMLElement("root",XMLConcat(XMLType(''),XMLType('')))
  2  from dual;

XMLELEMENT(ROOT,XMLCONCAT(XM
--------------------------------------------------------------------------------



Note: All "XMLType ("")" would be your XMLType. Lazy to create the complete example which is an XMLType variable.

Tags: Database

Similar Questions

  • Application of self-join interview question?

    Hi guys!

    I asked this question in an interview for the job as a developer of database.

    I received a select based on symbol table and asked to drow the printout and then explain works step by step this statement.

    Here are the instructions create & insert

    /**********************************************/

    create table tbl (number x, y varchar2 (50));

    INSERT INTO tbl (x, y) VALUES ('A', 0);

    INSERT INTO tbl (x, y) VALUES (1, 'B');

    COMMIT;

    /***********************************************/

    Below the query (select statement)

    SELECT tbl1.x

    OF tbl tbl1 tbl2 tbl

    WHERE tbl1.x = 0 OR tbl2.x = 1;

    Please explain me the output and work step by step this statement...

    Thank you...

    Hello usman_noshahi,

    If you omit the where the query clause will result as below

    SELECT tbl1.x, tbl2.x

    OF tbl tbl1 tbl2 tbl

    /

    X          X

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

    0          0

    0          1

    1          0

    1          1

    Request granted will result as below based on where condition on each line on top 4 rows...  Or Condition will be returs real if one condition is met with the data set.

    SQL > SELECT tbl1.x, tbl2.x

    2 tbl tbl1 tbl2 tbl

    3. WHERE tbl1.x = 0 tbl2.x = 1 GOLD

    4.

    X          X

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

    0          0

    0          1

    1          1

    SQL >

    You can get the information in a different way as below...

    SQL > explain plan set statement_id = "ORACLEFORUMS" for

    2. SELECT tbl1.x

    3 tbl tbl1 tbl2 tbl

    4 WHERE tbl1.x = 0 OR tbl2.x = 1;

    He explained.

    SQL > select LPad (' ', 2 *(Level-1)). Level | '.' || NVL (position 0). ' ' ||

    Operation 2. ' ' || Options of | ' ' || Object_name | ' ' || Object_type

    3   || ' ' || Decode (id, 0, Statement_Id |) "Cost = ' | Position) | cost

    4   || ' ' || Object_Node "Query Plan.

    plan_table 5

    6 start with id = 0 and statement_id = 'ORACLEFORUMS. '

    7. connect by prior id = parent_id

    8 and statement_id = 'ORAFAQ.

    9   /

    Query plan

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

    1.7 STATEMENT SELECT ORACLEFORUMS cost = 77

    2.1 NESTED LOOPS 7

    3.1 ACCESS FULL TBL TABLE 3 TABLE

    3.2 TABLE ACCESS FULL TBL TABLE 2

    SQL > SELECT *.

    TABLE 2 (DBMS_XPLAN. DISPLAY ('PLAN_TABLE', 'ORACLEFORUMS', 'BASIC'));

    PLAN_TABLE_OUTPUT

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

    Hash value of plan: 1718268327

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

    | ID | Operation | Name |

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

    |   0 | SELECT STATEMENT |      |

    |   1.  NESTED LOOPS |      |

    |   2.   TABLE ACCESS FULL | TBL |

    |   5:   TABLE ACCESS FULL | TBL |

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

    10 selected lines.

    SQL >

    SQL > select LPAD (' ', 2 *(LEVEL-1)). operation 'OPERATION', 'options ',.

    2 DECODE (TO_CHAR (id), '0',' COST = ' |) NVL (to_char (position), n / 'a').

    3 object_name) 'OBJECTNAME', id | » -'|| NVL (parent_id, 0) | » -'||

    4 NVL (position 0), 'ORDER', SUBSTR (optimizer, 1, 6) 'OPT '.

    plan_table 5

    6. start with id = 0

    7 and statement_id = 'ORACLEFORUMS. '

    8 connect by prior id = parent_id

    9 and statement_id = 'ORACLEFORUMS. '

    10.

    OPTIO OBJECTNAME OPT OPERATION ORDER

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

    COST OF THE SELECT = 7 0-0-7 ALL_RO

    NESTED LOOPS                                                                  1-0-1

    TABLE ACCESS FULL TBL 2-1-1

    TABLE 3-1-2 TBL FULL ACCESS

    SQL >

    ID ID-PARENT as follows...

    00

    10

    21

    31

    Here level 1 has 2 childs (2,3)

    Thus the sequential order of enforcement will be 2,3,1.

    For more reference I recommend you read below, of course it's Oracle V8 but it gives more information.

    Good reading!

    Optimization of joins

  • JOIN the question... Join two tables without omitting lines

    I came across a problem that should be an easy fix (I hope), but I'm having a hard time to come up with a solution.

    Basically I have two tables, one with the actual amounts with the budget. I have to write a sql statement select that joins these tables together and includes all of their lines. I was able to join the tables by using JOIN, LEFT JOIN and RIGHT JOIN, but it always fails the lines I need.

    Below, I have examples of my tables (AMOUNT_TABLE and BUDGET_TABLE). For simplicity, I built the examples to show the same values in the first four columns, with the 5th and 6th columns (SUB_ACCOUNT, AMOUNT, BUDGET) as the only values that are different. My actual tables are not quite that simple, but I don't think it was relavent to this issue.

    AMOUNT_TABLE

    FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT

    2013

    111111555555000010020131111115555551000100201311111155555520001002013111111555555300010020131111115555554000100

    BUDGET_TABLE

    FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT BUDGET

    2013

    1111115555553000200201311111155555540002002013111111555555500020020131111115555556000200

    Here's what I hope. Note that SUB_ACCOUNTs 0000, 1000, and 2000 show without budget amounts since there is not a corresponding line in the BUDGET_TABLE. And same for SUB_ACCOUNTs 5000 and 6000, they show budgets with no amount because there is not a corresponding line in the AMOUNT_TABLE.

    (exit)

    FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT BUDGET
    201311111155555500001000
    201311111155555510001000
    201311111155555520001000
    20131111115555553000100200
    20131111115555554000100200
    201311111155555550000200
    201311111155555560000200

    If all goes well, my question is clear. Any help on this would be greatly appreciated. Thanks in advance.

    Use the join ANSI - FULL OUTER JOIN syntax:

    with amount_table like)

    Select fiscal_year 2013, 1 period, 11111 acct_unit, 555555, 0000 sub_account, amount 100 of all the double union

    Select 2013,1,11111,555555,1000,100 from all the double union

    Select 2013,1,11111,555555,2000,100 from all the double union

    Select 2013,1,11111,555555,3000,100 from all the double union

    Select double 2013,1,11111,555555,4000,100

    ),

    budget_table like)

    Select 1 time, 11111 acct_unit, account 555555, sub_account 3000, 2013 fiscal_year, budget of 200 Union double all the

    Select 2013,1,11111,555555,4000,200 from all the double union

    Select 2013,1,11111,555555,5000,200 from all the double union

    Select double 2013,1,11111,555555,6000,200

    )

    Select nvl (a.fiscal_year, b.fiscal_year) fiscal_year,

    period of NVL (a.period, b.period),

    NVL (a.acct_unit, b.acct_unit) acct_unit.

    account of NVL (a.Account, b.Account),

    NVL (a.sub_account, b.sub_account) sub_account.

    Amount NVL(a.amount,0),

    NVL(b.budget,0) budget

    of amount_table one

    full join

    budget_table b

    on)

    a.Fiscal_Year = b.fiscal_year

    and

    a.period = b.period

    and

    a.acct_unit = b.acct_unit

    and

    a.Account = b.account

    and

    a.sub_account = b.sub_account

    )

    /

    FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT BUDGET
    ----------- ---------- ---------- ---------- ----------- ---------- ----------
    2013 1 11111 555555 0 100 0
    2013 1 11111 555555 1000 100 0
    2013 1 11111 555555 2000 100 0
    2013 1 11111 555555 3000 100 200
    2013 1 11111 555555 4000 100 200
    2013 1 11111 555555 6000 0 200
    2013 1 11111 555555 5000 0 200

    7 selected lines.

    SQL >

    SY.

  • Beginner XML questions

    Hello

    First post on the forums in a long time and the first here altogether. I hope it's okay jump in.

    I have a little experience of FM not structured for several years ago and use Ventura (13 years) to my company's books (long directories - 3 000 + / volume). I made some scripts in Ventura have so little experience in programming.

    We are looking to switch to XML rather than text files tagged Ventura can import because of its lack of support, problems, perhaps due to Win7, and the effort required to maintain files to import. I downloaded the trial FM 11 and have been experimenting a bit with XML back and forth and also import what we already have in XML. If a bit I'm sure very simple questions. and thanks in advance:

    I was going through the tutorials from Adobe and everything I can find online. It seem not to be well reviewed books on Amazon that deal with structured FM 9-11. Some that look promising for XML are about 10 years old - I think not that our needs are sharp, so should I get something this old, or stay with most recent although we complain? Any recommendations? If I can get the hang of it with something that is not specific FM will be really difficult to adapt this knowledge to the FM band?

    I find EDD, DTD and schema to be rather confusing. Someone explain the difference in simple terms or direct me to a video, etc.? Assuming that I start with an XML file that is created in one other purpose, not meant to be FM, need more than one of them? Do you do first?

    Ventura if I want to have two separate data elements (off the coast of the database) on the same line, say a left-aligned with the other right aligned, programmers put both with a tab, and that is controlled by a tag paragraph in Ventura with a tab on the right. With XML, if I understand it correctly, you wouldn't do that in the XML file - I'm probably not ready to understand the method, I just want to know if this is possible without doing something like having paragraph of second properties point to have no line breaks. If so, where that would be appropriate, ESD, DTD, etc.?

    XML in FM can include inline graphics? What about an Excel chart?

    Thank you

    Gary

    Hi Gary,.

    a lot of questions, he

    But lets start with the first things first.

    For your general understanding: XML separates basically content layout. You can add metadata to the content by adding attributes to some semantic purposes or to include information for your page layout process (or any information that you feel should be here).

    XML is essentially made up of elements, attributes and entities. Those that are defined in a DTD or a schema. ESD does the same for the management of content structured in FM. To stuff FM back and forth into XML and vice versa, you will need both a DSP for handling in FM and the DTD or schema of XML processing. Basically the two similar at first, but ESD will be also some layout information included as well as routines to facilitate the production of structured content (so called context rules).

    The translation between XML and FM requires also some reading/writing-rules governing the specific elements of the FM and values to create "correct" XML files

    Your layout (-> master pages), styles of paragraph and character, etc. pre-set styles of paintings, graphics and so on, are stored in a template file, which is used when you import an XML file to the FM band.

    These are the basics that you are handling.

    Everything that affects page layout will be on the side of the FM of things (if you use it to publish stuff).

    Everything that affects the structure is mainly done on the DTD and the reading/writing-rules side (but has an equivalent in ESD).

    So, for your search:

    XML books who have 10 years maybe not the best choice, because they will probably have a lot of references to SGML, which doesn't help much. But some who are about 5 years old will do just fine - not much changed on the side of XML (unless you decide to use the XML schema).

    For FM11, it is preferable to use guides for FM9 (those are the most comprehensive) and use this forum.

    If you insured the most, I would say to book some consultant for training on the creation of ESD. This will help avoid a lot of frustration later and pays really fast off the coast.

    It can also provide answers to specific questions such as the ones you posted above (Yes, graphics work).

    Once your done with that, you need to do a search, if one of the XML flavors already established already meet your needs in general (I'm talking about DITA, DocBook, S1000D and others) or if you want to develop your own structure (which needs a mayor of brainstorming, but could better meet your needs).

    Soon Alex

  • Release of FrameMaker XML question

    I have a problem with an attribute not be exported in XML format by FM8.

    Here is the excerpt of the DTD:

    <! ELEMENT std.table.header (+ std.table.row) >
    <! ATTLIST std.table.header
    CDATA #REQUIRED passes
    rowsep CDATA '1 '.
    >

    The first question I had was "collar" does not present as an attribute in the structured view. I solved it in question (with the help of MarttiP) by adding it to the EDD as shown below:

    Element (container): std.table.header
    General rule: std.table.row +.
    List of attributes
    Name: whole passes required

    Now I'll have is on the export of XML, the "collar" attribute is not exported and I get an error "required attribute"cols"unplanned". Any suggestions?

    Mike

    Add this rule to write:

    element 'std.table.header '.
    {
    is part of fm;
    "collar" attribute is the attribute of fm;
    }

    This replaces the built-in handling for the cols attribute without affecting the CALS tables.

    Ian

  • XML question: How do I search for children without grandchildren

    With an XML document:

    var xml =

    < root >

    < name L1 = "First" >

    < garbage / >

    < / L1 >

    < name L1 = "Second" >

    < garbage / >

    < / L1 >

    < / root >

    I need a XMLList tags < L1 > without their children, then the output should be:

    < name L1 = "First" >

    < name L2 = "Second" >

    Can someone help me with the syntaxt actionscript to accomplish this XML query? I could not find an example that does not return the children of the < L1 > tags as well.

    Thank you

    David

    Well, if you need exact release, you could use this line:

    trace (xml.toXMLString (match) (/<\s*L1.*?>/g) .join ('\n'));

    This approach much faster that doing redundant xmlfiltering + removal of garbage, hope this helps

  • Performance of XML question

    Hi all

    I have the query in order to retrieve the xml values in the table using XMLTABLE. The XMLTABLE extract about 280 columns. It takes 30 seconds to give the output. How to tune this XML query? or what is the best way.

    DB version:

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

    PL/SQL Release 11.2.0.1.0 - Production

    "CORE 11.2.0.1.0 Production."

    AMT for Linux: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    Query:

    SELECT OUTPUT.*

    OF AM_CUST_WS_MB t

    , XMLTABLE ('. t.CUSTXML PASSAGE des/ROOT/Types_of_Financials)

    COLUMNS

    PATH of VARCHAR2 (75) of Types_of_Financials '. / @VALUE',

    PATH of VARCHAR2 (75) of FY_Ended_DD_MM_YY '. / FY_Ended_DD_MM_YY/@VALUE',

    PATH of VARCHAR2 (75) of Operating_Months '. / FY_Ended_DD_MM_YY/Operating_Months/@VALUE',

    ..

    ..

    .. / * more than 200 columns described here * /.

    ..

    ..) OUTPUT

    Thank you

    Fame

    OK, this could be problematic:

    XMLTYPE COLUMN CUSTXML STORE AS CLOB BASICFILE

    You can recreate the table like this:

    create table am_cust_ws_mb)

    xmltype custxml

    )

    custxml XMLType column store as xml binary securefile;

    and test again?

  • Join the question

    Hello

    I have a question where I am by selecting a field and counting values on a date of service. Together with a date dimension to pick up all values, even if there is no data available at the date of service, but car_no its not return don't not the car no with no data on the date of service.

    The test script is less and the results expected:

    CREATE TABLE Date_Dim
    (
    DateKey INTEGER NOT NULL,
    DateValue DATE NOT NULL,
    DAY TANK (10).
    DayOfWeek INTEGER,
    DayOfMonth INTEGER,
    DayOfYear INTEGER,
    PreviousDay DATE,
    NextDay DATE,
    WeekOfYear INTEGER,
    MONTH CHAR (10),
    MonthOfYear INTEGER,
    QuarterOfYear INTEGER,
    YEAR INTEGER
    );

    INSERT INTO date_dim
    SELECT DateKey, to_number (TO_CHAR (CurrDate, 'YYYYMMDD'))
    DateValue AS CurrDate,
    DID to_char(CurrDate,'Day') DAY,
    TO_NUMBER (to_char(CurrDate,'D')) AS DayOfWeek,
    TO_NUMBER (to_char(CurrDate,'DD')) AS DayOfMonth,
    TO_NUMBER (to_char(CurrDate,'DDD')) AS DayOfYear,
    CurrDate - 1 AS the PreviousDay,.
    CurrDate + 1 NextDay,
    TO_NUMBER (to_char(CurrDate+1,'IW')) AS WeekOfYear,
    HAVE to_char(CurrDate,'Month') MONTHS,
    TO_NUMBER (to_char(CurrDate,'MM')) AS MonthofYear,
    TO_NUMBER ((to_char(CurrDate,'Q'))) AS QuarterOfYear,
    TO_NUMBER (to_char(CurrDate,'YYYY')) YEAR
    Of
    (SELECT level n,
    To_date('31/12/2014','DD/mm/YYYY') + NUMTODSINTERVAL(level,'day') CurrDate
    OF the double
    CONNECTION level < = 5000
    )
    ORDER BY 1;

    CREATE TABLE fact
    (id NUMBER, NUMBER, DATE of car_no service_date
    )
    ;

    INSERT INTO VALUES of fact
    ("001, 1877, 9 JANUARY 2015 ')
    );
    INSERT INTO VALUES of fact
    (' 002, 1877, 11 JANUARY 2015 ')
    );
    INSERT INTO VALUES of fact
    (' 003, 1877, JANUARY 21, 2015 ')
    );
    INSERT INTO VALUES of fact
    ("004, 1877, 23 JANUARY 2015 ')
    );
    INSERT INTO VALUES of fact
    ("005, 1877, 29 JANUARY 2015 ')
    );
    INSERT INTO VALUES of fact
    ("006, 1900, JANUARY 21, 2015 ')
    );
    INSERT INTO VALUES of fact
    ("007, 1900, 23 JANUARY 2015 ')
    );
    INSERT INTO VALUES of fact
    ("008, 1900, 29 JANUARY 2015 ')
    );
    INSERT INTO VALUES of fact
    ("009, 2300, FEBRUARY 1, 2015")
    );
    INSERT INTO VALUES of fact
    ("010, 2300, FEBRUARY 28, 2015")
    );

    CREATE TABLE car_dim
    (car_no NUMBER, car_name VARCHAR2 (3))
    )
    ;

    INSERT INTO car_dim VALUES
    (1877, "PWA")
    );
    INSERT INTO car_dim VALUES
    (1900, 'GHT')
    );
    INSERT INTO car_dim VALUES
    (2300, "SDR")
    );
    INSERT INTO car_dim VALUES
    (2308, "TRE")
    );
    INSERT INTO car_dim VALUES
    (2300, "BIS")
    );

    -Request 1

    Select f.car_no, count (*)
    fact f, car_dim c, date_dim d
    where f.car_no (+) = c.car_no
    and f.service_date = d.nextday
    and f.service_date = January 9, 2015.
    GROUP BY f.car_no

    -Expected results

    CAR_NOCOUNT (*)
    18771
    19000
    23000

    -Request 2

    Select f.car_no, count (*)

    fact f, car_dim c, date_dim d

    where f.car_no (+) = c.car_no

    and f.service_date = d.nextday

    and f.service_date = 1 January 2015"

    GROUP BY f.car_no

    CAR_NOCOUNT (*)
    18770
    19000
    23000

    Thanks for the inserts and create tables. Note that your insertions actually use varchars instead of dates you can fix this.

    For a query 1, you want to basically all the cars and the County of facts for the date of January 9, 2015? Actually-, it appears that you want only the cars with the service.

    SQL> ed
    Wrote file afiedt.buf                                                         
    
      1  select c.car_no, count(case f.service_date
      2                         when to_date('09-JAN-2015', 'DD-MON-YYYY') then 1
      3                         else null end) cnt
      4  from car_dim c, fact f
      5  where c.car_no = f.car_no
      6* group by c.car_No
    SQL> /                                                                        
    
        CAR_NO        CNT
    ---------- ----------
          1877          1
          1900          0
          2300          0
    
  • JOIN another Question

    Hi guys

    This is a matter of JOINING the paper example oracle practice. In the sales table, prod_id is the foreign key referencing prod_id in the products table. List each product id and the number of times wherever it was sold. Evaluate the following query.

    SQL > SELECT p.prod_id, count (s.prod_id)

    PRODUCT p _ sale s

    ON p.prod_id = s.prod_id

    GROUP BY p.prod_id;

    Including two JOIN options from below, can be used in the test to white in the query above to get the desired output? (Choose two)

    A. JOIN

    B. FULL OUTER JOIN

    C. LEFT OUTER JOIN

    D. RIGHT OUTER JOIN

    / / DESCsales
    NameNull valueType

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

    PROD_IDNUMBER (3) NOT NULL
    CUST_IDNUMBER 4 NOT NULL
    TIME_IDDATE
    QTY_SOLDNUMBER (10.2)

    SELECT * FROM sales;

    prod_id
    cust_id
    TIME_ID

    qty_sold
    6016101JANUARY 3, 1531011101JANUARY 1, 1511012101null21014101JANUARY 3, 153

    201

    1201JANUARY 1, 15120122012 JANUARY 15null3011301JANUARY 1, 151

    301

    23012 JANUARY 1523013301JANUARY 3, 15330143014 JANUARY 15430153015 JANUARY 155

    401

    1401JANUARY 1, 15170 s1501JANUARY 1, 15170 s2501nullnull70 s3501JANUARY 3, 15370 s45014 JANUARY 154

    / / DESCproducts
    NameNull valueType

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

    PROD_IDNUMBER (3) NOT NULL
    PROD_NAMEVARCHAR2 (30)
    PROD_LIST_PRICENUMBER (8.2)

    SELECT * from products;

    prod_id

    PROD_NAME prod_list_price 101Biscuit10201Cream50301Powder20401null15501Towelnull601nullnull

    Although the answers give the same result, in my view, the answers should be A and b. The correct answer is B and C. Use logic to say that C is also the right answer? Any advice?

    Because you might have products that have not been sold. You need a left outer join at least, and outer join complete which includes also

  • Manifest.XML questions

    Hello

    I use Photoshop CC 2015 and CC extensions Manager. I'm trying to install the Panel of editing beauty 3.0.1 but it does not work because of the error message that manifest.xml is not correct. Reinstall the new version of the extension manager does not help. Any idea?

    Please see this thread: Add it will not install

  • XML question

    I'm eventid parameter (if I'm passing eventid = 200) & after which is is a number when I show this event ID Message.

    now, I try as below. but do not get the result... Cau u help me... ?

    var eventID:String = this.loaderInfo.parameters.eventid;
    
    var myXML:XML;
    var myLoader:URLLoader = new URLLoader();
    myLoader.load(new URLRequest("http://www.sitename.com/events/idlist.xml"));
    myLoader.addEventListener(Event.COMPLETE, processXML);
    
    function processXML(e:Event):void
    {
              myXML = new XML(e.target.data);
              trace(myXML.Message.EventId);
              
       if(myXML.Message.EventId == eventID)
              {
                   trace("Yes this is 200");
                    mytxt.text = myXML.Message.MessageName;   
            }
    
    }
    

    trace

    < EventId > 100 < / EventId >

    < EventId > 200 < / EventId >

    < EventId > 300 < / EventId >

    My XML

    <?xml version="1.0" standalone="yes"?>
    <Messages>
      <Message>
        <EventId>100</EventId>
        <MessageName>Sample1</MessageName>
      </Message>
      <Message>
        <EventId>200</EventId>
        <MessageName>Sample2</MessageName>
      </Message>
      <Message>
        <EventId>300</EventId>
        <MessageName>Sample3</MessageName>
      </Message>
    </Messages>
    

    If you say "Yes well ' so I don't undersatand not what you're having a problem with.  As I said already, you should check all the individual values, which means that you probably want to check in a loop.

    for (var i: uint = 0; i

    If (myXML.Message [i]. EventID == eventID) {}

    myTxt.Text = myXML.Message [i]. MessageName;

    }

    }

  • JS - Can XML Question - I add attributes using Javascript?

    I want to add an attribute to an element tag, but I don't see how to do it programmatically. Is this possible? Also, is it possible to appoint a tag element dynamically? For example:

    How to add a child element is to use the appendChild as follows:

    XMLObject.appendChild(<childElement/>);
    XMLObject.childElement= "something";
    

    or just add it like this:

    XMLObject.childElement = "something";
    

    Right? (Side Question: is there a difference between these two methods?).

    What I want to do, is to add a dynamic attribute to a child named statically, or to create a child named dynamically.

    I could not understand this. Any ideas?

    Maybe take a look at Mozilla's E4X tutorial: https://developer.mozilla.org/en/E4X_Tutorial/

    There is no need eval() here. (There are usually not.) Use:

    XMLObject.appendChild(<{nameReference}/>);
    

    To add an attribute, you can use:

    XMLObject.@new_att = "the value";
    

    Jeff

  • Very basic XML question

    I am currently using two tables to load a sequence of videos in 2 areas of the Flash animation.

    var zoneAarray:Array = new Array ("movie1.mp4", "movie2.mp4", "movie3.mp4");

    var zoneBarray:Array = new Array ("movie4.mp4", "movie5.mp4", "movie6.mp4");

    var clipA:String = zoneAarray [0];

    var clipNumberA:int = 0;

    var clipTotalA:int = zoneAarray.length-1;

    var clipB:String = zoneBarray [0];

    var clipNumberB:int = 0;

    var clipTotalB:int = zoneBarray.length-1;

    Everything works fine, but I would like to import the list of videos from an XML file instead of hard-coding it in Flash.
    TIA,-Eric

    Large. Please mark the thread as answered.

  • Export XML question FM9

    Hello

    When you export to XML "File-Save as XML".

    FM exports all the information. Following is the display of the Structure:

    refsetup.png

    The XML output from this is:

    < ref >
    < Ref-installation-item id = "o00009-9-1230-783-00004" >
    < local link = "m00003-9-1230-783-00001" id = "m00003-9-1230-783-00001" > < / Ref-installation-point >.
    < Ref-installation-item id = 'o00009-9-1230-783-00007' >
    < local link = 's00001-9-1230-783-00050' id = ' s00001-9-1230-783-00050 "> < / Ref-installation-point >.
    < Ref-installation-item id = "o00009-9-1230-783-00010" >
    < local link = "o00031-9-1230-783-00001" id = "o00031-9-1230-783-00001" > < / Ref-installation-item > < / Ref > ".

    As you can see the text of 'link' element is missing and is not closed... any ideas?

    Of course - that would be my answer.  You don't need to force it to a frame of link - it can be treated as any other XML structure assuming that you have code that knows how to convert a link in HTML from the original XML structure.  Make a container and get rid of the rules R/W and it should come out just like the original DTD specification.

    Jim

  • Hierarchical XML question

    I have the XML code that looks like this:

    < name name = "myDB" >

    < name of directory = "database" path = "D:\database" >

    < name of directory = 'Nick' path = "D:\Nick" >

    < name of base = 'New' path = "D:\New" / >

    < name of base = 'Old' path = "D:\Old" / >

    < name of base = 'Blue' path = "D:\Blue" / >

    < / Book >

    < name of directory = "tmp" path = "D:\tmp" / >

    < name of base = 'News' path = "D:\News/ >"

    < name of base = "Example" path = "D:\Example/ >"

    < name of base = 'Set' path = "D:\Set/ >"

    < / Book >

    < / DatabaseList >

    What I want to do is to go through this last time so in a

    structure of the hierarchy tree that has only the items in the directory.

    Anything with "Database" must be eliminated. Imagine all

    < Database > stuff went. Of course, each element has

    many attributes, but that does nothing.

    I think I've exhausted everything with no good answer. The

    Replace() does not seem to do the trick.

    Any ideas out there? Thanks in advance.

    Try this:

    var xmlElement:XML;
    for each (xmlElement in myXML... Database)
    {
    If (xmlElement.name () is "Database")
    {
    xmlDeleteNode (xmlElement);
    }
    }

    And the function of xmlDeleteNode found here:

    private void xmlDeleteNode(xmlToDelete:XML):Boolean
    {
    var cn:XMLList = XMLList (xmlToDelete.parent ()) .children ();
        
    for (var i: Number = 0; i< cn.length()="" ;="" i++="">
    {
    If (cn [i] is xmlToDelete)
    {
    delete cn [i];
    Returns true;
    }
    }
       
    Returns false;
       
    }

    And it works!

Maybe you are looking for