cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Kuhnle <li...@kuhnle.net>
Subject Why does XSPMarkupLanguage wrap text in xsp:text?
Date Fri, 03 Jun 2005 07:51:25 GMT
Hi, I'm currently working on apatch for attribute value interpolation in 
XSP [1]. I noticed that XSPMarkupLanguage.characters wraps text in 
xsp:text elements. Is there a reason for this? At least my XSPs work 
without this...

public void characters(char[] ch, int start, int length) throws 
SAXException {
            String[] tag = (String[]) stack.peek();
            String tagURI = tag[0];
            String tagLName = tag[1];

            boolean flag = XSPMarkupLanguage.this.getURI().equals(tagURI);
            if (flag && tagLName.equals("page")) {
                // Characters after xsp:page and before first element.
                super.characters(ch, start, length);
            } else if (flag && (tagLName.equals("expr") ||
                    tagLName.equals("logic") || 
tagLName.equals("structure") ||
                    tagLName.equals("include"))) {
                super.characters(ch, start, length);
            } else {
                // Quote the string depending on the programming language
                String value = String.valueOf(ch, start, length);

                // Create a new element <xsp:text> that wrap the quoted 
PCDATA
                super.startElement(XSPMarkupLanguage.this.getURI(), 
"text",
                        localPrefix + ":text", XMLUtils.EMPTY_ATTRIBUTES);
// =============^ Why is this done?

                super.characters(value.toCharArray(), 0, value.length());
                super.endElement(XSPMarkupLanguage.this.getURI(), "text",
                        localPrefix + ":text");
            }
        }

Regards,
Jochen

[1] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=111693513631888&w=2

Mime
View raw message