Help analyze XML

Hello

Can someone recommend me a post or article to learn XML parse in BB. ?

Thanks in advance

I can recommend the search service.  I typed XML in there and that was the first thing that came out...

http://supportforums.BlackBerry.com/T5/Java-development/use-the-XML-parser/Ta-p/445210

Tags: BlackBerry Developers

Similar Questions

  • Help parsing XML (XMLParseDemo.java)

    Hello world

    I'm trying to parse the XML code in my application. Here's a sample of what I'm trying to analyze:

    
    
      http://api.netflix.com/catalog/titles/autocomplete?{-join|&|term}
      
        
      
      
        
      
      
        
      
      
        
      
    
    

    For the parser, I use the XMLDemoScreen.java that is provided in the JDE samples. What I'm trying to do is to analyze all of theitem. However, when I run the application, my output is as follows:<p class="help"> <pre> autocomplete url_template = <a href="http://api.netflix.com/catalog/titles/autocomplete?{-join" rel="external nofollow noreferrer">http://api.netflix.com/catalog/titles/autocomplete?{-join</a>|&|term}" autocomplete_item title autocomplete_item title autocomplete_item title autocomplete_item title </pre> <p class="help">So, that's the impression not the values of "title". Anyone know why? Is it because the element contains<title short="">?<p class="help"> <p class="help">Thanks for your help. Here is the code that I use (which can be found in the JDE samples):</p> <pre> /* * XMLDemoScreen.java * * Copyright © 1998-2009 Research In Motion Ltd. * * Note: For the sake of simplicity, this sample application may not leverage * resource bundles and resource strings. However, it is STRONGLY recommended * that application developers make use of the localization features available * within the BlackBerry development platform to ensure a seamless application * experience across a variety of languages and geographies. For more information * on localizing your application, please refer to the BlackBerry Java Development * Environment Development Guide associated with this release. */ package com.kflicks.xml; import java.io.InputStream; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.xml.parsers.*; import org.w3c.dom.*; /** * The main screen for the application. Displays the results of parsing the XML * file. */ /* package */public final class XMLDemoScreen extends MainScreen { // Constants // ----------------------------------------------------------------------------------- private static final int _tab = 4; InputStream input; /** * This constructor parses the XML file into a W3C DOM document, and * displays it on the screen. * * @see Document * @see DocumentBuilder * @see DocumentBuilderFactory */ public XMLDemoScreen(InputStream input) { setTitle(new LabelField("XML Demo")); this.input = input; try { // Build a document based on the XML file. DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(input); // Normalize the root element of the XML document. This ensures that // all Text // nodes under the root node are put into a "normal" form, which // means that // there are neither adjacent Text nodes nor empty Text nodes in the // document. // See Node.normalize(). Element rootElement = document.getDocumentElement(); rootElement.normalize(); // Display the root node and all its descendant nodes, which covers // the entire // document. displayNode(rootElement, 0); } catch (Exception e) { System.out.println(e.toString()); } } /** * Displays a node at a specified depth, as well as all its descendants. * * @param node * The node to display. * @param depth * The depth of this node in the document tree. */ private void displayNode(Node node, int depth) { // Because we can inspect the XML file, we know that it contains only // XML elements // and text, so this algorithm is written specifically to handle these // cases. // A real-world application will be more robust, and will handle all // node types. // See the entire list in org.w3c.dom.Node. // The XML file is laid out such that each Element node will either have // one Text // node child (e.g. <Element>Text</Element>), or >= 1 children // consisting of at // least one Element node, and possibly some Text nodes. Start by // figuring out // what kind of node we're dealing with. if (node.getNodeType() == Node.ELEMENT_NODE) { StringBuffer buffer = new StringBuffer(); indentStringBuffer(buffer, depth); NodeList childNodes = node.getChildNodes(); int numChildren = childNodes.getLength(); Node firstChild = childNodes.item(0); // If the node has only one child and that child is a Text node, // then it's of // the form <Element>Text</Element>, so print 'Element = "Text"'. if (numChildren == 1 && firstChild.getNodeType() == Node.TEXT_NODE) { buffer.append(node.getNodeName()).append(" = \"").append( firstChild.getNodeValue()).append('"'); add(new RichTextField(buffer.toString())); } else { // The node either has > 1 children, or it has at least one // Element node child. // Either way, its children have to be visited. Print the name // of the element // and recurse. buffer.append(node.getNodeName()); add(new RichTextField(buffer.toString())); // Recursively visit all this node's children. for (int i = 0; i < numChildren; ++i) { displayNode(childNodes.item(i), depth + 1); } } } else { // Node is not an Element node, so we know it is a Text node. Make // sure it is // not an "empty" Text node (normalize() doesn't consider a Text // node consisting // of only newlines and spaces to be "empty"). If it is not empty, // print it. String nodeValue = node.getNodeValue(); if (nodeValue.trim().length() != 0) { StringBuffer buffer = new StringBuffer(); indentStringBuffer(buffer, depth); buffer.append('"').append(nodeValue).append('"'); add(new RichTextField(buffer.toString())); } } } /** * Adds leading spaces to the provided string buffer according to the depth * of the node it represents. * * @param buffer * The string buffer to add leading spaces to. * @param depth * The depth of the node the string buffer represents. */ private static void indentStringBuffer(StringBuffer buffer, int depth) { int indent = depth * _tab; for (int i = 0; i < indent; ++i) { buffer.append(' '); } } } </pre> <p class="help">Thank you!</p> <p class="reply">You should get properly "title" attributes of node via</p> <p class="reply">NamedNodeMap attributes = node.getAttributes ();</p> <p class="reply">iterate through the mapping of attributes to retrieve the values you want.</p>

  • Answer need help parsing XML

    Hi, I am new to JAVA and don't work with her each time than in quite awhile.

    I have a question that is probably very simple for someone with experience in JAVA.

    I have a piece of writing JAVA code that will have to apply for a credit card transaction to a gateway, gateways response come in the form of XML.

    Here's the response XML file in its entirety.
    <?xml version="1.0" encoding="utf-8"?>
    <string xmlns="https://www.domain.com/ws/">1,0,Transaction accepted,0</string>
    I worked with other XML responses and was able to get what I need. However, this XML response is a little different, and I can't understand how to correctly analyze the text string I need at the end which is:
    1,0,Transaction accepted,0
    Any help would be appreciated.

    Thank you!

    jl1997 wrote:
    I used the following to try to get the information I need

    new PrintStream(ftemp).println("Root element :" + doc.getDocumentElement().getNodeName());
    new PrintStream(ftemp).println("Root value :" + doc.getDocumentElement().getAttribute("string"));
    

    Output of the above code is:

    Root element :string
    Root value :
    

    So I can identify the name of the node, which is 'chain', I just was not able to read the content of the node.

    Published by: jl1997 on April 9, 2013 08:05

    The element has no attribute named 'string. ' There only the content that you get using getTextContent() or the equivalent of what you use.

  • Help with XML - LIKE 3.0

    Hello everyone. I decided to start working with XML, because it allows me to load assets outside and more later very easily edit my applications without having to modify the fla itself. So, today, I looked at and read a few tutorials and now I am trying to build a Scroll event, throughout the XML and HAVE 3.0. Basically, what I want is to have several events within a movieclip that I fit in a scroll pane when I finished, because now I will focus on the extraction of data from the XML file, and he analyzes with AS 3.0. The layout is simple: a thumbnail image on the left and next to it on the right, there is the event title, date, and some info on this and it should have a dark gray background while the text is white. Each two events are apart 30 pixels and there are 5 events for now.

    OK, enough talking now let's make the code:

    XML code:

    <? XML version = "1.0" encoding = "utf-8"? >

    < EVENTSXML >

    < EVENT >

    < TITLE > event 1 < /title >

    < DATE > 04/12/2009 < / DATE >

    thumb0.jpg < GO > < / INCH >

    < INFO > text goes here < / INFO >

    < / EVENT >

    < EVENT >

    < TITLE > event 2 < /title >

    < DATE > 02/03/2009 < / DATE >

    thumb1.jpg < GO > < / INCH >

    < INFO > text goes here < / INFO >

    < / EVENT >

    < EVENT >

    < TITLE > event 3 < / TITLE >

    < DATE > 18/11/2008 < / DATE >

    thumb2.jpg < GO > < / INCH >

    < INFO > text goes here < / INFO >

    < / EVENT >

    < EVENT >

    < TITLE > event 4 < /title >

    < DATE > 09/10/2008 < / DATE >

    thumb3.jpg < GO > < / INCH >

    < INFO > text goes here < / INFO >

    < / EVENT >

    < EVENT >

    < TITLE > 5 < /title > event

    < DATE > 08/06/2008 < / DATE >

    thumb4.jpg < GO > < / INCH >

    < INFO > text goes here < / INFO >

    < / EVENT >

    < / EVENTSXML >

    ActionScript 3.0:

    var myXML:XML;

    var req:URLRequest = new URLRequest ("events.xml");

    var ldr:URLLoader = new URLLoader();

    LDR. Load (req);

    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, processXML);

    function processXML(e:Event):void

    {

    myXML = new XML (e.target.data);

    buildEvents (myXML.EVENT);

    }

    var eventScroll:MovieClip = new MovieClip();

    var padding: Number = 30;

    this.addChild (eventScroll);

    eventScroll.x = eventScroll.y = padding;

    function buildEvents(evnts:XMLList):void

    {

    for (var i: uint = 0; i < evnts.length (); i ++) {}

    var eventData:MovieClip = new MovieClip();

    eventData.y = (20 + padding) * i;

    eventData.itemNum = i;

    eventData.title = events [i]. TITLE;

    eventData.date = events [i]. DATE;

    eventData.thumb = events [i]. THE THUMB;

    eventData.info = events [i] .INFO;

    / / thumb container

    thisThumb:Sprite = new Sprite();

    var ldr:Loader = new Loader()

    var req:URLRequest = new URLRequest (eventData.thumb);

    ldr.load (req);

    thisThumb.addChild (ldr);

    eventData.addChild (thisThumb);

    eventScroll.addChild (eventData);

         }

    }

    now I'm stuck here... demand is not yet done, and when I publish the file I get errors, are errors:

    1067: constraint implied a value of type flash.display:Sprite to a type unrelated to class.

    Source: thisThumb:Sprite = new Sprite();


    1188: illegal assignment to the Sprite class.

    Source: thisThumb:Sprite = new Sprite();


    1120: access of undefined property thisThumb.

    Source: thisThumb.addChild (ldr);


    1120: access of undefined property thisThumb.

    Source: eventData.addChild (thisThumb);


    1119: access of possibly undefined property contentLoaderInfo via a reference with flash .net: URLLoader of static type.

    Source: ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, processXML);

    So where did I go wrong turn and how can I carry on with my code at the end of my application?

    PS: I don't want someone to do it for me, so in case someone decided to help me, please comment and explain your code because this application is for in the first place porpuses learning... Thanks in advance!

    infoF.wordWrap = true;

  • Gzip analyzes XML

    I've seen posts about issues with extracting XML and gzip. Separately, I have no problem doing either. But I can't send a gzipinputstream to my xml parser - he just throws exception and told me no stack trace.

    I send a parameter in my http request that determines if the server should return an XML file or the gziped XML file.  When you ask gzip, I can read and analyze very well. If I ask gzip and just read steam like this...

                    byte[] data = new byte[256];
                    int len = 0;
                    int size = 0;
                    StringBuffer raw = new StringBuffer();
    
                    while ( -1 != (len = inputStream.read(data)) )
                    {
                        raw.append(new String(data, 0, len));
                        size += len;
                    }
    

    It prints like my xml... so I guess that means his power to receive the data very gzip.

    However, if I ask gzip and try to analyze using the same code that works when I just parse xml, it fails.  Is there another step I have to do to convert the inputstream so Manager xml can be read?

    httpConnection = (HttpConnection)Connector.open(url);
    inputStream = httpConnection.openDataInputStream();
    
    if(httpConnection.getResponseCode() == HttpConnection.HTTP_OK)
    {
    
        inputStream = new GZIPInputStream(inputStream);
        InputSource is = new InputSource(inputStream);
    
        is.setEncoding(desiredEncoding);
    
        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser parser = factory.newSAXParser();
    
        DefaultHandler hcHandler = new XMLParse();
    
        parser.parse(is,hcHandler);
    
    } //end if(httpConnection.getResponseCode() == HttpConnection.HTTP_OK)
    

    You should check to see if the content is gzip:

    String encoding = m_httpConnection.getHeaderField("Content-Encoding");
    If ((encodage! = null) & (encoding.indexOf ("gzip")! = - 1)) {}
    compressed = true;
    }

    Then, unzip it:

    If {(compressed)
    Gzip GZIPInputStream = new GZIPInputStream (dataInputStream);
    DataInputStream tmp = new DataInputStream (gzip);
    dataInputStream = tmp;
    }

    Now you can safely parse the XML code.

  • analyzes XML leaving text after &amp;

    Hi all

    I am pasring an XML file using dom.

    Here is my code snippet

    DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
    DocumentBuilder builder = factory.newDocumentBuilder ();
    factory.setIgnoringComments (true);
    factory.setIgnoringElementContentWhitespace (true);
    factory.setExpandEntityReferences (false);
    factory.setCoalescing (true);
    factory.setValidating (false);
    Document document = builder.parse (in-Stream);
    vecData = new Vector (1, 1);
    Element rootElement = document.getDocumentElement ();
    rootElement.normalize ();

    I used getNodeValue() to retrieve the value of the node.

    The text I'm without the text after &...

    as if I have the value of the node as

    http://imypage.ashx?ImageUrl=http%3A%2f%2fecx.images-123%2fimages%2fI%2f51atrAxEVlL._SL480_.jpg&Widt...

    Can someone help me with this.

    Thank you best regards &,.

    Sachin

    I am getting the http://imypage.ashx?imageurl=http%3a%2f%2fecx.images-123%2fimages%2fI%2f51atrAxEVlL._SL480_.jpg value

    Hi all

    That was the problem with the dom parser...

    I used SAXParser and abel to read all the characters in the string...

  • Help parsing XML message using PeopleCode

    Hi all

    I'm new to web services and XML, but was able to consume a WSDL and call the web service successfully.

    I am now trying to parse the XML message that I receive as an answer and to retrieve values that I need and with the response analysis problems. Here's what I did and the my AE Test code. Basically, I'm trying to navigate to the 'Results' element in the response, and then use GetChildNode to get the child nodes, then use FindNode to find items and their values.

    Here's the WSLD I used to create the web service in PS. I only need WSDL operation doSearch_3_15
    [https://www.epls.gov/epls/services/EPLSSearchWebService?wsdl]

    My PC below calls the web service and passes the family name "ZOD" as a search parameter, and this should return 3 results back.

    I'm grabbing the response back and analyse to extract the values I need.

    + & inXMLDoc = CreateXmlDoc(""); +
    + & ret = inXMLDoc.ParseXmlString (& answer. GenXMLString()); +

    The question that I have is to be able to get 'inside' the results node (there are 3 of them) and browse the child nodes and get my values.

    AE Test code:

    Local channel & charge useful, & responseStr, last;
    Local Message msg & response;
    Local XmlDoc xml & inXMLDoc;
    Local of the array of XmlNode GetElements, RecordList, & field1List & aResultsNode;
    Local XmlNode RecordNode & ClassificationNode;
    Local file & MYFILE;

    + & FilePath = ' / psoft/ultimate.9/fpsdv1/prod/ap/files / '; +
    "+ & FileName = uhc_report.xml" +;
    + & MYFILE = GetFile (& FilePath | & FilePath_Absolute of filename, "W", %); +.

    + & payload = "<? XML version = "1.0"? "> < doSearch xmlns ="https://www.epls.gov/epls/services/EPLSSearchWebService">"; +
    + & first = ""; +
    + & last = "ZOD"; +
    + & payload = & load useful | "< query > < first >. and first. "< / first > < last > | & last. "< / last > < / query > < / doSearch > ';" +

    + & xml = CreateXmlDoc (& payload); +
    + & msg = CreateMessage (Operation.DOSEARCH_3_15, IntBroker_Request %) +;
    + & msg. SetXmlDoc(&xml); +

    + & reply = IntBroker.SyncRequest % (& msg); +

    If All(&reply) then

    If & MYFILE. IsOpen then
    + & MYFILE. WriteString (& response. GenXMLString()); +
    On the other
    MessageBox (0, "", 0, 0, "cannot Open File.");
    End - If;

    + & inXMLDoc = CreateXmlDoc(""); +
    + & ret = inXMLDoc.ParseXmlString (& answer. GenXMLString()); +

    If & then ret

    + & field1List = & inXMLDoc.GetElementsByTagName ("results"); +

    If & field1List.Len = 0 Then
    MessageBox (0, "", 0, 0, "GetElementsByTagName node not found");
    Error ("GetElementsByTagName Node not found");
    + / * perform some processing of error * / +.
    On the other
    J = 1 & at & field1List.Len
    If & j > 1 Then
    + MessageBox(0, "", 0, 0, &field1List [&j].) NodeName | " = " | field1List [& j]. NodeValue); +

    + & RecordNode = & inXMLDoc.DocumentElement.GetChildNode (& j); +
    If & RecordNode.IsNull then
    MessageBox (0, "", 0, 0, "GetChildNode not found");
    On the other
    + & ClassificationNode = & RecordNode.FindNode ("classification"); +
    If & ClassificationNode.IsNull then
    MessageBox (0, "", 0, 0, "FindNode not found");
    On the other
    + & SDN_TYPE = Substring (& ClassificationNode.NodeValue, 1, 50); +
    MessageBox (0, "", 0, 0, "& SDN_TYPE =" |) (& SDN_TYPE);
    End - If;
    End - If;

    End - If;
    -End;
    End - If;

    MessageBox (0, "", 0, 0, & inXMLDoc.DocumentElement.NodeName);

    On the other
    + / * perform some processing of error * / +.
    MessageBox (0, "", 0, 0, "error.) ParseXml");
    End - If;

    On the other
    MessageBox (0, "", 0, 0, "error.) No response").
    End - If;


    See the link below for the web service XML response with a few Notes message. As a link between the response as an XML doc (had to add .txt to xml extension to download).  I appreciate your help and comments.
    http://compshack.com/files/XML-message.PNG
    http://compshack.com/files/uhc_report.xml_.txt

    And here is the result of my AE Test. I'm able to find 3 County results, that I expected because I have 3 files returned from the web service, but fails for some reason, GetChildNode.

    results = (0,0)

    GetChildNode not found (0.0)

    results = (0,0)

    GetChildNode not found (0.0)

    results = (0,0)

    GetChildNode not found (0.0)

    Published by: Maher on 12 March 2012 10:21

    Published by: Maher on 12 March 2012 10:41

    Hello

    I made a few adjustments to your code.
    First of all you need not create an XMLDOC object on the IB response, since it is already a XML.
    Instead use something like this:

    / * Send & receive message * /.
    & ResMsg = % IntBroker.SyncRequest (& ReqMsg);
    / * Get XMLDOC of the response message * /.
    & xml = ResMsg.GetXmlDoc ();
    strxml = & xml. GenFormattedXmlString();
    / * read the reply * /.
    & aNodeData = & xml. GetElementsByTagName ("yournodename")

    Now your code fixed

    &inXMLDoc = CreateXmlDoc("");
    &ret = &inXMLDoc.ParseXmlFromURL("c:\temp\test.xml");
    If &ret Then
       &field1List = &inXMLDoc.GetElementsByTagName("results");
       If &field1List.Len = 0 Then
          MessageBox(0, "", 0, 0, "GetElementsByTagName Node not found");
          Error ("GetElementsByTagName Node not found");
          /* do error processing */
       Else
          For &j = 1 To &field1List.Len
             If &j > 1 Then
                MessageBox(0, "", 0, 0, &field1List [&j].NodeName | " = " | &field1List [&j].NodeValue);
                &RecordNode = &field1List [&j];
    
                &RecordChildNode = &RecordNode.GetChildNode(&j);
                If &RecordChildNode.IsNull Then
                   MessageBox(0, "", 0, 0, "GetChildNode not found");
                Else
                   MessageBox(0, "", 0, 0, "&RecordChildNode name:" | &RecordChildNode.NodeName);
    
                   &ClassificationNode = &RecordNode.FindNode("classification");
                   If &ClassificationNode.IsNull Then
                      MessageBox(0, "", 0, 0, "FindNode not found");
                   Else
                      &SDN_TYPE = Substring(&ClassificationNode.NodeValue, 1, 50);
                      MessageBox(0, "", 0, 0, "&SDN_TYPE = " | &SDN_TYPE);
                   End-If;
    
                End-If;
             End-If;
          End-For;
       End-If;
       MessageBox(0, "", 0, 0, &inXMLDoc.DocumentElement.NodeName);
    
    Else
       /* do error processing */
       MessageBox(0, "", 0, 0, "Error. ParseXml");
    End-If;
    

    Result:
    PeopleTools 8.51.12 - Application Engine
    Copyright (c) 1988-2012 Oracle and/or its affiliates.
    All rights reserved

    results = (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: results = (0.0) (0.0)

    & RecordChildNode name: address (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: & RecordChildNode name: address (0.0) (0.0)

    & SDN_TYPE =
    Individual (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: & SDN_TYPE =
    Individual (0.0) (0.0)

    results = (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: results = (0.0) (0.0)

    & RecordChildNode name: agencyUID (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: & RecordChildNode name: agencyUID (0.0) (0.0)

    & SDN_TYPE =
    Individual (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: & SDN_TYPE =
    Individual (0.0) (0.0)

    results = (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: results = (0.0) (0.0)

    & RecordChildNode name: classification (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: & RecordChildNode name: classification (0.0) (0.0)

    & SDN_TYPE =
    Individual (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: & SDN_TYPE =
    Individual (0.0) (0.0)

    soapenv:envelope (0,0)
    Game number of messages: 0
    Number of messages: 0
    Reason for the message: soapenv:Envelope (0.0) (0.0)
    Application Engine TEST_AE program ended normally

    Find the differences :)

    Published by: Hakan Biroglu on March 12, 2012 19:22

  • need help with xml data

    Hi all

    need your spiritual help once more!
    I have a table 'product' as below:

    create table product)
    product_id number (2),
    product_info varchar (4000));

    Select * from product:
    product_id product_info
    1 < ticketing > < product = 'TV' > < productservice = "shipping" > < / productservice > < / product = 'TV' > < / ticket >

    I need to get the column product_info information in a new table with 2 columns product and productservice product_details. as in: -.
    Select * from product_details:
    product_id product productservice
    1 expedition TV

    any suggestions on how to do it.
    PS-> for a product it can be several services and there may be several products for a ticket.

    Your XML file is not well formed at all (so many errors in there).

    However, if you had a valid XML code, you could do something like that...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as product_id, '' as product_info from dual union all
      2             select 2, '' from dual)
      3  --
      4  -- end of test data
      5  --
      6  select t.product_id, x.*
      7  from t
      8      ,xmltable('/ticketing/product'
      9                passing xmltype(t.product_info)
     10                columns product varchar2(10) path '/product/@name'
     11                       ,service varchar2(15) path '/product/productservice/@name'
     12*              ) x
    SQL> /
    
    PRODUCT_ID PRODUCT    SERVICE
    ---------- ---------- ---------------
             1 TV         shipping
             2 VCR        delivered
    
  • analyzing XML based on the elements of the array...

    Hello

    I wonder why two of my three tracks below are undefined or 'white', I think that everything is set up the way it should be, however, when I try and draw the attributes, they are not defined. What I am doing wrong? I hope it's an easy place for someone, my head popped up a bit (I show my naiviety).

    I will not go into why I do it this way, but I'm trying to get this data model to work.

    Thanks for any help,

    Chipleh

    var teamXML:XML = <team headerText="Field1,Field2,Field3,Field4,Field5,Field6,Field7" hitsFieldNumber="5">
      <player Field1="BLAH 1" Field2="BLAH 2" Field3="BLAH 3" Field4="BLAH 4" Field5="BLAH 5" Field6="BLAH 6" Field7="BLAH 7"/>
    </team>
                    
        var xmlHeaderText:XMLList = teamXML.@headerText;        
        var headerTextArray:Array = [];    
        var headerTextString:String = teamXML.@headerText;        
        headerTextArray = headerTextString.split(",");
        trace("headerTextArray = "+ headerTextArray);
        for(var i:int = 0;i<headerTextArray.length;i++)
        {
            trace(i + " : " + headerTextArray[i]);        
            trace("teamXML.player.@headerTextArray[i] = " + teamXML.player.@headerTextArray[i]);        
            var theField:String = headerTextArray[i];
            trace("teamXML.player.@headerTextArray[i] = " + teamXML.player.@theField);        
        }    
        
    
    use:
    
    var teamXML:XML = 
      
    
    
        var xmlHeaderText:XMLList = teamXML.@headerText;
        var headerTextArray:Array = [];
        var headerTextString:String = teamXML.@headerText;
        headerTextArray = headerTextString.split(",");
        trace("headerTextArray = "+ headerTextArray);     for(var i:int = 0;i 
               
  • Analyzing XML and data storage approach with OSB

    Hello!

    I hope that you could suggest an appropriate approach to make this request.

    We need treat and find data in XML files (which are consistent with an XSD) and store them in the database. There is a huge amount of XML files to deal with every day and these files are received through some messaging queues and must also be shipped to different queues.

    We use OSB as tool integration approach should therefore be centred OSB. I have now the OSB is able to process XML files through the XQuery expressions and store data in the database (at least to read the data, I don't know if she is able to insert data directly). But the problem I see, is that we have to analyze a lot of data of each XML file, so I think it could be very cunbersome to build all the XQuery expressions in a stadium of the OSB.

    Another approach, I thought consist of an MDB that receives XML, JAXB support building process and data stores files in the database. OSB could receive the queue of the original XML files, send them to the queue target as well as MDB to commit processing.

    What approach seems most suitable for you?

    Thank you.

    Daniel.

    The OSB database adapter would give you XSD modeling the tables that you want to insert. You can consider fields of mapping of the input XML to XSD data adapter directly.

    Come discover the database adapter, and you will find them easy.

  • Help parsing XML with multiple namespaces

    I have a function that returns the following XML:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <fetchReportDataResponse xmlns="http://RptArchive/">
             <fetchReportDataResult>
                <feed xmlns="urn:WA.Ecy.ADS.RptAuditImage.Services">
                   <Table xmlns="">
                      <Report>Person Item</Report>
                      <Program>WQ</Program>
                      <Application>PARIS</Application>
                   </Table>
                   <Table xmlns="">
                      <Report>Select DB by Fragment</Report>
                      <Program>WQ</Program>
                      <Application>PARIS</Application>
                   </Table>
                   <Table xmlns="">
                      <Report>EmployeeDetailReport</Report>
                      <Program>ADS</Program>
                      <Application>Son1</Application>
                   </Table>
                   <Table xmlns="">
                      <Report>DeliveryTestReport</Report>
                      <Program>ADS</Program>
                      <Application>Test</Application>
                   </Table>
                   <Table xmlns="">
                      <Report>Report_NoDMRs_ProcessByDeliveryMethod</Report>
                      <Program>WQ</Program>
                      <Application>PARIS</Application>
                   </Table>
                </feed>
             </fetchReportDataResult>
          </fetchReportDataResponse>
       </soap:Body>
    </soap:Envelope>
    I wrote to try to get the data of the following SQL statement:
    select application,program_name,report
    from 
    (select extract(enforce_pkg.get_ads_report_data,'/soap:Envelope/soap:Body/fetchReportDataResponse/fetchReportDataResult/child::node()',
    'xmlns="http://RptArchive/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/') xml
    from dual )t,
    xmltable('/feed/Table'
    passing t.xml
    columns
    report varchar2(100) path 'Report',
    program_name varchar2(100) path 'Program',
    application varchar2(100) path 'Application');
    {code}
    This returns zero records.  If I break this up, I see that my extract statement is working:
    
    {code}
    select extract(enforce_pkg.get_ads_report_data,'/soap:Envelope/soap:Body/fetchReportDataResponse/fetchReportDataResult/child::node()',
    'xmlns="http://RptArchive/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/') xml
    from dual ;
    Returns
    <feed xmlns="urn:WA.Ecy.ADS.RptAuditImage.Services">
    <Table xmlns="">
    <Report>Person Item</Report>
    <Program>WQ</Program>
    <Application>PARIS</Application>
    </Table>
    <Table xmlns="">
    <Report>Select DB by Fragment</Report>
    <Program>WQ</Program>
    <Application>PARIS</Application>
    </Table>
    <Table xmlns="">
    <Report>EmployeeDetailReport</Report>
    <Program>ADS</Program>
    <Application>Son1</Application>
    </Table>
    <Table xmlns="">
    <Report>DeliveryTestReport</Report>
    <Program>ADS</Program>
    <Application>Test</Application>
    </Table>
    <Table xmlns="">
    <Report>Report_NoDMRs_ProcessByDeliveryMethod</Report>
    <Program>WQ</Program>
    <Application>PARIS</Application>
    </Table>
    </feed>
    So I guess that there is something wrong with my implementation of the function xmltable - perhaps because there are two namespaces involved,
    one of them is null (I know that it is bad form--I am a consumer here and do not have control of the source).

    Any help would be appreciated.

    Best regards, Tony

    You can use xmltable with a simple xpath as follows:

    create or replace type ty_Rep  as object (rep_name varchar2(40), prg_name varchar2(40),app_name varchar2(40));
    /
    create or replace type tb_Rep as table of ty_Rep;
    /
    
    set serveroutput on
    declare
      l_xml xmltype := xmltype('
                                 
                                   
                                       
                                          
                                             Person ItemWQPARIS
    Select DB by FragmentWQPARIS
    EmployeeDetailReportADSSon1
    DeliveryTestReportADSTest
    Report_NoDMRs_ProcessByDeliveryMethodWQPARIS
    '); l_Rep tb_Rep := tb_Rep(); begin select ty_Rep(x.Report, x.Program, x.Application) bulk collect into l_Rep from (select l_XML as m from dual) d ,xmltable ('//Table' passing d.m columns Report varchar2(40) path 'Report' ,Program varchar2(40) path 'Program' ,Application varchar2(40) path 'Application') as x; dbms_output.put_line(l_Rep.count); for r in 1..l_Rep.count loop dbms_output.put_line('Report: ' || l_Rep(r).rep_name ); dbms_output.put_line('Program: ' || l_Rep(r).prg_name ); dbms_output.put_line('Application: ' || l_Rep(r).app_name ); end loop; end; / 5 Report: Person Item Program: WQ Application: PARIS Report: Select DB by Fragment Program: WQ Application: PARIS Report: EmployeeDetailReport Program: ADS Application: Son1 Report: DeliveryTestReport Program: ADS Application: Test Report: Report_NoDMRs_ProcessByDeliveryMethod Program: WQ Application: PARIS PL/SQL procedure successfully completed.
  • Need help on xml and datagrid

    Hi all

    I'm fighting with xml data as my dataProvider for my datagrid. I hope someone can look at this and see what the devil I'm doing wroing. No matter what I try my datagrid columns are empty.

    I tried several variations, changing the dataprovider to myApprovalsXML... viewentries... myApprovalsXML or entrydata etc. as well as the evolution of the datafields. I get lines but empty column values.

    Thanks in advance for any help!

    Sujit thanks

    Which worked great!

  • HELP: Default XML or the grid of data from the server

    Help

    I work a flash function proof-of-concept for a client that reads an XML file in a data grid. As coded, it works a lot when I run locally, but when I transfer to the server web it does not work (grid object shows but no data). And I guess I don't understand the remote debugging because when I 'Start the remote debugging session' and 'Opening' it appears to download again, works very well.

    The remote SWF file is located in the http://www.gw-webs.com/TSI/teamTSI.SWF. HTML and XML are also in the same remote folder.

    The code is all in frame 1 of the file (and not in a clip):

    _Global.nameAR = new Array;
    _Global.titleAR = new Array;
    _Global.biographyAR = new Array;
    _Global.contactAddressAR = new Array;
    _Global.contactPhoneAR = new Array;
    _Global.contactEmailAR = new Array;
    _Global.pictureFileAR = new Array;
    _Global. ARindex = 0;

    hd_name._visible = false;
    hd_title._visible = false;
    hd_biography._visible = false;
    hd_phone._visible = false;
    hd_email._visible = false;
    hd_mail._visible = false;


    function processXMLData(xml:XML)
    {
    var i: number = 0;
    var num:Number = xml.firstChild.childNodes.length;

    for (var i = 0; i < num; i ++) {}
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [0] _Global.nameAR = xml.firstChild.childNodes;
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [1] _Global.titleAR = xml.firstChild.childNodes;
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [2] _Global.biographyAR = xml.firstChild.childNodes;
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [3] _Global.contactAddressAR = xml.firstChild.childNodes;
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [4] _Global.contactPhoneAR = xml.firstChild.childNodes;
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [5] _Global.contactEmailAR = xml.firstChild.childNodes;
    Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue Sublst.ChildNodes(1).ChildNodes(0) [6] _Global.pictureFileAR = xml.firstChild.childNodes;
    }
    var dataAR = new Array;

    for (i = 0; i < num; i ++) {}
    dataAR = ({name: _global.nameAR, title: _global.titleAR });
    }

    dg_team. DataProvider = dataAR;
    }

    var xmlData = new XML();
    System.useCodepage = true;
    xmlData.ignoreWhite = true;

    xmlData.onLoad = {function (ok:Boolean)}
    If {(ok)
    processXMLData (this);
    } else {}
    trace ("XML doesn't not load");
    }
    };

    Create the data grid listener object click
    var dgListener:Object = new Object();
    dgListener.cellPress = {function (evt_obj:Object)}
    I have = evt_obj.itemIndex;

    If (_global.nameAR
    <>null) {}
    hd_name._visible = true;
    tx_name. Text = _global.nameAR ;
    }
    else {}
    hd_name._visible = false;
    tx_name. Text = "";
    }

    If (_global.titleAR
    <>null) {}
    hd_title._visible = true;
    tx_title. Text = _global.titleAR ;
    }
    else {}
    hd_title._visible = false;
    tx_title. Text = "";
    }

    If (_global.biographyAR
    <>null) {}
    hd_biography._visible = true;
    tx_biography. Text = _global.biographyAR ;
    }
    else {}
    hd_biography._visible = false;
    tx_biography. Text = "";
    }

    If (_global.contactPhoneAR
    <>null) {}
    hd_phone._visible = true;
    tx_phone. Text = _global.contactPhoneAR ;
    }
    else {}
    hd_phone._visible = false;
    tx_phone. Text = "";
    }

    If (_global.contactEmailAR
    <>null) {}
    hd_email._visible = true;
    tx_email. Text = _global.contactEmailAR ;
    }
    else {}
    hd_email._visible = false;
    tx_email. Text = "";
    }

    If (_global.contactAddressAR
    <>null) {}
    hd_mail._visible = true;
    tx_mail. Text = _global.contactAddressAR ;
    }
    else {}
    hd_mail._visible = false;
    tx_mail. Text = "";
    }
    };

    xmlData.load ("teamTSI_en.xml");

    Add the listener.
    dg_team.addEventListener ("cellPress", dgListener);

    Stop();

    Yes, you have found it. I used lower case letters used on the first character of the name of the xml file in the URL of the load statement line. Thank you very much for your help!

  • Help please XML...

    Hi all

    I'm looking for more help XML base. I have the xml file as I read in (I can control the content). I want to read in, take some user input and modify the content of the XML with a replacement.

    When the user enters a value of say 123 I want to replace XXX by 123. For some reason I can't get this to work. I'm a total jerk of XML. Here is the code that I use today without success...

    What happens, is the XMLNode is another element named aPath with my value. I tried different combinations of code so that it works, and get errors of null values or adding an item. Ugh. This should be simple, and I'm sure it is. I just can't understand it. Can you help me? Can I change the xml file to be what I want. So if this is the problem let me know.

    Thank you

    STeveR

    Copy the following code should help you get started:

  • Help Gallery XML

    Hey, I searched through some XML galleries out there but they all seem to have the same structure and this is you have a picture, click Next and a new image is loaded.
    What I tried to do, is to have - for example, project1_mc, project2_mc etc. - buttons that are responsible for 3 or 4 images for this 'project' at the same time. Then scroll you through the images loaded, rather than loading them on "next".
    Does anyone know a script like that around? Or is it so hard to do?
    Any help would be greatly appreciated thanks.
    B

    Looks like you want a style class MultiLoader.

    I know that David Stiller has one on his site.

    http://www.quip.net/blog/2007/Flash/ActionScript-20/tracking-multiple-files-part2

    I have one that is a variant of this approach. The link to mine is in the history of comment - under gwd - and yes I still "working on it". I would recommend that read you David article (perhaps including part1 as well!).

Maybe you are looking for