Add several attribute of a tag in the xml file

Hello

I have a donnees_xml in the xml_test_table of the table in the format

<? XML version = "1.0"? >
rowset <>
< ROW >
< CLASS > XII has < / CLASS >
KATE < TEACHER > < / TEACHER >
< STUDENT_STRENGTH > 30 < / STUDENT_STRENGTH >
< 50 OFFICES > < / DESKS >
< / ROW >
< ROW >
B XII < CLASS > < / CLASS >
< STUDENT_STRENGTH > 40 < / STUDENT_STRENGTH >
< NUMBER OF GIRLS 15 > < / NUMBER OF GIRLS >
< NUMBER_OF_BOYS > 25 < / NUMBER_OF_BOYS >
< / ROW >
< / LINES >

I need to change the xml in this format:

<? XML version = "1.0"? >
rowset <>
< ROW >
< CLASS > XII has < / CLASS >
< age TEACHER subject = "37" = "Math" > KATE < / TEACHER >
< STUDENT_STRENGTH > 30 < / STUDENT_STRENGTH >
< 50 OFFICES > < / DESKS >
< / ROW >
< ROW >
B XII < CLASS > < / CLASS >
< STUDENT_STRENGTH > 40 < / STUDENT_STRENGTH >
< NUMBER OF GIRLS 15 > < / NUMBER OF GIRLS >
< NUMBER_OF_BOYS > 25 < / NUMBER_OF_BOYS >
< / ROW >
< / LINES >

You will need to add several attribute to all the 'teacher' in the XML tag.
I am able to add a single using attribute

