- - PR -
データバインディングに挑戦しよう importを行っているSchemaについて
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2004-03-23 10:37
はじめまして、イノと申します。
早速ですが、質問させて下さい。 「JAXBでデータバインディングに挑戦しよう」 http://www.atmarkit.co.jp/fxml/rensai2/xmltool02/01.html 「Castorでデータバインディングに挑戦しよう」 http://www.atmarkit.co.jp/fxml/rensai2/xmltool03/01.html の記事の方はうまく動いたのですが、Schema Importを行っている XML Schemaの場合どうやれば動くのでしょうか? 例えば下のようなスキーマを自動生成しようとするとエラーになって しまいました。 【hogehoge-1[1].1.xsd】 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/PO1"> <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/> ・ ・ ・ ・ </xsd:schema> ・castorでは先にimportするSchemaの自動生成をしておいてから castorbuilder.propertiesの設定で 以下のようにしてみましたがダメでした。 org.exolab.castor.builder.nspackages=\ http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd=org.w3c.xmldsig ・jaxbの方はやり方が分かっていません。 「環境」 OS:XP Castor:Ver0.9.4.2 Jaxb:Ver1.0.2 JDK:Ver1.3.1_02 ・下記がエラーメッセージです。 【JAXB】 compile: [echo] Compiling the schema... [xjc] Compiling file:/C:/Program Files/eclipse/work1/workspace/ Jaxb/schemas/hogehoge-1[1].1.xsd [xjc] [ERROR] src-resolve: Cannot resolve the name 'ds:Signature' to a(n) 'element declaration' component. [xjc] line 37 of hogehoge-1[1].1.xsd [xjc] [xjc] BUILD FAILED: file:C:/Program%20Files/eclipse/work1/workspace/Jaxb/build.xml:24: unable to parse the schema. Error messages should have been provided 【CASTER】 castor: [echo] Generating Java classes and interfaces ... [java] -- Suppressing non fatal warnings. [java] Error reading import file 'http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd': java.net.NoRouteToHostException: No route to host: connect [java] at org.exolab.castor.xml.schema.reader.ImportUnmarshaller.<init>(ImportUnmarsha ller.java:182) [java] at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUn marshaller.java:513) [java] at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2Com ponentReader.java:253) [java] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) [java] at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno wn Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc her.dispatch(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [java] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) [java] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) [java] at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.jav a:388) [java] at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.jav a:441) [java] at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:797) |
|
投稿日時: 2005-04-07 18:07
mochaです。
Castorは使っていないので、JAXBについてのみコメントします。 ウチでは、二つとも手元にあるスキーマを使っていますが、以下の様なXJC指定でやっています。スキーマ毎に異なるパッケージにソースを吐くため、パッケージ指定はSchema内部で行い、XJCではパッケージ指定してません。 <xjc extension="true" target="${src.dir}" readOnly="true" removeoldoutput="yes"> <produces dir="${src.dir}" includes="**/*.java"/> <schema dir="${base_schema.dir}" includes="base_csif.xsd"/> <schema dir="${ext_schema.dir}" includes="ext_csif.xsd"/> </xjc> |
1