由买买提看人间百态

topics

全部话题 - 话题: parser
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)
w*******e
发帖数: 285
1
我想用java程序在远程执行任意传输的命令,比如
wget --header "host: www.google.com" -O result.htm 64.233.167.99
但是直接用Runtime.getRuntime().exec运行整个命令就会出错,因为"host: www.
google.com"里面有空格。我需要拆开成一个array来执行才行,但是有的时候比较复杂
,比如引号当中有引号什么的,有没有什么现成的parser把参数break成跟普通的shell
解析的一样的呢?
比如输入
wget --header "host: www.google.com" -O result.htm 64.233.167.99
就能输出
wget
g******e
发帖数: 3760
2
我觉得没什么现成的办法,但自己写一个parser应该也很快吧。Jakarta commons 有一
个命令行的parse 包你也可以试试。

shell
c*****t
发帖数: 1879
3
2 ways:
1. write your own parser.
2. use xslt (jdk 1.4+) to transform the rss/xml to the appropriate
html.
w*r
发帖数: 2421
4
来自主题: Java版 - xml to PDF的package
这个东西我写过,用itext, 自己设计一个template, 数据和chart从class到一个XML
file, 然后自己写一个parser把XML用itext生成pdf.. 不是很难,基本上属于四天dev
两天test的活儿
w*r
发帖数: 2421
5
来自主题: Java版 - xml to PDF的package
if xml is ready, all u need to do is write ur own parser, a week's work
c*****t
发帖数: 1879
6
来自主题: Java版 - JAXB
Ehmm, Use CookXml to parse XML :) Absolutely the fastest way to
develop an XML parser from scratch.
http://cookxml.yuanheng.org/
Online tutorial available.
t*******e
发帖数: 684
7
试试用IDE(eclipse, netbeans之类的)格式化一下你的XML output file. 是否加回车
符是由你使用的XML parser决定的。
b******y
发帖数: 9224
8
来自主题: Java版 - good java xpath parser
seems jaxen is good. Any others?
b******y
发帖数: 9224
9
来自主题: Java版 - good java xpath parser
thanks, I will take a look.
g**********y
发帖数: 14569
10
来自主题: Java版 - good java xpath parser
our company use dom4j. It's convenient, performance is ok. Almost no
learning curve.
b******y
发帖数: 9224
11
来自主题: Java版 - htmlcleaner seems good
Update: I tried it out, it is not bad, compared to some other parsers.
b******y
发帖数: 9224
12
来自主题: Java版 - annotation question
not sure, but, you can use "ant" to invoke a text parser to remove line by
line those annotations. Not an ideal way, but it should work fine.
c*****t
发帖数: 1879
13
Just curious. Assume that there is a very simple Lexical / Parser
generator for Java, will you use it over Pattern/Regex lib provided
by Sun?
b******y
发帖数: 9224
14
or, you can write your own java based parser/compiler, LL based.
I've read a book called "let's write a compiler" before, it is good and
tells you how to roll your own.
In fact, java compiler is LL (recursive decent), so you can hand-code a java
compiler yourself ;-)
t*******e
发帖数: 684
15
来自主题: Java版 - StAX, do you use it?
Are you talking about the XML stream parser? Why do you link it up with
state machines?
b**********g
发帖数: 806
16
来自主题: Java版 - acegi question
要给现在的一个application加上security,不能用form-based authentication.这个application是用EJB跟spring MVC做的.client call remote的action server,拿到data,然后用xml显示出来.
www.mycompany.com/app/person.xml?id=1&username=beerdrinking&password=pwd.已
经有个command parser,能拿到这些parameter的value.但是拿到username跟password以
后,应该怎么实现spring security呢? 多谢.
w*r
发帖数: 2421
17
来自主题: Java版 - 有人用过Spring吗?
your requirement is typical for informatica work.. if your company willing
to
buy such tool . If not, write a script parser in java to parse something
like:
File=abc.dat
layout
column1Var char(10)
column2Var char(20);
insert into tableA(
col1,col2,col3) values(
simple lexicon rules, var defines in layout block, ETL/ELT block using SQL-
like
constructs to do the insert/update/upsert
Handle everything in Java using connection.preparestatement();
then you should be fine.
If application requires per
w*r
发帖数: 2421
18
来自主题: Java版 - 有人用过Spring吗?
in related to spring, you can build XML format script files and use spring's
inversion of control to construct your worker objects and then you are set
to
go, it might be easier than build lexicon parsers to parse script file.
g*****g
发帖数: 34805
19
You can write an XML schema (XSD) that validates rules.
Below would be a rule to map character 1-8 to cl1.

characters
1
8

You can write an web interface for easier editing of this XML for
client. Considering you will have only a few rules, this shouldn't
be very difficult. Now all it takes it an XML parser to do the actual
mapping.


process
c*****t
发帖数: 1879
20
来自主题: Java版 - 请教:parse CSV文件
The presence of \, might indicate that \\ or other escape sequences.
Couple with error detection, it is a pain to write a perfect parser
by hand.
(btw, I think the standard CSV uses double quote for literals. It
is a bit strange to use \,)
Java's regular expression is not particularly efficient.
The best way is to use a lex tool (like my CookCC which is for Java)
to deal with this situation.
p***p
发帖数: 559
21
来自主题: Java版 - 什么是JAX WS
以前写WS都是AXIS上手就做,然后再检查SOAP信息。但是现在做一个项目,对方要求在
文档里面写出什么是JAX WS,哪些优点等等,一下子就有点晕菜了。我一直以为AXIS直
接到SOAP啊,顶多内置了一下XML的Parser之类的,查查结果还要RPC和MSG模式
哪位能深入浅出生动地说说到底是怎么回事情?
http://www.ibm.com/developerworks/cn/webservices/ws-tip-jaxwsrpc.html
http://baike.baidu.com/view/1865210.htm
c*****t
发帖数: 1879
22

^^^^^^^^^^^^^^^^^^^^^^^^^^
这又是怎么回事?你不要说一半。。。如果是什么语言的话,你先说清楚。
说不定有现成的 parser 。
s******e
发帖数: 493
23
just have thought, you may be able to take advantage of jdk 1.6 with mozilla
rhino(the only built-in Jscript implemntation support in hotspot)
for example you have a formula (op1 * 13 - op2)/13 *op2, you store in
formula in db or xml, because java new script engine allows you to define
your js function in java, you can just simply replace op1 and op2 at run
time, and send the defined function to js engine. this way you just take
advantage of exsiting js engine parser and interpreter. You do not
c********m
发帖数: 571
24
来自主题: Java版 - Java处理XML
在学用Java处理XML文档,google发现很多DOM parser,
请问那种用得比较多?
谢谢!
g*****g
发帖数: 34805
25
I am still in 2000. :-)
I wonder how people consume rest service, is there any standard tool?
Write an XML parser is too boiler plate but rest is not a standard I
doubt what can be done.
w*r
发帖数: 64
26
来自主题: Java版 - math expression
需要用一个简单的math expression parser。类似于做:
f(x1, x2,... xn) = (a1x1 + x2 *x3)*a2 -x4 ..
基本上都是四则运算。有没有什么open source的上手就可以用的library?谢谢!
c*****t
发帖数: 1879
27
来自主题: Java版 - math expression
No need to use antlr. My CookCC is smaller, faster and better :)
In fact, operator precedence is the worst nightmare for LL parsers
such as antlr.
CookCC even comes with a calculator example (well, a mini script
interpreter of a few hundred lines) that you just need to do minor
modifcations:
http://code.google.com/p/cookcc/source/browse/trunk/tests/javaap/calc/Calculator.java
w*********e
发帖数: 5286
28
as other ppl said, it is just like an embedded OS VS a
full-fledged OS like linux&windows.
you cannot judge complexity of kernal RDBMS by Derby.
If derby is recoginized as a RDBMS everywhere, why shall we
have DB2, ORacle, SQL Server, and even lower-end mysql?
anyway, it is all about how you look at the word "KERNAL".
for me, a "KERNAL" RDBMS shall at least cover from parser,
compiler, code-generation, execution to data layer, with
support of the core set of ANSI SQL.
Even without transaction
c*****t
发帖数: 1879
29
来自主题: Java版 - 简单算法问题
嗯。这个问题不是 regex 能解决的。这是 context free grammar 。
其实你自己写个 html parser 也不是太难 :P
m******t
发帖数: 2416
30
来自主题: Java版 - 简单算法问题

