如何读取文件xsb XML模式二进制文件。我解压了xmlbeans-3.0.1.jar文件,并在其中看到了许多二进制文件*.xsb。我很好奇文件*.xsb里面有什么数据?以及如何使用java代码读取文件xsb XML Schema二进制文件?
发布于 2020-05-25 14:33:03
@Joe:你们有没有使用DataInputStream从文件base.xsb https://jar-download.com/artifacts/org.apache.xmlbeans/xmlbeans/3.0.1中读取文件jar的示例代码
\xmlbeans-3.0.1\ schemaorg_apache_xmlbeans\ attribute\http_3A_2F_2Fwww_2Ew3_2Eorg_2FXML_2F1998_2Fnamespace\base.xsb
此代码不起作用
package layout;
import java.io.*;
class DataInputStreamDemo {
public static void main( String args[] ) throws IOException {
try ( DataInputStream din =
new DataInputStream( new FileInputStream( "base.xsb" ) ) ) {
// illustrating readDouble() method
double a = din.readDouble();
// illustrating readInt() method
int b = din.readInt();
// illustrating readBoolean() method
boolean c = din.readBoolean();
// illustrating readChar() method
char d = din.readChar();
System.out.println( "Values: " + a + " " + b + " " + c + " " + d );
}
catch ( FileNotFoundException e ) {
System.out.println( "Cannot Open the Input File" );
return;
}
}
}https://stackoverflow.com/questions/61911394
复制相似问题