XalanNode*
XercesNamedNodeMapBridge::setNamedItem(XalanNode* 	arg)
{
	assert(arg != 0);

	XalanNode*	theXalanNode = 0;

	// Find the DOM_Node that corresponds to the bridge node...
	const DOM_NodeType	theNode = m_navigator.mapNode(arg);

	if (theNode.isNull() == true)
	{
		// Doesn't belong to this doc, so throw...
		throw XercesDOMException(XercesDOMException::WRONG_DOCUMENT_ERR);
	}

	try
	{
		const DOM_NodeType	theOldXercesNode =
			m_xercesNamedNodeMap.setNamedItem(theNode);

		if (theNode.isNull() == false)
		{
			// A node was replaced, so map the replacement...
			theXalanNode = m_navigator.mapNode(theOldXercesNode);
			assert(theXalanNode != 0);
		}
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}

	return theXalanNode;
}
示例#2
0
XalanAttr*
XercesElementBridge::setAttributeNodeNS(XalanAttr*	newAttr)
{
	assert(newAttr != 0);


	const DOM_AttrType	theXercesAttrNode =
			m_navigator.mapNode(newAttr);
	assert(theXercesAttrNode.isNull() == false);

	XalanAttr*	theXalanAttrResult = 0;

	try
	{
		const DOM_AttrType	theXercesAttrResult =
			m_xercesNode.setAttributeNodeNS(theXercesAttrNode);

		theXalanAttrResult = m_navigator.mapNode(theXercesAttrResult);
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}

	return theXalanAttrResult;
}
示例#3
0
XalanNode*
XercesTextBridge::removeChild(XalanNode*	/* oldChild */)
{
	throw XercesDOMException(XercesDOMException::HIERARCHY_REQUEST_ERR);

	return 0;
}
示例#4
0
XalanNode*
XercesTextBridge::appendChild(XalanNode*	/* newChild */)
{
	throw XercesDOMException(XercesDOMException::HIERARCHY_REQUEST_ERR);

	return 0;
}
XalanNode*
XercesCommentBridge::replaceChild(
			XalanNode*	/* newChild */,
			XalanNode*	/* oldChild */)
{
	throw XercesDOMException(XercesDOMException::HIERARCHY_REQUEST_ERR);

	return 0;
}
示例#6
0
XalanNode*
XercesTextBridge::insertBefore(
			XalanNode*	/* newChild */,
			XalanNode*	/* refChild */)
{
	throw XercesDOMException(XercesDOMException::HIERARCHY_REQUEST_ERR);

	return 0;
}
XalanDocumentType*
XercesDOMImplementationWrapper::createDocumentType(
			const XalanDOMString&	/* qualifiedName */,
			const XalanDOMString&	/* publicId */,
			const XalanDOMString&	/* systemId */)
{
	throw XercesDOMException(XercesDOMException::NO_MODIFICATION_ALLOWED_ERR);

	return 0;
}
XalanDocument*
XercesDOMImplementationWrapper::createDocument(
			const XalanDOMString&		/* namespaceURI */,
			const XalanDOMString&		/* qualifiedName */,
			const XalanDocumentType&	/* doctype */)
{
	throw XercesDOMException(XercesDOMException::NO_MODIFICATION_ALLOWED_ERR);

	return 0;
}
示例#9
0
void
XercesElementBridge::removeAttribute(const XalanDOMString&	name)
{
	try
	{
		m_xercesNode.removeAttribute(c_wstr(name));
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
XercesBridgeHelper::normalize(DOM_NodeType&		theXercesNode)
{
	try
	{
		theXercesNode.normalize();
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::comment(const XMLCh* const	data)
{
	try
	{
		processAccumulatedText();

		append(m_doc->createComment(data));
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
XercesBridgeHelper::setPrefix(
			DOM_NodeType&			theXercesNode,
			const XalanDOMString&	prefix)
{
	try
	{
		theXercesNode.setPrefix(XalanDOMStringToXercesDOMString(prefix));
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::entityReference(const XMLCh* const	name)
{
	try
	{
		processAccumulatedText();

		append(m_doc->createEntityReference(name));
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::endDocument()
{
	try
	{
        // Process any remaining text, in case we're
        // appending to a DOMDocumentFragment.
        processAccumulatedText();
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
XercesBridgeHelper::appendData(
			DOM_CharacterDataType&	theXercesNode,
			const XalanDOMString&	arg)
{
	try
	{
		theXercesNode.appendData(XalanDOMStringToXercesDOMString(arg));
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
示例#16
0
void
XercesElementBridge::setAttributeNS(
			const XalanDOMString&	namespaceURI,
			const XalanDOMString&	qualifiedName,
			const XalanDOMString&	value)
{
	try
	{
		m_xercesNode.setAttributeNS(c_wstr(namespaceURI), c_wstr(qualifiedName), c_wstr(value));
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
XercesBridgeHelper::deleteData(
			DOM_CharacterDataType&	theXercesNode,
			unsigned int			offset, 
			unsigned int			count)
{
	try
	{
		theXercesNode.deleteData(offset, count);
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
XercesBridgeHelper::insertData(
			DOM_CharacterDataType&	theXercesNode,
			unsigned int			offset,
			const  XalanDOMString& 	arg)
{
	try
	{
		theXercesNode.insertData(offset, XalanDOMStringToXercesDOMString(arg));
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::charactersRaw(
		const XMLCh* const	chars,
		const unsigned int	length)
{
	try
	{
		processAccumulatedText();

		cdata(chars, length);
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}		
void
FormatterToXercesDOM::processingInstruction(
			const XMLCh* const	target,
			const XMLCh* const	data)
{
	try
	{
		processAccumulatedText();

		append(m_doc->createProcessingInstruction(target, data));
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
const XalanDOMString
XercesBridgeHelper::substringData(
			const DOM_CharacterDataType&	theXercesNode,
			unsigned int					offset,
			unsigned int					count)
{
	try
	{
		const DOMStringType		theString(theXercesNode.substringData(offset, count));

		return XalanDOMString(theString.rawBuffer(), theString.length());
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
XALAN_CPP_NAMESPACE_BEGIN



void
XercesBridgeHelper::setNodeValue(
			DOM_NodeType&			theXercesNode,
			const XalanDOMString&	nodeValue)
{
	try
	{
		theXercesNode.setNodeValue(XalanDOMStringToXercesDOMString(nodeValue));
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::ignorableWhitespace(
			const XMLCh* const	chars,
			const unsigned int	length)
{
	try
	{
		processAccumulatedText();

		assign(m_buffer, chars, length);

		append(m_doc->createTextNode(m_buffer.c_str()));
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::cdata(
			const XMLCh* const	ch,
			const unsigned int 	length)
{
	try
	{
		processAccumulatedText();

		assign(m_buffer, ch, length);

		append(m_doc->createCDATASection(m_buffer.c_str()));
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
XalanNode*
XercesNamedNodeMapBridge::removeNamedItem(const XalanDOMString&		name)
{
	XalanNode*	theXalanNode = 0;

	try
	{
		const DOM_NodeType	theXercesNode =
			m_xercesNamedNodeMap.removeNamedItem(c_wstr(name));

		// A node was removed, so get it corresponding XalanNode...
		theXalanNode = m_navigator.mapNode(theXercesNode);
		assert(theXalanNode != 0);
	}
	catch(const DOM_DOMExceptionType&	theException)
	{
		throw XercesDOMException(theException);
	}

	return theXalanNode;
}
void
FormatterToXercesDOM::endElement(const	XMLCh* const	/* name */)
{
	try
	{
		processAccumulatedText();

		if(m_elemStack.empty() == false)
		{
			m_currentElem = m_elemStack.back();

			m_elemStack.pop_back();
		}
		else
		{
			m_currentElem = 0;
		}
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}
void
FormatterToXercesDOM::startElement(
			const	XMLCh* const	name,
			AttributeListType&		attrs)
{
	try
	{
		processAccumulatedText();

		DOMElementType* const	elem = createElement(name, attrs);
		assert(elem != 0);

		append(elem);

		m_elemStack.push_back(m_currentElem);

		m_currentElem = elem;
	}
	catch(const XERCES_CPP_NAMESPACE_QUALIFIER DOMException&	theException)
	{
		throw XercesDOMException(theException);
	}
}