I
So put your counter in a sax parser, which is lightweight enough.
I still don't see any point in reinventing the whole wheel.
s******d
发帖数: 901
31
谢谢,我去查一下,对这个还真不大熟悉。
其实就是通过parse log file, 得到一系列data, 然后用这个data 做成bar chart,
copy 到最后的word document report 里,他要automate 这整个过程。因为parser是
用java做的,就想把整个process都用java做。
i**e
发帖数: 6810
32
来自主题: Java版 - 大家用什么 HTML Parser?
jsoup貌似不错。还有别的推荐吗?要求易用,popular,主要功能
bug free,能parse DOM tree找element,大伙给说说
u****s
发帖数: 2186
33
来自主题: Java版 - 大家用什么 HTML Parser?
second this.
Htmlparser is powerful and easy to use.
T*o
发帖数: 363
34
来自主题: Java版 - 大家用什么 HTML Parser?
isn't jsoup sufficient?
i**e
发帖数: 6810
35
来自主题: Java版 - 大家用什么 HTML Parser?
谢谢楼上几位答复 :-)
jsoup功能强大,就是不知道是否有caveats,特来问问。
你有经验吗?
r********3
发帖数: 2998
36
来自主题: Java版 - 学习JAVA的人要注意
这个也太扯了吧。难道连jdom, dom4j这些都没听说过吗?
写一个简单的XML Parser还是容易,但是要写到dom4j这样的地步,没有1,2个星期是不
行的。

