[jira] [Updated] (XERCESC-2239) When XMLUni::fgDOMWRTSplitCdataSections is true (the default), invalid XML characters are allowed by DOMWriter

"Scott Cantor (Jira)" <[email protected]>
Newsgroups gmane.text.xml.xerces-c.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/XERCESC-2239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Cantor updated XERCESC-2239:
----------------------------------
    Fix Version/s:     (was: 3.2.4)

> When XMLUni::fgDOMWRTSplitCdataSections is true (the default), invalid XML characters are allowed by DOMWriter
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-2239
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2239
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: DOM
>    Affects Versions: 3.2.0
>         Environment: Operating System: All
> Platform: All
>            Reporter: David Leffingwell
>            Priority: Major
>
> // Create a Document with a CDATA section that contains an invalid XML character (e.g. 0x1b). 
> // This should fail when serializing the Document, but it does not when XMLUni::fgDOMWRTSplitCdataSections is true.
> struct XercesDeleter
> {
>         template<typename T>
>         void operator()(T* data) const
>         {
>             if (data) { data->release(); };
>         }
> };    
> typedef std::unique_ptr<XERCES_CPP_NAMESPACE::DOMLSSerializer,XercesDeleter>   DOMWriterPtr;
> typedef std::unique_ptr<XERCES_CPP_NAMESPACE::DOMDocument,XercesDeleter> DOMDocumentPtr;
> XMLPlatformUtils::Initialize();
> DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS"));
>  // Create DOM with a CDATA section
> DOMDocumentPtr document(impl->createDocument());
> DOMElement* element = document->createElementNS(XMLString::transcode("http://schemas.openxmlformats.org/wordprocessingml/2006/main"), XMLString::transcode("w:t"));
> document->appendChild(element);
> DOMCDATASection* codesection = document->createCDATASection(XercesString("c = '';")); // 0x1B is not a valid XML 1.0 character
> element->appendChild(codesection); 
> DOMWriterPtr writer(impl->createLSSerializer());
> writer->writeToString(document.get())



--
This message was sent by Atlassian Jira
(v8.20.10#820010)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.