wednesday night / a site for sore eyes
choose one: a few recent posts; links to embarassing things; rss was for robots.

<< August 12, 2008 >>
a little disappointed

i had been doing a few small improvements since my initial xpcom parsing success on friday, but a Document.importNode()-based solution is not a... solution. today, i wrote a SAX-based parser in js, that just called my DOMImplementation's functions (why there isn't something in mozilla that can do that already had confounded me, but as you'll see, i'm no longer so naive).

that was all well and good, until i got it working, and tried to use XMLSerializer to print out my dom tree. that did not work. you see, there is a pesky little function call nsContentUtils::CanCallerAccess(), which contains this:

nsCOMPtr<nsINode> node = do_QueryInterface(aNode); NS_ENSURE_TRUE(node, PR_FALSE);

unfortunately, while my objects support nsIDOMNode, they do not support nsINode; its header is not in the public sdk directory, and besides:

class nsINode : public nsPIDOMEventTarget {

that P doesn't lead me to believe i should be implementing it.

ok, that's fine. i can create a dummy document with DOMParser, and import my document into it, and then dump that.

of course, nsDocument::ImportNode() has this:

nsCOMPtr<nsINode> imported = do_QueryInterface(aImportedNode); NS_ENSURE_TRUE(imported, NS_ERROR_FAILURE);

i'm sure i'll think of something in my sleep.

* * *