knoaman 2002/07/30 06:26:56
Modified: c/src/xercesc/parsers AbstractDOMParser.cpp
Log:
Create default attributes with the namespace URI mapped to the
attributes' prefixes.
Revision Changes Path
1.16 +6 -34 xml-xerces/c/src/xercesc/parsers/AbstractDOMParser.cpp
Index: AbstractDOMParser.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/parsers/AbstractDOMParser.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractDOMParser.cpp 26 Jul 2002 20:30:48 -0000 1.15
+++ AbstractDOMParser.cpp 30 Jul 2002 13:26:56 -0000 1.16
@@ -724,42 +724,14 @@
// So as long as the XML parser doesn't do it, it needs to
// done here.
const XMLCh* qualifiedName = attr->getFullName();
- int index =
DOMDocumentImpl::indexofQualifiedName(qualifiedName);
-
+ XMLBufBid bbPrefixQName(&fBufMgr);
XMLBufBid bbQName(&fBufMgr);
- XMLBuffer& buf = bbQName.getBuffer();
- static const XMLCh XMLNS[] = {
- chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s,
chNull};
-
- if (index > 0) {
- // there is prefix
- // map to XML URI for all cases except when prefix ==
"xmlns"
- XMLCh* prefix;
- XMLCh temp[1000];
-
- if (index > 999)
- prefix = new XMLCh[index+1];
- else
- prefix = temp;
-
- XMLString::subString(prefix ,qualifiedName, 0, index);
-
- if (!XMLString::compareString(prefix,XMLNS))
- buf.append(XMLUni::fgXMLNSURIName);
- else
- buf.append(XMLUni::fgXMLURIName);
-
- if (index > 999)
- delete prefix;
- }
- else {
- // No prefix
- if (!XMLString::compareString(qualifiedName,XMLNS))
- buf.append(XMLUni::fgXMLNSURIName);
- }
+ XMLBuffer& prefixBuf = bbPrefixQName.getBuffer();
+ XMLBuffer& nameBuf = bbQName.getBuffer();
+ unsigned int uriId = fScanner->resolveQName(qualifiedName,
nameBuf, prefixBuf, ElemStack::Mode_Attribute);
insertAttr = (DOMAttrImpl *) fDocument->createAttributeNS(
- buf.getRawBuffer(), // NameSpaceURI
+ fScanner->getURIText(uriId), // NameSpaceURI
qualifiedName); // qualified name
DOMNode* remAttr =
elemImpl->setDefaultAttributeNodeNS(insertAttr);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]