You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Burkhardt Martin (GS-EC/EMT2)" <Ma...@de.bosch.com> on 2002/10/16 14:27:55 UTC

split-cdata-sections (DOMWriter, DOMDocument) doesn't work

Hi,

I use CDataSections which possibly might contain the termination string of
CDataSections ( "]]>" ). Therefor I have to handle this case. I hoped that
the DOMWriter would do all the work for me:

	// set feature if the serializer supports the feature/mode
	if (Writer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, true))
		Writer->setFeature(XMLUni::fgDOMWRTSplitCdataSections,
true);

Yes, the Writer can and does set the Feature. If a CDataSections contains
the string "]]>", the content of the node is only serialized up to the first
occurrence of the string. The rest ist missing. There is no CDataSections
following up, which includes the part after the string "]]>".

Can anyone confirm this behaviour? Do I expect something wrong? What can I
do? Do I have to split the CDataSection myself?

I saw, that there is a split-cdata-sections feature in DOMDocument too, but
with the current Xerces Version you can't set the so called normalization
features:

DOMDocumentImpl.cpp----------------------------------------------------

	bool DOMDocumentImpl::canSetNormalizationFeature(const XMLCh* const
name, bool state) const {
	    return false;
	}

	void DOMDocumentImpl::setNormalizationFeature(const XMLCh* const
name, bool state) {
	    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
	}

	bool DOMDocumentImpl::getNormalizationFeature(const XMLCh* const
name) const {
	    throw DOMException(DOMException::NOT_FOUND_ERR, 0);
	    return false;
	}

/DOMDocumentImpl.cpp----------------------------------------------------

As always, help greatly appreciated.

TIA, Martin

[Refers to Xerces 2.1.x 30-09-2002 nightly build.]

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: split-cdata-sections (DOMWriter, DOMDocument) doesn't work

Posted by PeiYong PY Zhang <pe...@ca.ibm.com>.
Martin,

      I've looked into the issue and come up with a testing program, which
creates a dom document, adds
a CDATASection and serializes the result to the a file (to avoid messing up
with error message on the screen).

      My conclusion is that, the DOMwriter does follow what the Specs
requires, that is,
          .Once the slipt_cdata_section is set, it outputs multiple
CDATASection as needed.
          .Otherwise, it stops processing (seralization).

      Attached is the testing program with two output files, each is the
result of running with different setting of
this feature as shown below:

#1
  theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, true);
  XMLFormatTarget *myFormTarget = new LocalFileFormatTarget("result1");

#2
  theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, false);
  XMLFormatTarget *myFormTarget = new LocalFileFormatTarget("result2");

----- Original Message -----
From: "Burkhardt Martin (GS-EC/EMT2)" <Ma...@de.bosch.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, October 16, 2002 8:27 AM
Subject: split-cdata-sections (DOMWriter, DOMDocument) doesn't work


> Hi,
>
> I use CDataSections which possibly might contain the termination string of
> CDataSections ( "]]>" ). Therefor I have to handle this case. I hoped that
> the DOMWriter would do all the work for me:
>
> // set feature if the serializer supports the feature/mode
> if (Writer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, true))
> Writer->setFeature(XMLUni::fgDOMWRTSplitCdataSections,
> true);
>
> Yes, the Writer can and does set the Feature. If a CDataSections contains
> the string "]]>", the content of the node is only serialized up to the
first
> occurrence of the string. The rest ist missing. There is no CDataSections
> following up, which includes the part after the string "]]>".
>
> Can anyone confirm this behaviour? Do I expect something wrong? What can I
> do? Do I have to split the CDataSection myself?
>
> I saw, that there is a split-cdata-sections feature in DOMDocument too,
but
> with the current Xerces Version you can't set the so called normalization
> features:
>
> DOMDocumentImpl.cpp----------------------------------------------------
>
> bool DOMDocumentImpl::canSetNormalizationFeature(const XMLCh* const
> name, bool state) const {
>     return false;
> }
>
> void DOMDocumentImpl::setNormalizationFeature(const XMLCh* const
> name, bool state) {
>     throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
> }
>
> bool DOMDocumentImpl::getNormalizationFeature(const XMLCh* const
> name) const {
>     throw DOMException(DOMException::NOT_FOUND_ERR, 0);
>     return false;
> }
>
> /DOMDocumentImpl.cpp----------------------------------------------------
>
> As always, help greatly appreciated.
>
> TIA, Martin
>
> [Refers to Xerces 2.1.x 30-09-2002 nightly build.]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>