• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Passing string as arg to main

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to pass in a long string that is xml format as an arg to the main. But I get errors that say "Encountered EOF after : ""

My string looks like this:



How do I fix this problem?
 
author
Posts: 23923
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Passing in a long strings is not a problem -- I have read megabyte strings from files and passed it to methods, and it works fine.

I am guessing that you are using a string literal, and forgot to escape the quotes.

Henry
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure you want to pass it as an argument? longer pieces of text (especially if it's xml) should be read from a file and you only provide the lookup point as an argument.
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a good idea!
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if it is a platform independent solution but on Windows it works:
Put the whole text between "" and put a \ in front of every " in the text:

"# @prefix wwtts: <http://localhost/ontologies/wwtts.owl#>; . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>;
. :i1 a wwtts:Incident . :i1 wwtts:incidVessel :v2 .:i1 wwtts:incidOccurRegion \"INDONESIA\" . :v2 wwtts:vesselFlag \"US\" . :v2
wwtts:vesselName \"BIG BERTHA\" . :v2 wwtts:vesselWeight 2953 .:p3 a wwtts:Alarm .:p3 wwtts:featurerawtext \"alarms\" .
#"
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is strange. I thought I tried it with the "\" in front of the ". This time it worked.
I am actually passing the string to a web service from a client. But now I am not sure
how to extract the string returned.

I am getting a getStringResponse object which when I do a toString does not seem to
return a string although it is supposed to. I will post it to the web services group, unless you
have any suggestions.

Thanks,

Sonia
reply
    Bookmark Topic Watch Topic
  • New Topic