为什么我的代码不能在Web浏览器中生成? XML,DTD,CSS

时间:2012-11-01 02:32:18

标签: css xml web dtd xml-dtd

它开始打印所有内容直到29d 18h 46m然后停止。 idk为什么。 O.o

有人可以告诉我为什么它打印到那一点然后停止?

<?xml version="1.0" encoding="utf-8"?>
<?DOCTYPE phones SYSTEM "http://userpages.umbc.edu/~v16/is448/hw4/hw4_phones.dtd">
<?xml-stylesheet type="text/css" href="http://userpages.umbc.edu/~v16/is448/hw4/hw4_phones.css" ?>

<phones>
    <phone>

        <title>Apple iPhone 4S - 16GB - White (Factory Unlocked) Smartphone</title>
        <gBay_id>Item: 160913150440</gBay_id>
        <user_id>Seller: milehighmobilellc</user_id>
        <category>Type: Smartphone</category>
        <condition>Condition: Used</condition>
        <brand>Brand: Apple</brand>
        <model>Model: iPhone 4s</model>
        <carrier>Carrier: Factory Unlocked</carrier>
        <color>Color: White</color>
        <OS>Operating System: Apple iOS</OS>
        <contract>Contract: Without Contract</contract>
        <style>Form Factor: Bar</style>
        <buying_format>Buy It Now</buying_format>
        <auction>
            <starting_price>N/A</starting_price>
            <duration>N/A</duration>
        </auction>
        <buy_it_now>
            <starting_price>$449.99</starting_price>
            <duration>29d 18h 46m</duration>
        </buy_it_now>
        <description>
            Just when you thought a smartphone couldn’t get any better, it just did — the
            iPhone 4S is sure to change the way you communicate. The Siri technology lets
            you talk to this Apple smartphone as you would talk to a person, turning the
            iPhone 4S into a personal assistant. The powerful dual-core A5 chip ensures that
            this Apple phone gives you a lightning-fast performance and life-like graphics.
            Shoot 1080p HD videos and click crystal-clear snaps with the 8 MP camera of this
            Apple smartphone. To make your life easier, this Apple phone runs on iOS 5 that
            lets you enjoy numerous features and an easy-to-use interface. That’s not all;
            with the iCloud feature of the iPhone 4S, you can stop worrying about managing
            your stuff, because your phone does it for you.
        </description>
        <shipping>
        <cost>$0.00</cost>
        <speed>Expedited Shipping</speed>
        <shipping>
        <payment>PayPal, Bill Me Later</payment>
    </phone>

    <phone>

        <title>HTC Droid Incredible - 8GB - Black (Verizon) Smartphone</title>
        <gBay_id>Item: 251173407738</gBay_id>
        <user_id>Seller: jpfredd710</user_id>
        <category>Type: Smartphone</category>
        <condition>Condition: Used</condition>
        <brand>Brand: HTC</brand>
        <model>Model: Droid Incredible</model>
        <carrier>Carrier: Verizon</carrier>
        <color>Color: Black</color>
        <OS>Operating System: Android 2.3.4</OS>
        <contract>Contract: Without Contract</contract>
        <style>Form Factor: Bar</style>
        <buying_format>Auction</buying_format>
        <auction>
            <starting_price price="$62.01"></starting_price>
            <duration time="50m 30s"></duration>
        </auction>
        <buy_it_now>
            <starting_price price="N/A"></starting_price>
            <duration time="N/A"></duration>
        </buy_it_now>
        <description>
            The HTC Droid Incredible lets you communicate effortlessly through its
            touchscreen interface. This HTC smartphone has a 3.7-inch, 480x800-pixels
            resolution AMOLED display. Shoot pictures and videos using the built-in
            8.0-megapixel camera. This HTC cell phone has a 1 GHz Snapdragon processor,
            and 512 MB RAM running Google’s Android 2.1 or 2.3.4 (Gingerbread) with HTC
            Sense UI. What’s more, this CDMA HTC smartphone is Wi-Fi-ready. This HTC
            mobile phone has 8 GB memory, and supports up to 32 GB microSD memory cards.
            The HTC Droid Incredible has built-in Bluetooth 2.1 with A2DP support, and
            a microUSB 2.0 port.
        </description>
        <shipping>
        <cost>$5.99</cost>
        <speed>Economy Shipping</speed>
        <shipping>
        <payment>PayPal, Bill Me Later</payment>
    </phone>

    <phone>

        <title>HTC 7 Pro - 16GB - Gray (U.S. Cellular) Smartphone</title>
        <gBay_id>Item: 181006815999</gBay_id>
        <user_id>Seller: st4mford</user_id>
        <category>Type: Smartphone</category>
        <condition>Condition: Used</condition>
        <brand>Brand: HTC</brand>
        <model>Model: 7 Pro</model>
        <carrier>Carrier: U.S. Cellular</carrier>
        <color>Color: Black</color>
        <OS>Operating System: Windows Phone 7</OS>
        <contract>Contract: Without Contract</contract>
        <style>Form Factor: Bar</style>
        <buying_format>Auction</buying_format>
        <auction>
            <starting_price price="$79.99"></starting_price>
            <duration time="1h 14m 29s"></duration>
        </auction>
        <buy_it_now>
            <starting_price price="$119.99"></starting_price>
            <duration time="1h 14m 29s"></duration>
        </buy_it_now>
        <description>
            View and edit the office docs on your phone. Quickly and easily cut through
            the clutter to see only the unread, urgent, or flagged messages in your
            Outlook inbox. And use SharePoint, when you need a little bit of help from
            your team to crack the project.The slide and tilt screen on the HTC 7 Pro
            angles perfectly to reveal a dedicated QWERTY keyboard. The keys are raised
            and nicely spaced for fast and comfortable typing. And because the screen
            tilts, the HTC 7 Pro is perfect for watching videos - hands free - when you
            have a brief moment to kick back and relax.
        </description>
        <shipping>
        <cost price="$3.99"></cost>
        <speed type="Economy Shipping"></speed>
        <shipping>
        <payment>PayPal, Bill Me Later</payment>
    </phone>

样式:

phones  {   font-family:arial,calibri;  }
title   {   font-size:125%;     font-family:trebuchet ms, arial;    font-style:bold;    }
gBay_id     {   font-size:75%;  color: blue;    }
user_id     {   font-style:bold;    }
buying_format   {   background-color: #D8D8D8;  }
auction     {   background-color: #D8D8D8;  }
buy_it_now  {   background-color: #D8D8D8;  }

2 个答案:

答案 0 :(得分:2)

嗯,你有一些错误。

  • 您尚未正确关闭发货代码。他们应该是:
<shipping>
    <cost>$0.00</cost>
    <speed>Expedited Shipping</speed> 
</shipping>
  • 你错过了最后的结束标记:
</phones>
  • 我发现chrome可以提供非常有用的错误消息来帮助修复xml错误。例如,在我修复结束标记</phones>之前,chrome中的错误消息显示:
This page contains the following errors:

error on line 129 at column 10: Extra content at the end of the document
Below is a rendering of the page up to the first error.

答案 1 :(得分:1)

除了manishie已经提到的格式错误之外,您还需要更正格式错误的文档类型声明:for

<?DOCTYPE ... >

<!DOCTYPE ... >

当我修复它以及WF错误时,页面会正常显示,并且CSS样式似乎会按照人们的预期使用。

使用错误的DOCTYPE声明,解析器会识别 - 因此吞下你的xml-stylesheet指令。我不知道你为什么要看文件的第一部分而不是整篇文件。