Varek Boettcher

Greenhorn
+ Follow
since Aug 08, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Varek Boettcher

Hi,
I'm writing a csv text file parser. The parser is fine but determining when I've reached the end of the file has proved to be a pain.
Take the following code:

As I read each line from the file to parse, I use a while loop that goes something like:

The problem is if I use r.ready() (the FileReader) it goes false before all the lines are read. If I use br.ready() (the BufferedReader) it returns true even when the next br.readLine() returns null.
I need to know when I've ACTUALLY reached the end of the file. Can anyone suggest anything?
Thanx much in advance!
Varek
22 years ago
Yes it does... Thanx much!

------------------
Varek Boettcher
22 years ago
Hi,
Can a servlet make an http request another page or servlet on the same web server it's running on? I know this may seem like a silly/strange question but we're trying to do two things on the server with one request.
Thanx for any help!
------------------
Varek Boettcher
22 years ago
OK, I'll try.
WARNING: I'm a relative XML newbie here so I'm not very confident in my understanding of the technology or the tools. However, I find that my understanding of a topic increases when I have to attempt to explain it to someone and I'm sure someone else more knowledgable will cut in if I try to lead you too far astray...
The Traversal package defines a couple of nice ways to navigate a DOM document. The two main interfaces are the NodeIterator and the TreeWalker. The NodeIterator gives you a flat view of your document or a specific Node. You get a flat list of Nodes with no preserved hierarchy and methods to navigate up and down the list. The TreeWalker preserves the structure of a Document or sub-tree and also gives methods to navigate this tree.
One of the most powerful features (IMHO) is that the constructors for these interfaces can both make use of NodeFilters. You define a NodeFilter as part of the interface and then what you are navigating is actually a subset of the Document based on the NodeFilter you define.
The Traversal API is not currently supported in the current JAXP (1.1). It is supported in Xerces (Apache).
I'm currently learning this from "Professional Java XML" by WROX. So far I'm happy with this book.
Hope that helped...

------------------
Varek Boettcher
Hi,
I'm not an "XML master" either but my first response would be from a business practices perspective... I'm not going to rely on api libraries that are still in beta for my production code - period.
I realize you were probably looking for more of a technical discussion but I think the current release state is an important consideration.
Still hoping to see a technical discussion on this topic tho...
------------------
Varek Boettcher
Thank you!
Your clue put me on the path of Document.createTextNode, which seems to be just the ticket!
So that others understand what I'm doing...
I'm filling empty XML tags from a csv file. The code I've ended up with is:

I'm using a TreeWalker with a filter to traverse the tag nodes...
I can't say I'm totally understanding this - but I'm getting there... Thanx again!

------------------
Varek Boettcher
Hello,
Just by way of introduction - I'm a developer (surprise!), I'm not so new to Java but quite new to XML and JAXP.
FYI: JDK1.2.2_008 JAXP1.1 Xerces1.4.2 JDeveloper3.2
I'm writing an app that will take an existing data file and create an XML file from it. The hitch is that the nature of the data file will determine the structure of the document created.
I'm currently trying to use the XML file as a template. I load the data file and from a value in it I determine which XML file to load. I then want to insert the data values I have into the empty tags of the XML file. The problem is that I can't seem to find a method of the Node class that allows you to create a child node from thin-air. I'm using dom and dom.traversal and If I'm understanding what I've seen so far I need to create a #text child to hold the actual value of the tag in question...
I can clone a node but that requires an existing #text node. I've tried this in testing and it works but - there won't be an existing #text node to clone from in a real XML template.
Am I having a conceptual misunderstanding here or am I just missing something simple? How do I insert a value into an existing tag? Is DOM maybe the wrong tool for this?
Thanx for any help!
------------------
-----
Varek Boettcher