You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/07/12 10:24:20 UTC
cvs commit: xml-cocoon2/src/org/apache/cocoon/xml/dom DOMBuilder.java
cziegeler 01/07/12 01:24:19
Modified: src/org/apache/cocoon/xml/dom DOMBuilder.java
Log:
Fixing dom level 2 problems. Namespace for namespace attributes now set
correctly and new element without namespace get null as the namespace.
Revision Changes Path
1.2 +5 -5 xml-cocoon2/src/org/apache/cocoon/xml/dom/DOMBuilder.java
Index: DOMBuilder.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/xml/dom/DOMBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOMBuilder.java 2001/05/09 20:49:31 1.1
+++ DOMBuilder.java 2001/07/12 08:24:11 1.2
@@ -36,7 +36,7 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:31 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/07/12 08:24:11 $
*/
public class DOMBuilder implements XMLConsumer, Loggable {
protected Logger log;
@@ -110,7 +110,7 @@
* <code>Node</code>, because the notification occurs at <code>endDocument()</code>
* which does not happen here.
*/
-
+
public DOMBuilder(Node parentNode) {
// Set the document as the owner of this node
this.document = parentNode.getOwnerDocument();
@@ -121,7 +121,7 @@
// Go directly to BODY state
this.state = S_BODY;
}
-
+
/** * Return the newly built Document.
*/
public Document getDocument() {
@@ -280,7 +280,7 @@
// element check
if(state!=S_BODY) throw new SAXException("Invalid state"+location());
// Create the Element node
- Element e=this.document.createElementNS(n.getUri(),n.getQName());
+ Element e=this.document.createElementNS(("".equals(n.getUri()) ? null : n.getUri()),n.getQName());
// Process all attributes, leave out namespace attributes
for(int x=0;x<a.getLength();x++) {
String auri=a.getURI(x);
@@ -301,7 +301,7 @@
dec=(NamespacesTable.Declaration)this.undecl.elementAt(x);
String aname="xmlns";
if (dec.getPrefix().length()>0) aname="xmlns:"+dec.getPrefix();
- e.setAttribute(aname,dec.getUri());
+ e.setAttributeNS("http://www.w3.org/2000/xmlns/", aname,dec.getUri());
}
this.undecl.clear();
}
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org