/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I have a problem with parsing, that is the parse loops forever and i never get the results.

i send the xml file from the client to the server via socket

[CODE]
OutputStream output = socket.getOutputStream();

PrintStream print = new PrintStream(output, true);//write to socket.
print.println(“<?xml version=”1.0″ encoding=”UTF-8″?><Personnel><Employee type=”permanent”><Name>Seagull</Name><Id>3674</Id><Age>34</Age></Employee></Personnel>”);[/CODE]

The print with line 117 never gets printed because the document is never created because the parse loops forever so why is that, i even made a new BufferedReader the see that the inputstream is not empty so no problem there, i can even put junk instead of an xml file and still it loops, also tried to flush the data no good…
can anyone point the problem with parsing and inputstream?

[CODE] public String parsingInputStream(InputStream in) throws ParserConfigurationException, SAXException, IOException {
Document doc = null;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

System.out.println(“XMLParser class. Line 115. Test.”);
//BufferedReader reader = new BufferedReader(new InputStreamReader(in));
//System.out.println(reader.readLine());

doc = docBuilder.parse(in);//???
System.out.println(“XMLParser class. Line 117. Test.”);[/CODE]

to post a comment
Java

2 Comments(s)

Copy linkTweet thisAlerts:
@JemperauthorFeb 19.2009 — Tried a new tactic

[CODE]
doc = docBuilder.parse(br.readLine());
or
doc = docBuilder.parse(br.readLine().toString().trim());
[/CODE]


But i keep getting

C:Projects<?xml version="1.0" encoding="UTF-8"?><Employee type="permanent"><Employee> (The filename, directory name, or volume label syntax is incorrect)

Also been seeing this error flashing around occasionally on a random project build

[CODE]
org.apache.lucene.index.StaleReaderException: IndexReader out of date and no longer valid for delete, undelete, or setNorm operations
at org.apache.lucene.index.DirectoryIndexReader.acquireWriteLock(DirectoryIndexReader.java:246)
at org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:725)
at org.apache.lucene.index.FilterIndexReader.doDelete(FilterIndexReader.java:206)
at org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:727)
at org.netbeans.modules.java.source.usages.LuceneIndex.store(LuceneIndex.java:779)
at org.netbeans.modules.java.source.usages.BinaryAnalyser.store(BinaryAnalyser.java:415)
at org.netbeans.modules.java.source.usages.BinaryAnalyser.finish(BinaryAnalyser.java:224)
at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.updateBinary(RepositoryUpdater.java:2589)
at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.access$3500(RepositoryUpdater.java:1257)
at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker$1.run(RepositoryUpdater.java:1549)
at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker$1.run(RepositoryUpdater.java:1300)
at org.netbeans.modules.java.source.usages.ClassIndexManager.writeLock(ClassIndexManager.java:99)
at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.run(RepositoryUpdater.java:1297)
at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.run(RepositoryUpdater.java:1257)
at org.netbeans.api.java.source.JavaSource$CompilationJob.run(JavaSource.java:1618)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[catch] at java.lang.Thread.run(Thread.java:619)
[/CODE]


I don't know if they are connected but i suspect either incorrect xml syntex or a problem with multithreading is keeping this thing parser from working...
Copy linkTweet thisAlerts:
@JemperauthorFeb 19.2009 — Solved(for now).
×

Success!

Help @Jemper spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...