You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ray Allis <ra...@comcast.net> on 2004/04/02 04:31:35 UTC

CForms: how to retain htmlarea structure within a larger XML document

I made a "news release" form based on the 'form2' XML binding sample.
But the XHTML doesn't get to the output file.  Has someone solved this?
What must I do to retain the XHTML markup inside another XML document?

The output is:

<?xml version="1.0" encoding="UTF-8"?><data>
  <wrapper>
    <context>

      <headline>Headline
      </headline>

      <dateline>Dateline
      </dateline>

      <body>&lt;p&gt;At this step you need to specify where in the 
toolbar to insert the&#13;
button, or just create the whole toolbar again as you saw in the 
previous&#13;
section.  You use the button ID, as shown in the examples of customizing 
the&#13;
toolbar in the previous section.&lt;/p&gt;&#13;
&#13;
&lt;p&gt;For the sake of completion, following there are another 
examples.&lt;/p&gt;</body>
     
      <indexes>

Ray Allis


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-04-06 at 19:18, Ray Allis wrote:
> Sorry I am so obtuse.  I meant htmlarea, not htmlform. 
> 
> I just want to do what NewsML does, i.e. have XHTML embedded
> in a larger XML document.  Like so:
> --
>                     </Characteristics>
>                     <DataContent>
>                         <html xmlns="http://www.w3.org/1999/xhtml">
>                             <head>
>                                 <title/>
>                             </head>
>                             <body>
>                                 <p> HEBRON, West Bank, Sept 23 (Reuters) 
> - A Palestinian gunman  fired at Jewish settlers and pilgrims in the 
> West Bank city of  Hebron on Monday during Jewish Sukkoth holiday 
> celebrations,  wounding at least four people, rescue workers said.</p>
>                                 <p> The attack occurred near the Cave of 
> the Patriarchs, a  shrine revered by Moslems and Jews.</p>
>                                 <p> Hundreds of Israelis flocked to 
> Hebron, where some 400  settlers live in heavily guarded enclaves, for 
> the holiday that  commemorates the wanderings of the biblical Israelites 
> in the  Sinai desert after exodus from slavery in Egypt.</p>
>                                 <p> Rescue workers said one of the four 
> people wounded in the  attack was in extremely critical condition. </p>
>                                 <p> Witnesses said the gunman escaped 
> through Hebron's narrow  alleyways after firing at a group of Israelis.</p>
>                                 <p> Such attacks in the past have often 
> drawn violent  retaliation by settlers in Hebron, regarded as some of 
> the most  militant in the West Bank.    </p>
>                             </body>
>                         </html>
>                     </DataContent>
>                 </ContentItem>
>             </NewsComponent>
>         </NewsComponent>
>     </NewsItem>
> </NewsML>
> --------
> ... and I want to create, edit, delete these documents in xindice with 
> cforms, flow and binding.
> Probably fairly straightforward, if I weren't a newbie.  :-)
> 
> I have most of it working, except the <html> element keeps turning into 
> a string, and I do not
> understand how to treat it as an XML fragment.

You need to parse the string. Are you using the binding framework?
Either way, you'll have to write some custom code to parse the string to
a DOM and then import the dom node into your target document.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Ray Allis <ra...@comcast.net>.
Oh! Thank you!  Enlightment is a wonderful feeling! ;-)  And when I retrieve
the document from Xindice, do I convert the XML fragment to a string to
bind it to the htmlarea for the user to edit?

Thanks again
Ray Allis
--
Bruno Dumon wrote:

>You need to parse the string. Are you using the binding framework?
>Either way, you'll have to write some custom code to parse the string to
>a DOM and then import the dom node into your target document.
>  
>

Mark Lundquist wrote:

> It's not /turning into /a string... it just /is /a string, from the 
> very start! :-) Use a DOM parser on it.
>
> Cheers,
> mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 6, 2004, at 10:18 AM, Ray Allis wrote:

> Sorry I am so obtuse.  I meant htmlarea, not htmlform.

Ahh!  OK, I see what you're after...

> <..snip..>... and I want to create, edit, delete these documents in 
> xindice with cforms, flow and binding.

Right.

> I have most of it working, except the <html> element keeps turning 
> into a string, and I do not
> understand how to treat it as an XML fragment.

It's not turning into a string... it just is a string, from the very 
start! :-)  Use a DOM parser on it.

Cheers,
mark


Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Ray Allis <ra...@comcast.net>.
Sorry I am so obtuse.  I meant htmlarea, not htmlform. 

