尝试使用 JFugue 解析时出现 Musixml 解析异常,如何解决?

Musixml parsing exception when trying to parse with JFugue, how to fix this?

我在尝试解析 musicxml 文件时遇到错误,已尝试使用 JFugue 4.0.3 和 5.0.5。

调用(JFugue 4.0.3):

MusicStringRenderer renderer = new MusicStringRenderer();
MusicXmlParser parser = new MusicXmlParser();                   
parser.addParserListener(renderer);     
parser.parse(inputFile);

我之前一直在使用 JFugue 的 musicxml 解析功能,当时一切正常,但现在它给我这个错误:

java.io.IOException: Server returned HTTP response code: 403 for URL:   http://www.musicxml.org/dtds/partwise.dtd
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1628)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:646)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:263)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1167)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at nu.xom.Builder.build(Unknown Source)
at nu.xom.Builder.build(Unknown Source)
at nu.xom.Builder.build(Unknown Source)
at org.jfugue.MusicXmlParser.parse(MusicXmlParser.java:137)

link partwise.dtd 文件仍位于 link,但下载被拒绝。 是否可以link到本地文件?

我用于不从 musicxml 官方站点获取 dtd 文件的解决方法是在本地引用它,这样您就不需要网络连接来读取 musicxml 文件。 比如这样:

<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN" "../musicxmldtd/partwise.dtd">