You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Mikael Helbo Kjær <mh...@dia.dk> on 2000/07/06 12:16:18 UTC
Q about the inner workings of Xerces
I have two questions on the inner workings of Xerces and I would be very
happy if someone would help me.
1): Is it possible for a Document object to exist after the DOMParser
instance having created the DOM has been explicitly null-ed?
e.g. would the DOM tree be still be fully usuable?
2): Is it possible for to simply write:
DocumentImpl xmldoc = new DocumentImpl();
Element elem = xmldoc.createElement("general-result");
or is there other issue and settings needed.
Please somebody answer this, because I need this to finalize one of my
projects
Mikael Helbo Kjær
Software Developer @ DIA a/s
Re: Q about the inner workings of Xerces
Posted by Jason Crickmer <jc...@hire.com>.
Mikael wrote:
> I have two questions on the inner workings of Xerces and I would be very
> happy if someone would help me.
>
> 1): Is it possible for a Document object to exist after the DOMParser
> instance having created the DOM has been explicitly null-ed?
> e.g. would the DOM tree be still be fully usuable?
Yes, the parser (e.g. DOMParser) object will be out of scope if it is
not referenced again within your own code. There should be no need to
explicitly state "parser = null;", but it wouldn't do any harm.
Keep in mind that what you are doing in making your reference null,
not actually 'destroying' the object. If someone else has a
reference, the object will continue to persist regardless.
> 2): Is it possible for to simply write:
> DocumentImpl xmldoc = new DocumentImpl();
> Element elem = xmldoc.createElement("general-result");
> or is there other issue and settings needed.
Yes. This is how one would do it. Be sure to use something like
appendChild() if you actually want to place the Node (or, more
precisely, Element, in your example) within the document you just
created.
Hope this helps,
Jason