Analysis on OFA XML

Hello, everyone. Good evening.

I am trying to validate an XML file with a schema, but for some strange reason, it does not work.

I use JDev with OA Extension version 12.1.3 (jdk 1.5.0_05).

Despise the OA, the client version is located on EBS 12.2.4. We tried to do the last patch, but we faced some problems and so far, we use this version expired without any problem.

Say, by default JDev, I am able to do validation (the tests were conducted with the same version of the jdk). Specifically, class validator survey an exception when the XML is not valid. But this does not happen on JDevOA.

Have no idea what could happen?

Here's the code for entire test class.

import java.io.File;
import java.io.IOException;


import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;


import org.w3c.dom.Document;


import org.xml.sax.SAXException;


public class XMLReader2 {


    private Document doc;


    public XMLReader2(File xmlFile,
                      File schemaFile) throws ParserConfigurationException,
                                              SAXException, IOException {
        DocumentBuilder db =
            DocumentBuilderFactory.newInstance().newDocumentBuilder();
        doc = db.parse(xmlFile);
        validateXml(doc, schemaFile);
    }


    public void validateXml(Document doc, File schemaFile) throws SAXException,
                                                                  IOException {
        SchemaFactory schemaFactory =
            SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = schemaFactory.newSchema(schemaFile);
        Validator validator = schema.newValidator();
        validator.validate(new DOMSource(doc));
    }


    public static void main(String[] args) throws SAXException,
                                                  ParserConfigurationException,
                                                  IOException {
        File xmlFile =
            new File("C:\\Users\\marcelo.cavalcante\\Desktop\\itenscontratuais.xml");
        File schemaFile =
            new File("C:\\Users\\marcelo.cavalcante\\Desktop\\technip.xsd");
        XMLReader2 xMLReader = new XMLReader2(xmlFile, schemaFile);
    }




}

On JDevOA, I use a messageFileUpload to get the XML file and I use the overloaded method parse (InputStream), passing of BlobDomain.getInputStream ().

For the XSD, I get like a StreamSource (getClass .getClassLoader () .getResourceAsStream ()) ().

I already checked that both files are read correctly, at least by the methods mentioned just above.

It is the XSD content.

<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="itemLista" type="itemListaType"/>

<xs:complexType name="itemListaType">
  <xs:sequence>
  <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="itemType">
  <xs:sequence>
  <xs:element name="descricao" type="xs:string"/>
  <xs:element name="desenho" type="xs:string"/>
  <xs:element name="uom" type="xs:string"/>
  <xs:element name="qtd" type="xs:decimal"/>
  </xs:sequence>
</xs:complexType>

</xs:schema>


And it's the XML content (intended to trigger an error, because the qtd element does not exist).



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<itemLista>
  <item>
  <descricao>BK 90010.4.082</descricao>
  <desenho>--</desenho>
  <uom>Adaptador 9/16" - 18 - 37° JIC</uom>
  </item>
</itemLista>



I really appreciate any help you can provide.

Marcelo Cavalcante.

Hello, everyone.

I did the job. method of getStorageByteArray(), for some reason, I don't know, gave me a corrupt (at least it seems that Yes) byte array. After changing to getBinaryStream(), I was able to validate the file.

Tags: Oracle Applications

