[opencms-dev] Opencms 7.0.4 - CmsXmlHtmlValue error

Cavva davide.cavarretta at gmail.com
Tue Mar 26 11:07:19 CET 2013


Hi all,

I'm facing this error with some html unicode code.

I found characters give me trouble that are $ ($) and < (<), file
encoding is UTF-16. The first char is the cause of throwing the sequent
error:

java.lang.StringIndexOutOfBoundsException: String index out of range: 1
java.lang.String.charAt(String.java:686)
java.util.regex.Matcher.appendReplacement(Matcher.java:711)
org.opencms.i18n.CmsEncoder.decodeHtmlEntities(CmsEncoder.java:276)
org.opencms.i18n.CmsEncoder.adjustHtmlEncoding(CmsEncoder.java:128)
org.opencms.xml.types.CmsXmlHtmlValue.setStringValue(CmsXmlHtmlValue.java:250)
org.opencms.xml.A_CmsXmlDocument.correctXmlStructure(A_CmsXmlDocument.java:219)

The second is "cleaning" text till next html tag.

Those errors are either if I do it by and writing content source code and
writing it with 
		CmsFile xmlContentFile = cms.readFile(resource);
		CmsXmlEntityResolver cxer = new CmsXmlEntityResolver(cms);
		CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(lemma.getXml(),
UTF_16, cxer);
		xmlContent.setAutoCorrectionEnabled(true);
-->		xmlContent.correctXmlStructure(cms); <-- Throws exception
		xmlContentFile.setContents(xmlContent.marshal());
		cms.writeFile(xmlContentFile);

Somebody knows how to resolve them?

Thank you all
Davide



--
View this message in context: http://opencms.996256.n3.nabble.com/Opencms-7-0-4-CmsXmlHtmlValue-error-tp23155.html
Sent from the OpenCMS mailing list archive at Nabble.com.



More information about the opencms-dev mailing list