I just want to do what NewsML does, i.e. have XHTML embedded
in a larger XML document.  Like so:
--
                    </Characteristics>
                    <DataContent>
                        <html xmlns="http://www.w3.org/1999/xhtml">
                            <head>
                                <title/>
                            </head>
                            <body>
                                <p> HEBRON, West Bank, Sept 23 (Reuters) 
- A Palestinian gunman  fired at Jewish settlers and pilgrims in the 
West Bank city of  Hebron on Monday during Jewish Sukkoth holiday 
celebrations,  wounding at least four people, rescue workers said.</p>
                                <p> The attack occurred near the Cave of 
the Patriarchs, a  shrine revered by Moslems and Jews.</p>
                                <p> Hundreds of Israelis flocked to 
Hebron, where some 400  settlers live in heavily guarded enclaves, for 
the holiday that  commemorates the wanderings of the biblical Israelites 
in the  Sinai desert after exodus from slavery in Egypt.</p>
                                <p> Rescue workers said one of the four 
people wounded in the  attack was in extremely critical condition. </p>
                                <p> Witnesses said the gunman escaped 
through Hebron's narrow  alleyways after firing at a group of Israelis.</p>
                                <p> Such attacks in the past have often 
drawn violent  retaliation by settlers in Hebron, regarded as some of 
the most  militant in the West Bank.    </p>
                            </body>
                        </html>
                    </DataContent>
                </ContentItem>
            </NewsComponent>
        </NewsComponent>
    </NewsItem>
</NewsML>
--------
... and I want to create, edit, delete these documents in xindice with 
cforms, flow and binding.
Probably fairly straightforward, if I weren't a newbie.  :-)

I have most of it working, except the <html> element keeps turning into 
a string, and I do not
understand how to treat it as an XML fragment.

Ray Allis.
-----------

Mark Lundquist wrote:

> On Apr 3, 2004, at 9:43 AM, Ray Allis wrote:
>
>     O.K., I think I understand now how to ask the question. I am
>     starting from the 'forms'
>     XML binding sample:
>
>     <!--
>     | Binding form sample, using flowscript
>     -->
>
>     <map:match pattern="form2xml.flow">
>     <map:call function="handleForm">
>     <map:parameter name="function" value="form2xml"/>
>     <map:parameter name="form-definition" value="forms/form2_model.xml"/>
>     <map:parameter name="documentURI" value="forms/form2_data.xml"/>
>     <map:parameter name="bindingURI" value="forms/form2_bind_xml.xml"/>
>     </map:call>
>     </map:match>
>
>     ... and I want two fields to be 'htmlform' widgets.
>
>
> What is an 'htmlform widget'?
>
>     I _think_ what I'm trying to do
>     is 'bind' those fields from the displayed form to the database and
>     back as an XML
>     fragment (XHTML). But they are 'escaped' in the data written to disk.
>
>     What I want is a <body> element containing XHTML:
>
>     <dateline>PATUXENT RIVER, Md. April 2, 2004</dateline>
>
>     <body><p>The <a
>     href="http://www.boeing.com/rotorcraft/military/v22">V-22</a>
>     Integrated Test Team resumed air-to-air refueling flights recently
>     for the first time since the program's return to flight in May of
>     2002.
>     </p>
>
>
> OK — what does the above have to do with /forms/? There are no HTML 
> form controls in the HTML fragment above. All you have there is a <p> 
> element containing a hyperlink and some text. Where's the form? Where 
> are the form controls (that is: <input> elements)?
>
> There's some kind of disconnect going in here, but I can't tell just 
> what it is... your example makes it look like all you're trying to do 
> is some simple output (i.e., presentation). But you did say "bind 
> those fields from the displayed form to the database and back" which 
> makes it sound like you really do have an input-side problem to solve 
> as well... ?
>
> ~ mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 3, 2004, at 9:43 AM, Ray Allis wrote:

> O.K., I think I understand now how to ask the question.  I am starting 
> from the 'forms'
> XML binding sample:
>
>     <!--
>        | Binding form sample, using flowscript
>        -->
>
>     <map:match pattern="form2xml.flow">
>       <map:call function="handleForm">
>         <map:parameter name="function" value="form2xml"/>
>         <map:parameter name="form-definition" 
> value="forms/form2_model.xml"/>
>         <map:parameter name="documentURI" 
> value="forms/form2_data.xml"/>
>         <map:parameter name="bindingURI" 
> value="forms/form2_bind_xml.xml"/>
>       </map:call>
>     </map:match>
>
> ... and I want two fields to be 'htmlform' widgets.

