10-01-2008 07:28 AM
I tried reading docs and using XMLWriter but couldn't get it to work after ignoring the "do no call or override" notes in the docs.
Anyway, it was easier to just use string/stringbuffer processing to put "<" around all the fields and concatenate them myself.
I can now verify that I can export data that XMLParser can successfully prarse and reload on the phone. I'm storing the xml
on a server with http post/get but it looks like someone else is discussing the file io for you.
You can do something like this, where "htmller" changes things like "&" to "&" ,
and probably use stringbuffer or other choices but it really is this easy ,
xmldata=xmldata+"<shortcut name=\""+htmller(x.name) + "\" target=\""+htmller(x.tgt.url)+"\">\r\n";
parsing is just about as easy but you probably need your own handler.
It is pretty easy to just print out the params to the handler methods and figure out empirically what to do,
htmlhandler dh= new htmlhandler(m_app,bmf);
ByteArrayInputStream bais= new ByteArrayInputStream(xlmdata);
XMLParser xml = new XMLParser();
And, of course, do this on a background thread if you suspect your file will get large and notify user as things happen.
10-01-2008 08:43 AM
InputStream inputStream = getClass().getResourceAsStream( _xmlFileName );
The above code is working fine but I need the Data Output stream for the same file in need to include into the application.
Can any one tellme how to access the file through outputstream. In FileConnection concept I cant able to access the _xmlFileName
when the FileConnection need URL format for the above code in FIleConnection.
please send some samples / code segments if possible
10-01-2008 09:17 AM
Yes i got the things working for xml file reading and also persistent data storing.
but i dint find the anywhere about the xml file writing /appending.
Also you dint tell me about the data shifting from one device to other.
This xml file is there in my cod file. when i append it executes with out any exception but no change in the xml file. please assist me doing this.
InputStream inputStream = getClass().getResourceAsStream( "test.xml" );
Document doc = builder.parse(inputStream);
10-01-2008 10:20 AM
This probably is not of much help for your immediate problem but generally I've found that trying
to parse a stream, rather than building a DOM, has some benefits in this environment but it depends
on what you are trying to do. If you ever need to plow through a big collection of stuff to find a few things
of interest, it may be of benefit to discard all this stuff ASAP. Obviously, if you control both sides you can
design the xml file to reflect the needs of your app but sometimes there is only so much you can do.
10-03-2008 08:45 AM
AFAIK just including it on the rapc command line will work, at least it works with png files but apparently it
does look at the type - not sure if it would try to convert or process it
I posted much earlier on a database related thread but AFAIK no one ever answered. Some DB vendor
showed up, if you can find my earlier post perhaps you can coax the vendor to reply.
Personally I'm not sure that a general purpose java DB on a phone is a great way to go and RIM does
have a variety, IIRC, of things like sorted collections that could probably make indexes and of course you have
hash tables etc.
10-03-2008 09:58 AM
What have you got against a hashtable?
While there are xml db loaders in java,
the DOM itself could be a reasonable DB if you don't want to use the SAX parser to load your own data
structures on the fly?
Sorry if this doesn't help and perhaps for your app you really need a full function database but if you can find the thread
I referenced before there seem to be RIM ports of existing stuff and java is supposed to be platform independent. But, of
course truely indepedent code wouldn't even need a platform ( LOL) and many people write code as if the platform is infinite.
I'd just suggest that you can write more efficient implementations without sacrificing versatility ( it isn't versatile if the
extra stuff uses up all the memory or CPU).
10-03-2008 12:28 PM
This is a bit OT but it illustrates the motivation behind my constant comments about minimizing resource
waste. Many people, usually people who design Flash Ads and GUI's either don't know or don't care
about CPU, memory,. or bandwith. This was posted on an investment forum earlier,
( contains poorly typed but clear profanity )
from which you can't conclude " Microsoft Impedes Medical Research" but does make the point that
anytime you add versatility you generally end up using something that someone else may want to use
for something else.
So, if you want your app to play nice with other apps, consider something like a hashtable before looking for
a full blown database.
Sorry if this is a bit of a design philosophy rant but on constrained resource devices, if you don't have a financial
incentive to upsell phone users, you have to be a little more careful with resources.
10-06-2008 01:51 AM
Can you tellme XML File Write / Read possible ways to obtain the process flow operation.?
I need to read the file in the resoure itself and also I need to write the content into it.