cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Ulrich Niedermann <niederm...@isd.uni-stuttgart.de>
Subject Re: BUG?
Date Mon, 03 Jul 2000 06:23:46 GMT
Hi Niclas!

Niclas Hedhman <niclas@localbar.com> writes:

> This won't work.
> You need to keep track of the match between " and ', since it is
> allowed to use the opposite character 
> inside a matching pair such as;
> 
> <department name="Children's department">

You're right when it concerns XML attributes. But I thought we were
talking only about processing instructions. All PI's used by Cocoon
I've seen so far look something like 

<?xml version="1.0" encoding="iso-8859-1"?>
<?cocoon-format type="text/html"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="../whereever/xyz.xsl" media='lynx'?>

As long as no one declares MIME types or uses path names that contain
"'" or '"', this quick fix should work. 

A quick "find -exec grep" seemed to confirm that the Utils.getPI*
functions are only used for PIs. But you're free to correct me.

In order to get a clean solution: What is the regexp class called?

Uli

> Hans Ulrich Niedermann wrote:

> > The following will probably work as long as nobody uses constructs
> > like '"' or "'". Otherwise it will be difficult without regexps.
> >
> > The code is untested as I'm too silly to get C1 & C2 working on the
> > same machine. But at least it compiles :-)
> >
> > Index: src/org/apache/cocoon/Utils.java
> > ===================================================================
> > RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/Utils.java,v
> > retrieving revision 1.16
> > diff -c -r1.16 Utils.java
> > *** src/org/apache/cocoon/Utils.java    2000/06/04 20:03:35     1.16
> > --- src/org/apache/cocoon/Utils.java    2000/07/02 18:43:05
> > ***************
> > *** 165,171 ****
> >       private static final void addPIPseudoAttributes(ProcessingInstruction pi,
Hashtable attributes) {
> >           String data = pi.getData();
> >
> > !         Tokenizer st = new Tokenizer(data, "\"");
> >           try {
> >             while (st.hasMoreTokens()) {
> >                 String key   = st.nextToken();     // attribute name and '='
> > --- 165,171 ----
> >       private static final void addPIPseudoAttributes(ProcessingInstruction pi,
Hashtable attributes) {
> >           String data = pi.getData();
> >
> > !         Tokenizer st = new Tokenizer(data, "\"'");
> >           try {
> >             while (st.hasMoreTokens()) {
> >                 String key   = st.nextToken();     // attribute name and '='

Mime
View raw message