What is an 'htmlform widget'?

>   I _think_ what I'm trying to do
> is 'bind' those fields from the displayed form to the database and 
> back as an XML
> fragment (XHTML).  But they are 'escaped' in the data written to disk.
>
> What I want is a <body> element containing XHTML:
>
>      <dateline>PATUXENT RIVER, Md. April 2, 2004</dateline>
>
>      <body><p>The <a 
> href="http://www.boeing.com/rotorcraft/military/v22">V-22</a>
>            Integrated Test Team resumed air-to-air refueling flights 
> recently
>            for the first time since the program's return to flight in 
> May of 2002.
>          </p>
>

OK — what does the above have to do with forms?  There are no HTML form 
controls in the HTML fragment above.  All you have there is a <p> 
element containing a hyperlink and some text.  Where's the form?  Where 
are the form controls (that is: <input> elements)?

There's some kind of disconnect going in here, but I can't tell just 
what it is... your example makes it look like all you're trying to do 
is some simple output (i.e., presentation).  But you did say "bind 
those fields from the displayed form to the database and back" which 
makes it sound like you really do have an input-side problem to solve 
as well... ?

~ mark

Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Ray Allis <ra...@comcast.net>.
Mark Lundquist wrote:

> need more info... how does your XHTML markup get "inside another XML 
> document"?  Are you using the XSL document() function, or the Xinclude 
> or Cinclude transformers, or what?  What does your pipeline look like? 

--
O.K., I think I understand now how to ask the question.  I am starting 
from the 'forms'
XML binding sample:

     <!--
        | Binding form sample, using flowscript
        -->

     <map:match pattern="form2xml.flow">
       <map:call function="handleForm">
         <map:parameter name="function" value="form2xml"/>
         <map:parameter name="form-definition" 
value="forms/form2_model.xml"/>
         <map:parameter name="documentURI" value="forms/form2_data.xml"/>
         <map:parameter name="bindingURI" value="forms/form2_bind_xml.xml"/>
       </map:call>
     </map:match>

... and I want two fields to be 'htmlform' widgets.  I _think_ what I'm 
trying to do
is 'bind' those fields from the displayed form to the database and back 
as an XML
fragment (XHTML).  But they are 'escaped' in the data written to disk.

What I want is a <body> element containing XHTML:

      <dateline>PATUXENT RIVER, Md. April 2, 2004</dateline>

      <body><p>The <a 
href="http://www.boeing.com/rotorcraft/military/v22">V-22</a>
            Integrated Test Team resumed air-to-air refueling flights 
recently
            for the first time since the program's return to flight in 
May of 2002.
          </p>

What I get is:

      <dateline>PATUXENT RIVER, Md. April 2, 2004</dateline>

      <body>The &lt;a 
href="http://www.boeing.com/rotorcraft/military/v22"&gt;V-22&lt;/a&gt; &#13;
            Integrated Test Team resumed air-to-air refueling flights 
recently &#13;
            for the first time since the program's return to flight in 
May of 2002. &#13;
          &#13;
          &lt;p&gt;Over the course of two one-hour flights in Osprey No. 
22, U.S. Marine &#13;
            Corps test pilot Lt. Col. Kevin Gross, USMC, and Boeing 
[NYSE:BA] &#13;
            test pilot Steve Grohsmeyer, each connected with the 
refueling aircraft &#13;
            five times near Naval Air Station (NAS) Patuxent River. 
&lt;/p&gt;</body>

This is complicated by copy-and-paste issues, (it behaves differently in 
IE on a PC and
Mozilla on the PC and Solaris ;-)) but the first problem is that <p> becomes
&lt;p&gt;.  The whole XHTML fragment becomes a string.  In fact, the 
widget in the htmlforms
sample code is a string.  It must be widget definition and binding, but 
I have gone
around the circle several times in woody/cforms wiki reading and now I'm 
totally confused. 
Help?

BTW, I am really impressed with CForms.  Great stuff!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: how to retain htmlarea structure within a larger XML document

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 1, 2004, at 6:31 PM, Ray Allis wrote:

> I made a "news release" form based on the 'form2' XML binding sample.
> But the XHTML doesn't get to the output file.  Has someone solved this?
> What must I do to retain the XHTML markup inside another XML document?

need more info... how does your XHTML markup get "inside another XML 
document"?  Are you using the XSL document() function, or the Xinclude 
or Cinclude transformers, or what?  What does your pipeline look like?

mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org