Home » Developer & Programmer » JDeveloper, Java & XML » empty xmlns attribute in child elements
empty xmlns attribute in child elements [message #91709] Fri, 17 January 2003 04:37 Go to next message
Phil
Messages: 32
Registered: March 2001
Member
Hi,

I have a strange problem creating a dom document using the xdk for pl/sql.
When I define a xmlns="http://www.whatever.com" attribute in the root element, the parser adds
a xmlns="" attribute to each child element.
This behaviour started when I upgraded to the latest xdk (oracle.xml.parser.v2.XMLParser.getReleaseVersion() returns "Oracle XDK Java 9.2.0.4.0 Production").
The following code sample produces the output below (I used [[]] instead of <>, cause otherwise the code would not show.):

domdoc := xmldom.newDOMDocument;
xmldom.setVersion(domdoc, '1.0');
node_main := xmldom.makeNode(domdoc);
elmt_Test := xmldom.createElement(domdoc, 'TestTag');
xmldom.setAttribute(elmt_Test,'xmlns','http://www.foo.bar');
node_Test := xmldom.appendChild(node_main, xmldom.makeNode(elmt_Test));
elmt_Child1 := xmldom.createElement(domdoc, 'Child1');
node_Child1 := xmldom.appendChild(node_Test, xmldom.makeNode(elmt_Child1));
elmt_Child2 := xmldom.createElement(domdoc, 'Child2');
node_Child2 := xmldom.appendChild(node_Test, xmldom.makeNode(elmt_Child2));
elmt_Child3 := xmldom.createElement(domdoc, 'Child3');
node_Child3 := xmldom.appendChild(node_Child1, xmldom.makeNode(elmt_Child3));
xmldom.WRITETOBUFFER(domdoc, v_xml);
DBMS_OUTPUT.PUT_LINE(v_xml);

[[?xml version = '1.0'?]]
[[TestTag xmlns="http://www.foo.bar"]]
[[Child1 xmlns=""]]
[[Child3/]]
[[/Child1]]
[[Child2 xmlns=""/]]
[[/TestTag]]


Whereas in another database, where oracle.xml.parser.v2.XMLParser.getReleaseVersion() returns "Oracle XML Parser 2.0.2.9.0 Production",
the same PL/SQL block produces this output:

[[?xml version = '1.0'?]]
[[TestTag xmlns="http://www.foo.bar"]]
[[Child1 sdg="sdf"]]
[[Child3/]]
[[/Child1]]
[[Child2/]]
[[/TestTag]]

Some guy encountered the same problem using msxml parser, reported so on
http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20362254.html . The solution he said worked for him
can unfortunately not be applied in my situation.

Any advice appreciated, I'm having a little "time problem" on my job right now, and the documents created with those stupid
empty xmlns attributes won't validate against my schema (which i cannot edit/change).

Thanks a lot whoever can help me out.

Cheers
Phil
sdg="sdf" is a mistake made by me -- Phil [message #91711 is a reply to message #91709] Fri, 17 January 2003 06:21 Go to previous messageGo to next message
Phil
Messages: 32
Registered: March 2001
Member
sdg="sdf" is a mistake made by me, not produced by xdk -- Phil
Re: empty xmlns attribute in child elements [message #123255 is a reply to message #91709] Fri, 10 June 2005 16:48 Go to previous messageGo to next message
chendongtom
Messages: 2
Registered: June 2005
Junior Member
have you got any solution to this xmlns attribute problem? i am having the same issue. i would appreciate if you could share any solution u had found.
Re: empty xmlns attribute in child elements [message #156960 is a reply to message #91709] Mon, 30 January 2006 07:05 Go to previous message
plasma
Messages: 1
Registered: January 2006
Junior Member
<< have you got any solution to this xmlns attribute problem? i am having the same issue. ...
...me too!!!
Someone have news about this problem?
Previous Topic: Developer Vs. JDeveloper
Next Topic: Loading large XML-Files into 9i
Goto Forum:
  


Current Time: Mon Nov 25 00:58:29 CST 2024