Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
b25876fd
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b25876fd
编写于
9月 02, 2013
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
facf31f0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
13 deletion
+17
-13
spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java
...java/org/springframework/oxm/castor/CastorMarshaller.java
+8
-6
spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java
...ain/java/org/springframework/oxm/jibx/JibxMarshaller.java
+9
-7
未找到文件。
spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java
浏览文件 @
b25876fd
...
@@ -170,30 +170,32 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
...
@@ -170,30 +170,32 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
}
}
/**
/**
* Set the locations of the Castor XML
M
apping files.
* Set the locations of the Castor XML
m
apping files.
*/
*/
public
void
setMappingLocations
(
Resource
...
mappingLocations
)
{
public
void
setMappingLocations
(
Resource
...
mappingLocations
)
{
this
.
mappingLocations
=
mappingLocations
;
this
.
mappingLocations
=
mappingLocations
;
}
}
/**
/**
* Set the Castor target class. Alternative means of configuring {@code CastorMarshaller} for unmarshalling
* Set the Castor target class.
* multiple classes include use of mapping files, and specifying packages with Castor descriptor classes.
* @see #setTargetPackage
* @see #setMappingLocation
*/
*/
public
void
setTargetClass
(
Class
<?>
targetClass
)
{
public
void
setTargetClass
(
Class
<?>
targetClass
)
{
this
.
targetClasses
=
new
Class
<?>[]
{
targetClass
};
this
.
targetClasses
=
new
Class
<?>[]
{
targetClass
};
}
}
/**
/**
* Set the Castor target classes. Alternative means of configuring {@code CastorMarshaller} for unmarshalling
* Set the Castor target classes.
* multiple classes include use of mapping files, and specifying packages with Castor descriptor classes.
* @see #setTargetPackages
* @see #setMappingLocations
*/
*/
public
void
setTargetClasses
(
Class
<?>...
targetClasses
)
{
public
void
setTargetClasses
(
Class
<?>...
targetClasses
)
{
this
.
targetClasses
=
targetClasses
;
this
.
targetClasses
=
targetClasses
;
}
}
/**
/**
* Set the name
s of
package with the Castor descriptor classes.
* Set the name
of a
package with the Castor descriptor classes.
*/
*/
public
void
setTargetPackage
(
String
targetPackage
)
{
public
void
setTargetPackage
(
String
targetPackage
)
{
this
.
targetPackages
=
new
String
[]
{
targetPackage
};
this
.
targetPackages
=
new
String
[]
{
targetPackage
};
...
...
spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java
浏览文件 @
b25876fd
...
@@ -107,7 +107,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
...
@@ -107,7 +107,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
private
IBindingFactory
bindingFactory
;
private
IBindingFactory
bindingFactory
;
private
TransformerFactory
transformerFactory
=
TransformerFactory
.
newInstance
();
private
final
TransformerFactory
transformerFactory
=
TransformerFactory
.
newInstance
();
/**
/**
...
@@ -127,6 +127,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
...
@@ -127,6 +127,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
public
void
setTargetPackage
(
String
targetPackage
)
{
public
void
setTargetPackage
(
String
targetPackage
)
{
this
.
targetPackage
=
targetPackage
;
this
.
targetPackage
=
targetPackage
;
}
}
/**
/**
* Set the optional binding name for this instance.
* Set the optional binding name for this instance.
*/
*/
...
@@ -167,7 +168,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
...
@@ -167,7 +168,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
}
}
/**
/**
* Set the system
I
d for the DTD declaration written when marshalling.
* Set the system
i
d for the DTD declaration written when marshalling.
* By default, this is {@code null}. Only used when the root element also has been set.
* By default, this is {@code null}. Only used when the root element also has been set.
* <p>Set either this property or {@code docTypePublicId}, not both.
* <p>Set either this property or {@code docTypePublicId}, not both.
* @see #setDocTypeRootElementName(String)
* @see #setDocTypeRootElementName(String)
...
@@ -177,7 +178,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
...
@@ -177,7 +178,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
}
}
/**
/**
* Set the public
I
d for the DTD declaration written when marshalling.
* Set the public
i
d for the DTD declaration written when marshalling.
* By default, this is {@code null}. Only used when the root element also has been set.
* By default, this is {@code null}. Only used when the root element also has been set.
* <p>Set either this property or {@code docTypeSystemId}, not both.
* <p>Set either this property or {@code docTypeSystemId}, not both.
* @see #setDocTypeRootElementName(String)
* @see #setDocTypeRootElementName(String)
...
@@ -217,12 +218,12 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
...
@@ -217,12 +218,12 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
bindingName
=
DEFAULT_BINDING_NAME
;
bindingName
=
DEFAULT_BINDING_NAME
;
}
}
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"Configured for target package ["
+
t
argetPackage
+
"] using binding ["
+
bindingName
+
"]"
);
logger
.
info
(
"Configured for target package ["
+
t
his
.
targetPackage
+
"] using binding ["
+
this
.
bindingName
+
"]"
);
}
}
this
.
bindingFactory
=
BindingDirectory
.
getFactory
(
bindingName
,
targetPackage
);
this
.
bindingFactory
=
BindingDirectory
.
getFactory
(
this
.
bindingName
,
this
.
targetPackage
);
}
}
else
{
else
{
throw
new
IllegalArgumentException
(
"
e
ither 'targetClass' or 'targetPackage' is required"
);
throw
new
IllegalArgumentException
(
"
E
ither 'targetClass' or 'targetPackage' is required"
);
}
}
}
}
...
@@ -407,12 +408,13 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
...
@@ -407,12 +408,13 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
@Override
@Override
protected
Object
unmarshalSaxReader
(
XMLReader
xmlReader
,
InputSource
inputSource
)
protected
Object
unmarshalSaxReader
(
XMLReader
xmlReader
,
InputSource
inputSource
)
throws
XmlMappingException
,
IOException
{
throws
XmlMappingException
,
IOException
{
return
transformAndUnmarshal
(
new
SAXSource
(
xmlReader
,
inputSource
));
return
transformAndUnmarshal
(
new
SAXSource
(
xmlReader
,
inputSource
));
}
}
private
Object
transformAndUnmarshal
(
Source
source
)
throws
IOException
{
private
Object
transformAndUnmarshal
(
Source
source
)
throws
IOException
{
try
{
try
{
Transformer
transformer
=
transformerFactory
.
newTransformer
();
Transformer
transformer
=
t
his
.
t
ransformerFactory
.
newTransformer
();
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
transformer
.
transform
(
source
,
new
StreamResult
(
os
));
transformer
.
transform
(
source
,
new
StreamResult
(
os
));
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
os
.
toByteArray
());
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
os
.
toByteArray
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录