Bug 12755 - WebFrame should have a method - (NSData *)data to return an NSData representation of a document
Summary: WebFrame should have a method - (NSData *)data to return an NSData representa...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2007-02-12 22:17 PST by Robert Burns
Modified: 2007-12-10 06:34 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Burns 2007-02-12 22:17:44 PST
This would balance the method -(void)loadData which loads a file from data. Currently, this requires getting a string from the documentElement and converting it to data. This loses the DTD and XML declarations if present. Consequently mthods to roundtrip load data and save data are not there.
Comment 1 Alexey Proskuryakov 2007-02-13 03:21:17 PST
It is correct that document.documentElement serialization does not include the DTD or XML declaration, but I believe that serialization of the document itself should include those, and I think it's a WebKit bug that it doesn't.

Try javascript:alert((new XMLSerializer).serializeToString(document)) in Safari and in Firefox to compare the results.
Comment 2 Robert Burns 2007-02-13 22:48:35 PST
reported to http://bugreport.apple.com/ as 4995330
Comment 3 Robert Burns 2007-02-13 23:27:29 PST
> It is correct that document.documentElement serialization does not include the
> DTD or XML declaration, but I believe that serialization of the document itself
> should include those, and I think it's a WebKit bug that it doesn't.

Just to clarify, this bug is referring to the WebFrame class that has a corresponding element to loadData, but not one to unload data that has been edited. A related bug that should probably be reported separately is that there is no method to serialize the document that preserves the original DocType and XML preambles ( if any).