用。
r********3
发帖数: 2998
37
来自主题: Java版 - 学习JAVA的人要注意
这个也太扯了吧。难道连jdom, dom4j这些都没听说过吗?
写一个简单的XML Parser还是容易,但是要写到dom4j这样的地步,没有1,2个星期是不
行的。

用。
a******n
发帖数: 5925
38
呵呵, 确实, 我今天也正好看到这个事
从stackoverflow上看, 问c#的最多, 有370774个
java在第二, 316365
不过我觉得把java做好应该够我用了
另吐槽ms的东西做得真的太烂了,
我今天删ms的东西,
光VC 2005 redistributable就4,5 个,
2008又是4,5个
SQL相关的又5,6个
ASP.net mvc 2, 3, web 共六个
silverlight sdk 2个
msxml parser一共6个
web matrix, web standard..
为了写点ms的东西, 装的程序里面有一半是ms的东西。。。
删除好费劲
希望以后再也不需要碰了
r******r
发帖数: 700
39
来自主题: Java版 - 我自己编了个Java面试题
介不是面试题,就是寻求点帮助,好的解法吧?
如果不熟悉 RE, 或担心文件过大,就用 XML SAX parser 逐个元素读取文件,遇到每
个 node 中的 qName, 用 replace() 替换,重新输出的文件就是你需要的了。文件再
大也没事。
如果用 Regular Expression, 还要考虑是否 body text 中是否出现的 "<" 或 "/>"
字符的情况。
r******r
发帖数: 700
40
来自主题: Java版 - 我自己编了个Java面试题
除非文件特复杂,有特殊要求,否则直接用 java 自己的 SAX parser 就足够了吧。
c*****y
发帖数: 562
r*****s
发帖数: 985
42
It is using DOM because of POI.
We are not changing the parsers -- too much work.
Assume we have no control of the file size, because the java
vm may be already low in memory, so a small one may blow it.
If it is getting "out of memory error", the whole app is gone.
So the question is whether we could do anything to prevent it
when the memory is low.
We would rather abort the xml loading than halt the whole app.
Any ideas?
z****e
发帖数: 54598
43
楼主你那个文件里面
有int, string还有bool
当然用json的parser最方便啦
你要做的就是把你的配置文件变成json格式就好了
然后io+jackson,如果是java的话
ruby/js就更容易了,直接挂上io就可以读了
y***m
发帖数: 7027
44
来自主题: Java版 - 请推荐复杂xml parser
比如爱立信华为的CM file,非规律xml,多层嵌套,关联
Unmarshaller and org.eclipse.persistence.oxm.annotations.XmlPath ?
thx!
G**Y
发帖数: 33224
45
来自主题: Linux版 - 有没有parser的sample code?
C的。
读这样的文件。
## comments
keyword1 value2
keyword2 value2
## comments
keyword value
要求:skip所有 comments
这些,
keyword value
不一定按顺序出现?
E*V
发帖数: 17544
46
来自主题: Linux版 - 有没有parser的sample code?
grep -v ## 之类的行不行
a****g
发帖数: 54
47
来自主题: Linux版 - 有没有parser的sample code?
看看yacc吧
C********s
发帖数: 120
48
除非你的数据格式有严格控制否则这类问题不适合用正则表达式。找个 html parser
更合适吧。
如果你能确定 tag 全部在一行内,没有换行,tag 内没有比较古怪的字符,没
有 escape 字符,对结果要求不是特别严格,可以试用正则表达式。下面用 perl one
liner:
perl -e "m/
g****g
发帖数: 1828
49
来自主题: Linux版 - bash script真难看懂
这个我都快读晕了。
#!/bin/bash
# Light weight option parser for bash
#
abstract=""
usage="Usage: \${0##*/} [options] [arg1] [arg2] ..."
function Abstract()
{
abstract=$@
}
function Usage()
{
usage=$@
}
function Option()
{
eval "options=\"$options $1,$2,$3\""
eval "main_help=\"$main_help \t -$1,--$2\n\""
eval "main_help=\"$main_help \t $4\n\n\""
}
function OptionWithArgument()
{
ARGUMENT=`echo $3 | tr a-z A-Z`
eval "options_warg=\"$options_warg $1,$2,$3\""
eval "main_help=\"$main_help \t -$1 $ARGUMENT, --
v*****r
发帖数: 1119
50
来自主题: Linux版 - bash script真难看懂
shell 并不难,如果了解了用两只手就能数清的 special variables ($#, $-, $?, $!
,$@ ...), glob patten matching etc. 而且 shell 的这些东西都 natually built
into Perl, 对真正理解 Perl 也是必需的。
一般给自己的 shell script 加个 option parser 用不着这么复杂,用 shell
builtin 的 getopt/getopts, 或者用 case + while [ $# -gt 0 ],如果 options 不
多的话,不需要几行 code。
你这个 script 好象是个 parse generator, 用来给带着超级多 options 的 shell
script 自动产生 case statement 的 (case + while [ $# 。。。 】), 如果能贴
个使用的例子就清楚了
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)