{"id":645,"date":"2007-11-21T09:31:24","date_gmt":"2007-11-21T00:31:24","guid":{"rendered":"http:\/\/www.kazu.tv\/blog\/?p=645"},"modified":"2007-11-21T09:31:24","modified_gmt":"2007-11-21T00:31:24","slug":"setschema","status":"publish","type":"post","link":"https:\/\/kazu.tv\/blog\/2007\/11\/21\/setschema\/","title":{"rendered":"setSchema\u3067\u4f8b\u5916"},"content":{"rendered":"<p>\u6700\u8fd1XML Schema\u3067XML\u6587\u7ae0\u306e\u691c\u8a3c\u3063\u3066\u306e\u3092Java\u4e0a\u3067\u3084\u3063\u3066\u3044\u308b\u3002\u6570\u5e74\u524d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\uff0b\u65b0\u6a5f\u80fd\u8ffd\u52a0\u3063\u3066\u611f\u3058\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306a\u306e\u3067\u65b0\u65e7\u3044\u308d\u3093\u306a\u306e\u304c\u6df7\u3058\u3063\u3066\u308b\u3002<br \/>\n\u3055\u3066\u672c\u984c\u3002XML\u306e\u30d1\u30fc\u30b9\u306b\u306fSAX\u3092\u4f7f\u3063\u3066\u308b\u3002XML Schema\u3092\u4f7f\u3046\u306b\u306f\u5927\u4f53\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<div class=\"code\">\/\/ Schema\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<br \/>\nSchemaFactory sf =<br \/>\nSchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);<br \/>\nsf.setErrorHandler(new MyErrorHandler()); \/\/ *1<br \/>\nSource schemaFile = new StreamSource(new File(&#8220;schema.xsd&#8221;));<br \/>\nSchema schema = sf.newSchema(schemaFile);<br \/>\n\/\/ \u30d1\u30fc\u30b5\u30fc\u306e\u4f5c\u6210<br \/>\nSAXParserFactory factory = SAXParserFactory.newInstance();<br \/>\nfactory.setValidating(false);<br \/>\nfactory.setSchema(schema);<br \/>\nSAXParser parser = factory.newSAXParser();<\/div>\n<p>*1 MyErrorHandler\u306fDefaultHandler\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9<br \/>\n\u3053\u308c\u3067\u666e\u901a\u306b\u52d5\u3044\u3066\u305f\u3093\u3060\u3051\u3069\u3001ant\u3067\u30d3\u30eb\u30c9\u3057\u3066\u30d1\u30c3\u30b1\u30fc\u30b8\u4f5c\u3063\u3066\u8d77\u52d5\u3059\u308b\u3068\u3001factory.setSchema(schema)\u306e\u884c\u3067\u4ee5\u4e0b\u306e\u4f8b\u5916\u304c\u2026<\/p>\n<div class=\"code\">java.lang.UnsupportedOperationException: This parser does not support spe<br \/>\ncification &#8220;null&#8221; version &#8220;null&#8221;<\/div>\n<p><!--more--><br \/>\n\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001SAXParserFactory\u304c\u53e4\u3044JAXP\u3092\u4f7f\u304a\u3046\u3068\u3057\u3066\u3044\u308b\u304b\u3089\u3089\u3057\u304f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d5\u30a1\u30a4\u30eb\u3092classpath\u304b\u3089\u53d6\u308a\u9664\u3051\u3070ok\u3089\u3057\u3044\u3002<br \/>\njaxp.jar<br \/>\nxerces-2.6.2.jar<br \/>\ncrimson.jar<br \/>\nxalan.jar<br \/>\n\u306a\u3093\u3067\u3001\u305d\u3093\u306a\u4e8b\u304c\u8d77\u304d\u305f\u304b\u3068\u3044\u3046\u3068\u3001build.xml\u3067\u30af\u30e9\u30b9\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3068\u3053\u308d\u3067\u3001<\/p>\n<div class=\"code\">&#038;gtinclude name=&#8221;${hibernate.dir}\/**\/*.jar&#8221; \/&lt;<br \/>\n&#038;gtinclude name=&#8221;${hibernate-annotations.dir}\/**\/*.jar&#8221; \/&lt;<\/div>\n<p>\u3068\u6a2a\u7740\u3057\u305f\u304b\u3089\u3067\u3057\u305f\u3002<br \/>\n\u53c2\u8003\u306b\u306a\u3063\u305f\u306e\u306f<a href=\"http:\/\/forum.java.sun.com\/thread.jspa?threadID=713670&#038;messageID=4126553\" target=\"_blank\">\u3053\u3053<\/a>\uff08\u82f1\u8a9e\uff09\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java\u4e0a\u3067XML Schema\u3092\u4f7f\u3063\u3066XML\u6587\u66f8\u306e\u691c\u8a3c\u3092\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u3001setSchema\u3067UnsupportedOperationException\u3002\u4e0d\u8981\u306ajar\u30d5\u30a1\u30a4\u30eb\u3092classpath\u304b\u3089\u524a\u9664\u3057\u305f\u3089\u76f4\u3063\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[60],"tags":[],"class_list":["post-645","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":0,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"wp:attachment":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}