XSL file to format XML Document

Hey programmers,.

This thread is referring to this one (http://supportforums.blackberry.com/t5/Java-Development/Reading-XML-document/m-p/512637) which was resolved yesterday.

A little history: I ripped with success of XML from a server in response to a post message, I was able to put it inside a document using InputStream and was able to read the text content of this XML on the Blackberry screen.

Now I would use a .xsl file to format the XML document and then display it on the screen as HTML. Is this possible? How would I go to do this?

I found this piece of code on the internet (java, not specific to the blackberry associated):

public class CreationHTML {}
public static void createHTML (xml, xsl string string, string html) bird Exception {}
Create the source of DOM
DocumentBuilderFactory FabriqueD = DocumentBuilderFactory.newInstance ();
DocumentBuilder builder = fabriqueD.newDocumentBuilder ();
File fileXml = new File (xml);
Document document = builder.parse (fileXml);
Source source = new DOMSource (text);

Creation of the output file
File fileHtml = new File (html);
Result result = new StreamResult (fileHtml);

Configuration of the transformer
FabriqueT TransformerFactory = TransformerFactory.newInstance ();
StreamSource stylesource = new StreamSource (xsl);
Transformer transformer = fabriqueT.newTransformer (stylesource);
transformer.setOutputProperty (OutputKeys.METHOD, "html");
        
Transformation
transform. Transform (source, result);
}
Public Shared Sub main (String [] args) {}
try {}
createHTML ("Annuaire.xml", "Annuaire.xsl", "Annuaire.html");
} catch (Exception e) {e.printStackTrace () ;}
}
}

But actually I have a .xsl, not a string file, do you think that I could adapt it to meet my needs?

Many thanks for any help!

If you implement TransformerFactory on blackberry: sure, no problem.

In the opposite case: rather not.

Tags: BlackBerry Developers

