You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2006/03/21 09:01:50 UTC
svn commit: r387456 -
/xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
Author: amassari
Date: Tue Mar 21 00:01:49 2006
New Revision: 387456
URL: http://svn.apache.org/viewcvs?rev=387456&view=rev
Log:
If "entities" feature is set to TRUE, entities reference inside attribute values should be serialized as "&ent;"
Modified:
xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp?rev=387456&r1=387455&r2=387456&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp Tue Mar 21 00:01:49 2006
@@ -1002,9 +1002,24 @@
*fFormatter << XMLFormatter::NoEscapes
<< chSpace << attribute->getNodeName()
<< chEqual << chDoubleQuote
- << XMLFormatter::AttrEscapes
- << attribute->getNodeValue()
- << XMLFormatter::NoEscapes
+ << XMLFormatter::AttrEscapes;
+ if (getFeature(ENTITIES_ID))
+ {
+ DOMNodeSPtr child = attribute->getFirstChild();
+ while( child != 0)
+ {
+ if(child->getNodeType()==DOMNode::TEXT_NODE)
+ *fFormatter << child->getNodeValue();
+ else if(child->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE)
+ *fFormatter << XMLFormatter::NoEscapes
+ << chAmpersand << child->getNodeName() << chSemiColon
+ << XMLFormatter::AttrEscapes;
+ child = child->getNextSibling();
+ }
+ }
+ else
+ *fFormatter << attribute->getNodeValue();
+ *fFormatter << XMLFormatter::NoEscapes
<< chDoubleQuote;
}
} // end of for
@@ -1095,24 +1110,33 @@
const XMLCh* localName = nodeToWrite->getLocalName();
// check if this is a DOM Level 1 Node
- if(localName == 0) {
+ if(localName == 0)
*fFormatter << XMLFormatter::NoEscapes
- << nodeToWrite->getNodeName()
- << chEqual << chDoubleQuote
- << XMLFormatter::AttrEscapes
- << nodeToWrite->getNodeValue()
- << XMLFormatter::NoEscapes
- << chDoubleQuote;
- } else {
+ << nodeToWrite->getNodeName();
+ else
*fFormatter << XMLFormatter::NoEscapes
<< chOpenCurly << nodeToWrite->getNamespaceURI()
- << chCloseCurly << localName
- << chEqual << chDoubleQuote
- << XMLFormatter::AttrEscapes
- << nodeToWrite->getNodeValue()
- << XMLFormatter::NoEscapes
- << chDoubleQuote;
+ << chCloseCurly << localName;
+ *fFormatter << chEqual << chDoubleQuote
+ << XMLFormatter::AttrEscapes;
+ if (getFeature(ENTITIES_ID))
+ {
+ DOMNodeSPtr child = nodeToWrite->getFirstChild();
+ while( child != 0)
+ {
+ if(child->getNodeType()==DOMNode::TEXT_NODE)
+ *fFormatter << child->getNodeValue();
+ else if(child->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE)
+ *fFormatter << XMLFormatter::NoEscapes
+ << chAmpersand << child->getNodeName() << chSemiColon
+ << XMLFormatter::AttrEscapes;
+ child = child->getNextSibling();
+ }
}
+ else
+ *fFormatter << nodeValue;
+ *fFormatter << XMLFormatter::NoEscapes
+ << chDoubleQuote;
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org