|
|
|
Thursday, 13 October 2011 15:16 |
Hi, i use this class for pull XML from remote host
package com.jacsdev.test
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
import javax.microedition.io.HttpConnection;
import net.rim.device.api.io.transport.ConnectionDescriptor;
import net.rim.device.api.io.transport.ConnectionFactory;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
class GetRemoteXML extends Thread
{
public String myUrl = "";
public GetRemoteXML(String url) {
myUrl = url;
}
public void run()
{
ConnectionFactory mCFactory = new ConnectionFactory();
ConnectionDescriptor connDesc;
connDesc = mCFactory.getConnection(myUrl);
if (connDesc != null)
{
HttpConnection mHttpConn;
mHttpConn = (HttpConnection)connDesc.getConnection();
try
{
DataInputStream dis = new DataInputStream(mHttpConn.openInputStream());
int mBytes = dis.available();
ByteArrayOutputStream mByteArray = new ByteArrayOutputStream();
while ( 0 < mBytes )
{
byte[] response = new byte[mBytes];
dis.read(response);
mByteArray.write(response);
mBytes = dis.available();
}
// This String contains the xml
final String XmlString = mByteArray.toString();
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
// Here show an alert on mainscreen with xml content as string
Dialog.alert(XmlString.toString());
}
});
}
catch (IOException e)
{
System.out.println("IOException: " + e.toString());
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
}
So, here the way i call it
package com.jacsdev.test;
import net.rim.device.api.ui.UiApplication;
public class MyApp extends UiApplication
{
public static void main(String[] args)
{
MyApp theApp = new MyApp();
theApp.enterEventDispatcher();
}
public MyApp()
{
MyScreen screen = new MyScreen();
pushScreen(screen);
GetRemoteXML mXML = new GetRemoteXML("http://yourserver.com/yourxmlfile.xml");
mXML.start();
}
// If you get success , you'll see a dialog wiht xml string ... so, you must to parser it the way you want
}
@jacsdev Read more: |
|
|
Monday, 15 August 2011 17:56 |
// description of your code here
//This XSL will search inside certain nodes of a given XML file
//for certain values and replace them.
//In my example I have a UnitOfMeasure node that contains "EA" or "FT" but I want to change
//the EA to 1 and the FT to 0.
//Also in my ObsoleteIndicator node I want to replace OBS with 1 and this other value I don't care about,
//DNR to empty string to basically remove it.
//So we end up with the exact same XML we started with just with those values translated.
//You could do the same with regular string.replace but it would be very slow for large XML files
//as it would have to visit every character in the entire file each time you called it (in my case
// four times.)
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
name="{name(.)}">
name="{name(.)}">
 Read more: |
|
Sunday, 09 January 2011 17:53 |
// xml file
 Read more: |
|
|
Wednesday, 10 November 2010 03:00 |
 | About XML Cleaner
Drag files or folders to XML Cleaner to begin the cleaning process. XML Cleaner will check all XML files and show you which files are malformed. XML Cleaner will clearly point out malformed data in your files. Double click a file name to open the file in your preferred editor. After fixing errors, recheck files with the click of a button. |
Read more: |
|
Wednesday, 15 September 2010 07:00 |
 | About oXygen XML Editor
A multi-platform XML Editor, XSLT/XQuery Debugger and Profiler written in Java. It supports XML, XSL, XQUERY, FO, XSD, RNG, RNC,NRL, DTD, Schematron, WSDL and CSS documents. It offers a powerful and intelligent code insight that guides the user to write valid XML content. The code insight can be driven by a DTD, an XML Schema, an RNG or by the structure of a partial edited document. Features SVN Client and native XML Databases support. |
Read more: |
|
|
|
|
|
|
Page 1 of 2 |