开发者

validating xml with an arbitrary xml file

in my company they have came up with their own xml that is being used as a schema for data, now i have to validate a xml according to that schema. is th开发者_C百科ere any easy way to do it or i have to write from scratch?

i am working with java6...

thanks


One possibility is to create an XSLT transform that converts the homegrown schema document into a standard such as XML Schema or Relax NG.


Check out Package javax.xml.validation , as of Java 5 the API supports validation for custom schema.

The SchemaFactory object has a method newSchema that will take a file and create a schema from it that can be validated against.

Edit: If you need to convert your XML file to a schema look at this question: Any tools to generate an XSD schema from an XML instance document?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