Similar Questions

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

  • How to analysis of the XML in the sql statement?

    Hi friends, I have a table that contains a column of type CLOB, stores in xml format. For example, the data are like that

    <Employees xmlns="http://TargetNamespace.com/read_emp">
       <C1>106</C1>
       <C2>Harish</C2>
       <C3>1998-05-12</C3>
       <C4>HR</C4>
       <C5>1600</C5>
       <C6>10</C6>
    </Employees>
    
    

    So how can I write the sql statement for the analysis of the data at the top

    create or replace procedure parsing_xml

    (

    clob trans_payload

    trans_dir varchar2

    )

    as

    Start

    if(trans_dir='inbound/emp')

    then

    insert into emp_proj

    (

    employee_id

    last_name

    hire_date

    job_id

    salary

    department_id

    )

    Select t1.c1

    t1.c2

    t1.c3

    t1.c4

    t1.c5

    t1.c6

    from xmltable

    (

    XmlNamespaces ('http://TargetNamespace.com/read_emp' as 'emp').

    ' / ' emp:Employees by the way of xmltype (trans_payload)

    columns

    whole path of C1 'emp:C1. "

    path of varchar2 (10) C2 'emp:C2. "

    C3 varchar2 (10) path "emp:C3."

    C4 varchar2 (10) path "emp:C4."

    whole path of C5 "emp:C5."

    C6 varchar2 (10) path 'emp:C6 '.

    ) t1;

    end if;

    commit;

    end;

  • The analysis of an XML string

    Hi, I wonder if it is possible to skip creating a physics .xml file and parse the XML message I receive directly?

    normally, it takes

    builder.parse(fileConn.openInputStream());
    

    but it is not possible to open an InputStream on a string...

    ByteArrayInputStream built from String.getBytes () [or whatever we call.]

    It implements something like the idea of stringstream c ++.

  • The analysis of the xml in a text field string

    I call a Web service that returns a string in XML format as follows:

    < TemplateList >

    < template >

    < ID > 0 < /ID >

    < category >

    < name > Mine now < / name >

    < product >

    < ID > 0 < /ID >

    < description > SOLE HEEL CUP STAR JR. BLUE < / Description >

    < HDMSProductId > 227 < / HDMSProductId >

    < LawsonId > 216156 < / LawsonId >

    < PopupMessage / >

    < price / >

    < / product >

    < / category >

    < category >

    < name > old new < / name >

    < product >

    < ID > 0 < /ID >

    SMALL SLEEVES < description > TUBE PEDI-FOAM < / Description >

    < HDMSProductId > 224 < / HDMSProductId >

    < LawsonId > 216152 < / LawsonId >

    < PopupMessage / >

    < price / >

    < / product >

    < / category >

    < category >

    the four-legged < name > < / name >

    < product >

    < ID > 0 < /ID >

    SMALL SLEEVES < description > TUBE PEDI-FOAM < / Description >

    < HDMSProductId > 224 < / HDMSProductId >

    < LawsonId > 216152 < / LawsonId >

    < PopupMessage / >

    < price / >

    < / product >

    < / category >

    < category >

    Spirit of < name > < / name >

    < product >

    ... etc.

    < / product >

    < / category >

    < / template >

    < / TemplateList >

    I am drilling down to retrieve this string data. What is the best way to do so in the form of LC Designer?

    I tried to link the result to a text box and use applyXPath, but it's complicated when there is more than 1 product to go. Suggestions and examples are greatly appreciated!

    Hello

    What do you call the Web service.  If you use a data connection, and then you normally would bind a field to the result (even if this field is hidden).  If you use NET. SOAP, by default, you will get a return JavaScript object.

    But to answer your question, you can use E4X

    var responseString = "';

    responseXML var = new XML (responseString);

    for each (var in responseXML.Template.Category category)

    {

    Console.println (category. Name + "" + category. Product.Description);

    }

    Concerning

    Bruce

  • Analysis of conditional XML

    Hi all

    Database version: 11.23.0

    I have the below code

    CREATE OR REPLACE
    PROCEDURE get_order_type
    AS
      l_input VARCHAR2(30000);
      --l_response_xml VARCHAR2(30000);
      l_http_req UTL_HTTP.req;
      l_http_resp UTL_HTTP.resp;
      l_xml_resp VARCHAR2(30000):='<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>              
    <result>              
    <orderType selected="false">RE</orderType>               
    <orderType selected="true">RO</orderType>               
    </result>';
      v_parser xmlparser.parser;
      v_doc xmldom.domdocument;
      v_nl xmldom.domnodelist;
      v_n xmldom.domnode;
      l_returnCondition       VARCHAR2(30):='U';
      l_productBrand          VARCHAR2(30):='';
      l_productNumber         VARCHAR2(30):='9CL066-004';
      l_applicationSegment    VARCHAR2(30):='';
      l_orderCategory         VARCHAR2(30):='';
      l_subMarketSegment      VARCHAR2(30):='';
      l_marketSegmentAbbr     VARCHAR2(30):='';
      l_designApplication     VARCHAR2(30):='';
      l_modelNumber           VARCHAR2(30):='ST3450856SS';
      l_returnReason          VARCHAR2(30):='Q';
      l_internalProductName   VARCHAR2(30):='';
      l_inNewBuildProduction  VARCHAR2(30):='';
      l_nonSerializedFlag     VARCHAR2(30):='';
      l_encryptionType        VARCHAR2(30):='';
      l_originalShipToCountry VARCHAR2(30):='';
      l_orderType             VARCHAR2(30):='';
      l_OOW                   VARCHAR2(30):='';
      l_driveAge              VARCHAR2(30):='';
      l_productFamily         VARCHAR2(30):='';
      l_productLine           VARCHAR2(30):='';
      l_region                VARCHAR2(30):='';
      l_customerType          VARCHAR2(30):='';
      l_shipTo                VARCHAR2(30):='08250000';
      l_billTo                VARCHAR2(30):='08250000';
      l_decoupleFlowFlag      VARCHAR2(30):='';
      l_corpCode              VARCHAR2(30):='';
      l_salesChannel          VARCHAR2(30):='';
      l_shipToCountryCode     VARCHAR2(30):='';
    BEGIN
      l_input := '<input>                
    <returnCondition>'||l_returnCondition||'</returnCondition>                
    <originalShipDate></originalShipDate>                
    <productBrand></productBrand>                
    <productNumber>'||l_productNumber||'</productNumber>                
    <applicationSegment></applicationSegment>                
    <orderCategory></orderCategory>                
    <subMarketSegment></subMarketSegment>                
    <marketSegmentAbbr></marketSegmentAbbr>                
    <designApplication></designApplication>                
    <returnReason>'||l_returnReason||'</returnReason>                
    <modelNumber>'||l_modelNumber||
      '</modelNumber>                
    <internalProductName></internalProductName>                
    <inNewBuildProduction></inNewBuildProduction>                
    <nonSerializedFlag></nonSerializedFlag>                
    <encryptionType></encryptionType>                
    <originalShipToCountry></originalShipToCountry>                
    <orderType></orderType>                
    <OOW></OOW>                
    <creditMemoFlag></creditMemoFlag>                
    <driveAge></driveAge>                
    <productDecoupleFlag></productDecoupleFlag>                
    <region></region>                
    <customerType></customerType>                
    <shipTo>'||l_shipTo||'</shipTo>                
    <billTo>'||l_billTo||'</billTo>                
    <decoupleFlowFlag></decoupleFlowFlag>                
    <corpCode></corpCode>                
    <salesChannel></salesChannel>                
    <shiptocountrycode></shiptocountrycode>
    </input>';
      l_http_req := UTL_HTTP.begin_request('http://okdev1233.okla.seagate.com:8130/grs_jboss_rs/rest/OrderTypeXMLPost/', 'POST', 'HTTP/1.1');
      UTL_HTTP.set_header(l_http_req, 'Content-Type', 'application/xml');
      utl_http.set_header(l_http_req, 'Content-Length', LENGTH(l_input));
      UTL_HTTP.write_text(l_http_req,l_input);
      l_http_resp := UTL_HTTP.get_response (l_http_req);
      utl_http.read_text(l_http_resp,l_xml_resp);
      --DBMS_OUTPUT.put_line(l_response_xml);
      UTL_HTTP.end_response(l_http_resp);
      v_parser := xmlparser.newparser;
      xmlparser.parseclob(v_parser, l_xml_resp);
      v_doc := xmlparser.Getdocument(v_parser);
      xmlparser.freeparser(v_parser);
      v_nl := xslprocessor.selectnodes(xmldom.makenode(v_doc),'//result');
      FOR LP IN 0 .. XMLDOM.GETLENGTH(V_NL) - 1
      LOOP
        v_n := xmldom.item(v_nl, lp);
        Dbms_Output.Put_Line('ORDER_TYPE '|| Xslprocessor.Valueof(V_N,'orderType'));
      END LOOP;
      dbms_xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN UTL_HTTP.end_of_body THEN
      UTL_HTTP.end_response(l_http_resp);
    WHEN OTHERS THEN
      dbms_xmlparser.freeParser(v_parser);
      dbms_xmldom.freeDocument(v_doc);
      dbms_output.put_line(sqlerrm);
    END get_order_type;
    
    BEGIN
      get_order_type();
    END;
    

    I hardcoded the XML I have to analyze, and I need to pick up the OrderType for which the selected = "true", but I always get the first value only whatever it be selected true or false, could you please help me with this.

    Thanks and greetings

    Srinivas

    Use XQuery to extract the value, it is simpler than XMLParser/XMLDom:

    SQL > declare

    2

    3 l_xml_resp varchar2 (30000): =.

    4    '

    5

    6       RE

    7       RO

    8     ';

    9

    l_order_type 10-varchar2 (30);

    11

    12 start

    13

    14 select xmlcast)

    15 xmlquery ('/ result/orderType [@ selected = "true"] ")

    16 passage xmlparse (document l_xml_resp)

    17 return content

    18             )

    19 as varchar2 (30)

    20           )

    21 in l_order_type

    22 double;

    23

    24 dbms_output.put_line (' order type = ' | l_order_type);

    25

    26 end;

    27.

    Order type = RO

    PL/SQL procedure successfully completed

  • the analysis for the XML child nodes

    Hello

    I have the following XML

    ' < AllocSimulation >
    elements <>
    < > 76 ItemNo < / ItemNo >
    < DisplayCodes >
    < DisplayCode > 1 < / DisplayCode >
    < DisplayCode > 2 < / DisplayCode >
    < / DisplayCodes >
    < / object >
    elements <>
    < > 767 ItemNo < / ItemNo >
    < DisplayCodes >
    < DisplayCode > 3 < / DisplayCode >
    < DisplayCode > 5 < / DisplayCode >
    < / DisplayCodes >
    < / object >
    < / AllocSimulation > '

    How can I extract elements such as

    No display item code
    76 1.2
    767 3.5



    I ran the following query
         Select  * From
    xmltable('AllocSimulation/items'  passing  xmltype('<AllocSimulation>
    <items>
         <ItemNo>76</ItemNo>     
         <DisplayCodes>
              <DisplayCode>     1     </DisplayCode>
              <DisplayCode>2     </DisplayCode>     
         </DisplayCodes>
      </items>
      <items>
         <ItemNo>767</ItemNo>     
         <DisplayCodes>
              <DisplayCode>     3     </DisplayCode>
              <DisplayCode>5     </DisplayCode>     
         </DisplayCodes>
      </items>
    </AllocSimulation>')      columns       
         Item Varchar2(10) Path  'ItemNo',
      display xmltype path '//DisplayCode');
    result
    76 < DisplayCode > 1 < / DisplayCode > < DisplayCode > 2 < / DisplayCode >
    767 < DisplayCode > 3 < / DisplayCode > < DisplayCode > 5 < / DisplayCode >

    Manjusha Muraleedas wrote:
    It is one of the solutions... any solution straight forwatd for this?

    That's the one that I would have suggested too.

    Another possibility would be to expand the collection in a subquery using the MULTISET operator, but I prefer the first approach.

    To summarize (assuming that the document is stored in the TMP_XML table):

    SELECT x.itemno
         , cast(
             multiset(
               select code, min, max
               from XMLTable('DisplayCodes/DisplayCode'
                     passing x.display
                     columns
                 code  varchar2(100) path 'code'
                     , Min   number(10)    path 'Min'
                     , Max   number(10)    path 'Max'
              )
             )
             as displaycodes_vtt
           ) as display_collection
    FROM tmp_xml t
       , XMLTable('/purchase/items'
           passing t.object_value
           columns
          ItemNo  varchar2(30) path 'ItemNo'
           , display xmltype      path 'DisplayCodes'
         ) x
    ;
    

    or,

    SELECT d.itemno
         , cast(collect(displaycode(p.code, p.Min, p.Max)) as displaycodes_vtt) as display_collection
    FROM tmp_xml t
       , XMLTable('/purchase/items'
           passing t.object_value
           columns
          ItemNo  varchar2(30) path 'ItemNo'
           , display xmltype      path 'DisplayCodes'
         ) d
       , XMLTable('DisplayCodes/DisplayCode'
           passing d.display
           columns
          code  varchar2(100) path 'code'
           , Min   number(10)    path 'Min'
           , Max   number(10)    path 'Max'
         ) p
    GROUP BY d.itemno
    ;
    
  • The analysis via an XML file

    Hello

    I work with an XML file that is generated through the API of Google Books.  I'll apologize in advance if I don't get quite accurate XML terminology - it's my first foray into some of the tags XML see  I'm reading a XML file in and attempt to send data:

    "< cfhttp url = 'http://www.google.com/books/feeds/volumes?q=john+grisham+the+firm & min-viewability biased =" method = "GET" > "

    < CFSET xmlfile = xmlparse (cfhttp.filecontent) >


    < cfset xmlsize = arraylen (xmlfile.feed.entry) >


    < cfloop from = "1" = "" #xmlsize # "index ="a">"

    < b > title: #xmlfile.feed.entry [a].title.xmlText # < /b > < br >
    < b > Format: #xmlfile.feed.entry [a].format.xmlText # < /b > < br >
    < b > author: #xmlfile.feed.entry [a].creator.xmlText # < /b > < br >
    < b > identifier1: #xmlfile.feed.entry [a].identifier.xmlText # < /b > < br >
    < b > identifier2: #xmlfile.feed.entry [a] .identify [2] .xmlText # < /b > < br >

    < / cfoutput >
    < / cfloop >

    It works pretty well.  Here's the problem: there is often a third identifier field (xmlfile.feed.entry [a] .identify [3] .xmlText)- but not always.

    I'm testing the existence of this field before you post.  I tried the following:

    < CFIF isdefined("xmlfile.feed.entry[a].identifier[3].xmlText") >
    is defined

    < CFELSE >

    is not defined
    < / cfif >

    Gives the typical error:

    Parameter 1 of function IsDefined, which is now xmlfile.feed.entry [a] .identify [3] .xmlText, must be a valid variable name syntactically.

    I would use structkeyExists, but I can't understand how the third node (?) using the reference code:

    < cfif structKeyExists(xmlfile.feed.entry[a],"identifier") > only works for xmlfile.feed.entry [a] .identify [1] .xmlText

    < cfif structKeyExists(xmlfile.feed.entry[a],"identifier[3]") > is not valid.

    So with strucktkeyexists, I can not understand how to properly reference the name of the variable...

    Any help?  Or the best ideas to verify the existence of this variable?

    The node you are looking at is an array, so:

    you need to do. At the present time, you test for the attribute 'xmltext' rather than to check its node parent exists.

    HTH.

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

  • WebWorks structure bad XML OS 7 - config.xml error analysis-

    I get this error when compiling with SDK WebWorks 2.3.1.5

    [INFO]                  Parsing of the command line options
    [INFO]                  Bbwp.properties analysis
    [INFO]                  Validation of archive application
    [INFO]                  The analysis of config.xml
    [ERROR]                 Impossible to analyze the file config.xml - bad structure XML

    It's my config.xml file


    http://www.w3.org/ns/widgets ".
    ' xmlns:RIM ='http://www.blackberry.com/ns/widgets '
    version = "2.0".
    RIM: header = "" Widget-RIM: RIM/widget ">"
     
      http://www.myWeb.com/myplaybookapp/theApp.html
    RIM: copyright = "Copyright 2012-2013 mycomp.com" > my comp ".

     
     

    My application
     
     
    My app description
     

    <>committees mode = "portrait" / >
     
     <>
    backgroundColor = "#A4C1D8."
    foregroundImage = "img/allcategories.png"
    onLocalPageLoad = "true" >
      
     


     
     


       
     


     

    subdomains of http://www.myComp.com"="true">
      subdomains of http://ADN.eBay.com"="true">


    Copyright (c) 2013 Itassets.
    THE SOFTWARE IS PROVIDED "AS WHAT ', WITHOUT WARRANTY OF ANY KIND,.
    EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
    OF MERCHANTABILITY, FIT HAS A PARTICULAR PURPOSE AND
    ABSENCE OF COUNTERFEIT. IN ANY CASE, THE AUTHORS OR COPYRIGHT
    HOLDERS BE RESPONSIBLE FOR ANY CLAIM, DAMAGE OR OTHER LIABILITY,
    WHETHER IN AN ACTION OF CONTRACT, INSULT OR OTHERWISE, ARISING
    WHERE IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER TRANSACTIONS IN THE SOFTWARE.
     

     

    Hello

    Your href missing a symbol of closure ".»

    For reference, this site gives a decent XML validator:
    http://www.w3schools.com/XML/xml_validator.asp

    Saved my bacon a few times :-)

  • Why read XML taking so long?

    The 'answer' is perhaps that "XML is not intended for this purpose... "but here is the situation:

    I'm parsing of a directory tree and creating a table of clusters, one for each folder in the tree.  To save it to the 'user-friendly' on the disc format, I chose XML, in part because "it's here", because it is a 'standard', and part because he "embarked" in the file enough data LabVIEW structure it is easy, in principle, to recover the data in the same shape as I initially wrote (i.e. in the form of clusters with a specified TypeDef table).

    I did my routine to a directory with about 2700 folders tree.  It took 14 seconds to analyze the tree, about 0.1 second to write to the file (1.7 MB) XML, but over a minute and a half to read it back in and recover the original data.  Incidentally, I made a comparison between the "written data" and "read data", and all the 25 000 elements (the cluster had 9 elements) are the same, so at least to read and write XML "works."

    I'm always surprised at the 800-fold difference between reading and writing.  I suspect that this shift is not linear with the "size of the problem", since in the beginning, I tried to do this with a larger painting of 4900 what took 0.25 seconds to write, but I "gave up" after what seemed to be too long to wait (sorry, it's so no scientist, but I think it was 3-4 minutes at least).  However, now that I see that there is a difference of 800-fold for my previous example, I'll wait at least five minutes (800 * 0.25 sec = 200 s, 5 min = 300 sec)... (time goes away...)

    Patience rewarded - it took 322 seconds, which is about 1200 times slower (not to criticize my calculations - I'm rounding when I report time, but use the millisecond values when I calculate ratios...).  So the more you do it, it gets the slower.

    Hmm - we are going to prove by doing a small folder.  How about one with only 85 files?  Which takes 21 msec to write and 102 msec to read, a factor of 5 only!  Wow, this is certainly not a linear growth.

    What happens here?  Is there a problem with the analysis of large XML files?  [I must point out that I use a simple XML File reading (array) for the table (of which will prove be cluster), and then in a for loop do a "Unflatten from XML' to recover the cluster.]  I'm guessing that the loop is to behave linearly, as all clusters are (with the exception of their content) identical, then the part "polynomial time" should be "reading of XML File (array).

    Not sure why this should be the case.  It would seem, to me, that since LabVIEW tables are always "identical elements", read a file with 1000 'elements' and turn it into an array of 1000 elements should take approximately 10 times longer than that for an array of 100 elements, unless there is something that is extremely inefficient.  Is this something that can withstand being examined and possibly optimized?

    Bob Schor

    PS - was curious enough to do more tests.  I started with a 'Master Data Set' of 4906 records, then dealt with 'nested subsets' (which is a subset of the master, a subset of the subset, etc.) to try to compare of"apples with apples" (on a PC, of course).  My samples were 20, 210, 2736 and 4906 records.  The write speed of files has been between 10 K and 24K Records/sec on this beach, which is about nearly linearly with size.  However, a similar measure for the reading of records varies between 3K (for all 20 items) and 15 (for all), reducing the size has increased.  I traced a field of logarithmic data and got a slope of 0.1 for writing (a slope of 0 means speed is linear with the number of cases), but a slope of-0,95 for playback)


  • Loading XML Labview schema files in python(or matlab)

    Hello

    Does anyone have experience loading labview XSD in python or matlab or similar?  Or is there a better format to the output into that could have an easier interface.  I guess I want to be able to use the labview interface I have as much as possible, but to any other treatment elsewhere.  Vaguely hoped that there could be a simple conversion or schema imput I can use - without having to maintain several different sets of input\output code on different systems - ideas?

    JP

    Thank you

    So I guess if you want something doing...

    I have implemented something that helps with analysis of the XML in python.  I must say that I have not tested much, but it seems to do the simple things I need ok at the moment. I have the joint where it might be useful for someone else.

    Basically, the two files that you need are LabviewXMLDataLoader.py and ContextDict.py - the first is the module that parses the XML, the second is a module that I also stole and maimed so that its easier to have nested 'dicitionaries"which I think are the closest in python to clusters in LV

    PulsedMeasurement_v2.py is an example of how I load a lv object variables into a python object.

    Anyway, as I said it is not perfect, but it's a starting point.

  • Unique number with the manipulation of XML on the 8520 with OS 4.6

    Our application works on many devices with os 4.6 to 7. It's a platform for learning with a function like get server classes and show to the user. This course has the configuration xml file this demand analysis.

    App works fine on all phones, except one, it is 8520 with OS 4.6. In the log file, I see that the issue is part of the analysis of this xml file. Is classic DOM parser but this code works well on all OTHER phones, so the question is not in the format of this file. In addition, we cannot reproduce the developer side with Simulator, this problem only exists on the real phone.

    I guess that this problem is specific for 8520 with OS 4.6 and probably that you encountered with this at the beginning. So if you have the answer or guess it please share it with me. Any help would be apreciated.

    I mislead you.

    His language classic gap between me and my client. We didn't understand, and now this error occurs on many devices. So my question is meaningless.

    Thank you for your help.

  • Unable to parse the file config.xml - bad xml structure

    I'm doing a simple application for blackberry phones.  I used the code on the site of dev on creating your first application.


    http://www.w3.org/ns/widgets ".
    "xmlns:RIM ="http://www.blackberry.com/ns/widgets"
    version = "1.0.0.0" >
      DevBlog
      BlackBerry Developer Blog
     
    email = '[email protected]' > John Doe
     
      http://devBlog.BlackBerry.com"/ >
     

    I edited it for the site we want to and other details as follows:


    http://www.w3.org/ns/widgets ".
    "xmlns:RIM ="http://www.blackberry.com/ns/widgets"
    version = "1.0.0.0" >
     
     DeVryUniversity 
     DeVry University Library 
     
    email ="[email protected]" > Danny coats "
      
     http://library.DeVry.edu/cgi-bin/Pwebrecon.cgi?DB=local&page=first"/ >
     

    It gives me the following error when I compile it:

    C:\Program Research In Motion\BlackBerry WebWorks Packager > bbwp "C:\Users\".
    Danny Coats\workspace\applications\DeVryLibrary\DeVryLibrary.zip.
    [INFO]                  Parsing of the command line options
    [INFO]                  Bbwp.properties analysis
    [INFO]                  Validation of archive application
    [INFO]                  The analysis of config.xml
    [ERROR]                 Impossible to analyze the file config.xml - bad structure XML

    I use Windows 7 Professional and the latest version of the SDK of Blackberry WebWorks.  I find nothing in the community for this to solve.

    Any suggestions will be greatly appreciated.

    I had the same error when you try your config.
    So, I try to analyse.
    I found the error is in the value of the content item, you must:

    http://library.DeVry.edu/cgi-bin/Pwebrecon.cgi?DB=local&page=first

    and should be:

    http://library.DeVry.edu/cgi-bin/Pwebrecon.cgi?DB=local & page = First

    If the special characters in the URL must be converted to their html entities.

  • document.getElementsByTagName("*") truncates the querystrings in xml

    Hey. A difficult for me, being is not a guru in xml. I pasted the code below and the relevant xml. It seems that after analysis of an xml document, when you convert the result a NodeList, querystrings are truncated.

    For example, a URL such as domainGoesHere/something.aspx? a = 1 & b = 2 & c = 3

    is replaced by domainGoesHere/something.aspx? a = 1

    I know & is illegal in xml, with the exception of things like "but of course you need in URLs... I tried to convert the & characters &, but nothing helped.

    What is the proper way to preserve the URL querystrings?

    See you soon,.

    Justin D.

    The last element in the xml file is truncated.

    
    - http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:nyt="http://www.nytimes.com/namespaces/rss/2.0" version="2.0">
    - 
      NYT > Global Home
      http://www.nytimes.com/pages/global/index.html?partner=rss&emc=rss
      http://www.nytimes.com/services/xml/rss/nyt/GlobalHome.xml" />
      
      en-us
      Copyright 2010 The New York Times Company
      Tue, 24 Aug 2010 03:55:27 GMT
    - 
      NYT > Global Home
      http://graphics.nytimes.com/images/section/NytSectionHeader.gif
      http://www.nytimes.com/pages/global/index.html?partner=rss&emc=rss
      
    - 
      U.S. General Cites Ambitious Goals to Train Afghan Forces
      http://www.nytimes.com/2010/08/24/world/asia/24military.html?partner=rss&emc=rss 
    

    The song "& emc = rss" is truncated.

    
        private static NodeList GetNodeListFromInputStream(InputStream is) {
    
            NodeList list = null;
            InputStream strippedIS = GetStrippedXmlStreamFromInputStream(is);
    
            if (strippedIS == null) // Stripping problem- malformed xml?
                return null;
    
            byte[] bytes = new byte[1];
    
            try {
    
                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory. newInstance();
                docBuilderFactory.setNamespaceAware(true);
                docBuilderFactory.setAllowUndefinedNamespaces(true);
                DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
                bytes = IOUtilities.streamToBytes(strippedIS);
                ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
    
                docBuilder.isValidating();
                Document doc = docBuilder.parse(bais);           // Get stream from xml file    strippedIS
    
                list = doc.getElementsByTagName("*"); 
    
            }
            catch ( Exception e )
            {
                    System.out.println( "\n\n**** Parse exception: " + e.getMessage() + "\n");
                    return null;
            }
    
            return list;
    

    Hello. You're right it should work, but somehow it does not. I just changed to replace & with 'and business' and it was ok. Changed after. TKS for help, J.

Maybe you are looking for