diff options
Diffstat (limited to 'src/xmlfixups.cpp')
-rw-r--r-- | src/xmlfixups.cpp | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/src/xmlfixups.cpp b/src/xmlfixups.cpp index 2bb52f8..cd271e6 100644 --- a/src/xmlfixups.cpp +++ b/src/xmlfixups.cpp @@ -89,7 +89,8 @@ bool XmlFixups::breakElement(const DOM::Element& el, const string& contain) { ASSERT(el != NULL); - DOM::Element parent = (const DOM::Element&)el.getParentNode(); + DOM::Node node = el.getParentNode(); + DOM::Element parent = (DOM::Element&)node; DOM::Element grandparent; string s = el.getNodeName(); @@ -97,7 +98,10 @@ bool XmlFixups::breakElement(const DOM::Element& el, const string& contain) // Get the parent node if(parent != NULL) - grandparent = (const DOM::Element&)parent.getParentNode(); + { + node = parent.getParentNode(); + grandparent = (DOM::Element&)node; + } // Make sure we have something to work with before continuing if(grandparent == NULL || parent == NULL || @@ -131,7 +135,8 @@ bool XmlFixups::breakElement(const DOM::Element& el, const string& contain) else { // Clone it but not deep - DOM::Element parent2 = (const DOM::Element&)parent.cloneNode(false); + node = parent.cloneNode(false); + DOM::Element parent2 = (DOM::Element&)node; if(parent2 == NULL) return false; @@ -168,7 +173,8 @@ void XmlFixups::breakBlocks(DOM::Document& document) { for(int i = 0; i < blocks->getLength(); i++) { - DOM::Element block = (const DOM::Element&)blocks->item(i); + DOM::Node node = blocks->item(i); + DOM::Element block = (DOM::Element&)node; // If it's the single closed style para then break it if(block != NULL && !block.hasChildNodes()) @@ -183,7 +189,8 @@ void XmlFixups::breakBlocks(DOM::Document& document) { for(int i = 0; i < destinations->getLength(); i++) { - DOM::Element dest = (const DOM::Element&)destinations->item(i); + DOM::Node node = destinations->item(i); + DOM::Element dest = (const DOM::Element&)node; // Sanity Check if(dest == NULL || !dest.hasChildNodes()) @@ -235,7 +242,8 @@ void XmlFixups::wrapTags(DOM::Document& doc, const string& tagName, { for(int i = 0; i < tags->getLength(); i++) { - DOM::Element tag = (const DOM::Element&)tags->item(i); + DOM::Node node = tags->item(i); + DOM::Element tag = (const DOM::Element&)node; DOM::Element wrap = doc.createElement(wrapName); while(tag.hasChildNodes()) @@ -254,7 +262,8 @@ void XmlFixups::breakTags(DOM::Document& doc, const string& parentName, { for(int i = 0; i < parents->getLength(); i++) { - DOM::Element parent = (const DOM::Element&)parents->item(i); + DOM::Node node = parents->item(i); + DOM::Element parent = (DOM::Element&)node; if(!parent.hasChildNodes()) continue; @@ -264,7 +273,10 @@ void XmlFixups::breakTags(DOM::Document& doc, const string& parentName, if(tags != NULL) { for(int i = 0; i < tags->getLength(); i++) - breakElement((const DOM::Element&)tags->item(i), parentName); + { + node = tags->item(i); + breakElement((DOM::Element&)node, parentName); + } } DOM::Node tag = doc.createElement(tagName); @@ -321,7 +333,8 @@ void XmlFixups::breakTags(DOM::Document& doc, const string& parentName, { for(int i = 0; i < tags->getLength(); i++) { - DOM::Element tag = (const DOM::Element&)tags->item(i); + DOM::Node node = tags->item(i); + DOM::Element tag = (DOM::Element&)node; DOM::Node parent = tag.getParentNode(); if(parent != NULL && !DOMHelpers::isElement(parent, parentName)) @@ -337,7 +350,8 @@ void XmlFixups::breakLists(DOM::Document& doc) { for(int i = 0; i < destinations->getLength(); i++) { - DOM::Element dest = (const DOM::Element&)destinations->item(i); + DOM::Node node = destinations->item(i); + DOM::Element dest = (const DOM::Element&)node; // Sanity Check if(dest == NULL) @@ -617,7 +631,8 @@ void XmlFixups::runPassTwo(const DOM::Document& doc) // Tags for which duplicates need to be combined if(m_duplicates.find(name) != m_duplicates.end()) { - DOM::Element parent = (const DOM::Element&)el.getParentNode(); + DOM::Node node = el.getParentNode(); + DOM::Element parent = (DOM::Element&)node; if(parent != NULL) { DOM::Node prev = el.getPreviousSibling(); @@ -686,7 +701,8 @@ void XmlFixups::breakTables(DOM::Document& doc) { for(int i = 0; i < rows->getLength(); i++) { - DOM::Element row = (const DOM::Element&)rows->item(i); + DOM::Node node = rows->item(i); + DOM::Element row = (DOM::Element&)node; DOM::Node parent = row.getParentNode(); if(parent == NULL) @@ -715,7 +731,8 @@ void XmlFixups::breakTables(DOM::Document& doc) { for(int i = 0; i < destinations->getLength(); i++) { - DOM::Element dest = (const DOM::Element&)destinations->item(i); + DOM::Node node = destinations->item(i); + DOM::Element dest = (DOM::Element&)node; // Sanity Check if(dest == NULL) |