Don't indent element text when it's the only child. Fixed documentation.

git-svn-id: http://yate.null.ro/svn/yate/trunk@3100 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-03-02 09:27:10 +00:00
parent 4cbbec1ebb
commit 71aa51d5db
2 changed files with 11 additions and 6 deletions

View File

@ -1788,9 +1788,16 @@ void XmlElement::toString(String& dump, bool esc, const String& indent,
auxDump << "/";
auxDump << ">";
if (m) {
m_children.toString(auxDump,esc,indent + origIndent,origIndent,completeOnly,auth,this);
// Avoid adding text on new line when text is the only child
XmlText* text = 0;
if (m == 1)
text = static_cast<XmlChild*>(getChildren().skipNull()->get())->xmlText();
if (!text)
m_children.toString(auxDump,esc,indent + origIndent,origIndent,completeOnly,auth,this);
else
text->toString(auxDump,esc,String::empty(),auth,this);
if (m_complete)
auxDump << indent << "</" << getName() << ">";
auxDump << (!text ? indent : String::empty()) << "</" << getName() << ">";
}
dump << auxDump;
}

View File

@ -998,10 +998,8 @@ public:
bool completeOnly = true) const;
/**
* Load an file an parse it
* Reset the document
* Load a file an parse it
* Reset the document
* @param file The file to load
* @param error Pointer to data to be filled with file error if IOError is returned
* @return Parser error (NoError on success)