Place contents of xml file to 2D array

i have a xml file like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "map.dtd">
<map width="5" height="5" goal="6" name="Hallways of Dooom">
     <random-item type='lantern' amount='5' />
     <random-item type='health' amount='10' />
     <tile x="1" y="0" type="floor">
          <renderhint>floor:wood</renderhint>
     </tile>
     <tile x="0" y="1" type="wall" />
     <tile x="1" y="1" type="floor" startlocation="1" />
     <tile x="3" y="1" type="floor">
          <item type="treasure">Bar of Silver</item>
          <renderhint>floor:stone,blood</renderhint>
     </tile>
</map>i was asked to creat a 5*5 2D array from it. each tile represents a position on the point. If the type of tile is wall, it is represented by number 2; if it is floor, it is represented by number 1.
i have written my code as following:
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.io.*;
public class parsexml
    public void parseXML()
     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     factory.setValidating(true);
     factory.setIgnoringElementContentWhitespace(true);
     try {
         DocumentBuilder parser = factory.newDocumentBuilder();
         Document doc = parser.parse(new File("hallways.xml"));
         System.out.println("XML file parsed.");
         processTree(doc);
     } catch (ParserConfigurationException e) {
         e.printStackTrace();
     } catch (SAXException e) {
         e.printStackTrace();
     } catch (IOException e) {
         e.printStackTrace();
    public void processTree(Document doc)
     int column = 0;
     int row = 0;
     int hori = 0;
     int vert = 0;
     String Type = "";
     Node element = doc.getDocumentElement();
     NamedNodeMap attrs = element.getAttributes();
     for (int i = 0; i < attrs.getLength(); i++) {
         Node attr = attrs.item(i);
         String attrName = attr.getNodeName();
         if (attrName == "width") {
          column = Integer.parseInt(attr.getNodeValue());
         if (attrName == "height") {
          row = Integer.parseInt(attr.getNodeValue());
     int[][] map = new int[row][column];
     NodeList children = element.getChildNodes();
     for (int i = 0; i < children.getLength(); i++) {
         Node child = children.item(i);
         String nodeName = child.getNodeName();
         if (nodeName == "tile") {
          NamedNodeMap attributes = child.getAttributes();
          for (int a = 0; a < attributes.getLength(); a++) {
              Node attribute = attributes.item(a);
              String attributeName = attribute.getNodeName();
              if (attributeName == "x") {
               hori = Integer.parseInt(attribute.getNodeValue());
              if (attributeName == "y") {
               vert = Integer.parseInt(attribute.getNodeValue());
              if (attributeName == "type") {
               Type = attribute.getNodeValue();
         if (Type == "floor") {
          map[hori][vert] = 1;
         } else if (Type == "wall") {
          map[hori][vert] = 2;
     print(map);
    public void print(int[][] map)
     for (int r = 0; r < map.length; r++) {
         for (int c = 0; c < map[r].length; c++) {
          System.out.print(map[r][c]);
         System.out.println();
    public static void main(String[] args)
     parsexml xml = new parsexml();
     xml.parseXML();
}When i run the program, i found it doesn't fills the spcified position on the array. all I get is a 5*5 grid of 0s.
Can anyone tells me why? thank you in advance.

Unless someone is willing to put in the time to do your job for you, you'll have to debug it yourself. Put in some debugging statements. In their simplest form this is just a bunch of System.out.println("your message here") calls where you put in messages describing the current point of execution (like what method you just started or are about to finish) and the values of relevant data (such as method parameters, loop indices, whatever you feel is important).
Then run the program and see what it tells you.

Similar Messages

  • Obtain Array from an XML file with Multiple Arrays

    Hi,
    So I have been struggling with this program I am making for the last few months but I am almost there. I have a program that creates multiple arrays and place them one after another in an xml file and each array has its own unique name. Now I would like to create a VI that takes this XML file and when the user inputs the specific array name they are looking for it goes into the xml file finds the entire array under that name and displays it in an output indictor to be viewed on the VI. Attached is a sample of my xml file and the VI that creates this xml file.
    Thanks,
    dlovell
    Solved!
    Go to Solution.
    Attachments:
    I_Win.zip ‏20 KB

    Here is a slightly different version. The one above reads from a file. This is how you would read from an already loaded XML string.
    =====================
    LabVIEW 2012
    Attachments:
    Find Array.vi ‏18 KB

  • How to read the contents of XML file from my java code

    All,
    I created an rtf report for one of my EBS reports. Now I want to email this report to several people. Using Tim's blog I implemented the email part. I am sending emails to myself based on the USERID logic.
    However I want to email to different people other then me. My email addresses are in the XML file.
    From the java program which sends the email, how can I read the fields from XML file. If any one has done this, Please point me to the right examples.
    Please let me know if there are any exmaples/BLOG's which explain how to do this(basically read the contents of XML file in the Java program).
    Thank You,
    Padma

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • How to parse contents from XML file in Java

    Hi All,
    I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
    How to parse Contents of XML file??
    Thanks in advance,
    Rajendra.

    Hi All,
    I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
    How to parse Contents of XML file??
    Thanks in advance,
    Rajendra.

  • Get the content of a file into a array

    Hy to all!I have txt file with the following content : 0 1 1 0
    1 1 1 0
    0 0 0 0. I want to extract the values to a bi-dimension array,like this: a[0][0] = 0,a[0][1] = 1,a[0][2] = 1....and so on.
    Anybody could give a little help.THX

    The first thing I can help you with is that this doesn't have anything to do with java serialization.
    Secondly, if you are new to java, the best forum is "New To Java" forum.
    Thirdly, make sure you have done a google search first for an answer because it is likely that many people have asked the same question before.
    The follow search gets over 2 million hits. [http://www.google.co.uk/search?q=java+read+content+of+a+file+into+a+array]

  • How to generate xml file from an array of data using jQuery

    Hi All,
    Iam facing the problem with diaplaying array of data into a xml file, Actually iam using SAPUI5 commons table to display the backend data, each row in the table has checkbox. If we select each checkbox, iam getting the particular record and push it into an empty array and then i should show that array of data into xml file.

    OData.request 
    requestUri: url,  
    method: "POST",
    headers: {                    
    "X-Requested-With": "XMLHttpRequest",                  
    "Content-Type": "application/atom+xml",
    "DataServiceVersion": "2.0", 
    "Accept": "application/atom+xml,application/atomsvc+xml,application/xml",  
    "X-CSRF-Token": header_xcsrf_token   
    data: requestTableDATAArray
    // Response after posting and set message
    function (data, response) 
    alert(response.body);//gives xml format

  • Find keyword in XML file from an array of keywords

    Hi,
    I have an array of collection of keyword:
    $KeyWord = @("Fail","Exception","Terminated","Error")
    I want to check in a textfile sample.xml, if any or all keywords from the array $KeyWord exist. If any of the keyword exist in the textfile, a boolean variable $ExceptionOccurred will return $true.
    The code I am using working good with a TEXT file, but not working with XML file. Is there a way to convert XML to Text and then look for keyword in plaintext?
    Code:
    $KeyWord = @("Fail","Exception","Terminated","Error")
    $sampleFile = Get-Content .\file1.txt
    $ExceptionOccurred = $false
    $KeyWord | ForEach {
        If ($sampleFile -contains $_) {
            $ExceptionOccurred = $true
    $ExceptionOccurred

    hello,
    with PowerShell you can parsing XML files.
    Example XML-File:
    <ListOfData><Table><service>Backup1</service><description>Backup</description><status>Fail</status></Table><Table><service>Backup2</service><description>Backup</description><status>Exception</status></Table><Table><service>Backup2</service><description>Backup</description><status>Error</status></Table></ListOfData>
    with Select-Object you expand the XML as Table and ForEach-Object with if match the attribute "status" for value in the $KeyWord array.
    $KeyWord = @("Fail","Exception","Terminated","Error")[xml]$xml = Get-Content .\file.xml$xml.ListOfData | Select-Object -ExpandProperty Table | ForEach-Object{if($KeyWord -contains $_.status){$ExceptionOccurred = $true}}

  • How to export table contents in xml file format through SQL queries

    hi,
    i need to export the table data in to xml file format. i got it through the GUI what they given.
    i'm using Oracle 10g XE.
    but i need to send the table name from Java programs. so, how to call the export commands from programming languages through. is there any sql commands to export the table contents in xml format.
    and one more problem is i created each transaction in two tables. for example if we have a transaction 'sales' , that will be saved in db as
    sales1 table and sales2 table. here i maintained and ID field in sales1 as PK. and id as FK in sales2.
    i get the combined data with this query,
    select * from sales1 s1, sales2 s2 where s1.id=s2.id order by s1.id;
    it given all the records, but i'm getting two ID fields (one from each table). how to avoid this. here i dont know how many fields will be there in each table. that will be known at runtime only.
    the static information is sales1 have one ID field with PK and sales2 will have one ID filed with FK.
    i need ur valuable suggestions.
    regards
    pavan.

    You can use DBMS_XMLGEN.getXML('your Query') for generating data in tables to XML format and you can use DBMS_XMLGEN.SETROWSETTAG to change the parent element name other wise it will give rowset as well as DBMS_XMLGEN.SETROWTAG for row name.
    Check this otherwise XMLELEMENT and XMLFOREST function are also there to convert data in XML format.

  • Dynamically building web content using XML file(s)

    Hello All!
    I was recently tasked with a project to design a monitoring web application for our "in-house" built web applications. There is a certain set of modules and parameters that we need to monitor: GSLB --> Web Tier --> App Tier --> Database.
    Almost all (80%) of our applications share the same parameters that need to be monitored, but there are about a hundred of them. So here is what I'm thinking of doing....
    1. Create an XML document for each application (An example layout is included at the end of this post) and save it in the Applications directory.
    2. Setup a Spring Framework project, and create code to dynamically go through the Applications directory and kick-off the monitoring logic for each <application/> item. Basically, the code will just traverse through all of the xml files (I might even create just 1 xml file with all of the <application/> items in it), read the "metadata" for each application, and start the backend processing, as well as display the data in a dynamically-generated web GUI (based on the XML structure and data).
    Again, most of our applications (80%) have the same modules/parameters, therefore adding an application would only require us adding another <application/> element to the already-existing xml document (or adding an additional XML document). The code would do the rest...In regards to the rest 20% of applications, I would create a customize XML document with additional metadata (the code, in that case, would be able to handle the additional metadata).
    So here are my questions:
    1. What do you think of the idea itself? I'm sure that I'm not the only one who's thought of this, so are there any best-practices in this regard?
    2. The reason I thought of using Spring is that it is XML-based (there are many reasons for me using Spring actually -- Security, ORM integration, etc), and it might facilitate my efforts. I'm thinking that even if reading through the Applications directory isn't such a good idea, I can somehow utilize Spring's dependency injection & AOS to create the appropriate solution. Have anybody tried this before and willing to share ideas, implementation approach, etc?
    3. Other than Spring, what might help me accomplish this task?
    4. Is this feasible (from a time and effort stand-point), or should I just do it the old-fashioned way?
    Thanks in advance!
    Vladimir
    I am including a sample (very rough-draft) XML file of what the input might look like:
         <applications>
              <application name="Remote Application">
                   <vip>somethingUNIQUE.mycompany.com</vip>
                   <sys-level>LAB</sys-level>
                   <lb-type>GTM</lb-type>
                   <farms>
                        <farm name="Farm 1" id="1">
                             <member-name>sslname.mycompany</member-name>
                             <ip-address>34.34.24.242</ip-address>
                             <application-servers>
                                  <application-server name="Some Name1">
                                       <ip-address>
                                            34.983.238.32
                                       </ip-address>
                                  </application-server>
                                  <application-server name="Some Name 2222">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                                  <application-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                             </application-servers>
                             <web-servers>
                                  <web-server name="Some Name1">
                                       <ip-address>
                                            34.983.238.32
                                       </ip-address>
                                  </web-server>
                                  <web-server name="Some Name 2222">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </web-server>
                                  <web-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </web-server>
                             </web-servers>
                        </farm>
                        <farm name="Farm 2" id="2">
                             <member-name>sslvpn01.downingtown</member-name>
                             <ip-address>34.34.24.250</ip-address>
                             <application-servers>
                                  <application-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                             </application-servers>
                             <web-servers>
                                  <web-server name="Some Name1">
                                       <ip-address>
                                            34.983.238.32
                                       </ip-address>
                                  </web-server>
                                  <web-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </web-server>
                             </web-servers>
                        </farm>
                   </farms>
              </application>
              <application name="Tech Tools">
                   <vip>technicalUNIQUE.tools.mycompany.com</vip>
                   <sys-level>LAB</sys-level>
                   <lb-type>GTM</lb-type>
                   <farms>
                        <farm name="Farm 1" id="1">
                             <member-name>tools.tech</member-name>
                             <ip-address>34.34.24.214</ip-address>
                             <application-servers>
                                  <application-server name="Some Name 2222">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                                  <application-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                             </application-servers>
                             <web-servers>
                                  <web-server name="Some Name1">
                                       <ip-address>
                                            34.983.238.32
                                       </ip-address>
                                  </web-server>
                                  <web-server name="Some Name 2222">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </web-server>
                             </web-servers>
                        </farm>
                        <farm name="Farm 2" id="2">
                             <member-name>tools.tech222</member-name>
                             <ip-address>34.34.24.415</ip-address>
                             <application-servers>
                                  <application-server name="Some Name1">
                                       <ip-address>
                                            34.983.238.32
                                       </ip-address>
                                  </application-server>
                                  <application-server name="Some Name 2222">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                                  <application-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </application-server>
                             </application-servers>
                             <web-servers>
                                  <web-server name="Some Name1">
                                       <ip-address>
                                            34.983.238.32
                                       </ip-address>
                                  </web-server>
                                  <web-server name="Some Name 2222">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </web-server>
                                  <web-server name="Some Name 3425">
                                       <ip-address>
                                            34.343.248.32
                                       </ip-address>
                                  </web-server>
                             </web-servers>
                        </farm>
                   </farms>
              </application>
         </applications>

    Hello jschell!
    Again, the question was more about the overall architecture and design rather than monitoring implementation.
    So here is what I have now:
    1. A spring application that will do the following:
    Read in the "architecture.xml" file (a portion is shown below). This file will dictate not only the type of monitoring but also the layout (explained later).
    The architecture.xml is marshalled to entity objects -- Model (s), with nested Model "children"
    This array of Model(s) is what the server-side application will use to populate the monitoring parameters.
    When the Impl gets a hold of the Model(s), it traverses through all of these entities and does whatever processing it needs to do (Health check, routing check, etc), and produces Item(s) objects, which are similar in structure to the Model(s) entities, but have actual values that need to be displayed on the front-end. Each item might have an array of other, children, Item(s)
    2. A GWT application asks for the Items array, and displays them on the front-end.
    What I did already:
    *1. Created a base Spring project that accepts GWT requests and returns a set of Item(s) (statically-generated, since I don't have the proper Impl yet).*
    *2. Created the GWT project and the layout. GWT communicates with the Spring app (which runs on tomcat for now) and upon retrieving the Item(s) it recursively renders them into displayable items, with different background, borders colors, width, etc (based on the populated values and their nested children, if any) . The last code snippet is the definition of the Item class.*
    Basically, the architecture is setup and the next step is the actual implementation of the monitoring and routing logic -- which wasn't the point of this post, since I already did most of it for a different project :)
    Thanks for the replies though....
    Vladimir
    <serviceView name="YYYYYYYY XXXX">
         <item layout="vertical">
              <!-- The top level application name -->
              <item name="Routing XXXXXXX  (RX)"/>
              <!-- The GSLB name and Active Farms printout -- Work in Progress-->
              <item  name="RX GSLB - xxxxxxx.xx.xxxxxxxx.com" layout="vertical">
                   <dynamicText type="gslb_farms">
                        <param name="vip" value="xxxxxxxx.xx.xxxxxxxxx.com"/>
                   </dynamicText>
              </item>
              <!-- The farms Row -->
              <item layout="horizontal">
                   <!-- The 1st Farm -->
                   <item name="Farm 1" layout="vertical">
                        <operationalState name="xxxxxxx.xx.yyyyyyy.com" type="gslb_farm">
                             <param name="vip" value="activate.g.comcast.com"/>
                             <param name="farmName" value="RX.WT.F1.VIP">
                        </operationalState>
                        <hc name="RX.WT.F1.VIP" type="poller"/>
                        <!-- DataCenter name -->
                        <item name="PDX" value="PDX"/>
                        <!-- Web Tier -->
                        <item layout="horizontal">     
                             <item name="WEB1" description="WEB1" detailedView="someservice_level_xmlname.xml">
                                  <hc name="RE.WT.F1.rdw01" type="poller"/>
                             </item>
                             <item  name="WEB2">
                                  <hc name="RE.WT.F1.rdw02" type="poller"/>
                             </item>
                        </item>
    public class Item implements Serializable{
         private static final long serialVersionUID = 1L;
         public final static String _ROUTING_STATUS_ENABLED = "_ROUTING_STATUS_ENABLED";
         public final static String _ROUTING_STATUS_DISABLED = "_ROUTING_STATUS_DISABLED";
         public final static String _ROUTING_STATUS_UNKNOWN = "_ROUTING_STATUS_UNKNOWN";
         public final static String _HEALTH_STATUS_GOOD = "_HEALTH_STATUS_GOOD";
         public final static String _HEALTH_STATUS_BAD = "_HEALTH_STATUS_BAD";
         public final static String _HEALTH_STATUS_UNKNOWN = "_HEALTH_STATUS_UNKNOWN";
         // This is what will be printed out -- the static text
         private String name = null;
         // If detailedView is not empty, then a link for this item shows up
         // that opens up a Dialogue Box
         private String detailedView = null;
         // If detailedView is not empty, then a link for this item shows up
         // that opens up a completely new Service View
         private String serviceView = null;
         // Layout Information
         private boolean verticalLayout = true; // VERTICAL or HORIZONTAL
         // Coloring Information
         private String routingStatus = _ROUTING_STATUS_UNKNOWN; // ENABLED, DISABLED, UNKNOWN
         private String healthStatus = _HEALTH_STATUS_UNKNOWN; // HEALTHY or NOT-HEALTHY
         // Children
         private Item children[] = null;

  • Dbms_xmlgen: write emp content to xml file

    Hi.
    I have the following procedure to write the content of the emp table in xml to a file:
    CREATE OR REPLACE PROCEDURE BSP_DBMSXMLGEN IS
    v_ctx DBMS_XMLGen.ctxHandle;
    v_file Utl_File.File_Type;
    v_xml CLOB;
    v_more BOOLEAN := TRUE;
    l_exception varchar2(2000);
    BEGIN
    -- XML context erzeugen
    v_ctx := DBMS_XMLGen.newContext('SELECT * from emp_big');
    -- Root Element und Zeilentag setzen
    DBMS_XMLGen.setRowsetTag(v_ctx, 'Emp');
    DBMS_XMLGen.setRowTag(v_ctx, 'Zeile');
    -- XML Dokument erzeugen
    v_xml := DBMS_XMLGen.GetXML(v_ctx);
    DBMS_XMLGen.closeContext(v_ctx);
    -- Ausgabedatei erzeugen
    v_file := Utl_File.FOpen('XML_DIR', 'BSP_DBMSXMLGEN.xml', 'w');
    -- In Datei schreiben
    WHILE v_more LOOP
    Utl_File.Put(v_file, Substr(v_xml, 1, 32767));
    IF Length(v_xml) > 32767 THEN
    v_xml := Substr(v_xml, 32768);
    ELSE
    v_more := FALSE;
    END IF;
    END LOOP;
    Utl_File.FClose(v_file);
    EXCEPTION
    when OTHERS then
    l_exception := sqlerrm;
    dbms_output.put_line('Error: ' || l_exception);
    END;
    The procedure works well with 14 emp rows. But after duplicating the rows a few times the procedure stops working...
    insert into emp_big select * from emp_big;
    commit;
    select count(*) from emp_big;
    COUNT(*)
    960
    exec bsp_dbmsxmlgen;
    The file content:
    <?xml version="1.0"?>
    <Emp>
    <Zeile>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7902</MGR>
    <HIREDATE>17.12.80</HIREDATE>
    <SAL>800</SAL>
    <DEPTNO>20</DEPTNO>
    </Zeile>
    <Zeile>
    <EMPNO>7499</EMPNO>
    <E
    The procedure stops writing to file in the middle of a table row...
    Any ideas?
    Thanks
    Markus

    Thanks, Marco, but I think I need to be more clear. The original XML data in the XMLType field looks like:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <metadata>
    </metadata>where "metadata" is the root node of the entire file. What happens is when I run the script listed above, the name of the field being queried gets added as a root node, which I don't want. I did figure out how to omit the "ROW" and ROWSET" nodes from being placed in the resulting XML flat file. Using the same script, I replaced:
    -- Root Element und Zeilentag setzen
    DBMS_XMLGen.setRowsetTag( v_ctx, 'Emp' );
    DBMS_XMLGen.setRowTag( v_ctx, 'Zeile' );with
    -- Root Elements
    DBMS_XMLGen.setRowsetTag( v_ctx, '' );
    DBMS_XMLGen.setRowTag( v_ctx, '' );I simply removed "Emp" and "Zeile." By doing this, those nodes are omitted. I still can't figure out how to omit the "XML_DATA" node.

  • XML file - Child Nodes Array

    Just starting to learn about XML.
    I have a simple XML file that I created which is as follows
    <?xml version="1.0" encoding="utf-8" ?>
    <Probes>
    <Probe>
    <Location>Ambient</Location>
    </Probe>
    <Probe>
    <Location>panel1</Location>
    </Probe>
    <Probe>
    <Location>panel2</Location>
    </Probe>
    <Probe>
    <Location>panel3</Location>
    </Probe>
    </Probes>
     Using XML Property Node - Child Nodes Array results in an array of 9 elements:
    #text
    Probe
    #text
    Probe
    #text
    Probe
    #text
    Probe
    #text
    My question is what are all the #text that are there?  Shouldn't the child nodes be just the probes?
    Solved!
    Go to Solution.

    It sounds to me like you may be heading down a dark path.  Instead of using the 'Child Nodes Array' and fighting through the complications like extraneous text nodes, let me suggest you look into XPath and use 'Get All Matched Nodes.vi' or 'Get First Matched Node.vi' to get the elements.  XPath makes parsing XML a breeze.
    For Example:
    Of course I hope that using XP does not mean you are using LV8.6 or earlier since the XPath VIs are new to LV9.
    If you are using LV8.6 or earlier I suggest looking into the .NET functions to implement XPath.  Once you get the hang of it, it still beats trying to parse XML the old fashioned way.
    As to the editor, I generate very few XML files by hand, mostly I get them from other programs and parse them in LV.  Again, XPath smooths out the rough edges.

  • Importing content of XML file to table(s)

    I am looking for a way to import updates passed via XML file to a three tables.
    In IBM Domino it was facilitated while using DOMParser class.
    Does JDeveloper have a class or method for updating tables from XML file?

    To import a XML document to a dataabse table:
    1. Add <Oracle10g>/jdbc/lib/ojdbc14.jar, <Oracle10g>/jdbc/lib/servlet.jar, <XDK>/lib/xmlparserv2.jar, <XDK>/lib/xdb.jar and classes12dms.jar to Classpath.
    2. Create a table in Oracle database 10g, which includes columns for each of the element tags in the XML document.
    3. Create a connection with the database.
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@<host>:<port>:<SID>",
    "<user>","<password>");
    4. Create a OracleXMLSave class object.
    OracleXMLSave oracleXMLSave =new OracleXMLSave(conn, "<table>");
    “<table>” is the database table.
    5. Set the tag for the row enclosing element.
    oracleXMLSave.setRowTag("<row-tag>");
    Each <row-tag> tag in the example XML document corresponds to a database column.
    6. Import the XML document to database:
    oracleXMLSave.insertXML(oracleXMLSave.getURL("file://c:/input.xml"));
    7. If the XML document has attributes apply an XSLT to convert the attributes to elements.

  • Read rtf contents from xml file and print them in pdf using documaker

    I am using Documaker 11.2.
    Input file is XML and for a particular tag, rtf contents is passed like
    {\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial Narrow;}} \viewkind4\uc1\pard\b\f0\fs20 My\b0 name is Schoo.....
    I want to read this data excluding the RTF abstract and print the text alone in pdf along with format like paragraph,bold....
    The output file generated is PDF.
    Kindly let me know how can i achieve this in Documaker.

    There is no direct support for importing RTF from an XML extract. Perhaps feature 1514 "Mapping formatted XML data into multiline field" will be of some use. This was released in 11.0, I believe.
    Essentially you can establish paragraph and certain text formatting like bold and underline when you include the proper token information in the data. I believe this is similar to simple HTML tokens.
    Example: &lt;FIELD>&lt;P>First paragraph of data.&lt;/P>&lt;P>New paragraph with &lt;B>&lt;U>bold and underline text&lt;/U>&lt;/B>. Rest of paragraph normal.&lt;/P>&lt;/FIELD>
    The result is something like this:
    <P>First paragraph of data.</P><P>New paragraph with <B><U>bold and underline text</U></B>. Rest of paragraph normal.</P>

  • View then modify content of xml file.

    I am new in Java world and my background is database admin. What I am trying to achieve here is write a small java scripts code which would open connections.xml allow user to update connection definition.
    So here is what I do using java scripts, I load the connections.xml:
    xmlDoc.load("connections.xml");
    Then I disply the current conection def:
    var x=xmlDoc.getElementsByTagName("StringRefAddr");
    for (var i=0;i<x.length;i++)
    document.write("<tr>");
    document.write("<td>");
    document.write(x.getElementsByTagName("Contents")[0].childNodes[0].nodeValue);
    document.write("</td>");
    document.write("</table>");
    But this only displays the content of connections.xml.
    What is the code to allow user to actually modify what he or she is seeing displayed?
    If java scripts is not the appropriate way to do this then please advise on how to do this the simplest way possible.
    Please advise.
    Thanks.
    Bobby.

    So you're reading in this XML document and extracting some bits to display to the user? And then when the user changes those bits and says OK you are going to write out a modified XML document?
    Actually, never mind. Figure out what you are going to do and start doing it. Then when you run into a problem, post a specific question about that problem. It appears your question is actually "I don't know what I should do" and it isn't possible to answer that on a forum.

  • How to append a string whose content is XML file to the child of other XML?

    Hi guys,
    I have a question:
    I obtain a string which is actually a response from HTTP servlet, and I want to append this string as child of another XML, how can I do it? Is there any method to convert string to XML node, opposite to the method "render_2_string"?
    Thanks in advance
    Message was edited by: Liying Wang

    If I understand your question correctly, this may be helpful.
    types: begin of myStructure,
             myNumber type n,
             myChar   type c,
           end of myStructure.
    Data:
    IXML   Type Ref To     IF_IXML,
    XMLDOC Type Ref To     IF_IXML_DOCUMENT,
    RC     Type             SY-SUBRC.
    data rootNode type ref to if_ixml_element.
    data newNode type ref to if_ixml_element.
    data sourceString type string.
    types
      ixml = cl_ixml=>create( ).
      xmlDoc = ixml->create_document( ).
      rootNode = xmlDoc->create_element( 'RootElement' ).
      setAttributesFromStructure( node = rootNode structure = 
      mystructure ).
      newNode = xmlDoc->create_element( 'newNodeAdded' ).
      if sourceString is not initial.
        rc = newNode->IF_IXML_NODE~SET_VALUE( sourceString ).
      endif.
      add navigation graph entry
        rc = rootNode->append_child( newNode ).
    Quack

Maybe you are looking for

  • WAV files play back too fast

    When I choose File->Open to open an AIFF, MP3 or other file in Audition CS6, it simply plays back at normal speed. However, when I open a WAV file, it plays back at double speed (voices become high-pitched). NOTE: The sample rate (44.1) and bit size

  • Iphoto wont load

    I have looked at the help pages, the forum, I see that this question has been asked before but with no answers. When I try to open iphoto, it reads "loading photos" but nothing happens, even after quitting and rebooting, force quitting and restarting

  • Outbound IDocs to XI - sent but Status 20 (error)

    Hi, the detailed error message from application log says, that a function module has to be maintained for Port <space>. The IDocs are reveived at XI. What to do? Regards, Clemens

  • Clarification on the Percent type

    I want to know how to make input text field of type "percent" and it should accept not more than 100 and not less than 0 as the values . And i want it to store only positive values. I know how to make it ,but i am not sure that accepts 100 as the val

  • Spurious colours from RGB Curves and Track Matte...

    Hello people of the forums. I am working on a music video. In a couple of places in the sequence where there are two or more visible layers overlapping with top layer/s having less than 100% opacity there is some unwanted 'extra' colours appearing wh