小编Joh*_*nny的帖子

78
推荐指数
8
解决办法
26万
查看次数

为什么在使用 DTD 解析此 XML 文件时出现错误“StartTag:无效的元素名称”

该文档基本上以“目录”作为根标签,其子标签为“电影”,后跟一个或多个“演员”。这些子标签中的每一个还包含更多子标签。我本来应该根据给定的一些规则为此制定 DTD,但它只是拒绝了我在文档开头放置的任何内容。有什么帮助吗?

下面是 XML 代码:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!DOCTYPE catalog SYSTEM "catalog.dtd">

<catalog>
    <movie movieID="m0100" genre="drama">
    <title>Monster&apos;s Ball</title>
<year>2001</year> 
<length>111 minutes</length>
<topBilledActors actorIDs="a0100 a0102" />
</movie>

<actor actorID="a0100" oscarWinner="yes">
    <name>Halle Berry</name>
<date>August 14, 1966</date>
<birthplace>Cleveland, Ohio</birthplace>
<role character="Leticia Musgrove" movie="m0100" />
<role character="Storm" movie="m0101" />
</actor>

<actor actorID="a0102" oscarWinner="yes">
    <name>Billy Bob Thornton</name>
<role character="Hank Grotowski" movie="m0100" />
</actor>

<movie movieID="m0101" genre="fantasy">
    <title>X-Men</title>
<year>2000</year>
<length>104 minutes</length>
<topBilledActors actorIDs="a0100 a0103" />
</movie>

<actor actorID="a0103" oscarWinner="no">
    <name>Ian McKellen</name>
<role character="Magneto" movie="m0101" …
Run Code Online (Sandbox Code Playgroud)

xml dtd dtd-parsing

5
推荐指数
1
解决办法
3万
查看次数

为什么 Perl 模块 Crypt::SSLeay 在加载时出错?

我试图让 WWW::Mechanize 使用 https 登录到 Yahoo;但是,它需要使用 Crypt::SSLeay 来通过 https 发送。

Crypt::SSLeay 安装成功,并且系统上已经安装了 openssl。

但是,它在加载时给出错误:


Can't load '/home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so: undefined symbol: PL_sv_undef at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229. at /home/gen19/lwp4 line 15 Compilation failed in require at /home/gen19/lwp4 line 15. BEGIN failed--compilation aborted at /home/gen19/lwp4 line 15.


Crypt::SSLeay安装成功,可以识别openssl的安装(这里):

perl Makefile.PL
=======================================================
Only one OpenSSL installation found at /usr
Consider running 'perl Makefile.PL --default' the next
time Crypt::SSLeay is upgraded to select this directory
automatically thereby avoiding the following prompt.
======================================================= …
Run Code Online (Sandbox Code Playgroud)

perl openssl module perl-module

3
推荐指数
1
解决办法
3423
查看次数

在Java中,是否可以将变量的值连接到变量名称(声音搞砸了,但请阅读详细信息)

基本上我有一个变量,zlort = 1;

我想将zlort的值连接成一个变量(对象引用)名称.

喜欢

BankAccount Accountzlort = new BankAccount;
Run Code Online (Sandbox Code Playgroud)

我希望Account.zlort中的zlort实际上被替换为zlort的值(一个 - 意思是我希望值为Accountone),而不是zlort本身.

是否有可能做到这一点?

谢谢!

java variables declaration concatenation naming-conventions

2
推荐指数
2
解决办法
5047
查看次数

为什么我的JFrame GUI程序会出现运行时错误?

基本上我有一个继承自JFrame类的GUI,并且有自己的main方法.

它给出了错误

Exception in thread "main" java.lang.NullPointerException
    at MilesPerGallonApp.buildPanel(MilesPerGallonApp.java:33)
    at MilesPerGallonApp.<init>(MilesPerGallonApp.java:20)
    at MilesPerGallonApp.main(MilesPerGallonApp.java:58)
Run Code Online (Sandbox Code Playgroud)

这是源代码

import javax.swing.*;
import java.awt.event.*;

public class MilesPerGallonApp extends JFrame
{
    private JPanel panel;
    private JLabel messageLabel1;
    private JLabel messageLabel2;
    private JTextField distanceTextField;
    private JTextField gallonTextField;
    private JButton calcButton;
    private final int WINDOW_WIDTH = 500;
    private final int WINDOW_HEIGHT = 280;

    public MilesPerGallonApp()
    {
        super("Fuel Economy Calculator");
        setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        buildPanel();
        add(panel);
        setVisible(true);
    }

    private void buildPanel()
    {
        messageLabel1 = new JLabel("Enter maximum distance.");
        messageLabel2 …
Run Code Online (Sandbox Code Playgroud)

java swing jframe actionlistener joptionpane

1
推荐指数
1
解决办法
246
查看次数

如何在Perl中将变量的长度减少到20个字符?

基本上我有一些非常长的变量,只需要前几个字符.

我尝试使用这个正则表达式,但它不起作用.

$var =~ s/(^.{20})?/$1/g;
Run Code Online (Sandbox Code Playgroud)

它没有做任何事情.

任何帮助,将不胜感激.

regex perl

0
推荐指数
1
解决办法
373
查看次数