Is there a XML Schema validation library that supports the default attribute value?

后端 未结 2 1899
清酒与你
清酒与你 2021-01-07 06:15

If I read the XML Schema specification for default attribute values correctly, the validation process is actually supposed to change the DOM to fill the default values.

2条回答
  •  孤城傲影
    2021-01-07 07:05

    Xerces2 (Java) provides default values, however, the feature needs to be turned on in the parser.

        DOMParser parser=new DOMParser();
        parser.setFeature("http://apache.org/xml/features/validation/schema", true);
        parser.setFeature("http://apache.org/xml/features/validation/schema/element-default", true);
    

    The schema validation feature needs to be turned on.

    Refer: Xerces Features

提交回复
热议问题