DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26214>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26214 setIdAttribute("jeffid",true); throws DOMException: NOT_FOUND_ERR: Summary: setIdAttribute("jeffid",true); throws DOMException: NOT_FOUND_ERR: Product: Xerces2-J Version: 2.6.0 Platform: All OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The code listed below causes: java DOMGenerate org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist. at org.apache.xerces.dom.ElementImpl.setIdAttribute(Unknown Source) at DOMGenerate.main(DOMGenerate.java:18) I don't believe this is correct behavior. This is a DOM3 feature, so I may need to do something special to get Java to use it, but I don't think that is the case. import org.w3c.dom.*; import org.apache.xerces.dom.DocumentImpl; import org.apache.xerces.dom.DOMImplementationImpl; import org.w3c.dom.Document; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.Serializer; import org.apache.xml.serialize.SerializerFactory; import org.apache.xml.serialize.XMLSerializer; import java.io.*; public class DOMGenerate { public static void main( String[] argv ) { try { Document doc= new DocumentImpl(); Element root = doc.createElement("person"); Element item = doc.createElement("name"); item.appendChild( doc.createTextNode("Jeff") ); item.setIdAttribute("jeffid",true); root.appendChild( item ); doc.appendChild( root ); Element jeff = doc.getElementById("jeffid"); System.out.println("**************************"); System.out.println("Jeff tagName:"+jeff.getTagName()); System.out.println(jeff.getAttribute("id")); System.out.println("**************************"); System.out.close(); OutputFormat format = new OutputFormat( doc ); StringWriter stringOut = new StringWriter(); XMLSerializer serial = new XMLSerializer( stringOut, format ); serial.asDOMSerializer(); serial.serialize( doc.getDocumentElement() ); System.out.println( "STRXML = " + stringOut.toString() ); } catch ( Exception ex ) { ex.printStackTrace(); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
