[CS5 - JS] Definition of the XML attributes from variables...

Hello

I'm building a XML variable to store the information needed to run my script.

The XML structure is quite simple:

var = new XML document ("< document > < pages > < page / > < / pages > < / document >");

Every 'page' nodes are added using a simple statement.

If I need to add an attribute to a node of 'page' I usually use this method:

document.pages.page.@height= 210;

What happens if I need to add an attribute without knowing its name (because it is stored in a variable)?

Y at - it something like that? :

document.pages.page.setAttribute (Name, 210);

Have no idea how to handle this...

Try this:

document.pages.page['@'+var_name] = 210;

@+

Marc

Tags: InDesign

Similar Questions

  • Navigate trough different 'levels' in the XML file from the known item?

    I am quite new to this, so I have to ask even if it's a stupid question...

    I am trying to build a generic oracle procedure that can insert data into a table from a file XML so that message that it contains, but of course the messages has the same structure.

    I need to find the first item after data, in this case "CUS_ORD_HEAD", but it could be any message as PO_HEAD.
    So I need to somehow find the element without knowledge is the name of the element. It goes same for CUS_ORD_LINE that might be PO_LINE. Is it possible to navigate through the different 'levels' in the XML file from a known element.

    < CustomerOrder >
    < metadata >
    < TransActionIdentity > 1 < / TransActionIdentity >
    < / metadata >
    < data >
    < Client CUS_ORD_HEAD = 'ABC' CustomerOrderNumber '1234' = >
    < CUS_ORD_LINE CustomerOrderNumber = "1234" OrderedQuantity = "10" ProductNumber = "1001403" CustomerOrderLinePosition = "1" / >
    < HAPI_CUS_ORD_LINE CustomerOrderNumber = "1234" OrderedQuantity = "1" ProductNumber = "2530" CustomerOrderLinePosition = "2" / >
    < CUS_ORD_LINE_TEXT CustomerOrderLinePosition = '2' Text = "Test" CUSTOMERORDERNUMBER = "1234" / >
    < / HAPI_CUS_ORD_HEAD >
    < / data >
    < / CustomerOrder >

    the tablename parameter is identical to the XML element and attributes are the same as the columns

    OK, understood.

    You can retrieve the name of the element and attribute names in the same time by using something like the following.
    Attribute names are stored in a collection that is accessible iteratively in order to build the dynamic parts of the query:

    SQL> CREATE OR REPLACE TYPE TColumnList IS TABLE OF VARCHAR2(30);
      2  /
    
    Type created
    
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2
      3   xmldoc   xmltype := xmltype('
      4  
      5  
      6  1
      7  
      8  
      9  
     10  
     11  
     12  
     13  
     14  
     15  
     16  
     17  ');
     18
     19   --t_column_list TColumnList := TColumnList();
     20   --v_table_name  VARCHAR2(30);
     21
     22   tmp_cols      VARCHAR2(1000);
     23   tmp_paths     VARCHAR2(1000);
     24   tmp_qry       VARCHAR2(4000);
     25
     26  BEGIN
     27
     28    FOR r IN (
     29      SELECT table_name
     30           , set(cast(collect(column_name) as TColumnList)) as column_list
     31      FROM XMLTable(
     32           'for $i in /CustomerOrder/Data/descendant::*
     33              , $j in $i/attribute::*
     34            return element e
     35            {
     36              element TABLE_NAME {name($i)}
     37            , element COLUMN_NAME {name($j)}
     38            }'
     39            passing xmldoc
     40            columns
     41              table_name   varchar2(30)
     42            , column_name  varchar2(30)
     43           )
     44      GROUP BY table_name
     45    )
     46    LOOP
     47
     48      tmp_cols := NULL;
     49      tmp_paths := NULL;
     50
     51      --dbms_output.put_line(r.table_name);
     52
     53      FOR i in 1 .. r.column_list.count LOOP
     54
     55        tmp_cols := tmp_cols || ', ' || r.column_list(i);
     56        tmp_paths := tmp_paths || ', ' || r.column_list(i) || ' varchar2(35) path ''@' || r.column_list(i) || '''';
     57
     58      END LOOP;
     59
     60      tmp_cols := ltrim(tmp_cols, ', ');
     61      tmp_paths := ltrim(tmp_paths, ', ');
     62
     63      tmp_qry := 'INSERT INTO ' || r.table_name || ' (' || tmp_cols || ') ' ||
     64                 'SELECT ' || tmp_cols ||
     65                 ' FROM XMLTable(''/CustomerOrder/Data/descendant::' || r.table_name || '''' ||
     66                 ' PASSING :1 ' ||
     67                 'COLUMNS ' || tmp_paths ||
     68                 ')';
     69
     70      dbms_output.put_line(tmp_qry);
     71
     72    END LOOP;
     73
     74  END;
     75  /
    
    INSERT INTO CUS_ORD_HEAD (CustomerOrderNumber, Customer) SELECT CustomerOrderNumber, Customer FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_HEAD' PASSING :1 COLUMNS CustomerOrderNumber varchar2(35) path '@CustomerOrderNumber', Customer varchar2(35) path '@Customer')
    INSERT INTO CUS_ORD_LINE (CustomerOrderNumber, OrderedQuantity, ProductNumber, CustomerOrderLinePosition) SELECT CustomerOrderNumber, OrderedQuantity, ProductNumber, CustomerOrderLinePosition FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_LINE' PASSING :1 COLUMNS CustomerOrderNumber varchar2(35) path '@CustomerOrderNumber', OrderedQuantity varchar2(35) path '@OrderedQuantity', ProductNumber varchar2(35) path '@ProductNumber', CustomerOrderLinePosition varchar2(35) path '@CustomerOrderLinePosition')
    INSERT INTO CUS_ORD_LINE_TEXT (CUSTOMERORDERNUMBER, Text, CustomerOrderLinePosition) SELECT CUSTOMERORDERNUMBER, Text, CustomerOrderLinePosition FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_LINE_TEXT' PASSING :1 COLUMNS CUSTOMERORDERNUMBER varchar2(35) path '@CUSTOMERORDERNUMBER', Text varchar2(35) path '@Text', CustomerOrderLinePosition varchar2(35) path '@CustomerOrderLinePosition')
    
    PL/SQL procedure successfully completed
     
    
  • How to remove the value of the XML attribute in the Indesign file with javascript

    Hi all

    How to remove the value of the XML attribute in the Indesign file.

    1.jpg

    What error is this?

    in any case try this as well (one another),

    var myDoc = app.activeDocument;
    attrDelete(myDoc);
    function attrDelete(elm)
    {
        for (var i = 0; i < elm.xmlElements.length; i++)
        {
            try{
                for(j=0; j
    

    Vandy

  • Access to the XML schemas from the connection manager?

    The connection manager for a connection opened in version 4 is no longer an 'XML Schémas' icon (Java and XML patterns seem to have been deleted between versions 3 and 4). Is there a definition that can return the XML schemas?

    Using lists yet... »

    XML schemas

    XML schemas are definitions of schema, written in XML, that describe the structure and various other semantics of XML instance documents. For conceptual and information on the use of XML schemas, see the Guide of Oracle XML DB Developer in the Oracle database documentation library.

    You can change an XML schema by right clicking in the connections Navigator XML schema name and selecting open from the menu. You can delete a selected schema by selecting the Drop Schema menu. » ...

    The XML node drawings missing in the connections Navigator is a known issue for the 4.0.1.  The 4.0.2 patch is a fix.

    Regarding the Java node, it seems to me in all versions 4.0.x.  Maybe your Preferences... > Database > Navigation filter turned it off?

    Kind regards
    Gary

    SQL development team

  • POOR RECOVERY OF THE XML ATTRIBUTE VALUES

    Hi all

    I searched this forum and the web a way to get the value of an xml attribute. The solutions I found always had a problem, the values returned when concatenated without any separators, so I can't know every value.

    Here's how:

    BEGIN

    l_bfile: = BFILENAME ('CTEMP1', nome_fich);
    DBMS_LOB. FileOpen (l_bfile);
    DBMS_LOB. LoadFromFile (l_clob, l_bfile, DBMS_LOB.lobmaxsize);
    DBMS_LOB. FileClose (l_bfile);
    xmlx: = XMLTYPE (l_clob);
    Str: = xmlx. Extract('rowset/Row/@id'). GETSTRINGVAL();

    dbms_output.put_line (' :'|| id values) (STR);
    END;

    Returns the string str: 123456654321 for this example

    <? XML version = "1.0" encoding = "UTF-8"? >
    rowset <>
    < row id = "123456" >
    < name > Peter < / name >
    < / row >
    < row id '654321' = >
    < name > Louis < / name >
    < / row >
    < / lines >


    I want to get each id concatenated for example values (123456:654321) instead, I get the concatenated values (123456654321).


    Does anyone know a work around for this problem?


    Cordially Pedro.

    11.2 you can use listagg()

    SQL> with t as (select xmltype('
      2    
      3      Peter
      4     
      5     
      6      Louis
      7     
      8    ') xcol from dual)
      9  select listagg(v.val,':') within group (order by null) val
     10  from t,xmltable('/rowset/row/@id'
     11  passing t.xcol
     12  columns val varchar2(1000) path '.') v;
    
    VAL
    ------------------------------------------------------------------------------------------------------------------------
    123456:654321  
    

    If not 11.2

    SQL> with t as (select xmltype('
      2  
      3  Peter
      4  
      5  
      6  Louis
      7  
      8  ') xcol from dual)
      9  select xmlquery('fn:string-join(/rowset/row/@id,'':'')'
     10  passing by value t.xcol  returning content) val
     11  from t;
    
    VAL
    ------------------------------------------------------------------------------------------------------------------------
    123456:654321
    
  • With the help of the XML attributes in itemRenderer and labelFunction

    Hello!

    I searched for hours and read the Devguide but always impossible to find the solution to my problem.
    I have a xml returned from php like this:
    < files >
    < record id = "1" name = "name_1" type = "0" / >
    < record id = "2" name = "name_2" type = "0" / >
    < record id = "3" name = "name_3" type = "1 / >"
    < / documents >

    I can bind the result returned from the HTTPService to a data grid:

    < mx:DataGrid dataProvider = "{ret_XML.record}" width = "500" number of rows = "20" editable = "false" id = "dg" > "
    < mx:columns >
    <!-NEXT WORK! ->
    "< mx:DataGridColumn headerText ="Name" dataField="@name " width ="300"/ >
    <!- LABELFUNC don't DO NOT WORK IN LINE NEXT->
    "< headerText ="Type"dataField="@type mx:DataGridColumn " labelFunction ="labelFunc">
    < / mx:DataGridColumn >
    "< headerText ="Id"mx:DataGridColumn dataField="@id " editable ="false">
    < mx:itemRenderer >
    < mx:Component >
    <!-LINE FOLLOWING IS don't DO NOT WORK! ->
    "{< mx:Button label="{data.@id} '/ >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >
    < / mx:columns >
    < / mx:DataGrid >

    and I have a labelFunction like this:

    private void labelFunc(item:Object,_column:DataGridColumn):String {}
    return "Type:"+ item.@type; "
    }

    So, my problem is that when I bind the column to an XML attribute, it works fine but when I try to link it to an itemRenderer or use it in a function, it does not work. I'm trying for hours now, but just can't make it work.
    I tried:
    "{< mx:Button label="{data.@id} '/ >
    < mx:Button label = "{data. () @id)} »/ >
    "{< mx:Button label="{@data.id} '/ >

    and perhaps others but no luck...
    Please someone help me with this one!

    Ty:
    [Pig]

    Problem solved!

    Well, post it on the forum after I solved my problem as follows:

    So in itemRenderer just use data.attribute () with the desired XML attribute name

    And in the labelFunction:

    private void labelFunc(item:Object,_column:DataGridColumn):String {}
    return "Type:"+ item.attribute ('type'); '.
    }
    Even with itemRenderer but rather data use () item.attribute

    I hope that this is the 'official' solution too...

    [Pig]

  • Retrieves the value of the XML attribute for multiple element sequence

    Guys,

    I have already posted this in the forum XML DB, but some of you could help me.


    I have searched for a solution for this and couldn't quite. I'm trying to get multiple entries in a node attribute values. It workes for a single node, but for many nodes, it fails. Could you please give me a solution?

    SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
      2        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME
      3        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION
      4  from xmltable('WORLD' passing xmltype('
      5  <WORLD>
      6  <COUNTRY NAME="INDIA">
      7  <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      8  </COUNTRY>
      9  </WORLD>'
     10  ));
     
    COUNTRY_NAME CITY_NAME POPULATION
    ---------------------- ------------------ -------------------
    INDIA MUMBAI 10000
    When I execute the same for several nodes, it fails, please guide me. Please also let me know how to handle if I have an XML file that contains this data.

    SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
      2        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME
      3        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION
      4  from xmltable('WORLD' passing xmltype('
      5  <WORLD>
      6  <COUNTRY NAME="INDIA">
      7  <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      8  <CITY NAME="CHENNAI" POPULATION="2000"></CITY>
      9  <CITY NAME="BANGALORE" POPULATION="13000"></CITY>
     10  <CITY NAME="HYDERABAD" POPULATION="14000"></CITY>
     11  </COUNTRY>
     12  </WORLD>'
     13  ));
    select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
                                                                      *
    ERROR at line 1:
    ORA-19025: EXTRACTVALUE returns value of only one node
    See you soon
    Sarma.

    So, this is the first step:

    SQL> with test as
      2  (select xmltype('
      3                 
      4                 
      5                 
      6                 
      7                 
      8                 
      9  ') resp from dual)
     10  select country
     11       , cities
     12  from xmltable('WORLD/COUNTRY' passing (select resp from test)
     13                         columns country varchar2(50) path '/COUNTRY/@NAME'
     14                               , cities xmltype path '/COUNTRY/CITY') world
     15  /
    
    COUNTRY         CITIES
    --------------- --------------------------------------------------
    INDIA           
    

    two columns, a varchar2 and an xmltype.

    Then do the same with the second column, pass the XML to the function XMLTABLE

    SQL> with test as
      2  (select xmltype('
      3                 
      4                 
      5                 
      6                 
      7                 
      8                 
      9  ') resp from dual)
     10  select country
     11       , cit.name
     12       , cit.population
     13  from xmltable('WORLD/COUNTRY' passing (select resp from test)
     14                         columns country varchar2(50) path '/COUNTRY/@NAME'
     15                               , cities xmltype path '/COUNTRY/CITY') world
     16     , xmltable ('CITY' passing cities
     17                columns name varchar2(50) path '@NAME'
     18                      , population number path '@POPULATION'
     19                ) cit
     20  ;
    
    COUNTRY         NAME                                               POPULATION
    --------------- -------------------------------------------------- ----------
    INDIA           MUMBAI                                                  10000
    INDIA           CHENNAI                                                  2000
    INDIA           BANGALORE                                               13000
    INDIA           HYDERABAD                                               14000
    
  • Analysis the xml response from PL/SQL

    Can someone please help me to analyze the XML below?

    DECLARE

    l_response CLOB.

    g_system_id VARCHAR2 (255);

    g_session_id VARCHAR2 (255);

    g_user_id VARCHAR2 (255);

    BEGIN

    l_response: =.

    ' - uuid:18cb22a2 - 11cc-43f4-bfea-c213da179d30 + id = 156

    Content-ID: http://tempuri.org/0 >

    Content-Transfer-Encoding: 8 bit

    Content-Type: application/xop + xml; charset = utf-8; Type = "application/soap + xml".

    " < s: Envelope = xmlns:s ' http://www.w3.org/2003/05/soap-envelope "" xmlns: a = " " http://www.w3.org/2005/08/addressing ' > < s:Header > < a: s:mustUnderstand Action = "1" > ". http://tempuri.org/ILoginService/LoginByUserNameResponse " < / has: Action > < a: RelatesTo > urn: uuid:cf410a05 - 23 d 4 - 4B 92-a22c-329cbc19fbe7 < / has: RelatesTo > < / s:Header > < Body > < LoginByUserNameResponse xmlns =" http://tempuri.org/ ' > < LoginByUserNameResult xmlns:i = ' http://www.w3.org/2001/XMLSchema-instance "" xmlns: x = " " http://www.w3.org/2001/XMLSchema ' > < XObject.m_element i: type = "x: string" xmlns = "" > & lt; OnlineContext SystemId = "{19E0DDB4-5FA5-41EE-B624-AEA762865A6C}" SessionId = username "{F23D32A4-B325-4BFA-9E90-39CA253E843C}" = "{2C6ABE4C-D356-46F0-B4BE-9C4F0A36A522}" / & gt; < XObject.m_element > < / LoginByUserNameResult > < / LoginByUserNameResponse > < / Body > < / s: Envelope >

    -uuid: 18cb22a2-11cc-43f4-bfea-c213da179d30 + id = 156-';

    SELECT systemid, sessionid, userid

    IN g_session_id, g_system_id, g_user_id

    FROM XMLTABLE)

    xmlnamespaces ('http://www.w3.org/2003/05/soap-envelope' 'DATA'),

    'data:LoginByUserNameResponse/LoginByUserNameResult/XObject.m_element/OnlineContext '.

    PASSAGE xmltype (l_response)

    Systemid VARCHAR2 COLUMNS (50) PATH "@OnlineContext."

    SessionId VARCHAR2 (50) PATH "@OnlineContext."

    UserID VARCHAR2 (50) PATH "@OnlineContext") xt;

    Dbms_output.put_line)

    "Session Id".

    || g_session_id

    || "System Id".

    || g_system_id

    || "User Id".

    || g_user_id);

    END;

    Thank you.

    It gets you a little closer

    declare
    -- Local variables here
    l_response     CLOB;
    g_system_id    VARCHAR2 (255);
    g_session_id   VARCHAR2 (255);
    g_user_id      VARCHAR2 (255); 
    
    begin
    -- Test statements here
    l_response := '
    
        http://tempuri.org/ILoginService/LoginByUserNameResponse
        urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7
    
    
        
           
              
              
          
      
    '; 
    
        SELECT systemid, sessionid, userid
          INTO g_session_id, g_system_id, g_user_id
          FROM XMLTABLE (
                  xmlnamespaces ('http://www.w3.org/2003/05/soap-envelope' AS "s",
                                 'http://tempuri.org/' as "data"),
                  's:Envelope/s:Body/data:LoginByUserNameResponse/data:LoginByUserNameResult/XObject.m_element/OnlineContext'
                  PASSING xmltype (l_response)
                  COLUMNS systemid VARCHAR2 (50) PATH '@SystemId',
                          sessionid VARCHAR2 (50) PATH '@SessionId',
                          userid VARCHAR2 (50) PATH '@UserId') xt; 
    
    DBMS_OUTPUT.put_line (
           'Session id '
        || g_session_id
        || ' System id '
        || g_system_id
        || ' User id '
        || g_user_id); 
    
    end;     
    

    You will need to manually parse as CLOB and pull the XML itself of the response string.  This can be done via SUBSTR and INSTR looking for the first < and="" last=""> in that you showed at least.  Upgrading from a previous version of working correctly with the xmlns = "", which redefines the default namespace to the default value. "  The XPath has been corrected to reflect using the appropriate prefix.

  • CS5.5 cannot find the XML connector component - which gives

    I'm working on an actionscript file in flash CS5.5 2 and can't find the XML connector component any place. What happened to him?  How are you suppose to get a ride there. Y at - it somewhere I can download the .swc file and install it? convert it to action script 3 is not an option in this case.

    Thank you

    Joel

    with as2, use the xml class.

  • (CS5 JS) Path of the XML with Accents, etc.

    Long as I need to ask a question, but I'm stuck on this one.

    I have a database of names (~ 10 000), and many of these names have accents etc. Each name has their own path for a picture and this picture is imported into my models through XML using a JavaScript script. Unfortunately, when I upgraded to CS5 my XML would see is more accents and others, on the contrary it would replace these characters with Chinese characters.

    This is the XML code that worked in CS4 (Windows 7 platform).

    "" < PHOTO href = 'file://prod/VEC/BulkCandidatePhotoImport/Borough of Helene.bmp of the Borough of Queenscliffe 2008 / Queenscliffe Council/BUTLER, Hélène/BUTLER, "/ > < / PHOTO >

    Here is the XML that CS5 export if I have data in the model, so that it works in CS5.

    "< PHOTO href ="file:///V:/BulkCandidatePhotoImport/Borough%20of%20Queenscliffe%202008/Queenscliffe%20Boro ugh%20Council/BUTLER%2c%20H%c3%a9l%c3%a8ne/BUTLER%2c%20H%c3%a9l%c3%a8ne.bmp "> < / PHOTO>"

    As you can see CS5 added a load of mapping of characters in the path of the file.

    My question is. Code/adjust cela so my version CS4 works in CS5?

    Please let me know if there is more information that is required, thank you.

    Kind regards

    Brett

    Hi Brett,

    Try to use decodeURI() and encodeURI() instead of escape() and unescape()

  • How to add the XML attribute to an element using BPEL assign

    I have a xml request to a bpel process that contains no attribute.
    After some process, I need to create this missing attribute and specify a value.

    I tried to use the XML fragment in the business to be divested. But how do I create an attribute?
    This XML node which I am trying to create an attribute is a very large knot with many dynamic typing(xsi:type). I can just re - create the complete xml code with the required nodes.

    Anyone know how I can create an attribute xml using the BPEL entitlement? I don't want to use the Java code in my process.

    Thank you.

    You can use the attribute bpelx:insertMissingToData on the item to copy, for example:




    Query="/client:process/@time"/ >

    If not there is time of the attribute in the process element, it will be added.

  • Hide the XML attribute if no data value / doesn't exist

    Hello

    I have a xsd defined as the following structure:
    --------------
    < xsd: complexType name = "PersonImageType" >
    < xsd: attribute name = "ID" type = "xsd: Integer" / >
    < xsd: attribute name = "FileName" type = "xsd: String" / >
    < xsd: attribute name = "ErrorMessage" type = "xsd: String" use = "optional" / >
    < xsd: attribute name = "Fetched" type = "xsd: String" / >
    < xsd: attribute name = "S1" type = "xsd: String" / >
    < xsd: attribute name = "S2" type = "xsd: String" / >
    < / xsd: complexType >
    --------------

    When I run my BPEL process, I get the reply/output as follows:

    --------------
    < PersonImage >
    "" < PersonImage ID = "12410276" FileName = "12410276.jpg" ErrorMessage ="" recovered = "Y" S1 = S2 "Y" = "Y" / >
    < / PersonImage >
    --------------

    When you look at the output, the xml 'ErrorMessage' attribute has no value in it.
    I want to:
    (a) hide this attribute - when there is no data and
    (b) display this attribute - when it has all the data.

    Very appreciated if someone help me solve this problem.

    Thank you and best regards,
    Rakesh

    without double quotes around the @ErrorMessage

    see you soon
    James

  • How to read the XML doc in variable with XPath?

    Suppose that a variable in BPEL contains an entire XML document as (without the quotes):

    "value1 < foo > < bar > < / bar > < bar > value2 < / > < / foo >.

    How to read of BPEL an XPath expression with the value of the second
    < bar > element in a nother variable "target"?

    What do I have to use getvariabledata? How to pass the XPath?

    Peter

    Peter

    Here's how you can get there by business to be divested. You can access it by writing the XML expression (do not select foo--> bar directly on the tree) as below

    bpws:getVariableData ('Variable_name', 'Foo','/ NS4:foo / NS4:barbpws:getVariableData("intCounter")') and assign it to the variable "target". Here the value of the variable integer "intCounter" represents the nth element under the tag "foo". Let us know if you face any issues.

    Hope this will help.

  • Remove the XML attribute

    Hello

    I export xml data into our database files. Since the xsd has changed it can be exported directly to another db to a third-party tool and I (among others) remove an attribute of an element
    CREATE TABLE xml_test(
          message XMLTYPE
          )
    /
    INSERT INTO xml_test
    VALUES (q'[<?xml version="1.0" encoding="ISO-8859-1"?>
    <ZusyMeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.zusy.de/2002/XMLSchema" 
    xsi:schemaLocation="http://www.zusy.de/2002/XMLSchema ZusyAZ01.xsd">
      <TransferHeader xsi:nil="true"/>
      <Daten>
        A lot more elements
      </Daten>
    </ZusyMeldung>]')
    /
    COMMIT;
    < TransferHeader xsi: Nil = 'true' / > should become < TransferHeader / >.

    I want to write files directly with the script next and tried to use updateXML in my SELECTION, but somehow I don't understand well.
    DECLARE
        CURSOR cur_out IS
            SELECT  message
            FROM    xml_test;
    BEGIN
        FOR r_out IN cur_out LOOP
            dbms_xslprocessor.clob2file (
                 r_out.message
                ,'DIR_XMLOUT'
                ,'out_name.xml'
                ,0
                );
        END LOOP;
    END;
    /
    Concerning
    Marcus

    Hi Marcus,

    Given that you want to remove, try deleteXML :

    select xmlserialize(document
             deletexml(
               message
             , '/ZusyMeldung/TransferHeader/@xsi:nil'
             , 'xmlns="http://www.zusy.de/2002/XMLSchema", xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
             )
           )
    from xml_test ;
    

    Note that the functions of XML DML Oracle (updateXML, deleteXML etc.) are not recommended in 11.2.0.3 for the update of XQuery:

    select xmlquery(
             'declare default element namespace "http://www.zusy.de/2002/XMLSchema"; (: :)
              copy $d := .
              modify ( delete node $d/ZusyMeldung/TransferHeader/@xsi:nil )
              return $d'
            passing message
            returning content
           )
    from xml_test ;
    
  • Try to get an XML attribute from an XMLType variable

    Hi people,

    I'm parsing a XML very well, except for a couple of attributes in the first element. I do not know how to reference their (start date / to date). Here is an example XML and the way I am referencing the data.

    <? XML version = "1.0" encoding = "UTF-8"? >
    < date of animal - data = "2013-01-07" to date "07-01-2013" = >
    < animal >
    < name > dog < / name >
    < color > Brown < / color >
    < / animal >
    < animal >
    < name > cat < / name >
    < color > Black < / color >
    < / animal >
    < / animal - data >

    I have no problem get the data as well, assuming the above XML code is in a variable named v_XML of type XMLType

    v_AnimalCount: = 1;

    All in v_XML.existsNode ('/ data/animal-animal ['| v_AnimalCount |']) ') = 1
    loop
    v_Name: = v_XML.extract ('/ data/animal-animal ['| v_AnimalCount |'] /Name/Text()').getStringVal ();)
    v_color: = v_XML.extract ('/ data/animal-animal ['| v_AnimalCount |'] /Color/Text()').getStringVal ();)
    v_animalCount: = v_animalCount + 1;
    end loop;

    But how do I get the attributes of this day and this day using the same type of syntax (v_XML.extract)?

    Thank you very much!

    -Adam

    Adam vonNieda says:
    But how do I get the attributes of this day and this day using the same type of syntax (v_XML.extract)?

    In the XPath language, an attribute is accessible via the "attribute:" axis, or its most commonly used abbreviation '@':

    v_from_date        := v_XML.extract('/animal-data/@from-date').getStringVal();
    

    What is your version of db?
    What about using XMLTable instead of PL/SQL?

Maybe you are looking for

  • Firmware TV Stor.e

    First of all, sorry for my bad English of Spain I have a STOR. E TV 1.5 tB unit. Of course when an I bought the camera, I thought that it was better for support to acquire one from a company well know instead of these small businesses. I was wrong, t

  • meh

    Hallo zusammen, ICH möchte mein Prufprogramm DIAdem in um languages tracing und habe therefore feste text z.B. in Dialogen durch variables: @ChT(21,spr_) @ ersetzt ICH habe leider in Combo-Boxen nicht die opportunity, specific einzusetzen.Hat someone

  • "Sonic focus... pilots." "How can I get rid of the error message?

    Whenever my system going through startup or reboot, I get an error message, "Sonic focus drivers must be...". » How can I stop this. 8 months ago I reinstalled my OS (XP) and I got this doomed message since then.

  • problem to install the new language of the interface

    When I try to install the new language pack of interface on my win xp SP3 this message, it is displayed: "The windows XP MUI version seems to have been installed on this system. Persian interface pack for Windows cannot be installed on this computer.

  • Windows Mail is not refreshing since 09/02/2012. When I try to update using the F5 key, I get the error messages.

    Windows Mail is not refreshing since 09/02/2012.  When I try to update using the F5 key, I get the error messages.  The only way I can see me new emails is to sign on the web page of my Internet service provider, which I don't like. original title: w