Similar Questions

  • Need to XSL file create my XML file

    Hello world

    This is the first time that I post my question here in the XML section, in fact I have a XML file as
    <root_node>
        <node_1>
            <element>abc</element>
        </node_1>
    </root_node>
    Now when I retrieve data from this XML file so I need to get the root node in the Dept and 1 node as DeptRow and item as an identifier.
    While she will look like when I will actually try recover data
    <Dept>
        <DeptRow>
            <Id>abc</Id>
        </DeptRow>
    </Dept>
    So for this I need to use Transform method in java and generate an XSL file that can convert data according to my needs without modifying the original file.

    then may - does anyone know what content must exist in the XSL file.

    your help would be appreciated too

    Thank you
    FIZZZ...

    Apply an XSLT transformation to inpt XML. Please see
    http://XML.sys-con.com/node/48763

  • XSL file formatting

    XSL file formatting

    Hello.

    I have problem with this xsl files, the problem is the output for the date field and the number:
    a) `2011-05-13T21:50:00` instead of `13/05/2001 21:50:00`
    b) `.00` instead of `0`
    It is the output in XML format:
    <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
         <s:Schema id="RowsetSchema">
              <s:ElementType name="row" content="eltOnly" rs:CommandTimeout="30">
    
                   <s:AttributeType name="myDates" rs:number="6" rs:nullable="true" rs:writeunknown="true">
                        <s:datatype dt:type="dateTime" rs:dbtype="timestamp" dt:maxLength="16" rs:scale="0" rs:precision="19" rs:fixedlength="true"/>
                   </s:AttributeType>
    
                   <s:AttributeType name="Net" rs:number="29" rs:nullable="true" rs:writeunknown="true">
                        <s:datatype dt:type="number" rs:dbtype="numeric" dt:maxLength="19" rs:scale="2" rs:precision="10" rs:fixedlength="true"/>
                   </s:AttributeType>
    
                   <s:extends type="rs:rowbase"/>
              </s:ElementType>
         </s:Schema>
         <rs:data>
    
              <z:row myDates="2011-05-13T21:50:00" Net=".00" />
    
         </rs:data>
    </xml>
    This XML output is generate with the ASP code and saved in csv format:
    <!-- #include virtual="/_XML/adovbs.inc" -->
    
    <% 
    
    filename = "titty.xml" 
    
    Set xmlDoc = CreateObject("MSXML2.DOMDocument.4.0")
    Set xslDoc = CreateObject("MSXML2.DOMDocument.4.0")
    
    %>
    
    <%
    
    sql = "SELECT * FROM tbl_login" 
    Set rs = objConn.Execute(sql) 
    
    rs.Save xmlDoc, 1 
    
    xmlDoc.Save Server.MapPath(filename)
    
    rs.Close 
    Set rs = Nothing 
    
    %>
    
    <%
    
     Set oDOM = CreateObject("MSXML2.DOMDocument.4.0")
     oDOM.async = False 
     
     oDOM.Load Server.Mappath(filename)
      
     Set oXSL = CreateObject("MSXML2.DOMDocument.4.0") 
     oXSL.async = False 
     
     oXSL.Load Server.Mappath("Trasform_csv.xsl")
     
     strTransform = oDOM.transformNode(oXSL) 
     
     Set fso = CreateObject("Scripting.FileSystemObject")
     strPath = Server.Mappath("testme.csv")
      
     Set file = fso.opentextfile(strPath, 2, True)
     file.write strTransform
    
     file.Close 
     Set file = Nothing
      
     Set fso = Nothing
                            
     Set oDOM = Nothing 
     Set oXML = Nothing 
     Set oXSL = Nothing 
      
    %>
    The XSL file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" 
     xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 
     xmlns:rs="urn:schemas-microsoft-com:rowset" 
     xmlns:z="#RowsetSchema">
         <xsl:output omit-xml-declaration="yes"/>
         <xsl:template match="/">
              <!-- show a header by looking Schema element -->
              <xsl:for-each select="/xml/s:Schema/s:ElementType/s:AttributeType">
                   <xsl:value-of select="@name"/>
                   <xsl:choose>
                        <xsl:when test="position()!=last()">
                              <!-- xls -->
                             <xsl:text>     </xsl:text>
                             <!-- csv -->
                             <!--xsl:text>,</xsl:text-->
                        </xsl:when>
                        <xsl:otherwise>
                             <xsl:text>
    </xsl:text>
                        </xsl:otherwise>
                   </xsl:choose>
              </xsl:for-each>
              <!-- row data -->
              <xsl:for-each select="/xml/rs:data/z:row">
          <xsl:variable name="row" select="."/>
          <!-- for each column -->
                   <xsl:for-each select="/xml/s:Schema/s:ElementType/s:AttributeType">
                      <!-- display each column if it exists -->
                     <xsl:variable name="columnName" select="@name"/>
                        <!-- go through all columns and display something that matches-->
                        <xsl:value-of select="$row/@*[name()=$columnName]" />
                        <!--xsl:value-of select="translate($row/@*[name()=$columnName],'.',',')" /-->
                        <xsl:if test="position()!=last()">
                            <!-- xls -->
                             <xsl:text>     </xsl:text>
                             <!-- csv -->
                             <!--xsl:text>,</xsl:text-->
                        </xsl:if>
             </xsl:for-each>
                   <xsl:text>
    </xsl:text>
           </xsl:for-each>
         </xsl:template>
    </xsl:stylesheet>
    I need another exit in the XML file:
    <z:row myDates="13/05/2001 21:50:00" Net="0.00" />
    And the CSV file:
    13/05/2001 21:50:00, 0
    Can you help me?
    Thanks in advance.
    See you soon

    Published by: user6317803 on August 30, 2011 13:31

    Published by: user6317803 on August 30, 2011 13:34

    Published by: user6317803 on August 30, 2011 13:36

    Hello

    What database you use?

    I guess you could easily get in shape your columns directly in the SQL query, using something like TO_CHAR (Oracle), CONVERT (SQLServer) or CAST/DATE_FORMAT (MySQL), instead of a plain "SELECT."

  • HTML and XML document tags

    Good day everyone,

    I create a small Flash application that will be updated content to an XML file. The XML document looks like this:
    < event >
    < data >
    < 1 > visible < / visible >
    Position test < title > 1 < / police > < / Heading1 >
    body test < BodyText > < / BodyText >
    < ButtonText > tap me < / ButtonText >
    < URLText > http://www.rmp-consulting.com < /URLText >
    < / data >

    The above structure is repeated for each event.

    In my Flash app, I walk through the XML document with the following code:

    While (element! = null) {}

    If (element.nodeName.toUpperCase () == 'VISIBLE') {}
    isVisible.push (element.firstChild.nodeValue);
    }

    If (element.nodeName.toUpperCase () == 'Title 1') {}
    Heading.push (element.firstChild.nodeValue);
    }
    If (element.nodeName.toUpperCase () == "Subheading") {}
    subheading.push (element.firstChild.nodeValue);
    }
    If (element.nodeName.toUpperCase () == 'BODYTEXT') {}
    BodyText.push (element.firstChild.nodeValue);
    }
    If (element.nodeName.toUpperCase () == 'BUTTONTEXT') {}
    ButtonText.push (element.firstChild.nodeValue);
    }

    If (element.nodeName.toUpperCase () == 'URLTEXT') {}
    URLText.push (element.firstChild.nodeValue);
    }
    element = element.nextSibling;

    }
    I then put the dynamic text fields by using the values in the table:


    This.news1.heading.text = position [0];
    BodyText = this.news1.bodytext.text [0];
    ButtonText = this.news1.myButton.ButtonText.text [0];
    URLText = this.news1.URLText.text [0];

    Ideally, I want to be able to include some HTML for basic formatting of option in the XML document. I would like to change the color and size. But, as, as soon as I change my XML document to include these tags, the code above does not work correctly.

    Any suggestions?

    Can also answer my own message and answer...

    All I have to do was wrap my HTML tags with a

  • try to open a document, but he repeats to me is not a valid bitmap file or format

    Yes im trying to open a document, but he continues to say is not a valid bitmap file or format is not supported currently it please tell me what this means and what I need to do

    Thank you

    It's pretty, that makes what he says - the file is not a valid bitmap file, or it is damaged or it is not formatted properly.  Contact the source for the file and ask what program you need to open and use this program to open it.

  • INDD CS6 error: "InDesign can't open files in format 'InDesign CS5.5 Document'.

    Working in CS6 on Mac OS X 10.7.5: when I double click on an INDD file in the Finder, I get the following error in InDesign:

    "The 'name of the doc' document could not be opened. InDesign can't open files in format 'InDesign CS5.5 Document '. »

    It started recently and I was not able to understand why. I've not updated INDD or OS X. I can't think of anything that has changed, except perhaps an update to Java. Have not updated the latest OS yet.

    The I'm opening the files are files that I created with CS6 - only a few minutes ago.  I can open fine using the file > open command in InDesign, so I can open them, but I can't open them by double clicking it in the Finder or by dragging the INDD icon in the dock.

    The info in the said Finder's "Get Info" window is configurΘ for dΘmarrer in CS6 CS6 files and I have permissions to read and write. They are not locked.

    It is not disabling, but rather annoying and slows me down since it is one of the most common ways I open files.

    Any suggestsion would be appreciated.

    Probably will not work because this looks like a problem of operating system of some sort, but you can try trashing the prefs see replace your preferences

  • Convert flat file to XML document and store it in the Oracle database

    First of all:
    I have a flatfile and created an external table to read this file in Oracle
    Now, I want to create an XML document for each line and insert in the Oracle database, I think as XMLtype.
    Could you please give me some information/steps.

    Second:
    Are there performance issues, because every day, I need to check that the XML document stored in the database against the next file.
    Thank you.

    I won't tell it not in the same words that Marco used, but your solution is impassable and an invitation for bad things to happen.

    Wait miserable performance, and you will not be disappointed.

    The concept of total flexibility works up a code that you depend on has no idea what to do with what is playback.
    Will happen to enough short term and is roughly the equivalent of the absurdity of Java to be independent of the database.

    I would recommend you take the concept and consider, with your data volumes, something more likely to succeed.

  • He had to create to my XML file in the XSL file

    Hello world

    This is the first time that I post my question here in the XML section, in fact I have a XML file as
    <root_node>
        <node_1>
            <element>abc</element>
        </node_1>
    </root_node>
    Now when I retrieve data from this XML file so I need to get the root node in the Dept and 1 node as DeptRow and item as an identifier.
    While she will look like when I will actually try recover data
    <Dept>
        <DeptRow>
            <Id>abc</Id>
        </DeptRow>
    </Dept>
    So for this I need to use Transform method in java and generate an XSL file that can convert data according to my needs without modifying the original file.

    then may - does anyone know what content must exist in the XSL file.

    your help would be appreciated too

    Thank you
    FIZZZ...

    See a tutorial XSLT.
    http://XML.sys-con.com/node/48763

  • XML document lack of implementation in the form after adding the node

    Hi all

    I'm adding a new node to my XML document using java.

    After I add, when I print the doc, I can see the xml code is not properly 'indexed' or 'formatted' (with a step internal node within the parent node.)

    I have put OutputKeys.INDEX that Yes. But I still have this problem.


    Kindlly help me regarding this.


    Thank you
    Sabarisri. N

    After I add, when I print the doc, I can see that xml is not properly "indexed" (sic, "indented") or 'formatted' (with a step internal node within the parent node.)

    It is indeed a common place of what to get. Rarely these whitespace contravene semantic aspects of xml, but it's annoying to the human eye. The OutputKeys.INDENT on the transformer fixing certainly wouldn't heal and makes it worse.

    If the lack of alignment gets enough wide, sometimes I use a custom xsl file to put an order of it. This is how the xsl looks like: it is just a slight development of an identity transformation. And I assume you are using jdk1.5 + packaged xerces and xalan.

    
    
    
    
    
        
            
        
    
    
        
    
    
    

    Suppose to be called indenter.xsl, and put themselves in the working directory. Printing to a file may seem just that.

    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer(new StreamSource("indenter.xsl"));
    //suppose the doc is the document parsed and edited in the memory, and outfile is the path to output file
    t.transform(new DOMSource(doc), new StreamResult(new FileOutputStream(outfile)));
    

    I use xalan namespace to control the amount of space to indent. If you don't use of xalan, just leave these namespace declaration and the xalan:indent - amounted to and let the xsl processor using its default value.

    If you prefer instead of writing your own small xsl utilities, you can maybe google (mainly in using key as pretty print or a utility called htmltidy with w3c) to clean the misaligned output. Or check the documentation on the xsl processor used, some processor could have custom method to do the same.

    But cleaning may still run the risk of too interpret what can hold and is not. It is important to know what you finally want what to do and adjust according to your need.

    Published by: tsuji on Sep 21, 2011 07:57

  • Schema validation fails on the transformed XML document

    OK, this is weird.

    I get XML files that are supposed to conform to a given XSD. There are dozens of different parties who send these files. To be more precise, I refer to the Ontario Energy Board (OEB) PIPE Documents.

    I found that at least one sender sends invalid files. I can't that fixes to the source, so I'm working around that.

    for example
    <?xml version="1.0" encoding="UTF-8"?>
    <PIPEDocument  xmlns="http://www.oeb.gov.on.ca" 
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                              xsi:schemaLocation="http://www.oeb.gov.on.ca/ PIPEDocument.xsd" 
                              Version="4.0" 
                              DocumentReferenceNumber="xxx" CreationDate="20110825100008000ES">
    <MarketParticipantDirectory>
    <Sender>
    ...
    Oracle is not like this:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00344: namespace values "http://www.oeb.gov.on.ca" and "http://www.oeb.gov.on.ca/" differ
    OK, so to work around this problem, before schema validation, I apply an XSLT transformation to clean the top-level element:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.oeb.gov.on.ca">
    <xsl:output method="xml" indent="no"/>
    
    <xsl:template match="/">
        <xsl:copy>
          <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="*">
        <xsl:if test="local-name() = name()">
                <xsl:element name="{local-name()}">
                  <xsl:apply-templates select="@*|node()"/>
                </xsl:element>
        </xsl:if>
    </xsl:template>
    
    <xsl:template match="@*">
        <xsl:if test="local-name() = name()">
                <xsl:attribute name="{local-name()}">
                  <xsl:value-of select="."/>
                </xsl:attribute>
        </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    Nice: the fact that it is intended for:
    <?xml version="1.0" encoding="UTF-8"?>
    <PIPEDocument xmlns="http://www.oeb.gov.on.ca" 
                             Version="4.0" 
                             DocumentReferenceNumber="50520110825080908VA0001.EBT" 
                             CreationDate="20110825100008000ES">
    <MarketParticipantDirectory>
    <Sender>
    ...
    If I now the schema validate the above transformed XML, then it validates OK.

    Large? No, if I try to turn on the fly (i.e. without first transformation and followed by reading in the transformed data from the file), I get a strange error:
    declare
     v_xml xmltype := xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604.xml'), 0).transform(XDBURIType('/ERS_TEST01/PIPE/XSLT/V1.0/pre_validate_XSLT.xsl').getXML());
     v_xsd_name varchar2(255) := 'PIPE/Power/V4.0/PIPEDocument.xsd'; 
    begin
    if v_xml.isSchemaValid(v_xsd_name) = 1 then 
           dbms_Output.put_line('valid');
        else
           dbms_Output.put_line('invalid');
           
           --in order to get specific error info for a non-schema message need to convert the XML to schema based
           
           v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
          
           v_xml.schemaValidate();               
           
        end if;  
    end;
    /
    ORA-31043: Element '' not globally defined in schema ''
    Exsqueeze me? What element in the schema?

    The transformation itself works very well. Specifically, if I run the following:
    select xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604.xml'), 0).transform(XDBURIType('/ERS_TEST01/PIPE/XSLT/V1.0/pre_validate_XSLT.xsl').getXML()).getclobval() from dual;
    ... I get the desired result. Of course, if I save the result file and validate the fact that it works:
    declare
     v_xml xmltype := xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604_manually_saved.xml'), 0);
     v_xsd_name varchar2(255) := 'PIPE/Power/V4.0/PIPEDocument.xsd'; 
    begin
    if v_xml.isSchemaValid(v_xsd_name) = 1 then 
           dbms_Output.put_line('valid');
        else
           dbms_Output.put_line('invalid');
           
           --in order to get specific error info for a non-schema message need to convert the XML to schema based
           
           v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
          
           v_xml.schemaValidate();               
           
        end if;  
    end;
    /
    I would like to join example XML file, but it contains customer data so I can't do that. I would fix the XSD but it is the nest of a rat of 50 XSD with includes and a 300 script online registration scheme, so I can't do that.

    What I'm missing here?

    Looks like an Oracle bug for me at this isSchemaValid binds to a beginning of the XML instance and not to the instance transformed.

    thoughts?

    (using database Oracle 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production under linux)

    Published by: Pollocks01 on October 18, 2011 16:11

    Hello

    Looks like an Oracle bug for me at this isSchemaValid binds to a beginning of the XML instance and not to the instance transformed.

    That wouldn't be surprising. There are "few" bugs on the XSL transformation.
    Here's a recently posted: {: identifier of the thread = 2245703}

    The solution was to serialize the output and analyze again.
    So, what you describe on 'reading of a works file' makes me think it's the same kind of problem.

    You can also view the contents of the variable just after that:

    v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
    

    ?

  • In the XML document HTML tags

    I have an application that loads an XML file information and displays in a dynamic text box. Which works very well. Now, I want to add tags HTML of the information contained in the XML file for the dynamic text box will format. If I add html right:

    < Answer1 > Earth, < b > < /b > air, fire and water. < / Answer1 >

    I get a null value in the text box. If I encode

    < Answer1 > Earth, & gt; b & lt; Air & gt; / & lt; fire and water. < / Answer1 >

    It then displays

    Earth, the < b > < /b > air, fire and water.

    No help on how to code html embedded in an XML document, so a dynamic text box using the html code?

    Thank you.

    Just use CDATA tags around your HTML values, for example:

    air, fire and water.]] >

    HTH.

  • Is it safe to remove the date in the name of the xml document?

    Hi, the iTunes library xml document is titled "iTunes Library" 2015-07-11. Is this correct and problems can occur if l remove the name date?

    L ask because my Sonos system has trouble with importing iTunes playlists and they are suggesting that the document name length perhaps the question.

    Thank you

    This file is a copy of the database (.itl) iTunes created by iTunes, during an update.  The XML version of the library is always called iTunes Library.xml.  Is there is no basis for comment by Sonos, that it may be related to the length of the absolute path of the XML file - where it is on your system?

  • When I try to open files saved in my documents, microsoft word opens a page that looks like a kind of code. and does not open my saved work. How can I fix

    I open my documents. I find the file I'm looking for. I click on it to open it and it will automatically open in Microsoft word. with coded letters page which makes no sense.  most of these files is open in Picture Manager, but now all the... some will be open at all... How can this be repaired?

    Hello

    1. what version of Windows is installed on the computer?

    2. What is the format (file extension) of the document you want to open?

    3 are you aware of any changes made to the computer, before the show?

    I suggest to change the default program associated with a file type and look for the question.

    Change the programs that Windows uses by default

    http://Windows.Microsoft.com/en-us/Windows7/change-which-programs-Windows-uses-by-default

    I hope this helps.

  • Impossible to analyze the xml.aspx contained in the main.js.Iam get the following error"could not obtain XML document, and the connection has failed: status 500

    Impossible to analyze the xml.aspx contained in the main.js.Iam get the following error"could not obtain XML document, and the connection has failed: status 500

    My main.js resembles

    xmlDataSource var = {}
     
    URL: 'dcds. - symbianxml.aspx", etc. (sample).
     
    init: function() {}
    URL, successful reminder, the reminder of failure
    This.Connect (this.) (URL, this.responseHandler, this.failureHandler);
    },
     
    /**
    * Analyzes the XML document in an array of JS objects
    @param xmlDoc XML Document
    * @returns {table} array of objects of the device
    */
    parseResponse: {function (xmlDoc)}
        
    var chElements = xmlDoc.getElementsByTagName ("channel");
       
    channels of var = [];
      
    Console.log (chElements.Length);
      
    for (var i = 0; i)< chelements.length;="">
        
    var channel = {};
       
    for (var j = 0; j)< chelements[i].childnodes.length;="">
        
    var node = Sublst.ChildNodes(1).ChildNodes(0) chElements [i] [j];
                
    If (node.nodeType! = 1) {//not an element node}
    continue;
    }
           
    Channel [node. TagName] = node.textContent;
    }
       
    Channels.push (Channel);
    }
    Console.log (Channels.Length);
    return the strings;
    },
     
    /**
    Manages the response and displays the data from device web app
    @param xmlDoc
    */
    responseHandler: {function (xmlDoc)}
      
    var channel = this.parseResponse (xmlDoc);
    var markup = "";
       
    for (i = 0; i< channels.length;="">
       
    markup += this.generateHTMLMarkup (i, channels [i]);
    }
    document.getElementById("accordian").innerHTML = mark-up;
    },
     
    /**
    Generates HTML tags to insert in to the DOM Web App.
    * @index i, index of the device
    @param device, device object
    */
    /*
    generateHTMLMarkup: function (i, channel) {}
      
    var str ="";
    "Str += '.


    ' onclick =-"mwl.setGroupTarget ('#accordian ',' #items_" + i + "', 'ui-show ',' ui - hide');" + ".
    "mwl.setGroupTarget ('#accordian ',' item_title_ #" + i + "', 'ui-open', 'ui-farm'); Returns false; \ » > » ;
    "" Str += "" + channel ['name'] + ' ";
    "Str += '.
    ";
    "Str += '.
    ";
    "Str += '.
    "+" id: "+ channel ['id'] +" ' "
    ";
    "Str += '.
    "+" type: "+ channel ['type'] +" ' "
    ";
    "Str += '.
    "+" language: "+ channel ['language'] +" ' "
    ";
    "Str += '.
    «+ "bandwidth:" + "fast" channel + "»»
    ";
    "Str += '.
    "+" cellnapid: "+ channel ["cellnapid"] +". "
    ";
    "Str += '.
    «+ ' link: '+'start the video »»
    ";
    "Str += '.
    ";
    return str;
    },*/
    generateHTMLMarkup: function (i, channel) {}
       
    var str ="";
    "Str += '.
    ";
    str +=  "" +
    "" + channel ['name'] + ""+""
    ";
    "Str += '.
    «+ ' link: '+'start the video »»
    ";
         
    return str;

    },
     
    failureHandler: {function (reason)}
    document.getElementById("accordian").innerHTML = "could not get XML document.
    '+ reason;
    },
     
    /**
    Retrieves a resource XML in the given URL using XMLHttpRequest.
    @param url URL of the XML resource to retrieve
    @param called successCb, in the XML resourece is recovered successfully. Retrieved XML document is passed as an argument.
    @param failCb called, if something goes wrong. Reasons, in text format, is passed as an argument.
    */

    Connect: {function (url, successCb, failCb)
      
    var XMLHTTP = new XMLHttpRequest();
      
    XMLHTTP. Open ("GET", url, true);

    xmlhttp.setRequestHeader("Accept","text/xml,application/xml");
    xmlhttp.setRequestHeader ("Cache-Control", "non-cache");
    xmlhttp.setRequestHeader ("Pragma", "non-cache" "");
      
    var that = this;
    XMLHTTP.onreadystatechange = function() {}
       
    If (xmlhttp.readyState == 4) {}
        
    If (XMLHTTP. Status == 200) {}
         
    {if (!) XMLHTTP.responseXML)}
    try {}
    If server has not responded with good an XML MIME type.
    var domParser = new DOMParser();
    var xmlDoc = domParser.parseFromString(xmlhttp.responseText,"text/xml");
           
    successCb.call (that, xmlDoc);
           
    } catch (e) {}
    failCb.call (, "answer was not in an XML format.");
    }
              
    } else {}
    successCb.call (that, xmlhttp.responseXML);
    }
    } else {}
    failCb.call (this, "connection failed: status"+ xmlhttp.status ");
    }
    }
    };
    XMLHTTP. Send();
    }
    };

    Please see the content in main.js is fully analyzed.

    Forward for the solution to my request all members of the community...

  • Eception java.lang.error trying to create format XML string

    I am trying to create XML documents without having to build everything manually whenever I want to do this.  I created a XMLFile class to create the document.  When I try to launch my app TestFoo, I get untrapped Exception java.lang.error.  I tried kxml2, using org.w3c.dom, java XML, banging my head against the wall as to why it will not work until I finally just rolled my own simple implementation.  I always get the error!  No details are provided.  There is no stack trace.  I use the emulator 9000 "BOLD" crossing os 4.6.0 eclipse 3.4.1

    Console:

    Starting TestFooStarted TestFoo(154)Exit TestFoo(154)ErrorNo detail messageTestFoo Document  0x171TestFoo XMLFile  0x381TestFoo TestFoo  0x297TestFoo TestFoo main 0x276
    

    TestFoo.java

    import net.rim.device.api.system.Application;
    
    public class TestFoo extends Application {
    
      public static void main(String[] args) {      TestFoo foo = new TestFoo();      foo.enterEventDispatcher();   }
    
      public TestFoo() {        XMLFile xml = new XMLFile("rootNode");        xml.addProperty("myprop", "some value");      System.out.println(xml.toFormattedXMLString());       System.exit(0);   }}
    

    XMLFile.java

    public class XMLFile {   Document document;    public XMLFile(String rootElement) {      document = new Document(rootElement); }
    
      public void addProperty(String pName, String pText) {     Element elm = new Element("property");        elm.addAttribute("name", pName);      elm.setTextContent(pText);        document.appendChild(elm);    }    public String toFormattedXMLString() {     return document.toFormattedXML();    }}
    

    Element.Java

    import java.util.Enumeration;import java.util.Hashtable;import java.util.Vector;
    
    public class Element {   private Vector children;  private String name;  private String textContent;   private Hashtable attributes;
    
      public Element(String name) {     this.children = new Vector();     this.attributes = new Hashtable();        this.name = name; } public void appendChild(Element child) {      this.children.addElement(child);  } public Vector getChildren() {     return children;  } public String getName() {     return name;  } public void setName(String name) {        this.name = name; } public String getTextContent() {      return textContent;   } public void setTextContent(String textContent) {      this.textContent = textContent;   } public Hashtable getAttributes() {        return attributes;    } public boolean hasChildren() {        return (this.children.size() > 0); } public int childrenCount() {      return this.children.size();  } public String getAttributeValue(String name) {        return this.attributes.get(name).toString();  } public void addAttribute(String key, String value) {      this.attributes.put(key, value);  } public void addAttribute(String key, int value) {     addAttribute(key,Integer.toString(value));    } public void addAttribute(String key, long value) {        addAttribute(key,Long.toString(value));   } public void addAttribute(String key, boolean value) {     addAttribute(key, String.valueOf(value)); } public boolean hasAttribute(String name) {        return this.attributes.containsKey(name); } public Element getChild(int position) {       return (Element) this.children.elementAt(position);   } public Enumeration getAttributeKeys() {       return this.attributes.keys();    }}
    

    Document.Java

    import java.util.Enumeration;
    
    public class Document { private static final char _gt = '>';   private static final char _lt = '<';   private static final char _eq = '=';  private static final char _dqt = '"'; private static final char _cl = '/';  private static final char _sp = ' ';  private static final char _tab = '\t';    private static final byte[] _nl = System.getProperty("line.separator").getBytes();
    
      private Element rootNode; private StringBuffer sb;
    
      public Document(String rootName) {        this.rootNode = new Element(rootName);    } public void appendChild(Element child) {      this.rootNode.appendChild(child); } public String toFormattedXML() {      sb = new StringBuffer();      format(this.rootNode,0);      return sb.toString(); }
    
      private void format(Element node, int depth) {        writeOpenTag(node, depth);        for (int i=0;i0;i--) {            sb.append(_tab);      } }    private void writeOpenTag(Element node, int depth) {       indent(depth);        sb.append(_lt);       sb.append(node.getName());        for (Enumeration keys = node.getAttributeKeys();keys.hasMoreElements();) {            String key = keys.nextElement().toString();           sb.append(_sp).append(key);           sb.append(_eq).append(_dqt);          sb.append(node.getAttributeValue(key).toString());            sb.append(_dqt);      }    }    private void writeCloseTag(Element node, int depth) {       if (node.hasChildren()) {         sb.append(_lt).append(node.getName());        } else {          sb.append(_cl);       }     sb.append(_gt).append(_nl);    }}
    

    This line:

    private static final byte[] _nl = System.getProperty("line.separator").getBytes();
    

    is originally a NullPointerException because line.separator is not well supported. The line terminator standard for XML is CR/LF, so you can use:

    private static final byte[] _nl = { '\r', '\n' };
    

Maybe you are looking for