Holmes Wong

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

Recent posts by Holmes Wong

I am wondering how to capitalize the first letter of the string
I get from the following xsl expression:

Could not figure it out by searching books....

Originally posted by William Brogden:
What you are describing is processing with the DOM - Document Object Model (tree) in which the entire XML document resides in memory and can be directly manipulated. The programming style is completely different from SAX but can be done with the same Xerces library or the classes built into Java 1.4.

Thanks, bill for your reply.
Gonna research about it.

I am transforming xml file into a html file, after get user input,
I try to merge user input to the original xml file. Instead of
scanning xml file and locating tags (nasty coding), is there a better
way to do it?
I am using xerces+sax. Is there a way like: build a tree for xml file,
add new nodes (input) to the tree, and transform it back to xml file
with added content?
Thank you very much, Lasse. Finally got it work.

Originally posted by Lasse Koskela:
You need to store the attributes somewhere when they are given with startElement(...) in order to access them later in the endElement() method.

I am using Xerces with Sax2 to do the parsing. I
can get element values using the following checking
in endElement(..., String localName, ...) method:
//get element value
If Element1 has several attributes: att1 = "value1" att2="value2",
how do I get these attribute values while checking attribute names?
thanks in advance
Thanks Lasse:
You reminded me of using xhtml as standard xml to be processed
by xsl file. I guess I need to make xml file well-formed first.

Originally posted by Lasse Koskela:
XSL can only be applied to well-formed XML documents. If you've got a mix of HTML and XML that is not well-formed, I'm afraid there's nothing you can do but fix it somehow before proceeding with the XSL transformation. If the HTML stuff is well-formed, there is no problem -- the parser considers it as XML just like the standard XHTML tags, right? Or did I miss something?

I am trying to transform a mixed xml+html file into xhtml, I can
create a xsl stylesheet to translate xml part, but I do
not know how to keep html code and its location.
The following is a sample file:
<?xml version="1.0" encoding="utf-8"?>
<sim xmlns='http://www.w3.org/TR/REC-html40'
<b>Sample file</b>
<form:tag2 values=�value1� defined=�value2�/>
<input type=�text� name=�student�/>
<input type=�submit/>
Thanks in advance for your input.
Hi, guys:
I am trying to do pagination without using any taglibs. Once the results
have more than page limit, jsp page should display prev/next links for
users to navigate. In order to do this, I must get some values such as start count and page number when user clicks on prev or next links. I am wondering if there is any way to get these values by using an actionForm? Or there is any
better way to do it?
20 years ago
Hi, guys:
I am kind of new to xml processing. What I am trying to do is to get data
from xml files. For example:
<department id="1">
<employee id="222">
<employee ....>
If I want to get a particular employee's name and age, what technology do I need to use to easily do this job? DOM? SAX2?
I need nice advice from you. If you have some good tutorials to jump start, please tell me. Thanks.

about them.
to use
[ October 30, 2003: Message edited by: Holmes Wong ]
thanks, Jim. This may be what I want. I will try it out.
QUOTE]Originally posted by Jim Yingst:
List list = new ArrayList(set);
The order of the list will be whatever order the set had. For a TreeSet, this means either natural order, or order determined by the Comparator; for HashSet, well... just pretend it's random. (HashSet order is based on hashCode() and capacity, but the exact algorithm is not specified, so it's best to make no assumptions.)
20 years ago
I need to use a list (or collection) to display data on
jsp page. Is there any fats way to trun a Set into an indexed Collection
or List? (Can get individual element using get(index))
20 years ago
Hi, guys:
I really need you guys' help on this. If the server repeatedly send blobs through a http channel like URLConnection, will these blobs stay on the channel til the client fetches them?
thanks a lot.
20 years ago
If I have to repeatedly send many blob objects through a servlet, the client side will have to wait
for an interval and wake up to retrieve blob objects sent from the servlet. If I repeatedly send one blob object at a time, and the client wakes up every 30 seconds and uses a loop to retrieve blob objects from the URLConnection (or any stream from server), will that work? I really need your guys advices on this. Thank you.
20 years ago
Thanks, Jim:
I am writing both client code and server code (Websphere), so I don't have problem with protocol problem. The client will use HTTP URLConnection to request the server, and get response. A file or directory will be set up on server side to either get input to a file, or write input to the file and insert this file into the directory.
If I use directory-based queue to queue up incoming files, every time the client request asks for new files in the directory, these files will be retrived and sent through response, after that these files will be deleted from the directory, so when the client poll this directory-based queue again, it will get only new files or nothing, I don't have to worry about old content any more.
Is there any way to implement the directory-based file queue?
Any input will be appreciated. Thanks!

Originally posted by Jim Yingst:
If you're running some sort of Java program on the same system as the file (i.e. some sort of server program - JSP/servlet/whatever) then File.lastModified() is probably what you want. If you're talking about trying to learn about this "remote file" from another computer, where you don't have any control over the server's codebase, well, you need to konw what sort of server they're running. Does it accept HTTP requests? FTP? Some custom protocol using sockets? We need more details. (Unless lastModified() was already an adequate answer.)

20 years ago
There is a remote text file which will be regulary added new lines of text data. I want to remotely check its content. If its content is changed, the new data will be pulled out. What is the best method to check if this file has changed since the last time and pull out new data? Any idea?
20 years ago