Select insertChildXML (donnees_xml, 'game of LINES/LINES/TEACHER', '@age', ' 37 ") of test_xml_table;

Thanks in advance

In this scenario, we have a simple find and replace the XML function using which i can replace the tag with (I understand this is not good was to solve this).

Why not use two calls separate insertChildXML?
The premiera adds the attribute to @age, and the other adds the attribute @subject on the result of the first.

Tags: Database

Similar Questions

  • Replace several tags in the xml file

    Hello

    I have a donnees_xml in the test_xml_table of the table in the format

    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < CLASS > XII has < / CLASS >
    KATE < TEACHER > < / TEACHER >
    < STUDENT_STRENGTH > 30 < / STUDENT_STRENGTH >
    < 50 OFFICES > < / DESKS >
    < / ROW >
    < ROW >
    B XII < CLASS > < / CLASS >
    < STUDENT_STRENGTH > 40 < / STUDENT_STRENGTH >
    < NUMBER OF GIRLS 15 > < / NUMBER OF GIRLS >
    < NUMBER_OF_BOYS > 25 < / NUMBER_OF_BOYS >
    < / ROW >
    < / LINES >

    Need to replace some tags with a new tag (< TEACHER > with < CLASS_TEACHER > and < CLASS > with < CLASS_AND_DIVISION >), the method used is currently
      select regexp_replace(regexp_replace(xml_data,'TEACHER>','CLASS_TEACHER>'),'CLASS>','CLASS_AND_DIVISION>')from test_xml_table ;
    version of database
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Solaris: 11.2.0.2.0 - Production Version
    NLSRTL Version 11.2.0.2.0 - Production


    Problems I'm here, it's that this returns me a string that I have to convert to XML again and having to use
    the regexp_replace function0 several times. Is there a function XML to aid that can be used to do this, if there is
    no other option like this, is there any function to replace alternative can replace all the necessary tags at once?

    Thanks in advance

    Edited by: M. 13 on October 26, 2012 01:40

    One possible way using XSLT:

    SQL> select xmltransform(xml_data
      2         , xmlparse(document
      3  '
      4    
      5      
      6        
      7      
      8    
      9    
     10      
     11        
     12      
     13    
     14    
     15      
     16        
     17      
     18    
     19  ')
     20  ) as result
     21  from test_xml_table
     22  ;
    
    RESULT
    --------------------------------------------------------------------------------
    
    
     
       XII A 
       KATE 
       30 
       50 
     
     
      XII B
       40 
       15 
       25 
     
    
     
    
  • How to analyze all the data of the particular tag in the xml file

    Hi all

    I have a xml file, who like tags, code, rev_num, type... volunteers. I want to analyze the XML and save all data (code, rev_num...) the unknown tag in a text file. I tried to use a node matching vi, but I do not get the output I have need.attach is my attempt, can someone suggest me or help out me. (Sorry Cant join the XML so I recorded it in a text file.)

    Thank you

    Ankit G

    You must replace the instance of "resource" with "resource [type = 'unknown']." Did you do it?

  • Clone several nodes and appl_top shared using the XML file backup

    Can I use work save file of application context to repeat the clones and avoid to perform following steps:

    -Configure the node C (run '"perl adclonectx.pl sharedappltop contextfile = < context of Applications for the existing node file >' and ' perl-I < AU_TOP > / perl txkSOHM.pl"orders ")

    If I work the previous clone XML, I would be able to use the same XMl file for re - clone without implement shared appltop and add a node step. Please, share your ideas.

    ma_apps wrote:
    Can I use work save file of application context to repeat the clones and avoid to perform following steps:

    -Configure the node C (run '"perl adclonectx.pl sharedappltop contextfile =' and 'perl - I /Perl txkSOHM.pl"orders)

    If I work the previous clone XML, I would be able to use the same XMl file for re - clone without implement shared appltop and add a node step. Please, share your ideas.

    You should be able to use it. However, according to the Oracle docs support is to clone the main node and add more nodes by cloning the context files.

    Cloning Oracle Applications Release 11i with rapid Clone [ID 230672.1]
    Sharing the Application Tier file system in Oracle Applications Release 11i [ID 233428.1]

    Cloning Oracle Applications V12 with rapid Clone [ID 406982.1]
    Share Application-level file system in Oracle E-Business Suite Release 12 [384248.1 ID]

    Thank you
    Hussein

  • Add a xmlns tag to the XML using DBMS_XMLGEN

    I'm using the version of Oracle version 10.1.0.4.2.

    I want to create an xml file according to some data in the relational database tables. For the same thing, I created object types and discovers with the types of objects, since the data is divided into several tables.

    Then, I used DBMS_XMLGEN.getxml to generate xml with queries from the view of the object.

    Y at - it an option to add the xmlns attribute in the xml file generated.

    Please let me know if any additional details are needed.

    If you want to add the namespace declaration to the root element, I don't think it's possible with DBMS_XMLGEN directly.
    You can ask DBMS_XMLGEN to treat some of the fields of the object as XML attributes by prefixing with '@' (for example '@my_attribute'), but you can't control which for bounding of the elements.

    A possible solution is to add it later, using XSLT, or insertChildXML, but apparently it is not available in your version.

    However...

    For the same thing, I created object types and discovers with the types of objects, since the data is divided into several tables.

    Because the data from different tables, why not use SQL and SQL/XML functions to build the document?
    This is simple, simple and needs no additional items.

    select xmlelement("Departments",
             xmlattributes('http://xmlns.example.org' as "xmlns")
           , xmlagg(
               xmlelement("Department",
                 xmlattributes(d.deptno as "Id")
               , xmlelement("Name", d.dname)
               , xmlelement("Employees"
                 , xmlagg(
                     xmlelement("Employee",
                       xmlattributes(e.empno as "Id")
                     , xmlforest(
                         e.ename as "Name"
                       , e.job as "Job"
                       )
                     ) order by e.empno
                   )
                 )
               ) order by d.deptno
             )
           )
    from scott.dept d
         join scott.emp e on e.deptno = d.deptno
    group by d.deptno, d.dname
    ;
    

    Output:

    
      
        ACCOUNTING
        
          
            CLARK
            MANAGER
          
          
            KING
            PRESIDENT
          
          
            MILLER
            CLERK
          
        
      
      
        RESEARCH
        
          
            SMITH
            CLERK
          
          
            JONES
            MANAGER
          
          
            FORD
            ANALYST
          
        
      
      
        SALES
        
          
            ALLEN
            SALESMAN
          
          
            WARD
            SALESMAN
          
          
            MARTIN
            SALESMAN
          
          
            BLAKE
            MANAGER
          
          
            TURNER
            SALESMAN
          
          
            JAMES
            CLERK
          
        
      
    
    
  • How to add URL links in the XML file?

    Hello

    I have a problem with adding the URL links to the power of lightning. I use the XML file to call images, then the corrsponding links. Images are called correctly but when I try to add a link I do not receive the links, but rather to get the anchor HTML text tags. I use escape XML characters to escape HTML tags, but the results are not what I need.

    I use the following code:

    < preview = "miniature large.jpg" thumb = "thumb.jpg" > "
    < title > <! [CDATA [Financial Services]] > < / title >
    < discription > <! [CDATA [& lt; a href = & quot; ]] http://www.google.ca "> Google < / a > " [[ ]] > < / discription >
    < / thumbnails >

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

    Output:

    Images are displayed correctly, but instead get the links, I get following message:

    " < a href =" http://www.Google.ca "> < /a > Google .

    I need to know what I'm doing wrong. I use the proper way to add links or not?

    Thanks for your time.

    Use tags html directly inside CDATA - after all, what CDATA is for.

  • create table from the XML file at several levels

    Hello

    I'm working on the provision of an app to display xml data, which are currently using data from the settings file where the data was stored in a table.

    CONT =]
    [{txt: 'Perfume'} //main menu]

    [[{txt: 'Top Note', framework: 'topNote'}, {txt: 'Heart notes', frame: "heartNote"}, {txt: frame, 'Note of Base': 'gaps'}] / / submenu]

    ,[
    {txt: 'Packaging', field: 'packaging'} / / main menu

    ]

    ]

    I created an xml file and am able to recover data and impossible to find the same.

    Here's the xml file

    < Products >
    < produces txt = setting "Perfume" = "" > "".
    < = frame 'Top Note' = "topNote" txt file name > < / name of the file >
    < = txt file name ' heart notes"frame ="heartNote"> < / name of the file >
    < file name txt = "Core score" frame = 'gaps' > < / name of the file >
    < / product >
    < produces txt = framework of 'Packaging' = 'packaging' > < / product >
    < produces txt = framework "3D Animation" = "tvAd" video = "true" flvName = "video.flv" w = "547" h = "309" > < / product >
    < product txt framework "advertising Lla' = 'the package' = >
    < name of the txt-file = "Print Ad Creative Pack" frame = "printCp" > < / name of the file >
    < / product >
    < / product >

    AS A CODE

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

    (GlobalVarContainer.myXML is the place where is stored the xml file)

    var node:XMLNode = GlobalVarContainer.myXML.firstChild;
    var navItm:int = int (node.childNodes.length);
    for (i = 0; i < wheel; i ++) {}

    var temp_array:Array = new Array();
    var subnavCount:int = int (node.childNodes [i].childNodes.length);     subnav
    var obj:Object = new Object();
    obj.txt = node.childNodes [i] .attributes ['txt ""]
    obj. Frame = node.childNodes [i] .attributes ["frame" "]
    trace (node.childNodes [i]. Attributes ['txt'])

    for (var j: int = 0; j < subnavCount; j ++)
    {
    trace (node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'])
    obj.subtxt = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'];
    obj. Subframe = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['frame'];
    temp_array.push (obj);
    }
    GlobalVarContainer.my_array.push (temp_array);

    }

    If I add - trace (GlobalVarContainer.my_array); -to code the outout is

    [object Object], [object Object], [object Object]
    [object Object], [object Object], [object Object],.
    [object Object], [object Object], [object Object],.
    [object Object], [object Object], [object Object], [object Object]

    but trace (.txt [i] GlobalVarContainer.my_array + "array"); or trace (GlobalVarContainer.my_array [i] [0] .txt + "array"); no results.

    need advice to move forward from here.

    Thank you

    AYUSH

    What I meant is that if you load the XML e4x, you have to analyze in a table to use it. You can retrieve the syntax of e4x XMLList and use it directly in your code. You can treat the XMLList almost as you treat any array using a for each loop for example.

    Take the code below as an example and adapt it to your needs:

    var mainMenu:XMLList = this.testXML.menu;

    for each {var menu: XML (in mainMenu)}

    trace ("Menu:" + menu.@txt);

    You can use your logic to create menu main point here

    var mynavItem:Navitem = new Navitem (0, spatie * i, GlobalVarContainer.my_array [i] [0], [i, 0], false, true);

    this.holder.addChild (mynavItem); ABLE TO VIEW THE MAIN MENU

    var items: XMLList = menu.children ();

    If (items.length () > 0) {}

    for each {var point: XML (in the points)}

    trace ("point:" + item.@txt);

    Logic of creation of subitem here

    var mySubnavItem:Navitem = new Navitem (dash, spatie * (i + 1 + j), GlobalVarContainer.my_array [i] [2], [i, j], true);

    this.holder.addChild (mySubnavItem);        DISPLAYS ONLY THE LAST ENTRY IN THE SUBMENU

    }

    }

    }

  • IMAQdx attributes listed in the xml file not found in labview

    Hello

    Some attributes of my camera our watch camera (DALSA CamExpert) software but are not displayed in MAX.

    When I opened the xml file, I don't see a difference between the attributes shown and hidden.

    Why LabView displays all possible attributes?

    The sml file has specific requirements?

    Any ideas?

    Hello Eric,

    I solved the problem yesterday!

    I use a DALSA camera. Dalsa software downloads the XML file and saves it in a directory 'dalsa"on my local disk.

    National instruments software (MAX) downloaded XML file and saves it in another directory. The 2 files were not equal. I replaced the XML file OR the XML of Dalsa file and now I'm able to get all attributes.

    But thanks for your response!

    Kind regards

    Kim

  • Generate the XML file with elements and attributes in table Oracle

    Hello

    I have the following table structure.

    CREATE TABLE SPOOL
    (
    COIL_ID NUMBER (10),
    COIL_NUMBER VARCHAR2 (40),
    COIL_PO_OPERATING_UNIT VARCHAR2 (20).
    COIL_PO_NUMBER VARCHAR2 (40),
    MILL_NUMBER VARCHAR2 (2),
    MILL_COIL_STATUS VARCHAR2 (15).
    ITEM_NUMBER VARCHAR2 (40),
    COIL_WEIGHT NUMBER (38),
    WEIGHT_UOM VARCHAR2 (10),
    DOCUMENT_NUMBER VARCHAR2 (40),
    DATE OF DOCUMENT_DATE,
    DOCUMENT_STATUS VARCHAR2 (15).
    DOCUMENT_TYPE VARCHAR2 (20).
    DOCUMENT_SOURCE VARCHAR2 (20).
    TEST_ID NUMBER (38),
    NUMBER VALUE,
    TEST_UOM VARCHAR2 (20).
    TEST_STATUS VARCHAR2 (70).
    TESTER_LOGIN VARCHAR2 (20).
    EQUIPMENT_CODE VARCHAR2 (50).
    DOC_STS_MSG VARCHAR2 (600)
    )
    /
    For each record COILID, there could be several folders baased on TEST_ID/VALUE/TEST_UOM etc.

    And I would like to prepare the xml file in the following format by selecting data in the COIL?


    <? XML version = "1.0"? >
    -coil xsi: noNamespaceSchemaLocation = "www.tempel.com/COIL.xsd" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb = "http://xmlns.oracle.com/xdb" >
    < CoilId > 1419532 < / CoilId >
    < CoilNo > D2221050010A0 < / CoilNo >
    Changzhou < CoilPOOperatingUnit > < / CoilPOOperatingUnit >
    < CoilPONo > 4619 < / CoilPONo >
    < MillNo > 86 < / MillNo >
    Test of < MillCoilStatus > < / MillCoilStatus >
    C5 050FP800 < ItemNo > < / ItemNo >
    < weight > 7076 < / weight >
    KILOGRAM of < GLU > < / UDM >
    < DocumentNo > 0 < / DocumentNo >
    < DocumentDate > 2013 - 01 - 11 < / DocumentDate >
    < DocumentStatus > not < / DocumentStatus >
    < DocumentType > test < / DocumentType >
    CHIGMA1 < DocumentSource > < / DocumentSource >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4992" TestUnit = "mm" Status = 'NonProcessed' TestId = "135" / >
    < test DocStsMsg = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.0128" TestUnit = "mm" Status = 'NonProcessed' TestId = "124" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "12" TestUnit = "mm" Status = 'NonProcessed' TestId = "125" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5095" TestUnit = "mm" Status = 'NonProcessed' TestId = "127" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5042" TestUnit = "mm" Status = 'NonProcessed' TestId = "128" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5058" TestUnit = "mm" Status = 'NonProcessed' TestId = "129" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4967" TestUnit = "mm" Status = 'NonProcessed' TestId = "130" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.5049" TestUnit = "mm" Status = 'NonProcessed' TestId = "131" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4972" TestUnit = "mm" Status = 'NonProcessed' TestId = "132" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4960" TestUnit = "mm" Status = 'NonProcessed' TestId = "133" / >
    < DocStsMsg test = '0' EquipmentCode = "CHIGMA1" TesterLogin = "dpkrueger" Value = "0.4996" TestUnit = "mm" Status = 'NonProcessed' TestId = "134" / >
    < / reel >

    Can you please guide me how to do it in a single query?

    Thanks in advance.

    Function EXTRACT will force a print in your version:

    SELECT XMLElement("Coil",
             XMLAttributes(
               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
             , 'www.tempel.com/COIL.xsd' as "xsi:noNamespaceSchemaLocation"
             )
           , XMLForest(
               COIL_ID                as "CoilId"
             , COIL_NUMBER            as "CoilNo"
             , COIL_PO_OPERATING_UNIT as "CoilPOOperatingUnit"
             , COIL_PO_NUMBER         as "CoilPONo"
             , MILL_NUMBER            as "MillNo"
             , MILL_COIL_STATUS       as "MillCoilStatus"
             , ITEM_NUMBER            as "ItemNo"
             , COIL_WEIGHT            as "Weight"
             , WEIGHT_UOM             as "UOM"
             , DOCUMENT_NUMBER        as "DocumentNo"
             , DOCUMENT_DATE          as "DocumentDate"
             , DOCUMENT_STATUS        as "DocumentStatus"
             , DOCUMENT_TYPE          as "DocumentType"
             , DOCUMENT_SOURCE        as "DocumentSource"
             )
           , XMLAgg(
               XMLElement("Tests",
                 XMLAttributes(
                   DOC_STS_MSG    as "DocStsMsg"
                 , EQUIPMENT_CODE as "EquipmentCode"
                 , TESTER_LOGIN   as "TesterLogin"
                 , VALUE          as "Value"
                 , TEST_UOM       as "TestUnit"
                 , TEST_STATUS    as "Status"
                 , TEST_ID        as "TestId"
                 )
               )
             )
           ).extract('/*')
    FROM coil
    GROUP BY COIL_ID
           , COIL_NUMBER
           , COIL_PO_OPERATING_UNIT
           , COIL_PO_NUMBER
           , MILL_NUMBER
           , MILL_COIL_STATUS
           , ITEM_NUMBER
           , COIL_WEIGHT
           , WEIGHT_UOM
           , DOCUMENT_NUMBER
           , DOCUMENT_DATE
           , DOCUMENT_STATUS
           , DOCUMENT_TYPE
           , DOCUMENT_SOURCE ;
    
  • Automation of several Flash file by using the XML file 'mailing list '.

    I created a Flash interactive multi-fichiers 'demo' for a client. It is very well as a Web site (although he doesn't use it as a Web site) in the way it is stated that there is an index page which can then direct you to product categories, which you can click to see. Each 'page' contains the product (or product category) information, photos, diagrams, etc. There is nothing of Flash animation.

    My client also wants to be able to put in place so that the demo runs automatically in a configurable XML file. My ActionScript skills are fairly limited, but I was able to by using ActionScript 3 to load and read XML file. A loop using 'for', I am able to read the XML file and returns the path of each Flash file and the time that each file must be displayed (my client asked that he able to configure the duration of each page as well).

    I created a charger for each video clip and a timer for the duration. Unfortunately, the thing that throws me off is that when I try to load the clip (as the last element in the loop for), it reads the entire XML file, returns all the clips and the durations (I use trace to see this) before loading the clip. Thus, the single loaded clip is the last reading of the XML file.

    As I said, I'm not very good at ActionScript, so everything I managed to combine was internet tutorials.

    This is my code:

    var xmlLoader:URLLoader = new URLLoader();

    xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);

    var mcLoader:Loader = new Loader();
    mcLoader.contentLoaderInfo.addEventListener (Event.INIT, playClip);

    var mcCurrent:MovieClip = new MovieClip();
    stage.addChild (mcCurrent);

    var xml;

    function playClip(e:Event):void
    {
    trace("Function:playClip");
    stage.removeChild (mcCurrent);
    mcCurrent = MovieClip (mcLoader.content);
    mcLoader.unload ();
    stage.addChild (mcCurrent);
    }

    function xmlLoaded(e:Event):void
    {
    trace ("function: xmlLoaded");
    XML = new XML (e.target.data);

    var cl:XMLList = xml.clip;
    for (var i: uint = 0; i < cl.length (); i ++)
    {
    trace ("Begin"for"loop");
    trace ("variable" i "is" + i);

    clipPath var = cl[i].@path;
    var delay = cl[i].@duration;

    trace ("Clip path is" + clipPath);
    trace ("Display for" + delay);

    mcLoader.load (new URLRequest (clipPath));
    }
    }

    xmlLoader.load (new URLRequest ("filerunlist.xml"));


    I removed the timer event because, like all the rest was repeated until whatever it is obtained, so I wanted to figure out out to get the charger clip (mcLoader) to load the clip for each file, before I realized where put in the time to make sure each element is displayed for the appropriate duration. I suspect that the timer event must occur in the function "playClip", but that it would take advice on that as well.

    Thanks to anyone who can help me understand this.

    You need to do in the service of parsing xml is just to store all data in a table.  You will use while an array element after another through some timer control you set up, access each file in the order that they are stored in the table.  You do not load in this function, all data storage, and when finished, the last line of this function outside the loop, fires at any function you have who begins to treat the first element of the array.

    For example, to store the data objects in the array...

    var clipData:Array = new Array();   store your data xml here

    var clipToShow:uint = 0;                   use later in the function showClip

    function xmlLoaded(e:Event):void
    {
    trace ("function: xmlLoaded");
    XML = new XML (e.target.data);
       
    var cl:XMLList = xml.clip;
    for (var i: uint = 0; i
    {
    clipArray.push ({clipPath: cl[i].@path, delay: cl[i].@duration});

    }

    showClip();
    }

    function showClip() {}

    Regardless of the process of loading .clipPath clipArray [clipToShow]

    and using clipArray [clipToShow] .delay to start some timer is involved

    the timer handler function calls this function when it is run

    clipToShow += 1;   increment the counter for the next clip online

    }

    If you are not comfortable/familiar with the approach of the object, then you could also store the clip and delay data in two separate tables.

  • Analysis of the XML file

    Hello

    I try to access a web service. I am currently using NetBeans 6.5. I am able to acess webservice by creating the stub.

    This draft is back this xml content in a string format

    so, when I try o use

    SAXParserFactory saxfact = SAXParserFactory.newInstance ();

    SAXParser sp = saxfact.newSAXParser ();

    Sax InputSource = new InputSource (temp); Temp is the string that's been out since the heel in a string format

    TPI Parse (Sax, this);    on this step, the code is throwing an exception

    / * org.xml.sax.SAXParseException:
    org.xml.sax.helpers.DefaultHandler.fatalError (+ 1)
    com.sun.ukit.jaxp.Parser.panic (+ 18)
    com.sun.ukit.jaxp.Parser.setinp (+ 203)
    com.sun.ukit.jaxp.Parser.parse (+ 42)
    analysis. (parsing.java:54)
    to call_to_webservice.run(call_to_webservice.java:54) * /.

    I'm stuck here

    I was trying to access xml directly, but the statement sp.parse () takes InputSource or InputStream

    need help very urgent

    Thanks in advance

    Hi Panknaik,

    Try this code,

    try {}
    SAXParserFactory plant = SAXParserFactory.newInstance ();
    SAXParser saxParser = factory.newSAXParser ();
    org.xml.sax.helpers.DefaultHandler Manager = new xmlReader (startTag, endTag); start and endtag you want to analyze.              InputStream in = new ByteArrayInputStream (response.getBytes("UTF-8"));
    InputSource source = new InputSource (in);
    saxParser.parse (source, handler);
    } catch (Exception e) {}

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

    Then extends DefaultHandle,

    /**
    * A class containing a generic logic to read an XML file.
    */
    class xmlReader extends DefaultHandler {}
    private String startTag; /**< start="" tag="" to="" be="" looked="" for.="">
    private String endTag. /**< end="" tag="" to="" be="" looked="" for.="">
    Private boolean currentTag;
    Private boolean Errortag.
    String tagValue;
           
    /**
    * Sets the start and end tag to be read in the XML file.
    startTag @param tag beginning.
    endTag @param tag end.
    */
    {} public xmlReader (startTag, endTag String String)
    this.startTag = startTag;
    this.endTag = endTag;
    }
           
    /**
    * Startup item implementation of the DefaultHandler.
    */
    ' public void startElement (String namespaceURI, String localName,
    String qualifiedName, attributes atts) throws SAXException {}
    If (localName.equals ("error"))
    Errortag = true;
    ElseIf (localName.equals (startTag))
    currentTag = true;
    }
           
    /**
    * Implementation of the DefaultHandler element ends.
    */
    ' public void endElement (String namespaceURI, String localName,
    String QualifiedName) throws SAXException {}
    If (localName.equals ("error"))
    Errortag = false;
    ElseIf (localName.equals (endTag))
    currentTag = false;
    Else if (currentTag == true) {}
    attribValue.addElement (tagValue); Add it to vector
    tagValue = "";
    }
    }
           
    /**
    * The treatment on the tag to read.
    ch @param String containing the tag.
    @param start starting location of the tag.
    @param tag length.
    */
    characters public Sub (ch of char [], int start, int length)
    throws SAXException {}
               
    Dim str As String = new String (ch);
    String tempTagValue = str.substring (start, start + length);
               
    If (Errortag is true)
    errorNo = Integer.parseInt (tempTagValue);
    Else if (currentTag == true)
    tagValue = tempTagValue;
    }
    }

    I think that it solve your problem.

    Kind regards

    -Jitu.

  • repair of iTunes - fusion of the xml files or combine libraries

    My iTunes xml I messed up a little bit and now all my old songs have the same Date added date, if they have been added to 4 years ago or on 02/07/15.

    Titles added after 02/07/15 have correct dates.

    I am trying to find the better (not necessarily the easiest) way to fix them.

    It is important for me because I sort my titles by date added.

    I have a huge library and can change them one by one in the xml file.

    I think that the ideal way to change the dates maybe with a script that would take the correct dates back to the old xml and replace the incorrect in the xml of the last.

    However, I do not have such a script, and I don't know how to write one.

    So my other option is to merge libraries.

    I will do this on a separate drive in order not to spoil the libraries either old or new.

    I have a bunch of backups, but had not noticed the problem posed by the until after all the backups had already been updated with new and incorrect files.

    I also have a fully functional library on a player removed from my MBP dead last year.

    So I now several copies of a messed library and an obsolete library containing the correct information.

    If I had to start with the old library I would need then to add all new titles that were added last year on my new computer.

    I can sort of filter by modification Date to clear the majority of them.

    I know that iTunes has a feature to add to the library , but before I use it I want to make sure that will accomplish what I am trying to do.

    I hope that someone with real experience in doing that reads my post.

    Useful suggestions of someone else is appreciated.

    Too bad (as if someone was actually going to answer).

    I have since discovered that the added Date cannot be changed.

    So now I have copied the old library on an external drive, made iTunes open this library, and then added everything in my current library which was not in the old library. I now have a library with the correct dates for the majority of the files, but all my files since August 2014 have now to the current Date added date.

    Better to have 16 months from the incorrect dates of 6 years.

  • having a problem with parsing the XML file

    Hi all
    I am trying to get data from XML file
    I want to only 4-5 values in this XML file
    Here is an example of XML file
    -< transaction >
    -< TransCtx >
    > < pAMETranType > IRCVACAPPROVAL < / pAMETranType >
    > < / TransCtx >
    > < / transaction >

    I want to add value and to store this value in table
    I'm here, I want to "IRCVACAPPROVAL".
    the tag
    < pAMETranType >

    for this purpose


    I created a procedure

    CREATE OR REPLACE PROCEDURE insert_xml_emps (p_directory in varchar2,
    > p_filename in varchar2)
    (> vtableName in varchar2) as
    > v_filelocator BFILE.
    > v_cloblocator CLOB.
    > l_ctx DBMS_XMLSTORE. CTXTYPE;
    > l_rows NUMBER;
    > v_amount_to_load NUMBER;
    > dest_offset NUMBER: = 1;
    > offset NUMBER: = 1;
    > lang_context NUMBER: = DBMS_LOB. DEFAULT_LANG_CTX;
    > WARNING NUMBER;
    > START
    > dbms_lob.createtemporary (v_cloblocator, true);
    > v_filelocator: = bfilename (p_directory, p_filename);
    > dbms_lob.open (v_filelocator, dbms_lob.file_readonly);
    > v_amount_to_load: = DBMS_LOB.getlength (v_filelocator);
    >-* this line is changed * -.
    > DBMS_LOB. LOADCLOBFROMFILE (v_cloblocator,
    > v_filelocator.
    > v_amount_to_load.
    > dest_offset.
    > offset.
    > 0,
    > lang_context.
    (> warning);
    >
    > l_ctx: = DBMS_XMLSTORE.newContext (vTableName);
    > DBMS_XMLSTORE.setRowTag (l_ctx, 'TRANSACTION');
    > DBMS_XMLSTORE.setRowTag (l_ctx, 'TRANSCTX');
    >-clear the update settings
    > DBMS_XMLStore.clearUpdateColumnList (l_ctx);
    >-set the columns to update a list of values
    > DBMS_XMLStore.setUpdateColumn (l_ctx, 'PAMETRANTYPE');
    >
    >-now insert the doc.
    > l_rows: = DBMS_XMLSTORE.insertxml (l_ctx, v_cloblocator);
    > DBMS_XMLSTORE.closeContext (l_ctx);
    > dbms_output.put_line(l_rows ||) "... inserted rows. ») ;
    > dbms_lob.close (v_filelocator);
    > DBMS_LOB. FREETEMPORARY (v_cloblocator);
    > END;

    I also have on the table who get this value

    whenever I call that created the procedure
    it sometime gives an error or sometime run correctly but store null in the table


    But when I change the XML file
    as
    When convert all lowercase letters in the capital then it works fine

    Is tehre to other ways to parse the XML file with no change in the XML file?

    Did you use the same test (with the exception of file name and directory) case?

    What I posted is a copy/paste direct SQL * Plus, and it works on version 11.2.0.1.

  • Flatten XML does not record the names of the ListBox element to the XML file.

    On my front, I have a ListBox indicator that has strings that the user can select. Also, the user can edit items in the drop-down list to add new items. After that the user selects one and pushes my "Save" button, I use the flatten XML function to save the selection in an XML file. But Flatten XML saves only the value (the index of the selected items to the XML file and not the names of items in ListBox.) This is enough information to reconstruct from the string of data that the user has selected.

    A ListBox where a user is to select from a list of strings, flatten function XML should not also store the strings that have been selected?


  • Processing the XML file

    I have a requirement to process a stream of xml files and load its content in the oracle as a name-value pair tables. Basically, my table has three columns ID, Detail_NM, Detail_val.  I have to extract the ID and the corresponding details and store it in this table. The XML file looks like in below.  I can use an extract sql but you are looking for the most effective way to do it. I would like to highlight the elements dynamically as an element may or may not be present in every game. for example. Second series below has address2 that isn't there in the first document set. Even if nothing new is introduced, I should be able to treat them without explicitly mentioning the name of the element.  Is there a better way to deal with?  Please, share your ideas.  Thanks in advance

    < document >

    < id > 546534 < /ID >

    < details >

    the New York < City > < / City >

    Ave de Rome 45 < address > < / address >

    < zip > 10281 < / Zip >

    < / details >

    < / document >

    < document >

    < id > 6785565 < /ID >

    < details >

    Dallas < City > < / City >

    < address > 56 locust ave < / address >

    < Address2 > 2nd floor < / address >

    < zip > 07454 < / Zip >

    < / details >

    < / document >

    user626688 wrote:

    Thanks again.  Yes, we can have a node root here.

    -What is the average size of a single XML entity? (Number of nodes, size in bytes)? -A file can be up to 2MB size. Each ID can have different elements from 0 to 200 under him. (Each document tag).

    Sorry, missed your last answer once again.

    If there is a root node, it is even simpler.

    And you can certainly use an intermediate binary table of XMLType:

    SQL> begin
      2
      3    -- insert as Binary XMLType
      4    -- optional step for small files
      5    insert into tmp_xml
      6    values (
      7      xmltype(bfilename('TEST_DIR','sample2.xml'), nls_charset_id('AL32UTF8'))
      8    );
      9
    10    -- parse and insert into the target table
    11    insert into my_table (id, detail_nm, detail_val)
    12    select x1.id
    13         , x2.detail_nm
    14         , x2.detail_val
    15    from tmp_xml t
    16       , xmltable('/Documents/Document'
    17           passing t.object_value
    18           columns id       number  path 'Id'
    19                 , details  xmltype path 'Details'
    20         ) x1
    21       , xmltable('/Details/*'
    22           passing x1.details
    23           columns detail_nm  varchar2(256)  path 'local-name(.)'
    24                 , detail_val varchar2(4000) path 'text()'
    25         ) x2 ;
    26
    27  end;
    28  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from my_table;
    
            ID DETAIL_NM            DETAIL_VAL
    ---------- -------------------- ------------------------
        546534 City                 New York
        546534 Address              45 Rome Ave
        546534 Zip                  10281
       6785565 City                 Dallas
       6785565 Address              56 locust ave
       6785565 Address2             2nd Floor
       6785565 Zip                  07454
    
    7 rows selected.
    

Maybe you are looking for

  • Built-in camera is not clear - Satellite L635

    Since I bought this Satellite L635-I discovered that the built-in webcam is not clear.I tried several times to adjust the settings but seems that I can't get through to fix a good resolution. I can assume that there is an updated driver?Can someone g

  • Toner bottle collection

    My Laserjet P4014 gave an error that the waste toner bottle is full.  I removed, he pushed and succeeded him.  The printer seems content for now.  What should I do to fix this? Empty it? Replace it? f I need to replace it, where can I get a new and w

  • HP Office Jet 8600 Premium: scan using the glass rather than the feed document dumpster

    Hello, I have the above printer and I would like to analyze an old photo using the technique of the flat bed scanner rather than feed the loading of documents. Can help you with this? Thank you Casey20131

  • Recovery disc Burns but fails on "verification" - error 20

    I used SONY DVD - media and LG DVD-.  Both failed at the stage of verification with the error 20.  Both media have always been solid as a rock.  When burning it isn't is no way to slow down the burning rate in case that could be the problem.  The PC

  • Problem to get the startup-config under the privilege level

    Hi guys I use the level of privilege 15.2 and in this version, that I can not get the startup-config under some of IOS (in this case, IE 7) I have no problem to get it from the earlier version, also to 15.1 Router #sh privileges Current privilege lev