effective analysis of XML

Hi guys,.
I need to parse a XML file. These XML files have sizes range from 4 k to 1500 k.
My code currently supported files XML as an InputStream as shown below.

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuilder();
ByteArrayInputStream stream = new ByteArrayInputStream(xmlData.getBytes());
Document doc = builder.parse( stream ); // <-- this string works very slow !!!!!!!!

It works fine, but when the size of the file (for example) is about 1200 KB, it took 12 minutes to parse this file. It is extremely slow and unusable... It freezes device and I need to wait until the end of the analysis...

Is there another way to analyze large files? Why it works slowly? Does anyone have the same problems? Help, please!

Thanks, Vlad.

Thanks Simon! I'll try it

Tags: BlackBerry Developers

Similar Questions

  • Analysis of XML files

    I have a problem, the analysis of this XML file. I swear it worked but now the sections DC_Source and DC_Load return null.

    In XML (Subvi) .vi tag monitor, look at the results on the terminal. The wire that connects to the Terminal should use a shift register.

  • Analysis sax XML parser

    Hello...

    I would like to publish this example to help pasring xml or live feed from a URL.

    SAXParserFactory plant = SAXParserFactory.newInstance ();
    SAXParser saxParser = factory.newSAXParser ();

    DefaultHandler Manager = new DefaultHandler() {}

    ' public void startElement (String uri, String localName, String qName,
    Attributes attributes) throws SAXException {}
    If (qName.equalsIgnoreCase ("an element of xml"))
    {

    vector.addElement (attributes.getValue ("attribute of an element"));

    }

    ElseIf (qName.equalsIgnoreCase ("second item FRO xml"))
    {

    attributteValue = attributes.getValue ("title");

    }

    ' public void endElement (String uri, String localName, String qName)
    throws SAXException {}

    currentElement = false;

    If (qName.equalsIgnoreCase ("end of the element"))
    {
    do something
    }

    }

    };
    S StreamConnection = null;

    s = (StreamConnection) Connector.open ("enter the url that provides the xml file");
    HttpConnection httpConn s = (HttpConnection);

    If (httpConn.getResponseCode () is 400)

    {
    Dialog.Alert ("internett noaccess");

    }

    InputStream input = null;
    entry = s.openInputStream ();

    Reader reader = new InputStreamReader(input,"UTF-8");
    InputSource is = new InputSource (reader);
    is.setEncoding("UTF-8");

    saxParser.parse (, Manager);
    }

    Add the required elements of the XML in the analysis to the vectors and do something.

    SAX (Simple API for XML) is a parser based on the events in sequential access API developed by the XML - DEV list for XML documents. SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the DOM (Document Object). When the DOM works on the document as a whole, SAX parsers function on each element of the XML document in order.

    SAX parsers have certain advantages over DOM-style parsers. A SAX parser doesn't need to declare every event analysis what happens and almost all of these once-reported information normally rejects (he does, however, keep some things, for example a list of all the elements that have not been closed yet, in order to intercept errors later as the end tags in the wrong order). Thus, the minimum memory required for a SAX parser is proportional to the maximum depth of the XML (i.e. the XML tree) and the maximum data involved in a single XML event (for example, the name and the attributes of a single tag start, or the content of a processing instruction, etc.).

    This amount of memory is generally regarded as negligible. A DOM parser, however, usually built a representation of the tree of the entire document in memory at first, using memory that increases with the length of the entire document. It takes a lot of time and space for large documents (memory allocation and the construction of data structures take time). The advantage of compensation, of course, is that once loaded no matter what part of the document are accessible in any order.

    I hope this post was helpful.



    Welcome on the support forums.

    Thank you for contributing. There is however a minor problem: all blocking operations must be made on a separate thread. You cannot use Dialog.alert on a thread without use invokelater or synchronization on the eventlock, you should fix that.

    In addition, there are a lot of response codes, and you should check for 200 continue, otherwise trigger an error.

    There is also a xmldemo in the samples provided with the eclipse plugin or JDE, but it uses DocumentBuilder, no Sax.

  • Analysis of XML with SAX parser

    
    
    
      
         
        
                
        
                
            
        
        
                
        
                
            
    
    
        
                
    
        
                
          
    
    
        
                
    
        
                        
    
            
                
    
        
                
        
                
    
        
                
        
    
    
    

    It comes to my XML. I am able to analyze using the DOM parser, bt I m new analysis SAX. Can someone help me to analyze it using SAX parser

    There is a snippet of Code to call the HTTP Xml & only to the analyzed using Sax parser.

    SAXParserImpl saxparser = new SAXParserImpl();
    ListParser receivedListHandler=new  ListParser();
    static DataInputStream din = null;
    public static String response;
    
        HttpConnection hc = null;
            OutputStream os;
               try
               {
                   final String url =""+ InitClass.getConnectionString()+";ConnectionTimeout=25000";
    
                   hc = (HttpConnection)Connector.open(url);
    
                   os = hc.openOutputStream();
                   os.write(postDataBytes);
    
                   if (hc.getResponseCode() == 200)
                        din = hc.openDataInputStream();
                    else
                        response = "" + hc.getResponseCode();
                    saxparser.parse(din, receivedListHandler);
               }
               catch (Exception e)
               {
    
               }
               finally
               {
                  try
                  {
                      if(din!=null)
                          din.close();
                      din = null;
                      if(hc!=null)
                          hc.close();
                      hc = null;
                  }
                  catch (Exception e) {   }
               }
    

    class Analyzer

    public class ListParser extends DefaultHandler
    {
    private String Key="";
    private  Hashtable ht=new Hashtable();
    vector vec = new Vector();
    public ListParser()
    {
    
    }
    /**
    * Gets called, whenever a Xml is start .
    */
    public void startDocument() throws SAXException
    {
    
    }
    /**
    * Gets called, whenever a Xml is End .
    */
    public void endDocument() throws SAXException
    { 
    
    }
    /**
    * Gets called, whenever a new tag is found.
    */
    public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException
    {
        if(name.equals(""))
        {
            ht = null;
            ht = new Hashtable();
        }
        else if(name.equals(""))
        {
    
        }
        Key=name;
    }
    
    /**
    * Gets called, whenever a closed tag is found.
    */
    public void endElement(String uri, String localName, String name) throws SAXException
    {
        if(name.equals(""))
        {
            vec.addElement(ht);
        }
    }
    public void characters(char[] ch, int start, int length) throws SAXException
    {
        String element=new String(ch, start, length);
        ht.put(Key, element);
    }
    }
    

    It will analyze your XML file and you will get data of vector vec in hash tables by XML tag.

  • Is it a good idea to add predefined effects using presetEffects.xml?

    Hello

    I am currently working on a plugin using scriptUI.
    One thing I do is add a control null, which have many options for expressions.

    My basic problem is I want to sort them into groups for better ergonomics. The only way I found to do this, add some excerpts to presetEffects.xml. (please tell me if you know another way)

    Presents all works. So great. But now, I think, is it really a good idea? My main concern is: will they stay there? When the user is updating to a newer version of AE they are replaced?

    Y at - it other problems, that I should be aware?

    Thank you
    Jakob

    If you would not add new effects to null-controller, I think that the best way to organize things, is to create custom predefined ( you can use this script )

    store as a binary file inside your script, and then apply this preset.

  • Analysis of XML base using E4X syntax

    Hello

    I'm going crazy with E4X parsing. I'm trying to parse an XML document that is rather simple, but I can't seem to find a way to analyze what I need.

    I try to extract the name of vApps (VAPP only 1 in this example):

    var xmldoc = new XML(test);
    if (!xmldoc) {
      System.debug("XML PAS BON");
      var errorCode = "Invalid XML Document";
      throw "Invalid XML document";
    }
    System.debug("test 1 : "+xmldoc..AdminVAppRecord.@name);
    
    

    It's (a response to vCloud Director REST API 5.1) XML content:

    <?xml version="1.0" encoding="UTF-8"?>
    <QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" total="1" pageSize="25" page="1" name="adminVApp" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://myvcloudhost.com/api/admin/extension/vapps/query?page=1&pageSize=25&format=idrecords&filter=isExpired==true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://myvcloudhost.com/api/v1.5/schema/master.xsd">
      <Link rel="alternate" type="application/vnd.vmware.vcloud.query.references+xml" href="https://myvcloudhost.com/api/admin/extension/vapps/query?page=1&pageSize=25&format=references&filter=isExpired==true"/>
      <Link rel="alternate" type="application/vnd.vmware.vcloud.query.records+xml" href="https://myvcloudhost.com/api/admin/extension/vapps/query?page=1&pageSize=25&format=records&filter=isExpired==true"/>
      <AdminVAppRecord vdcName="john-vdc" vdc="urn:vcloud:vdc:4cc245-23f0-439a-9b98-e85319106af1" storageKB="8388608" status="SUSPENDED" ownerName="system" org="urn:vcloud:org:19893ffe-b5de-40a6-9a08-307e41ac0f49" numberOfVMs="1" name="qsdqs" memoryAllocationMB="3072" isVdcEnabled="true" isInMaintenanceMode="false" isExpired="true" isEnabled="true" isDeployed="false" isBusy="false" creationDate="2013-08-02T15:01:39.260+02:00" cpuAllocationMhz="2" id="urn:vcloud:vapp:fe07c653-4848-4f03-a1f8-ddba8da13a50" honorBootOrder="false" pvdcHighestSupportedHardwareVersion="9" cpuAllocationInMhz="4000" taskStatus="success" lowestHardwareVersionInVApp="9" task="urn:vcloud:task:090db9f8-4b04-4550-a1a3-5396c4f25043" autoDeleteDate="2013-08-10T17:47:56.683+02:00" numberOfCpus="2" taskStatusName="vdcUpdateVapp"/>
    </QueryResultRecords>
    

    Could someone give me a hand on this one? I believe that an example of work would be enough for me to start the analysis correctly.

    Thank you for your help.

    A few errors here:

    1. your XML file is not correct because it contains no sequence of escape '&' characters; they should be replaced by '& '.

    2. your XML elements are in a namespace (see "xmlns" attribute), but your E4X query is not. You must define the namespace, for example

    var vcloud = new Namespace("http://www.vmware.com/vcloud/v1.5");
    

    and then the query will become

    System.log("test 1 : " + xmldoc.vcloud::AdminVAppRecord.@name);
    

    Hope this helps,

    -Ilian

  • Problem in the analysis of XML response.

    Hello

    I want to parse the XML response like this:

    http://www.Google.co.in/imgres?imgurl=&imgrefurl=http%3A%2f%2Fwww.SimpleDNS.com%2Fkb.aspx%3Fkbid%3D1...

    Can someone help me?

    Found the solution!

    http://StackOverflow.com/questions/16053621/reading-XML-file-content-in-Java

  • Analysis of xml with QT

    Hello

    Is there a way to parse the XML in a QString? All of the examples on the web shows how to parse the XML for the file, but none of them shows how to parse XML from a QString. I have a server for my app to connect to via TCP/IP, and the server then sends the XML to the client (app) to be scanned, it will be a waste of resources prior to writing the XML to a file.

    I have the base sax parser and my implementation looks like this

    XMLHandler * m_handler;

    QXmlInputSource * source = new QXmlInputSource (new QFile("asset:///responseMessage.xml"));)

    QXmlSimpleReader reader;
    reader.setContentHandler (m_handler);

    Reader.Parse (source);

    How can I change this line

    QXmlInputSource * source = new QXmlInputSource (new QFile("asset:///responseMessage.xml"));)

    to use a string input, and not a file? I know that QXmlInputSource class does not support a string of implementation is if there is another approach in the API that I can use?

    Thank you for all the advice!

    I found the solution. I changed my class instead to use a QXmlStreamReader. It can take values QByteArray in its constructor so I just called the QString toAscii method to convert the string received from my server to a QByteArray and passed to the QXmlStreamReader. This implementation does not require major changes to my manager so I think it works best for my situation. Thanks for all the help guys.

  • analysis using XML dom

    Hi all

    very new development for mobile am my doubts may be stupid to you all,.

    but I need your help as am new to this platform.

    My requirement is, I need to parse a xml form url DOM parser and

    I need to analyze the sectionname only an xml file and display them in a

    ListField.when I select one of the item listfield it must navigate

    next screen and parse and xml again and list the contents of the sectionname.

    class VVFApplication extends UiApplication{      MainScreen _screen= new MainScreen();      String _node,_element;      Connection _connectionthread;
    
    public static void main(String arg[]){     VVFApplication application = new VVFApplication();     application.enterEventDispatcher(); } 
    
    public VVFApplication() {   
    
        _screen.setTitle("Vishwak Video Framework");    _screen.add(new RichTextField("LOADING"));     _screen.add(new SeparatorField());      pushScreen(_screen);     _connectionthread = new Connection();     _connectionthread.start();} 
    
    public void updateField(String node, String element){ 
    
         String title="SectionName";     _screen.add(new RichTextField("*"+element));    // _screen.add(_listElements.addElement("*"+element) );     if(node.equals(title)){     _screen.add(new SeparatorField()); } } 
    
    private class Connection extends Thread{     public Connection()    {        super();     } 
    
    public void run()    { 
    
         Document doc;      StreamConnection conn;      try{      conn=(StreamConnection)Connector.open;       DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory. newInstance();      DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder();       docBuilder.isValidating();      doc = docBuilder.parse(conn.openInputStream());      doc.getDocumentElement ().normalize ();      NodeList list=doc.getElementsByTagName("SectionName");     _node=new String();     _element = new String();      Object obj = Application.getEventLock();     for (int i=0;i
    

    now, I need to have a selectable listfield, who displays the sectionname in list.and wen I select the list item, it must navigate to the next screen to display its content.

    can anyone suggest me some ideas.thanks in advance

    If the screen is blank, then there not all fields or fields not display anything. Show us the code for how you build the screen, how do fill you the listfield and anything else that might be relevant. More (relevant) information, it is more likely that you will receive assistance.

    Did you read the documentation for ListField? In addition, RIM has several articles on listfield in the category of fields of knowledge base. There is a tutorial at http://developerlife.com/tutorials/?p=898, and a search on the web for "blackberry listfield" will many examples.

    You must extract the DOM, the information that you want to view and add to the (usually an array or a vector) data structure used by a ListFieldCallback registered with the ListField. If you use the ObjectListField, it acts as its own ListFieldCallback and attracts each element as a line of text using ToString. Otherwise, you must write your own ListFieldCallback, which is pretty easy, unless you want fancy layout for each line.

  • I really need professional help in the analysis of XML to the XML Document, or I want to read XML

    Hi all

    I'm really looking for your sweet help. I have suffered for two days. I'm working on Blackberry java app. I have the xml file is located in "file:///store/home/user/myNotes.xml".

    I want to be able to parse the XML into XMLDocument to confront the NodeList and ChildNode.

    I always get Eception Exception RunTimeError

    NOTE the following prayer:

    1 - my JDK is 1.7.0.5.5 (SE) only

    2. I don't have "XMLSerializer" or "Transformer", or "TransformerFactory', 'KXML.

    3. all I want is just to be able to read XML above and analyzed to XMLDocument.

    Find my Java code below:

    =====================================================================================

    Private Sub parseXmlFile() raises {RuntimeException
    try {}

    XMLDocument DOM = null;
    private static final String fileN = "file:///store/home/user/myNotes.xml";
    FileConnection fc = (FileConnection) Connector.open (fileN);
    fc.openDataInputStream ();
    DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
    DocumentBuilder builder = factory.newDocumentBuilder ();
    InputStream is = getClass () .getResourceAsStream (fileN);
    DOM = builder.parse (is);
        
    } catch (Exception pce) {}
    Dialog.Alert (PCE. ToString());
    }
            
    }

    ======================================================================

    End of my Code

    Thank you very much for your time of reading and you answer to help me.

    I appreciate really.

    Dear all,

    Hello and thank you from the bottom of my heart. This works. My problem was absent "normalization."

    Thank you once again I ng3epa enjoyed your valuable contribution.

  • 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.

  • Analysis of XML with Namespace

    Hello

    Can someone help me with the following: -.
    I have an XMLType in pl/sql as follows:

    <? XML version = "1.0" encoding = "utf-8"? >
    < rapdrpProcessCIN:GetCINRes xmlns:rapdrpProcessCIN = "http://rapdrp.com/processcin/transactional/model/1.0/" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "http://rapdrp.com/processcin/transactional/model/1.0/."
    xmlns:N1 = "http://rapdrp.com/common/bodcomponents/transactional/model/1.0/".
    xmlns:N2 = "http://rapdrp.com/gis/cin/business/model/1.0/" >
    < rapdrpProcessCIN:ApplicationArea >
    < N1:Sender >
    < N1:Id > PRT01 < / N1:Id >
    < / N1:Sender >
    < N1:Receiver >
    < N1:CompanyName > MGVCL < / N1:CompanyName >
    string of < N1:CompanyId > < / N1:CompanyId >
    < / N1:Receiver >
    < N1:Reference >
    < N1:BODCreationDateTime > 1697 - 02-01 T 00: 00:00Z < / N1:BODCreationDateTime >
    < N1:BusinessProcessId > BP014 < / N1:BusinessProcessId >
    string of < N1:MessageId > < / N1:MessageId >
    string of < N1:TransactionId > < / N1:TransactionId >
    string of < N1:Username > < / N1:Username >
    string of < N1:Token > < / N1:Token >
    < / N1:Reference >
    < / rapdrpProcessCIN:ApplicationArea >
    < rapdrpProcessCIN:DataArea >
    < rapdrpProcessCIN:CIN >
    string of < N2:CIN > < / N2:CIN >
    < / rapdrpProcessCIN:CIN >
    string of < rapdrpProcessCIN:ConsumerNumber > < / rapdrpProcessCIN:ConsumerNumber >
    string of < rapdrpProcessCIN:SRNumber > < / rapdrpProcessCIN:SRNumber >
    < / rapdrpProcessCIN:DataArea >
    < / rapdrpProcessCIN:GetCINRes > note the tag < message > xmlns attribute is "" which is unusual, but not something I can't change.

    I want to retrieve the text string of the BusinessProcessId tag. I tried the following:

    DECLARE
    v_result varchar2 (32765);
    XMLType v_xml;
    BEGIN
    v_xml: = XMLType ('... over XML...');
    v_result: = xmltype.extract (v_xml, ' / rapdrpProcessCIN:GetCINRes / rapdrpProcessCIN:ApplicationArea / BusinessProcessId/reference/text () "," xmlns:rapdrpProcessCIN = "http://rapdrp.com/processcin/transactional/model/1.0/" ""). getStringVal();

    dbms_output.put_line ('v_result :'|| v_result);
    END;

    ... and I get the following result:

    ORA-30625: shipping method on the argument NULL SELF is not allowed
    ORA-06512: at line 6

    What I am doing wrong?
    Any help appreciated.

    Kind regards
    Himani

    Hello

    /PurchaseOrder/ShippingInstructions/name/text()
    

    Given that the 'name' element is empty, XPath leads to a NULL XMLType instance and so the error ORA-30625.

    If you want to retrieve a single value (that is, an attribute or a text node), you must always use the extractValue() or function XMLQuery() function in 11g (see my previous post).
    So in your example:

    ...
    
    --v_result := xmltype.extract(v_xml,'/PurchaseOrder/ShippingInstructions/name/text()','xmlns="http://rapdrp.com/processcin/transactional/model/1.0/"').getStringVal();
    
    select extractValue( v_xml,
                         '/PurchaseOrder/ShippingInstructions/name',
                         'xmlns="http://rapdrp.com/processcin/transactional/model/1.0/"' )
    into v_result
    from dual;
    
    dbms_output.put_line('v_result:'||v_result);
    
    ...
    
  • What is the recommended API for reading/analysis of XML in Java files?

    Hello, everyone!

    In my application, I have to read a XML file. I think that Java has several APIs to parse XML files and as I am new to this, I would like to know from you what is the recommended Java for this API.

    Thank you.

    Marcos

    Unless you plan to edit nodes and I would recommend that you use a Sax parser, which is a lot less hunger of memory as a DOM parser. The DOM parser to read the entire document in memory for the manipulation of the user.
    If you are looking only to read the document and extract specific values then a DOM parser would be an exaggeration. If you are planning leave the document unchanged then a SAX parser is the way to go - a little more complex to write but worth the extra as it will be faster and more scalable.

  • Analysis of XML ESTK/INDESIGN deadline?

    Hi guys,.

    My title looks more confused my problem is:

    I am trying to create an XML object from a file XML with XML (xmlFile.read ());

    For reasonable size xml files, it's ok, but if the XML is huge, it's as if the script engine cannot create the XML object. Is this a known issue or me something wrong?

    Sorry if this is a cross-cutting issue but as I am trying to achieve via the ESTK and later with Indesign, I think there is some sense to ask here.

    TIA Loïc

    Alert() and $. writeln() are fine for small things, not so fine for great things.

    What savings myXML.read () in a string, then $.writeln-ing xmlstring.length?

    I'm skeptical that the problem is the read(). This works very well for me and who should be independent of the structure of the file, just, based on the length.

    Good luck!

  • Need help with analysis on XML DataGrid

    Hello

    I retrivied in my function from HttpService result data.


    < list >
    < user >
    < ename > JAMES < / ename >
    < > 7900 empno < / empno >
    < / user >
    < user >
    < ename > FORD < / ename >
    < > 7902 empno < / empno >
    < / user >
    < user >
    < ename > MILLER < / ename >
    < > 7934 empno < / empno >
    < / user >
    < / list >

    [Bindable]
    private var xmldata:XML;

    private void resultHandler(event:ResultEvent):void {}
    XMLDATA = Event.Result as XML;
    }


    < mx:DataGrid x = "50" y = "23" width = "469" height = "265" dataProvider = "{xmldata." The user} ">"
    < mx:columns >
    < mx:DataGridColumn headerText = "Type" dataField = "ename" / >
    < mx:DataGridColumn headerText = "Sales" dataField = "empno" / >
    < / mx:columns >
    < / mx:DataGrid >

    But this displays all the data in the DataGrid control.

    Could someone help me please.

    Thank you.

    After obtaining data affect data in the data grid

    DataGrid.DataProvider = xml;

    and also do datagrid.invalidateList () after u get the data if the line above does not help

    See also if the data provider is not null, if nothing is done.

Maybe you are looking for