Kaydet (Commit) 9f235cfe authored tarafından Michael Stahl's avatar Michael Stahl

xmlfix3: #i113683#: finish CProcessingInstruction

üst c5db3b93
......@@ -603,7 +603,7 @@ namespace DOM
xmlChar *xTarget = (xmlChar*)o1.getStr();
OString o2 = OUStringToOString(data, RTL_TEXTENCODING_UTF8);
xmlChar *xData = (xmlChar*)o2.getStr();
xmlNodePtr const pNode = xmlNewPI(xTarget, xData);
xmlNodePtr const pNode = xmlNewDocPI(m_aDocPtr, xTarget, xData);
pNode->doc = m_aDocPtr;
Reference< XProcessingInstruction > const xRet(
static_cast< XNode* >(GetCNode(pNode).get()),
......
......@@ -54,46 +54,89 @@ namespace DOM
/**
The content of this processing instruction.
*/
OUString SAL_CALL CProcessingInstruction::getData() throw (RuntimeException)
OUString SAL_CALL
CProcessingInstruction::getData() throw (RuntimeException)
{
// XXX
return OUString();
::osl::MutexGuard const g(m_rMutex);
if (0 == m_aNodePtr) {
return ::rtl::OUString();
}
char const*const pContent(
reinterpret_cast<char const*>(m_aNodePtr->content));
if (0 == pContent) {
return ::rtl::OUString();
}
OUString const ret(pContent, strlen(pContent), RTL_TEXTENCODING_UTF8);
return ret;
}
/**
The target of this processing instruction.
*/
OUString SAL_CALL CProcessingInstruction::getTarget() throw (RuntimeException)
OUString SAL_CALL
CProcessingInstruction::getTarget() throw (RuntimeException)
{
// XXX
return OUString();
}
::osl::MutexGuard const g(m_rMutex);
if (0 == m_aNodePtr) {
return ::rtl::OUString();
}
char const*const pName(
reinterpret_cast<char const*>(m_aNodePtr->name));
if (0 == pName) {
return ::rtl::OUString();
}
OUString const ret(pName, strlen(pName), RTL_TEXTENCODING_UTF8);
return ret;
}
/**
The content of this processing instruction.
*/
void SAL_CALL CProcessingInstruction::setData(const OUString& /*data*/) throw (RuntimeException, DOMException)
void SAL_CALL CProcessingInstruction::setData(OUString const& rData)
throw (RuntimeException, DOMException)
{
// XXX
}
::osl::MutexGuard const g(m_rMutex);
if (0 == m_aNodePtr) {
throw RuntimeException();
}
OString const data(OUStringToOString(rData, RTL_TEXTENCODING_UTF8));
xmlChar const*const pData(
reinterpret_cast<xmlChar const*>(data.getStr()) );
xmlFree(m_aNodePtr->content);
m_aNodePtr->content = xmlStrdup(pData);
}
OUString SAL_CALL CProcessingInstruction::getNodeName()throw (RuntimeException)
OUString SAL_CALL
CProcessingInstruction::getNodeName() throw (RuntimeException)
{
::osl::MutexGuard const g(m_rMutex);
OUString aName;
if (m_aNodePtr != NULL)
{
const xmlChar* xName = m_aNodePtr->name;
aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8);
if (0 == m_aNodePtr) {
return ::rtl::OUString();
}
return aName;
sal_Char const*const pName =
reinterpret_cast<sal_Char const*>(m_aNodePtr->name);
OUString const ret(pName, strlen(pName), RTL_TEXTENCODING_UTF8);
return ret;
}
OUString SAL_CALL CProcessingInstruction::getNodeValue() throw (RuntimeException)
OUString SAL_CALL CProcessingInstruction::getNodeValue()
throw (RuntimeException)
{
return getData();
}
void SAL_CALL
CProcessingInstruction::setNodeValue(OUString const& rNodeValue)
throw (RuntimeException, DOMException)
{
return setData(rNodeValue);
}
}
......@@ -81,6 +81,9 @@ namespace DOM
throw (RuntimeException);
virtual OUString SAL_CALL getNodeValue()
throw (RuntimeException);
virtual void SAL_CALL setNodeValue(OUString const& rNodeValue)
throw (RuntimeException, DOMException);
// --- delegation for XNde base.
virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
throw (RuntimeException, DOMException)
......@@ -189,11 +192,6 @@ namespace DOM
{
return CNode::replaceChild(newChild, oldChild);
}
virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
throw (RuntimeException, DOMException)
{
return CNode::setNodeValue(nodeValue);
}
virtual void SAL_CALL setPrefix(const OUString& prefix)
throw (RuntimeException, DOMException)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment