Skip to content

Commit

Permalink
在 Fenix 的 XML 文件中添加了 xmlns 等元素,用于 xsd 识别和校验
Browse files Browse the repository at this point in the history
  • Loading branch information
blinkfox committed Feb 3, 2021
1 parent 6433f12 commit 10c6e07
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 8 deletions.
3 changes: 2 additions & 1 deletion fenix.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
</xs:choice>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="resultType" type="xs:string"/>
<xs:attribute name="removeIfExist" type="xs:string"/>
</xs:complexType>
</xs:element>

Expand Down Expand Up @@ -174,4 +175,4 @@
</xs:complexType>
</xs:element>

</xs:schema>
</xs:schema>
5 changes: 4 additions & 1 deletion src/test/resources/fenix/BlogRepository.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来测试 XML 模版或标签生成的 SQL语句或参数的 Fenix XML 文件. -->
<fenixs namespace="BlogRepository">
<fenixs namespace="BlogRepository"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<!-- 一个最简单的示例来查询我的博客信息. -->
<fenix id="querySimplyDemo">
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/fenix/UnitTestRepository.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来单元测试 XML 模版或标签生成的 SQL 的数据库操作运行时的 Fenix XML 仓库. -->
<fenixs namespace="UnitTestRepository">
<fenixs namespace="UnitTestRepository"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<fenix id="sqlHeader">
SELECT u FROM User AS u
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/fenix/UserRepository.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来测试 XML 模版或标签生成的 SQL语句或参数的 Fenix XML 文件. -->
<fenixs namespace="com.blinkfox.fenix.repository.UserRepository">
<fenixs namespace="com.blinkfox.fenix.repository.UserRepository"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<fenix id="UserHeader">
SELECT u FROM User AS u
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/fenix/fenix.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来测试 XML 模版或标签生成的 SQL语句或参数的 Fenix XML 文件. -->
<fenixs namespace="fenix">
<fenixs namespace="fenix"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<!-- 用于单元测试 equal 标签生成的 JPQL 语句和参数. -->
<fenix id="equal">
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/my/dir/xml/other-dir.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来 XML 文件在自定义的目录中. -->
<fenixs namespace="otherFenix">
<fenixs namespace="otherFenix"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<!-- 测试该多个 and 时移除 "1 = 1 AND " 的 SQL 片段 -->
<fenix id="queryUsersByName" removeIfExist="1 = 1 AND ">
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/myfenix/my.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来 XML 文件在自定义的目录中. -->
<fenixs namespace="defaultFenix">
<fenixs namespace="defaultFenix"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<!-- 测试该多个 and 时移除 "1 = 1 AND " 的 SQL 片段 -->
<fenix id="queryUsersByName" removeIfExist="1 = 1 AND ">
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/others/fenix-xml.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这是用来测试当配置了具体的 XML 文件路径时是否能扫描到该 XML 文件. -->
<fenixs namespace="myFenixXml">
<fenixs namespace="myFenixXml"
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn https://gitee.com/blinkfox/fenix/raw/master/fenix.xsd">

<!-- 查询所有用户信息. -->
<fenix id="queryAllUsers">
Expand Down

0 comments on commit 10c6e07

Please sign in to comment.