Open Bug 63568 Opened 24 years ago Updated 11 months ago

document encoder should be able to serialize free-standing subtrees

Categories

(Core :: XML, enhancement)

enhancement

Tracking

()

Future

People

(Reporter: hjtoi-bugzilla, Unassigned)

Details

We realized in bug 45627 that it would be nice to be able to serialize DOM subtrees that do not have a pointer to a document. (When do we have such subtrees?)
Severity: normal → enhancement
Heikki, are the "free-standing subtrees" in the bug description document fragments? (are DocumentFragments without parent documents even possible?) Or is the bug aboutsomething else?
"free-standing subtree" is a term I heard vidur use for case where we have DOM nodes that are not in a document (i.e. the nodes do not have a pointer to an owner document). Currently we cannot serialize such things, and this is what this bug is all about. I do not know if we can even have such things currently, or if we can, when it is possible... Johnny? By the way, it is possible to serialize parts of a DOM document. You can serialize a) complete document, b) selection or c) a range (that could contain a single complete node, for example).
Heikki, you mention selections and ranges as serializable. Has the serializer gained additional options, compared to the docs at http://www.mozilla.org/xmlextras ?
Oops, sorry. No. The parts in layout CAN serialize selections and ranges, but the XMLExtras Serializer interface does not have a method to invoke it that way. It looks like the DOM 3 will have load & save methods, and I guess it might be best to confer with jst & vidur on the best way to proceed with our DOMParser and XMLSerializer.
jst explained that this situation could arise (for example) if we have a script selecting nodes from a document (building a new tree) and the original document goes away. I am arguing that this should still be pretty rare, and even rarer still would be the case where you want to serialize it. And given that you can already serialize parts of the DOM if the document is still there: This bug has been marked "future" because the original netscape engineer working on this is over-burdened. If you feel this is an error, that you or another known resource will be working on this bug,or if it blocks your work in some way -- please attach your concern to the bug for reconsideration.
Target Milestone: --- → Future
QA Contact: petersen → rakeshmishra
QA Contact: rakeshmishra → ashishbhatt
Could this be used to "Save As..." a picture or document currently loaded? There is a DIRE need in bug 115174 to be able to save a currently loaded page "as is" without requiring a round trip to the server or cache (since the cache must follow server directed expirations and large files that bypass the cache entirely. The large images are the ones people mostly save. See comment #101 in bug 115174, "serialize the DOM like IE does" is what got me looking here. What I was thinking is that Mozilla could use the subtree to save the image. Also, there is a similar need for a single file (like ODF) serialization of a web page that could be used by any browser to display the page exactly as it is seen (not requiring any network reloads despite coding). Another suggestion was to use the same classes used when "printing" to generate a PDF (natively, bypassing the virtual printer requirement), to save the image (in it's native format) or save a PNG or whatever is actually stored in memory.
QA Contact: ashshbhatt → xml

The bug assignee didn't login in Bugzilla in the last 7 months.
:peterv, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: hjtoi-bugzilla → nobody
Flags: needinfo?(peterv)
Severity: normal → S3
Flags: needinfo?(peterv)
You need to log in before you can comment on or make changes to this bug.