Commit 60bc730a authored by Guido van Rossum's avatar Guido van Rossum

Take care of XML namespace for element tag

parent c6594026
...@@ -111,14 +111,16 @@ class CopyingDOMVisitor(DOMVisitor): ...@@ -111,14 +111,16 @@ class CopyingDOMVisitor(DOMVisitor):
self.curNode = self.curNode.parentNode self.curNode = self.curNode.parentNode
def copyElement(self, node): def copyElement(self, node):
namespaceURI = node.namespaceURI
if self.newDocument is None: if self.newDocument is None:
# This must be the documentElement node. Create the # This must be the documentElement node. Create the
# document now; this also creates the documentElement node # document now; this also creates the documentElement node
self.newDocument = self.documentFactory.createDocument( self.newDocument = self.documentFactory.createDocument(
None, node.nodeName, None) namespaceURI, node.nodeName, None)
newNode = self.newDocument.documentElement newNode = self.newDocument.documentElement
else: else:
newNode = self.newDocument.createElement(node.nodeName) newNode = self.newDocument.createElementNS(namespaceURI,
node.nodeName)
self.curNode.appendChild(newNode) self.curNode.appendChild(newNode)
self.curNode = newNode self.curNode = newNode
......
<?xml version="1.0" ?> <?xml version="1.0" ?>
<biztalk_1> <biztalk_1 xmlns="urn:schemas-biztalk-org:biztalk:biztalk_1">
<header plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo=""> <foo:header xmlns:foo="whomping-willow" plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo="">
<manifest> <manifest>
<document> <document>
<name>sample1</name> <name>sample1</name>
<description>a simple invoice</description> <description>a simple invoice</description>
</document> </document>
</manifest> </manifest>
</header> </foo:header>
<body> <body>
<!-- sample1.xml is an example of a simple invoice for a small restaurant supplies order --> <!-- sample1.xml is an example of a simple invoice for a small restaurant supplies order -->
<Invoice> <Invoice xmlns="urn:http://schemas.biztalk.org/united_rest_com/yw7sg15x.xml">
<Header> <Header>
<InvoiceNumber>01786</InvoiceNumber> <InvoiceNumber>01786</InvoiceNumber>
<InvoiceDate>2000-03-17</InvoiceDate> <!-- March 17th, 2000 --> <InvoiceDate>2000-03-17</InvoiceDate> <!-- March 17th, 2000 -->
......
<?xml version="1.0" ?> <?xml version="1.0" ?>
<biztalk_1 xmlns="urn:schemas-biztalk-org:biztalk:biztalk_1"> <biztalk_1 xmlns="urn:schemas-biztalk-org:biztalk:biztalk_1">
<header plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo=""> <foo:header xmlns:foo="whomping-willow" plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo="">
<manifest> <manifest>
<document> <document>
<name>sample1</name> <name>sample1</name>
<description>a simple invoice</description> <description>a simple invoice</description>
</document> </document>
</manifest> </manifest>
</header> </foo:header>
<body> <body>
......
<?xml version="1.0" ?> <?xml version="1.0" ?>
<biztalk_1> <biztalk_1 xmlns="urn:schemas-biztalk-org:biztalk:biztalk_1">
<header plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo=""> <foo:header xmlns:foo="whomping-willow" plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo="">
<manifest> <manifest>
<document> <document>
<name>sample1</name> <name>sample1</name>
<description>a simple invoice</description> <description>a simple invoice</description>
</document> </document>
</manifest> </manifest>
</header> </foo:header>
<body> <body>
<!-- sample1.xml is an example of a simple invoice for a small restaurant supplies order --> <!-- sample1.xml is an example of a simple invoice for a small restaurant supplies order -->
<Invoice> <Invoice xmlns="urn:http://schemas.biztalk.org/united_rest_com/yw7sg15x.xml">
<Header> <Header>
<InvoiceNumber>01786</InvoiceNumber> <InvoiceNumber>01786</InvoiceNumber>
<InvoiceDate>2000-03-17</InvoiceDate> <!-- March 17th, 2000 --> <InvoiceDate>2000-03-17</InvoiceDate> <!-- March 17th, 2000 -->
......
<?xml version="1.0" ?> <?xml version="1.0" ?>
<biztalk_1 xmlns="urn:schemas-biztalk-org:biztalk:biztalk_1"> <biztalk_1 xmlns="urn:schemas-biztalk-org:biztalk:biztalk_1">
<header plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo=""> <foo:header xmlns:foo="whomping-willow" plain="guido" quote='"' apostrophe="'" both="&quot;'" lt="&lt;" gt="&gt;" amp="&amp;" foo="">
<manifest> <manifest>
<document> <document>
<name>sample1</name> <name>sample1</name>
<description>a simple invoice</description> <description>a simple invoice</description>
</document> </document>
</manifest> </manifest>
</header> </foo:header>
<body> <body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment