1require "rexml_test_utils"
2
3require "rexml/document"
4
5class TestNamespace < Test::Unit::TestCase
6  include REXMLTestUtils
7  include REXML
8
9  def setup
10    @xsa_source = <<-EOL
11      <?xml version="1.0"?>
12      <?xsl stylesheet="blah.xsl"?>
13      <!-- The first line tests the XMLDecl, the second tests PI.
14      The next line tests DocType. This line tests comments. -->
15      <!DOCTYPE xsa PUBLIC
16        "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
17        "http://www.garshol.priv.no/download/xsa/xsa.dtd">
18
19      <xsa>
20        <vendor id="blah">
21          <name>Lars Marius Garshol</name>
22          <email>larsga@garshol.priv.no</email>
23          <url>http://www.stud.ifi.uio.no/~lmariusg/</url>
24        </vendor>
25      </xsa>
26    EOL
27  end
28
29  def test_xml_namespace
30    xml = <<-XML
31<?xml version="1.0" encoding="UTF-8"?>
32<root xmlns:xml="http://www.w3.org/XML/1998/namespace" />
33XML
34    document = Document.new(xml)
35    assert_equal("http://www.w3.org/XML/1998/namespace",
36                 document.root.namespace("xml"))
37  end
38end
39