mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 00:07:59 +02:00
changes for 1.2.4
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DOMParser.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/src/DOMParser.cpp#1 $
|
||||
// $Id: //poco/1.2/XML/src/DOMParser.cpp#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
@@ -54,6 +54,8 @@ DOMParser::DOMParser(NamePool* pNamePool):
|
||||
_whitespace(true)
|
||||
{
|
||||
if (_pNamePool) _pNamePool->duplicate();
|
||||
_saxParser.setFeature(XMLReader::FEATURE_NAMESPACES, true);
|
||||
_saxParser.setFeature(XMLReader::FEATURE_NAMESPACE_PREFIXES, true);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Document.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/src/Document.cpp#1 $
|
||||
// $Id: //poco/1.2/XML/src/Document.cpp#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
@@ -306,4 +306,20 @@ Notation* Document::createNotation(const XMLString& name, const XMLString& publi
|
||||
}
|
||||
|
||||
|
||||
Element* Document::getElementById(const XMLString& elementId, const XMLString& idAttribute) const
|
||||
{
|
||||
Element* pElem = documentElement();
|
||||
if (pElem) pElem = pElem->getElementById(elementId, idAttribute);
|
||||
return pElem;
|
||||
}
|
||||
|
||||
|
||||
Element* Document::getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const
|
||||
{
|
||||
Element* pElem = documentElement();
|
||||
if (pElem) pElem = pElem->getElementByIdNS(elementId, idAttributeURI, idAttributeLocalName);
|
||||
return pElem;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Element.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/src/Element.cpp#1 $
|
||||
// $Id: //poco/1.2/XML/src/Element.cpp#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
@@ -404,5 +404,42 @@ Node* Element::copyNode(bool deep, Document* pOwnerDocument) const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
Element* Element::getElementById(const XMLString& elementId, const XMLString& idAttribute) const
|
||||
{
|
||||
if (getAttribute(idAttribute) == elementId)
|
||||
return const_cast<Element*>(this);
|
||||
|
||||
Node* pNode = firstChild();
|
||||
while (pNode)
|
||||
{
|
||||
if (pNode->nodeType() == Node::ELEMENT_NODE)
|
||||
{
|
||||
Element* pResult = static_cast<Element*>(pNode)->getElementById(elementId, idAttribute);
|
||||
if (pResult) return pResult;
|
||||
}
|
||||
pNode = pNode->nextSibling();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element* Element::getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const
|
||||
{
|
||||
if (getAttributeNS(idAttributeURI, idAttributeLocalName) == elementId)
|
||||
return const_cast<Element*>(this);
|
||||
|
||||
Node* pNode = firstChild();
|
||||
while (pNode)
|
||||
{
|
||||
if (pNode->nodeType() == Node::ELEMENT_NODE)
|
||||
{
|
||||
Element* pResult = static_cast<Element*>(pNode)->getElementByIdNS(elementId, idAttributeURI, idAttributeLocalName);
|
||||
if (pResult) return pResult;
|
||||
}
|
||||
pNode = pNode->nextSibling();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NamespaceStrategy.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/src/NamespaceStrategy.cpp#1 $
|
||||
// $Id: //poco/1.2/XML/src/NamespaceStrategy.cpp#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
@@ -184,15 +184,19 @@ void NamespacePrefixesStrategy::startElement(const XMLChar* name, const XMLChar*
|
||||
const XMLChar* attrValue = *atts++;
|
||||
XMLString attrURI;
|
||||
XMLString attrLocal;
|
||||
XMLString attrPrefix;
|
||||
splitName(attrName, attrURI, attrLocal, attrPrefix);
|
||||
attributes.addAttribute(attrURI, attrLocal, attrPrefix, CDATA, attrValue, i < specifiedCount);
|
||||
XMLString attrQName;
|
||||
splitName(attrName, attrURI, attrLocal, attrQName);
|
||||
if (!attrQName.empty()) attrQName.append(":");
|
||||
attrQName.append(attrLocal);
|
||||
attributes.addAttribute(attrURI, attrLocal, attrQName, CDATA, attrValue, i < specifiedCount);
|
||||
}
|
||||
XMLString uri;
|
||||
XMLString local;
|
||||
XMLString prefix;
|
||||
splitName(name, uri, local, prefix);
|
||||
pContentHandler->startElement(uri, local, prefix, attributes);
|
||||
XMLString qname;
|
||||
splitName(name, uri, local, qname);
|
||||
if (!qname.empty()) qname.append(":");
|
||||
qname.append(local);
|
||||
pContentHandler->startElement(uri, local, qname, attributes);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,9 +206,11 @@ void NamespacePrefixesStrategy::endElement(const XMLChar* name, ContentHandler*
|
||||
|
||||
XMLString uri;
|
||||
XMLString local;
|
||||
XMLString prefix;
|
||||
splitName(name, uri, local, prefix);
|
||||
pContentHandler->endElement(uri, local, prefix);
|
||||
XMLString qname;
|
||||
splitName(name, uri, local, qname);
|
||||
if (!qname.empty()) qname.append(":");
|
||||
qname.append(local);
|
||||
pContentHandler->endElement(uri, local, qname);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user