F****n 发帖数: 3271 | 1 你说的这个问题非常TYPICAL,N年前在JAXB尚为成标准的时候我就发现了这个东东,觉
得是好东西一度将所有PROJECTS里的XML应用都做成JAXB。但过了几个月许多就不得不
改回来。为什么?JAXB容错性太差,实际应用中XML数据不标准的太多,用JAXB会产生
huge headache
总结的经验是,如果是自己定义的新标准,应该推广JAXB,如果是LEGACY的数据格式(
特别象你这种连XSD都没有的),还是别浪费时间了,老老实实写HANDLER吧。
unmarshal。 |
|
t*******e 发帖数: 684 | 2 关于JAXB 2.0的一个article. 说明了JAXB有能力通过StAX处理巨大的XML document
stream 而不消费太多memory, 另外JAXWS也是用JAXB binding的。
http://www.javarants.com/C1464297901/E20060501083853/index.html
The best of both worlds exists within JAXB 2.0. Not only can you get typed
objects from your XML documents but you can also drop down to StAX when you
need to stream data from the document. The biggest limitation is that JAXB
does need some sort of schema in order to generate the typed objects. Using
a great tool called trang, we ca |
|
c*****t 发帖数: 1879 | 3 Want to ask some questions:
1. Can JAXB directly unmarshal an XML document into a tree of existing
type classes, say JMenu/JMenuItem tree?
Specifically, I want to know if it possible to create a library
of converting XML->Swing objects (can be limited to only menu creation)
directly using JAXB without much Java work, say 5 lines not counting
imports, at most, and only provide an XML schema.
2. How does JAXB deal with evolving schemas? Say I have a schema on
day 1, and day 14 I |
|
t*******e 发帖数: 684 | 4 WSDL有好几个部分,包括XSD,Operations,SOAP bindings. 其中XSD是data structure,
Operations是method interfaces.
只有XML没有XSD是不能用JAXB的, 设想XSD就是Java class definition,XML是Java
object.有了XSD,就能用JAXB生成Schema derived classes. 如果给你的string包含所
有的elements和attributes,可以自己搞个XSD,再用JAXB. |
|
y*c 发帖数: 904 | 5 jaxb自动换函数名字
一个web service endpoint的函数名字是abc_de, wsdl保持不变
client 用wsimport, 建立的java就变成AbcDe了。client 无法根据wsdl中的定义写
code了。
underscore "_" 可以通过custom jaxb 的globalbinding修改,但是capitalized
first
letter是怎么回事啊。
JAXB的算法搞什么搞啊,为什么要这么多此一举。
请赐教
搞了好几天搞不定。 |
|
A**o 发帖数: 1550 | 6 你说到点子上了,可讲讲jaxb的容错性么?我没什么经验。
另外,我会尽量隐藏jaxb的model,减少对其他组件的影响。 |
|
F****n 发帖数: 3271 | 7 JAXB基本没有容错性, ERROR Handler在这里不适用。你无非就是要读XML,没必要用
JAXB |
|
t*******e 发帖数: 684 | 8 如果有XSD的话,用JAXB还是很不错的,灵活的custom binding,用着像普通的Java Beans
,performance也很好,如果object graph很大的话,可以结合JXPath,navigate比较容易.
类似的XMLBean(也算JAXB的implementation)的performance就差很多。 |
|
y***m 发帖数: 7027 | 9 JAXB XStream 类似,封装好,简单调用, code简洁,可以对象关联,把xml子对象放
到集
合,适合较复杂的后期处理,load到内存吧。不知哪个性能好些
SAX 手工活多,code比较臃肿,游标操作。
超大xml如几个GB的 SAX 性能,内存方面可能更好,或者 JAXB XStream + 游标/分段
读出
请赐教, thx! |
|
A**o 发帖数: 1550 | 10 这个东西不错,大家都用什么工具搞定JAXB的?
schema to java, java to schema, and round trip? |
|
A**o 发帖数: 1550 | 11 继续问问题,如果给你一个xml数据样本,没有xsd,你怎么生成自己的xsd和java类?
如果数据样本以后有一定的扩展,你怎么保持你的xsd和java跟得上形势?
目前的use case是在使用人家的web service,人家的wsdl上说返回的是一个string,
但实际上是一个xml string……我要parse丫的,怎么做比较容易呢?
我现在是手动model java类,然后以此为样板生成自己的xsd,然后用JAXB unmarshal。
有啥更简洁的方法吗?当然的,要让人家更新wsdl是不大现实的。nnd |
|
t*******e 发帖数: 684 | 12 可以自己搞个XSD,再用JAXB runtime parsing XML string.
或者用JDOM,dom4j之类的不要求XSD. |
|
A**o 发帖数: 1550 | 13 你说得没错,但是我的问题是wsdl不是我的,是第三方的,我改不了。
有空我再多看看,这个新的jaxb已经很不错了,比dom自己parse要简单多了。 |
|
F****n 发帖数: 3271 | 14 就是说这个STRING的结构根本没有用XSD严格定义,而且还有可能变,
所以别浪费时间在JAXB上了。 |
|
t*******e 发帖数: 684 | 15 Why do you convert an XSD to a DTD file? I don't see any need of doing that.
Valuable online docs are available at https://jaxb.dev.java.net/ |
|
b******y 发帖数: 9224 | 16 JAXB 不清楚,但SAX非常灵活,不需要占内存。 |
|
J*********r 发帖数: 5921 | 17 Thanks for your reply.
I just checked out Jersey, it seems to be for RESTful web service, I will
definitely look at it in more detail.
What about SOAP web service? Any suggestions? How does JAXB fit into the
whole picture? (My job requirements include JAXB, though I haven't used it
yet) |
|
b***s 发帖数: 117 | 18 我感觉这个有点象jaxb xsd的一套,xsd定义数据结构,jaxb做marshall, unmashall |
|
s****r 发帖数: 28 | 19 【 以下文字转载自 SanFrancisco 讨论区 】
发信人: sepher (sepher), 信区: SanFrancisco
标 题: job opening
发信站: BBS 未名空间站 (Thu Sep 1 14:59:01 2011, 美东)
This is a full-time contractor position starting in the next few weeks
until June/July 2012 for a wellknow network company in bayarea. Local
candidates only.
skills we are looking for are:
Required: Perl (4), Java (5), SQL (3), JDBC (2), shell scripting (4), UNIX/
Linux (4), software localisation (2), HTML 4 (4)
Desirable: JSP (3), JavaScript (3), XML (2), JAXB/JAX... 阅读全帖 |
|
i*******t 发帖数: 9 | 20 We are now hiring a Senior Java Developer. Please see the following
description.
Job title: Senior Java Developer
Industry: Finance
Location: New York, NY
Job Description:
As a member of the Application Development staff, the Java developer will
participate in the development and implementation of internal and mission
critical external distributed web applications. The position is for an
intermediate Application Developer who has very strong experience developing
and implementing applications us... 阅读全帖 |
|
s*****r 发帖数: 43070 | 21 data layer就是JPA, hibernate, DB schema,query这些,现在还会有nosql,广义上
cache和configuration也算data。
service layer就是web service这块,流行技术是Jersey RESTful,JAXB,包括HTTP的
各种header的定义及应用。
business layer技术比较杂,什么都可以往里扔,主要有Spring,DB transaction,
job scheduler,application event,message delivery。分布式的东东很少往
business layer放,因为business的原则是不能出错,出错以后的问题很麻烦。 |
|
|
m********0 发帖数: 2717 | 23 JUST FYI, no more comments
SELECT a.Symbol, b.AvgVolume, a.[Date], a.Volume
FROM Stock.dbo.stock_daily a
Join (
SELECT Symbol, AVG(Volume) as AvgVolume
FROM Stock.dbo.stock_daily
WHERE Date >= '20100101'
GROUP BY Symbol
) b
ON a.Symbol = b.Symbol
WHERE 1=1
AND a.Volume > 5*b.AvgVolume
AND a.[Date] >= '20101131'
AND b.AvgVolume > 0
ORDER BY a.Symbol, a.[Date]
Symbol Year_AvgVolume Date Volume Ratio
AERL 74756 12/3/2010 667100 8.923698432
AMAC 9247 12/3/2010 78400 ... 阅读全帖 |
|
w****r 发帖数: 245 | 24 大侠,分类都分好了,求神签
# Basic Materials, Agricultural Chemicals
AGU Agrium Inc.
AVD American Vanguard Corp.
CAGC China Agritech Inc.
CF CF Industries Holdings, Inc.
CGA China Green Agriculture, Inc.
CMP Compass Minerals International
COIN Converted Organics Inc.
IPI Intrepid Potash, Inc.
MON Monsanto Co.
MOS Mosaic Co.
NOEC New Oriental Energy & Chemical
POT Potas... 阅读全帖 |
|
c********t 发帖数: 4527 | 25 I am looking for a few strong back end engineers with good Java experiences.
If you are an ambitious software guys in Boston area, please feel free to
reach me.
The Senior/Principal Software Engineer will work in the Java Framework team
on such projects as web services framework, messaging systems framework and
integration, authentication, authorization, caching, diagnostic tools, and
other java application server infrastructure
Contribute as a Sr. individual contributor within a team of top eng... 阅读全帖 |
|
i*******t 发帖数: 9 | 26 We are now hiring a Senior Java Developer. Please see the following
description.
Job title: Senior Java Developer
Industry: Finance
Location: New York, NY
Job Description:
As a member of the Application Development staff, the Java developer will
participate in the development and implementation of internal and mission
critical external distributed web applications. The position is for an
intermediate Application Developer who has very strong experience developing
and implementing applications us... 阅读全帖 |
|
s****r 发帖数: 28 | 27 This is a full-time contractor position starting in the next few weeks
until June/July 2012 for a wellknow network company in bayarea. Local
candidates only.
skills we are looking for are:
Required: Perl (4), Java (5), SQL (3), JDBC (2), shell scripting (4), UNIX/
Linux (4), software localisation (2), HTML 4 (4)
Desirable: JSP (3), JavaScript (3), XML (2), JAXB/JAX-WS (1), HTML 5 (1),
SOAP (1), RMI (1), Dojo (1)
*numbers in ( ) is the required years of experience
Please send email to sunnybayar... 阅读全帖 |
|
j********r 发帖数: 96 | 28 WE are looking to find 2 candidates immediately.
This is a Contract-to-Hire position. Pay Rate: $50+ per hour.
If interested please contact: j**[email protected]
Requirements:
- 8+ years experience in OO development (Java or C/C++)
- Proficient in XML, XSD, DTD
- Familiarity with XBRL is a significant plus
- Experience with JAXB, XSLT, SAX, Xerces
- Experience developing for multi-tier distributed applications using J2EE,
JMS, JMX, JavaBeans, EJB, Java, JavaScript, JSF, JSP, XML, SOAP, JAXWS, an |
|
g*s 发帖数: 2277 | 29 or use JAXB to get flexibility of DOM and performance of SAX. |
|
c*******e 发帖数: 5 | 30 Hi, I am doing a project using J2EE. I met some problems which made me stuck,
so I need your help very much ! Thanks in advance.
1. maybe too simple question
what is "native code" ?
2. Can I use an Entity Bean to read and edit XML file? How to use JAXB in EJB?
3. Does anyone know a lot or have experience on Resource adaptor?....I have to
develop a application which is multi-threaded... What the cost of implementing
a resource adaptor? I mean the time, the knowledge, etc.
Any help will be appre |
|
F****n 发帖数: 3271 | 31 forget, other than JAXB. |
|
p***p 发帖数: 559 | 32 太多了,搞不清楚哪个是干什么的,JDK自身还有,还和其他包互相冲突
DOM,JDOM,Crimson,Xerces,JAXB,SAX....etc |
|
t*******e 发帖数: 684 | 33 JSF, Spring, Hibernate, JavaEE5(EJB3), WebServices(JAXP, JAXB, JAX-RPC,JAX-
WS) 最好都知道一些, WEBWORK, TAPESTRY, VELOCITY不是很popular, 很多ideas也被
借鉴在上面的技术规范中了. |
|
p**********g 发帖数: 17 | 34 我在一家小公司工作了几年。主要在用Tomcat, JSP,servlet 和MySQL。
现在有两个机会:1。做EJB,Web Service,用 AXIS 和JAXB,JBoss等。当然这些技术
都得现学。2。只用Core Java。不要求任何JAVA EE的技术。
我个人觉得 1 可能对将来更好些。感觉招聘广告要求Java EE的比Core Java多得多。
可手头这个2的offer比 1 工资高一万多。
该选哪个呢? |
|
b**********g 发帖数: 806 | 35 我的build.xml里要build两个xsd,象下面这样子.但是不能同时build两个,我看到有说u
se a nested element,用过的给个sample好吗,谢谢谢谢.
schema="${src.xml}/ruckusStreaming_1.0.xsd"
target="${target.src}"
package="net.company.ui.web.client.jaxb">
target="${target.src}"
package="net.company.ui.web. |
|
b**********g 发帖数: 806 | 36 除非我改动了第二个,ant才会去找第二个,不然总是去第一个.因为总是build第一个,这
样我在第二个里面定义的,system就没生成.我现在改成了这个样子,显示的就是compile
client_2.0.xsd and others. 以前都是要么显示compile client_2.0.xsd, 要么显示
compile streaming_1.0.xsd.
也不知道我说清楚了没有:(
package="net.company.ui.web.client.jaxb">
>
|
|
t*******e 发帖数: 684 | 37 去java.net下载吧,ant tasks,和maven plugin都是内建的。 |
|
g*****g 发帖数: 34805 | 38 俺用CXF做webservice, 对这些细节是不关心的。
如果service你管不了,或者不是java的,axis之类
的也可以通过wsdl产生stub吧。
unmarshal。 |
|
S*********t 发帖数: 78 | 39 返回来的 wsdl 里面应该有 schema location吧
unmarshal。 |
|
A**o 发帖数: 1550 | 40 看样子没完全说清楚,人家的wsdl里面是有xsd的,但是声明的返回的变量是个string
,我拿到了这个string一看,其实这个string是一个xml data,所以,wsdl里面并没有
定义这个xml data的结构的。为了方便,我要自己把这个xml转换成java数据结构。不
知道这么讲是不是清楚了,人家的wsdl对我这个例子其实是没有帮助的,我的客户stub
仅仅可以给我一个String。
简单的说,就是给你一个xml数据,你要转换成java内部数据,怎么整最方便。而这个
数据今后可能增加新的数据,怎么才能保证新增数据的时候调试的痛苦最小化。 |
|
|
A**o 发帖数: 1550 | 42 我现在是先建好java model,然后生成xsd,因为我没有xsd的开发经验。
昨天折腾了几个小时,搞定了。想听听大家有没有类似的经历和建议。 |
|
t*******e 发帖数: 684 | 43 你的这个象是Document-centric web services,要求对XML,XSD,WSDL有比较深的了解
。返回的string也可以表达成SOAPElement,或一个stream的表像。现在web services发
展奇快。看看java.net上面的metro项目会有很多帮助的。 |
|
m******t 发帖数: 2416 | 44
This is where you lost me.
...and here. 8-)
stub |
|
A**o 发帖数: 1550 | 45
比如wsdl里是这个样子,所以你通过stub拿到的是一个String对吧?
然后这个String实际上是一个xml,比如什么
的,我现在要对付的是这个xml。
这么说清楚一点儿了吗? |
|
c*****t 发帖数: 1879 | 46 Ehmm, Use CookXml to parse XML :) Absolutely the fastest way to
develop an XML parser from scratch.
http://cookxml.yuanheng.org/
Online tutorial available. |
|
m******t 发帖数: 2416 | 47
+1. Just bite the bullet and parse it. 8-) |
|
|
|
|