Skip to content

Commit

Permalink
恢复: spring.schemas中的schema不强制转为unqualified
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Zhou committed Jan 2, 2013
1 parent e3a70f6 commit 62f0e03
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ private SpringPluggableSchemaImpl(String name, String version, String targetName
}
}

Schema schema = new SpringPluggableSchemaImpl(name, version, null, null, parsingTargetNamespace, sourceDesc, source, null, true, sourceInfo);

// 强制转换成unqualified style
schema.transform(getUnqualifiedStyleTransformer());

return schema;
return new SpringPluggableSchemaImpl(name, version, null, null, parsingTargetNamespace, sourceDesc, source, null, true, sourceInfo);
}

/** 创建一般的schema。 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void unqualifiedStyle() throws Exception {
String elementQualified = "elementFormDefault=\"qualified\"";

assertThat(textOriginal, containsString(elementQualified)); // springext-base-types.xsd包含elementFormDefault
assertThat(textTransformed, not(containsString(elementQualified))); // 转换后被强制去除
assertThat(textTransformed, containsString(elementQualified)); // 转换后被保留
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:services="http://www.alibaba.com/schema/services" xsi:schemaLocation="
http://www.alibaba.com/schema/services http://localhost:8080/schema/services.xsd
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://localhost:8080/schema/www.springframework.org/schema/beans/spring-beans.xsd
">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:services="http://www.alibaba.com/schema/services" xmlns:res-filters="http://www.alibaba.com/schema/services/resource-loading/filters" xmlns:res-loaders="http://www.alibaba.com/schema/services/resource-loading/loaders" xsi:schemaLocation="
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:services="http://www.alibaba.com/schema/services"
xmlns:res-loaders="http://www.alibaba.com/schema/services/resource-loading/loaders"
xsi:schemaLocation="
http://www.alibaba.com/schema/services http://localhost:8080/schema/services.xsd
http://www.alibaba.com/schema/services/resource-loading/filters http://localhost:8080/schema/services-resource-loading-filters.xsd
http://www.alibaba.com/schema/services/resource-loading/loaders http://localhost:8080/schema/services-resource-loading-loaders.xsd
http://www.springframework.org/schema/beans http://localhost:8080/schema/www.springframework.org/schema/beans/spring-beans.xsd
">

<services:property-placeholder/>
<services:property-placeholder />

<services:resource-loading>

<resource-alias pattern="/" name="/srcdir"/>
<resource-alias pattern="/" name="/srcdir" />

<resource pattern="/srcdir">
<res-loaders:file-loader basedir="${test.srcdir}"/>
<res-loaders:file-loader basedir="${test.srcdir}" />
</resource>

<resource pattern="/destdir">
<res-loaders:file-loader basedir="${test.destdir}"/>
<res-loaders:file-loader basedir="${test.destdir}" />
</resource>

<resource pattern="/classpath">
<res-loaders:classpath-loader/>
<res-loaders:classpath-loader />
</resource>

</services:resource-loading>
Expand Down
7 changes: 4 additions & 3 deletions webx/framework/src/test/resources/META-INF/mycomponent/a.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:services="http://www.alibaba.com/schema/services" xsi:schemaLocation="
http://www.alibaba.com/schema/services http://localhost:8080/schema/services.xsd
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://localhost:8080/schema/www.springframework.org/schema/beans/spring-beans.xsd
">

<beans:bean id="s1" class="java.lang.String">
<beans:constructor-arg value="hello"/>
<beans:constructor-arg value="hello" />
</beans:bean>

</beans:beans>
7 changes: 4 additions & 3 deletions webx/framework/src/test/resources/META-INF/mycomponent/b.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:services="http://www.alibaba.com/schema/services" xsi:schemaLocation="
http://www.alibaba.com/schema/services http://localhost:8080/schema/services.xsd
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://localhost:8080/schema/www.springframework.org/schema/beans/spring-beans.xsd
">

<beans:bean id="s2" class="java.lang.String">
<beans:constructor-arg value="world"/>
<beans:constructor-arg value="world" />
</beans:bean>

</beans:beans>

0 comments on commit 62f0e03

Please sign in to comment.