i want to validate some files looking like this:
我想验证一些看起来像这样的文件:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd />
...
<bean>...</bean>
...
</beans>
Some of them have more xmlns and locations and some less. Someone knows if there is any api where u just give in such files and it will validate it in java?
其中一些有更多的xmlns和位置,有些更少。有人知道是否有任何api你只是在这些文件中给出它将在java中验证它?
greetings
问候
2 个解决方案
#1
0
There you go.
你去吧
http://download.oracle.com/javase/1,5,0/docs/api/javax/xml/validation/package-summary.html
http://download.oracle.com/javase/1,5,0/docs/api/javax/xml/validation/package-summary.html
You can wrap it and make parser that will first extract schemas, then use them for validation.
您可以将其包装并制作首先提取模式的解析器,然后使用它们进行验证。
#2
1
Spring will validate spring configuration files. You can write a junit that loads your configuration to test if the configuration files are formatted correctly.
Spring将验证spring配置文件。您可以编写一个junit来加载您的配置,以测试配置文件是否格式正确。
#1
0
There you go.
你去吧
http://download.oracle.com/javase/1,5,0/docs/api/javax/xml/validation/package-summary.html
http://download.oracle.com/javase/1,5,0/docs/api/javax/xml/validation/package-summary.html
You can wrap it and make parser that will first extract schemas, then use them for validation.
您可以将其包装并制作首先提取模式的解析器,然后使用它们进行验证。
#2
1
Spring will validate spring configuration files. You can write a junit that loads your configuration to test if the configuration files are formatted correctly.
Spring将验证spring配置文件。您可以编写一个junit来加载您的配置,以测试配置文件是否格式正确。