diff options
author | Stef Walter <stef@memberwebs.com> | 2004-07-27 21:34:03 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-07-27 21:34:03 +0000 |
commit | 61ff9cee67228fd5b430eb929687ca0cac992a7c (patch) | |
tree | 73e27790adf037ce31280ae92e67d494983d18bd /src | |
parent | d2105fb3fb2082bb32875eaab6db6a2c04c7eae5 (diff) |
- Element comparison fixes
- Other XML fixup fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/domhelpers.cpp | 8 | ||||
-rw-r--r-- | src/xmlcomposer.cpp | 9 | ||||
-rw-r--r-- | src/xmlfixups.cpp | 8 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/domhelpers.cpp b/src/domhelpers.cpp index 4836d17..9a9cfd2 100644 --- a/src/domhelpers.cpp +++ b/src/domhelpers.cpp @@ -50,7 +50,7 @@ bool DOMHelpers::isElement(const DOM::Node& node, const string& name) bool DOMHelpers::isEqualElement(const DOM::Element& el1, const DOM::Element& el2) { - if(el1.getNodeName() == el2.getNodeName()) + if(el1.getNodeName() != el2.getNodeName()) return false; // Compare attributes @@ -67,14 +67,14 @@ bool DOMHelpers::isEqualElement(const DOM::Element& el1, const DOM::Element& el2 for(int i = 0; i < at1->getLength(); i++) { DOM::Attr attr1 = (const DOM::Attr&)at1->item(0); - if(attr1 != NULL) + if(attr1 == NULL) return false; DOM::Attr attr2 = (const DOM::Attr&)at2->getNamedItem(attr1.getNodeName()); - if(attr2 != NULL) + if(attr2 == NULL) return false; - if(attr1.getNodeValue() == attr2.getNodeValue()) + if(attr1.getNodeValue() != attr2.getNodeValue()) return false; } diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index a90c25a..6f41b29 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -1095,7 +1095,14 @@ ON_CHARDATA(Content) AN_ATTRIBUTE(kAtName, font); if(fontsize != -1) - AN_ATTRIBUTE(kAtSize, fontsize); + { + // Little hack for half point sizes + wstring size = NUM_ATTR(fontsize / 2); + if(fontsize % 2) + size.append(L".5"); + + AN_ATTRIBUTE(kAtSize, size); + } if(format.textColor() != -1) AN_ATTRIBUTE(kAtColor, format.textColor()); diff --git a/src/xmlfixups.cpp b/src/xmlfixups.cpp index 45fa59a..3b56f6b 100644 --- a/src/xmlfixups.cpp +++ b/src/xmlfixups.cpp @@ -75,7 +75,7 @@ XmlFixups::XmlFixups() { loadStringSet(m_duplicates, kNoDuplicates); loadStringSet(m_removes, kRemoveTags); - loadStringSet(m_removes, kRemoveEmpty); + loadStringSet(m_removeEmpty, kRemoveEmpty); loadStringSet(m_requireAttrs, kRequireAttrs); loadStringSet(m_consolidateStart, kConsolidateStart); loadStringSet(m_consolidateEnd, kConsolidateEnd); @@ -511,7 +511,7 @@ void XmlFixups::runPassTwo(const DOM::Document& doc) if(font != NULL) el.setAttribute(kAtName, font.getAttribute(kAtName)); - font.removeAttribute(kAtId); + el.removeAttribute(kAtId); } } @@ -545,7 +545,7 @@ void XmlFixups::runPassTwo(const DOM::Document& doc) // Tags that get removed but contents preserved. Also here are // tags that get removed if they have no attributes if(m_removes.find(name) != m_removes.end() || - (m_requireAttrs.find(name) != m_requireAttrs.end() && el.hasAttributes())) + (m_requireAttrs.find(name) != m_requireAttrs.end() && !el.hasAttributes())) { DOM::Node parent = el->getParentNode(); @@ -569,7 +569,7 @@ void XmlFixups::runPassTwo(const DOM::Document& doc) } // Tags that get removed when no child nodes exist - if(m_removeEmpty.find(name) != m_removeEmpty.end() && el.hasChildNodes()) + if(m_removeEmpty.find(name) != m_removeEmpty.end() && !el.hasChildNodes()) { DOM::Node parent = el->getParentNode(); |