代码合成似乎不会生成“有效”的xml树

时间:2020-12-29 03:14:52

I've been working with code synthesis xsd to generate an xml tree to ensure constinency of the xml output to the original xsd.

我一直在使用代码合成xsd生成一个xml树,以确保xml输出到原始xsd的一致性。

After initial testing, everything looked ok but when I tried entering invalid values (correct type, but outside the defined range), the values were allowed.

初步测试后,一切看起来都不错但是当我尝试输入无效值(正确的类型,但超出定义的范围)时,允许使用这些值。

Although the xml is well formed and conforms to the types set in the xsd, it is not a valid xml wrt the schema.

虽然XML结构良好,符合在XSD设置的类型,它不是一个有效的XML WRT的模式。

Has anybody else used this tool and/or come up across this problem?

有没有人使用过这个工具和/或遇到过这个问题?

2 个解决方案

#1


0  

The tool may not do the sort of checking you want when creating the document.

创建文档时,该工具可能无法进行所需的检查。

If your document is small, you may just want to generate the XML,then re-parse it with XSD checking on and let that be your checking.

如果您的文档很小,您可能只想生成XML,然后使用XSD检查重新解析它并让它成为您的检查。

#2


0  

You'll want to provide some examples here to get a detailed response, but for now I think it's fair to say that all bets are off if your document doesn't validate according to the schema.

您需要在此提供一些示例以获得详细的响应,但是现在我认为,如果您的文档未根据架构进行验证,则所有投注均已关闭。

Remember it's the parser which does the schema validation, not Code Synthesis XSD (which by the way, is a terrible product name because it is difficult to use unambiguously!).

记住它是进行模式验证的解析器,而不是代码综合XSD(顺便说一下,它是一个糟糕的产品名称,因为它很难明确地使用!)。

#1


0  

The tool may not do the sort of checking you want when creating the document.

创建文档时,该工具可能无法进行所需的检查。

If your document is small, you may just want to generate the XML,then re-parse it with XSD checking on and let that be your checking.

如果您的文档很小,您可能只想生成XML,然后使用XSD检查重新解析它并让它成为您的检查。

#2


0  

You'll want to provide some examples here to get a detailed response, but for now I think it's fair to say that all bets are off if your document doesn't validate according to the schema.

您需要在此提供一些示例以获得详细的响应,但是现在我认为,如果您的文档未根据架构进行验证,则所有投注均已关闭。

Remember it's the parser which does the schema validation, not Code Synthesis XSD (which by the way, is a terrible product name because it is difficult to use unambiguously!).

记住它是进行模式验证的解析器,而不是代码综合XSD(顺便说一下,它是一个糟糕的产品名称,因为它很难明确地使用!)。