Weird Eclipse stuff

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Weird Eclipse stuff

Matt Allen
Guys;

I downloaded a brand new eclipse and installed OPS studio from the
update site. Now I cant run an "OIS Application" I tried from scratch to
make a new project, no dice.

The error is: 'an internal error occurred during: "Launching".'

Any clues?

Matta
--
Matt Allen
0413 777 771
"My car gets forty rods to the hogshead, and that's the way I likes it!"
- Grandpa Simpson




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Sebastien Noir
Hello!

I followed somehow the same path, I got the same error. I managed to get
rid of it by upgrading all orbeon component once again through the
update feature inside Eclipse...

Hope that helps.

Seb.

> Guys;
>
> I downloaded a brand new eclipse and installed OPS studio from the
> update site. Now I cant run an "OIS Application" I tried from scratch
> to make a new project, no dice.
>
> The error is: 'an internal error occurred during: "Launching".'
>
> Any clues?
>
> Matta
>
>------------------------------------------------------------------------
>
>
>--
>You receive this message as a subscriber of the [hidden email] mailing list.
>To unsubscribe: mailto:[hidden email]
>For general help: mailto:[hidden email]?subject=help
>ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Matt Allen
Gday;

Eclipse wont let me update, says everything is up to date.

Matt

Sebastien Noir did write the following on 3/08/2005 5:12 PM:

> Hello!
>
> I followed somehow the same path, I got the same error. I managed to get
> rid of it by upgrading all orbeon component once again through the
> update feature inside Eclipse...
>
> Hope that helps.
>
> Seb.
>
>> Guys;
>>
>> I downloaded a brand new eclipse and installed OPS studio from the
>> update site. Now I cant run an "OIS Application" I tried from scratch
>> to make a new project, no dice.
>>
>> The error is: 'an internal error occurred during: "Launching".'
>>
>> Any clues?
>>
>> Matta
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> You receive this message as a subscriber of the
>> [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>>
>
>
--
Matt Allen
0413 777 771
"My car gets forty rods to the hogshead, and that's the way I likes it!"
- Grandpa Simpson



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Sebastien Noir

> Eclipse wont let me update, says everything is up to date.

I had to use the "unstable* Orbeon site to update my eclipse install...

Seb




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Matt Allen
I tell a lie, it worked !!

Thanks Seb, much appreciated.

Matta

Sebastien Noir did write the following on 3/08/2005 5:51 PM:
>
>> Eclipse wont let me update, says everything is up to date.
>
>
> I had to use the "unstable* Orbeon site to update my eclipse install...
>
> Seb
>
>

--
Matt Allen
0413 777 771
"My car gets forty rods to the hogshead, and that's the way I likes it!"
- Grandpa Simpson



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Oliver Charlet
I found out, that its also possible, to download studio 1.2.3 "manually" at the orbeon website and install the features and plugin files manually. That is for eclipse 3.1x. The 3.0.2 works alright using the eclipse internal installer.
:olli

Matt Allen schrieb:
I tell a lie, it worked !!

Thanks Seb, much appreciated.

Matta

Sebastien Noir did write the following on 3/08/2005 5:51 PM:

Eclipse wont let me update, says everything is up to date.


I had to use the "unstable* Orbeon site to update my eclipse install...

Seb




-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

redirect if session expires

Alexander Žaťko
In reply to this post by Matt Allen
What is the best way to redirect to the login page if a session
expires? I am trying to use the redirect processor, but am getting
class java.lang.IllegalStateException exception.

My pageflow looks like this:

<config xmlns="http://www.orbeon.com/oxf/controller"
xmlns:xu="http://www.xmldb.org/xupdate">

     <page id="main" path-info="/edi" model="login.xpl"
view="login.xsl"/>

     <page id="authenticate" path-info="/edi/authenticate"
model="authenticate.xpl" view="login.xsl"/>

     <page id="view-orders" path-info="/edi/view-orders"
model="view-orders.xpl" view="view-orders.xsl"/>

     <epilogue url="oxf:/config/epilogue.xpl"/>

</config>

The page I am testing this session expiration mechanism  on is
"view-orders". It's  "view-orders.xpl" file contains the following
processor definition:

     <p:processor name="oxf:redirect">
         <p:input name="data">
             <redirect-url>
                 <server-side>true</server-side>
                 <path-info>/edi</path-info>
             </redirect-url>
         </p:input>
     </p:processor>

Here are a couple of lines from the stack trace:

org.orbeon.oxf.portlet.PortletExternalContext$DirectResponseTemp  
        sendRedirect   PortletExternalContext.java   567
org.orbeon.oxf.processor.RedirectProcessor start
        RedirectProcessor.java 68
org.orbeon.oxf.processor.pipeline.PipelineProcessor$11 run
        PipelineProcessor.java 617
org.orbeon.oxf.processor.ProcessorImpl executeChildren
        ProcessorImpl.java 504
org.orbeon.oxf.processor.pipeline.PipelineProcessor start
        PipelineProcessor.java 615
org.orbeon.oxf.processor.pipeline.PipelineProcessor$1 getInput
        PipelineProcessor.java 141


The documentation recommends to use pageflow controller to do redirect,
but I could not find a way for PFC to see the state of the session.

Any help is appreciated.

Alex




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Sebastien Noir
In reply to this post by Sebastien Noir
Hello!
Did someone write a custom processor? I'm trying the SAX way. My goal is
to implement "translators" from scala (see scala.epfl.ch) xml dialect to
the xml representation used in Orbeon. Everything works fine, except the
namespace handling.

I implemented the method startPrefixMapping(String prefix,String uri)
after each Node containing a prefix and uri (startElement), and its
sister method enPrefixMapping after endElement. My generated xml
preserves prefix well, but doesn't keep uri associated to them:

generated by custom processor:
 
    <outr_0:tuples me_1:from_table="user">
      <tuple>
        <username>Burak</username>
        [...]
      </tuple>
    </outr_0:tuples>
 
Original after scala execution:

<outr:tuples me:from_table="user"

  xmlns:othr="http://other.com"
  xmlns:me="http://www.epfl.ch/orbeon/me"   xmlns:outr="http://outer.com">
  <tuple>
    <username>Burak</username>
    [...]
  </tuple>
</outr:tuples>

For those who could be intersted in some scala code (very nice to
process xml!)
Original in scala :

 <outr:tuples me:from_table = {getTable4DB()}
      xmlns:me="http://www.epfl.ch/orbeon/me"
      xmlns:othr="http://other.com"
      xmlns:outr="http://outer.com">
      <tuple>{ // this builds elements for all fields...
        getDBFieldList().map(
          (dbf:DBField)=>{
            val actualValue =  {
              if (dbf.getValue() != null) dbf.getValue().toString() else "NULL"
            };    
            Elem(null,                             //prefix
                 dbf.getName(),                     //label
                 scala.xml.Null,                    //attribute
                 TopScope,                          //Namespace
                 Text(actualValue)    //children
               )
          }
        )
      }</tuple>
    </outr:tuples>

Do I have to generate attribute named xmlns with proper uri in order to
keep the namespace correctly?
Any help will be appreciated...
Greetings from Switzerland, S?bastien Noir






--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Weird Eclipse stuff

Erik Bruchez
Administrator
Sebastien,

SAX is very tricky. It is easy to generate invalid streams of SAX events.

As a first step, it would be easier if you could generate a DOM or
Dom4j, and then serialize this to SAX with JAXP. Then you can optimize.

To answer some of your questions directly:

o No, you should not generate namespaces declarations as attributes.

o You should generate startPrefixMapping() BEFORE the startElement() on
which the mapping must appear. Simlarly, generate endPrefixMapping()
AFTER the endElement() on which the mapping disappears.

I hope this helps a little,

-Erik

Sebastien Noir wrote:

> Hello!
> Did someone write a custom processor? I'm trying the SAX way. My goal is
> to implement "translators" from scala (see scala.epfl.ch) xml dialect to
> the xml representation used in Orbeon. Everything works fine, except the
> namespace handling.
>
> I implemented the method startPrefixMapping(String prefix,String uri)
> after each Node containing a prefix and uri (startElement), and its
> sister method enPrefixMapping after endElement. My generated xml
> preserves prefix well, but doesn't keep uri associated to them:
>
> generated by custom processor:
>  
>    <outr_0:tuples me_1:from_table="user">
>      <tuple>
>        <username>Burak</username>
>        [...]
>      </tuple>
>    </outr_0:tuples>
>  
> Original after scala execution:
>
> <outr:tuples me:from_table="user"
>  xmlns:othr="http://other.com"
>  xmlns:me="http://www.epfl.ch/orbeon/me"   xmlns:outr="http://outer.com">
>  <tuple>
>    <username>Burak</username>
>    [...]
>  </tuple>
> </outr:tuples>
>
> For those who could be intersted in some scala code (very nice to
> process xml!)
> Original in scala :
>
> <outr:tuples me:from_table = {getTable4DB()}      
> xmlns:me="http://www.epfl.ch/orbeon/me"      xmlns:othr="http://other.com"
>      xmlns:outr="http://outer.com">
>      <tuple>{ // this builds elements for all fields...
>     getDBFieldList().map(
>       (dbf:DBField)=>{
>         val actualValue =  {
>           if (dbf.getValue() != null) dbf.getValue().toString() else "NULL"
>         };            Elem(null,                             //prefix
>          dbf.getName(),                     //label
>          scala.xml.Null,                    //attribute
>          TopScope,                          //Namespace
>          Text(actualValue)    //children
>            )
>       }
>     )
>      }</tuple>
>    </outr:tuples>
>
> Do I have to generate attribute named xmlns with proper uri in order to
> keep the namespace correctly?
> Any help will be appreciated...
> Greetings from Switzerland, Sébastien Noir


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

SAX troubles

Sebastien Noir
Hello Erik,
Thanks for your answer.
I made some adjustements to my code, to be able to trace the SAX events
trace. It shows that the proper startPrefixMapping() and
endPrefixMapping() are done respectively before and after startElement()
and endElement() with proper paramaters...

The generated xml is correct, except for those missing prefiy mapping
(prefiy are present).

I also noticed that the prefix are "changed" (a number and underscore is
added at the end,see below) for some unknown reason (could this be a
clue to where the trouble is?):
/ /generated xml fragment : <outr_0:tuples me_1:from_table="user">
should be :<outr:tuples me:from_table = "user"}
      xmlns:me="http://www.epfl.ch/orbeon/me"
      xmlns:othr="http://other.com"
      xmlns:outr="http://outer.com">

I also tried with a very simple code, just to see:


Hello Erik,
Thanks for your answer.
I made some adjustements to my code, to be able to trace the SAX events
trace. It shows that the proper startPrefixMapping() and
endPrefixMapping() are done respectively before and after startElement()
and endElement() with proper paramaters...

The generated xml is correct, except for those missing prefiy mapping
(prefiy are present).

I also noticed that the prefix are "changed" (a number and underscore is
added at the end,see below) for some unknown reason (could this be a
clue to where the trouble is?):
/ /generated xml fragment : <outr_0:tuples me_1:from_table="user">
should be :<outr:tuples me:from_table = "user"}
      xmlns:me="http://www.epfl.ch/orbeon/me"
      xmlns:othr="http://other.com"
      xmlns:outr="http://outer.com">

I also tried with a very simple code, just to see:

      contentHandler.startDocument();
        contentHandler.startPrefixMapping("prefix","http://www.uri.com");
           
contentHandler.startElement("http://www.uri.com","db_row","prefix:db_row",
new AttributesImpl());
             
contentHandler.startElement("http://www.uri.com","username","prefix:username",
new AttributesImpl());
           
                contentHandler.characters(("foo").toCharArray(), 0, 3);

             
contentHandler.endElement("http://www.uri.com","username","prefix:username");
           
contentHandler.endElement("http://www.uri.com","db_row","prefix:db_row");
        contentHandler.endPrefixMapping("prefix");
      contentHandler.endDocument();

xml produced:
<prefix:db_row><prefix:username>foo</prefix:username></prefix:db_row>

Thanks for any ideas...


>
> SAX is very tricky. It is easy to generate invalid streams of SAX events.
>
> As a first step, it would be easier if you could generate a DOM or
> Dom4j, and then serialize this to SAX with JAXP. Then you can optimize.
>
> To answer some of your questions directly:
>
> o No, you should not generate namespaces declarations as attributes.
>
> o You should generate startPrefixMapping() BEFORE the startElement()
> on which the mapping must appear. Simlarly, generate
> endPrefixMapping() AFTER the endElement() on which the mapping
> disappears.



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: redirect if session expires

Alessandro  Vernet
Administrator
In reply to this post by Alexander Žaťko
--- Alexander Zatko <[hidden email]> wrote:

> What is the best way to redirect to the login page if a session
> expires? I am trying to use the redirect processor, but am getting
> class java.lang.IllegalStateException exception.

Alex,

The simplest (and best IMHO) thing to do is use the servlet authentication
mechanism. Doing so, the servlet container will automatically redirect the
user to the login page when the session expires.

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: SAX troubles

Erik Bruchez
Administrator
In reply to this post by Sebastien Noir
Forgot to say that there is an oxf:sax-debugger processor which you can
hookup to the output of your processor, and which will log all the SAX
events. Looking at the output of that should be of some help. Maybe you
can try to create a small case (i.e. small incorrect output document so
that the number of SAX events is not too big) and send the results here.

-Erik

Sebastien Noir wrote:

> Hello Erik,
> Thanks for your answer.
> I made some adjustements to my code, to be able to trace the SAX events
> trace. It shows that the proper startPrefixMapping() and
> endPrefixMapping() are done respectively before and after startElement()
> and endElement() with proper paramaters...
>
> The generated xml is correct, except for those missing prefiy mapping
> (prefiy are present).
>
> I also noticed that the prefix are "changed" (a number and underscore is
> added at the end,see below) for some unknown reason (could this be a
> clue to where the trouble is?):
> / /generated xml fragment : <outr_0:tuples me_1:from_table="user">
> should be :<outr:tuples me:from_table = "user"}
>      xmlns:me="http://www.epfl.ch/orbeon/me"
>      xmlns:othr="http://other.com"
>      xmlns:outr="http://outer.com">
>
> I also tried with a very simple code, just to see:
>
>
> Hello Erik,
> Thanks for your answer.
> I made some adjustements to my code, to be able to trace the SAX events
> trace. It shows that the proper startPrefixMapping() and
> endPrefixMapping() are done respectively before and after startElement()
> and endElement() with proper paramaters...
>
> The generated xml is correct, except for those missing prefiy mapping
> (prefiy are present).
>
> I also noticed that the prefix are "changed" (a number and underscore is
> added at the end,see below) for some unknown reason (could this be a
> clue to where the trouble is?):
> / /generated xml fragment : <outr_0:tuples me_1:from_table="user">
> should be :<outr:tuples me:from_table = "user"}
>      xmlns:me="http://www.epfl.ch/orbeon/me"
>      xmlns:othr="http://other.com"
>      xmlns:outr="http://outer.com">
>
> I also tried with a very simple code, just to see:
>
>      contentHandler.startDocument();
>        contentHandler.startPrefixMapping("prefix","http://www.uri.com");
>            
> contentHandler.startElement("http://www.uri.com","db_row","prefix:db_row",
> new AttributesImpl());
>              
> contentHandler.startElement("http://www.uri.com","username","prefix:username",
> new AttributesImpl());
>                          
> contentHandler.characters(("foo").toCharArray(), 0, 3);
>
>              
> contentHandler.endElement("http://www.uri.com","username","prefix:username");
>
>            
> contentHandler.endElement("http://www.uri.com","db_row","prefix:db_row");
>        contentHandler.endPrefixMapping("prefix");
>      contentHandler.endDocument();
>
> xml produced:
> <prefix:db_row><prefix:username>foo</prefix:username></prefix:db_row>
>
> Thanks for any ideas...
>
>
>>
>> SAX is very tricky. It is easy to generate invalid streams of SAX events.
>>
>> As a first step, it would be easier if you could generate a DOM or
>> Dom4j, and then serialize this to SAX with JAXP. Then you can optimize.
>>
>> To answer some of your questions directly:
>>
>> o No, you should not generate namespaces declarations as attributes.
>>
>> o You should generate startPrefixMapping() BEFORE the startElement()
>> on which the mapping must appear. Simlarly, generate
>> endPrefixMapping() AFTER the endElement() on which the mapping
>> disappears.
>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

SAXand DOM troubles...

Sebastien Noir
Hello,

So far it seems there is a "feature" (bug?) in orbeon server which
prevents correct handling of xml with custom processors:
Let's consider the following xml fragment:
  <bar:tuples me:from_table = {getTable4DB()}
      xmlns:me="http://www.epfl.ch/orbeon/me"
      xmlns:othr="http://other.com"
      xmlns:bar="http://bar.com">
      <me:foo othr:arg="8">
          <tuple>
          </tuple>
    </me:foo>
  </bar:tuples>

Here are my attempts:

First, using SAX, the generated XML is :
<bar:tuples me:from_table="user">
    <me:foo othr:arg="8">
        <tuple>
        </tuple>
    </me:foo>
</bar:tuples>

The strucutre is OK, only the namespace uri are missing.
Let's examine the Logging provided through oxf:sax-debugger (where is
the logging done, except in the Eclipse window? I had to copy line by
line...):
startDocument()
startPrefixMapping('me', 'http://www.epfl.ch/orbeon/me')
startPrefixMapping('bar', 'http://bar.com')
startPrefixMapping('othr', 'http://other.com')
startElement('http://bar.com', 'tuples', 'bar:tuples',
('http://www.epfl.ch/orbeon/me', 'from_table', 'me:from_table'))
startElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo',
('http://other.com', 'arg', 'othr:arg'))
startElement('', 'tuple', 'tuple')
endElement('', 'tuple', 'tuple')
endElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo')
endElement('http://bar.com', 'tuples', 'bar:tuples')
endPrefixMapping('othr')
endPrefixMapping('bar')
endPrefixMapping('me')
endDocument()

To my eyes, the SAX event structures seems correct, yet he produced XML
is bad.

I made another attempt using DOM, here is the generated xml:
<bar:tuples me:from_table="user">
  <me:foo othr:arg="8">
    <tuple>
    </tuple>
  </me:foo>
</bar:tuples>

I get exactly the same result. Let's have a look at the logging:
setDocumentLocator(...)
    startDocument()
    startPrefixMapping('bar', 'http://bar.com')
    startPrefixMapping('othr', 'http://other.com')
    startPrefixMapping('me', 'http://www.epfl.ch/orbeon/me')
    startElement('http://bar.com', 'tuples', 'bar:tuples',
('http://www.epfl.ch/orbeon/me', 'from_table', 'me:from_table'))
    startElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo',
('http://other.com', 'arg', 'othr:arg'))
    startElement('', 'tuple', 'tuple')
    endElement('', 'tuple', 'tuple')  
    endElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo')
    endElement('http://bar.com', 'tuples', 'bar:tuples')
    endDocument()
I can spot 2 differences with the SAX logging: the prefix mapping starts
are in a different order (unimportant), and the endPrefixMapping are
missing...
I can't understand why they are missing: with the DOM model, either
attributes are present, or absent. How can this happend with a tree
structure?
I must also say that the prefix/uri mapping in DOM was made using
regular attribute:
 element.setAttributeNS("http://www.w3.org/2000/xmlns/",("xmlns:"+prefix),
uri);
If this line is modified this way:
 element.setAttributeNS("http://www.w3.org/2000/xmlnz/",("xmlnz:"+prefix),
uri);
We get a totally different xml output:
<bar:tuples me:from_table="user"
  xmlnz:bar="http://bar.com"
  xmlnz:me="http://www.epfl.ch/orbeon/me"
  xmlnz:othr="http://other.com">
    <me:foo othr:arg="8">
    <tuple>
    </tuple>
  </me:foo>
</bar:tuples>
Except for the xmlnz which should be xmlns, the whole thing is
correct... IMHO, it seems to indicate that the xmlns declarations are
not handled correctly (or at least how I think they should) in Orbeon...
If I am correct, the DOM model implies xmlns declaration to be declared
as simple attributes...

I hope that was clear enough... Thanks for any help.

S?bastien Noir





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: SAXand DOM troubles...

Erik Bruchez
Administrator
Sebastien,

Sebastien Noir wrote:

 > So far it seems there is a "feature" (bug?) in orbeon server which
 > prevents correct handling of xml with custom processors:

It is quite unlikely that such a generalization is true :-) All the
processors, custom or not, in the end use SAX to communicate with the
outside world (i.e. other processors in a pipeline). And believe us,
namespaces are used all over the place in OPS. But let's keep looking
at your problem.

 > Let's consider the following xml fragment:
 >  <bar:tuples me:from_table = {getTable4DB()}
 >      xmlns:me="http://www.epfl.ch/orbeon/me"
 >      xmlns:othr="http://other.com"
 >      xmlns:bar="http://bar.com">
 >      <me:foo othr:arg="8">
 >          <tuple>
 >          </tuple>
 >    </me:foo>
 >  </bar:tuples>
 >
 > Here are my attempts:
 >
 > First, using SAX, the generated XML is :
 > <bar:tuples me:from_table="user">
 >    <me:foo othr:arg="8">
 >        <tuple>
 >        </tuple>
 >    </me:foo>
 > </bar:tuples>

What is "the generated XML"? What code do you use to produce it? Where
do you look at it?

 > The strucutre is OK, only the namespace uri are missing.
 > Let's examine the Logging provided through oxf:sax-debugger (where is
 > the logging done, except in the Eclipse window? I had to copy line by
 > line...):
 > startDocument()
 > startPrefixMapping('me', 'http://www.epfl.ch/orbeon/me')
 > startPrefixMapping('bar', 'http://bar.com')
 > startPrefixMapping('othr', 'http://other.com')
 > startElement('http://bar.com', 'tuples', 'bar:tuples',
 > ('http://www.epfl.ch/orbeon/me', 'from_table', 'me:from_table'))
 > startElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo',
 > ('http://other.com', 'arg', 'othr:arg'))
 > startElement('', 'tuple', 'tuple')
 > endElement('', 'tuple', 'tuple')
 > endElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo')
 > endElement('http://bar.com', 'tuples', 'bar:tuples')
 > endPrefixMapping('othr')
 > endPrefixMapping('bar')
 > endPrefixMapping('me')
 > endDocument()
 >
 > To my eyes, the SAX event structures seems correct, yet he produced XML
 > is bad.

Yes, the SAX events appear ok. Now I still don't understand what the
"produced" XML is. I can bet my right hand (Note: I have lost it
several times already ;-) that if you use the File serializer to
output that result on disk, for example, the result will be what you
expect.

 > I made another attempt using DOM, here is the generated xml:
 > <bar:tuples me:from_table="user">
 >  <me:foo othr:arg="8">
 >    <tuple>
 >    </tuple>
 >  </me:foo>
 > </bar:tuples>

What code do you use to convert from DOM to SAX?

 > I get exactly the same result. Let's have a look at the logging:
 > setDocumentLocator(...)
 >    startDocument()
 >    startPrefixMapping('bar', 'http://bar.com')
 >    startPrefixMapping('othr', 'http://other.com')
 >    startPrefixMapping('me', 'http://www.epfl.ch/orbeon/me')
 >    startElement('http://bar.com', 'tuples', 'bar:tuples',
 > ('http://www.epfl.ch/orbeon/me', 'from_table', 'me:from_table'))
 >    startElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo',
 > ('http://other.com', 'arg', 'othr:arg'))
 >    startElement('', 'tuple', 'tuple')
 >    endElement('', 'tuple', 'tuple')
 > endElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo')
 >    endElement('http://bar.com', 'tuples', 'bar:tuples')
 >    endDocument()
 > I can spot 2 differences with the SAX logging: the prefix mapping starts
 > are in a different order (unimportant), and the endPrefixMapping are
 > missing...
 > I can't understand why they are missing: with the DOM model, either
 > attributes are present, or absent. How can this happend with a tree
 > structure?

If you use a JAXP identity transform to convert from DOM to SAX and
the endPrefixMapping() calls are missing, well, it could be a bug with
whoever implement that transform. In practice, I would not expect this
to cause serious problems, as most code does not rely on
endPrefixMapping().

 > I must also say that the prefix/uri mapping in DOM was made using
 > regular attribute:
 >
element.setAttributeNS("http://www.w3.org/2000/xmlns/",("xmlns:"+prefix),
 > uri);

Note that with W3C DOM, namespace nodes appear to be handled like
regular attributes, which is not how other DOMs like dom4j work, and
not like the XML infoset and "modern" XML data models work either: all
those have a special concept of namespace declarations or namespace
nodes, which makes things clearer. This is why we almost never use the
crappy standard DOM API in OPS, but use dom4j instead. I can only
recommend you do the same to save you a lot of trouble.

 > If this line is modified this way:
 >
element.setAttributeNS("http://www.w3.org/2000/xmlnz/",("xmlnz:"+prefix),
 > uri);
 > We get a totally different xml output:
 > <bar:tuples me:from_table="user"
 >  xmlnz:bar="http://bar.com"
 >  xmlnz:me="http://www.epfl.ch/orbeon/me"
 >  xmlnz:othr="http://other.com">
 >    <me:foo othr:arg="8">
 >    <tuple>
 >    </tuple>
 >  </me:foo>
 > </bar:tuples>
 > Except for the xmlnz which should be xmlns, the whole thing is
 > correct... IMHO, it seems to indicate that the xmlns declarations are
 > not handled correctly (or at least how I think they should) in Orbeon...
 > If I am correct, the DOM model implies xmlns declaration to be declared
 > as simple attributes...

I think that is correct too. Clearly you have at least one case (SAX
generated by hand) where the SAX stream is 100% correct, so I believe
the crux of the question is: how to you go from the SAX events to the
serialized XML result you produce above?

-Erik



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: SAXand DOM troubles...

Sebastien Noir
Hello!

Thanks for the time you took to reply to my troubles... I will try to
answer your question one by one (see below).

> > So far it seems there is a "feature" (bug?) in orbeon server which
> > prevents correct handling of xml with custom processors:
>
> It is quite unlikely that such a generalization is true :-) All the
> processors, custom or not, in the end use SAX to communicate with the
> outside world (i.e. other processors in a pipeline). And believe us,
> namespaces are used all over the place in OPS. But let's keep looking
> at your problem.

That's also what I thought, and this is precisely why I want to have
namespace keeped correctly.

> > Let's consider the following xml fragment:
> >  <bar:tuples me:from_table = {getTable4DB()}
> >      xmlns:me="http://www.epfl.ch/orbeon/me"
> >      xmlns:othr="http://other.com"
> >      xmlns:bar="http://bar.com">
> >      <me:foo othr:arg="8">
> >          <tuple>
> >          </tuple>
> >    </me:foo>
> >  </bar:tuples>
> >
> > Here are my attempts:
> >
> > First, using SAX, the generated XML is :
> > <bar:tuples me:from_table="user">
> >    <me:foo othr:arg="8">
> >        <tuple>
> >        </tuple>
> >    </me:foo>
> > </bar:tuples>
>
> What is "the generated XML"? What code do you use to produce it? Where
> do you look at it?
I'm trying to write processors to allow the "translation" from and to  
SAX/DOM xml represetation to/from scala xml representation. (see
http://scala.epfl.ch). The little xml code fragment on top is scala xml
code (see the {getTable4DB()}: it provides the attribute from_table by
calling a method.).
The SAX XML is generated by scala code, using standard java libraries
(mainly calling the various method of contentHandler). At this time,
this code is in a custom processor, for testing purpose. This custom
scala processors is compiled in regular java byte code, and referenced
in custom-processors.xml.
The output of this processor is sent (thanks for this suggestion) to the
logging processor oxf:sax-debugger. The final output is just sent in a
textarea tag of a page, providing a quick wiev of what was generated.

> > The strucutre is OK, only the namespace uri are missing.
> > Let's examine the Logging provided through oxf:sax-debugger (where is
> > the logging done, except in the Eclipse window? I had to copy line by
> > line...):
> > startDocument()
> > startPrefixMapping('me', 'http://www.epfl.ch/orbeon/me')
> > startPrefixMapping('bar', 'http://bar.com')
> > startPrefixMapping('othr', 'http://other.com')
> > startElement('http://bar.com', 'tuples', 'bar:tuples',
> > ('http://www.epfl.ch/orbeon/me', 'from_table', 'me:from_table'))
> > startElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo',
> > ('http://other.com', 'arg', 'othr:arg'))
> > startElement('', 'tuple', 'tuple')
> > endElement('', 'tuple', 'tuple')
> > endElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo')
> > endElement('http://bar.com', 'tuples', 'bar:tuples')
> > endPrefixMapping('othr')
> > endPrefixMapping('bar')
> > endPrefixMapping('me')
> > endDocument()
> >
> > To my eyes, the SAX event structures seems correct, yet he produced XML
> > is bad.
>
> Yes, the SAX events appear ok. Now I still don't understand what the
> "produced" XML is. I can bet my right hand (Note: I have lost it
> several times already ;-) that if you use the File serializer to
> output that result on disk, for example, the result will be what you
> expect.
Well, it does (nice for your right hand ;-) ! Here is the sax document
produced by File serializer:
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<bar:tuples xmlns:me="http://www.epfl.ch/orbeon/me"
xmlns:bar="http://bar.com" xmlns:othr="http://other.com"
me:from_table="user">
    <me:foo othr:arg="8">
        <tuple></tuple>
    </me:foo>
</bar:tuples>
I use the term "generated XML", because its origin is in the scala code.
It doesn't come from Orbeon server. I'm building first the scala xml to
SAX/DOM xml processor. So, from the point of view of OPS, this
processors has no input. It produces/generates XML out of the blue.

> > I made another attempt using DOM, here is the generated xml:
> > <bar:tuples me:from_table="user">
> >  <me:foo othr:arg="8">
> >    <tuple>
> >    </tuple>
> >  </me:foo>
> > </bar:tuples>
>
> What code do you use to convert from DOM to SAX?

I use the java code suggested on your website, translated to scala (very
siomilar to java, using java classes). in scala:
    val identity  
=org.orbeon.oxf.xml.TransformerUtils.getIdentityTransformer();
    identity.transform(new javax.xml.transform.dom.DOMSource(doc), new
javax.xml.transform.sax.SAXResult(contentHandler));
in java:

Transformer identity = TransformerUtils.getIdentityTransformer();
transformer.transform(new DOMSource(doc), new SAXResult(contentHandler));

 > I get exactly the same result. Let's have a look at the logging:

> > setDocumentLocator(...)
> >    startDocument()
> >    startPrefixMapping('bar', 'http://bar.com')
> >    startPrefixMapping('othr', 'http://other.com')
> >    startPrefixMapping('me', 'http://www.epfl.ch/orbeon/me')
> >    startElement('http://bar.com', 'tuples', 'bar:tuples',
> > ('http://www.epfl.ch/orbeon/me', 'from_table', 'me:from_table'))
> >    startElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo',
> > ('http://other.com', 'arg', 'othr:arg'))
> >    startElement('', 'tuple', 'tuple')
> >    endElement('', 'tuple', 'tuple')
> > endElement('http://www.epfl.ch/orbeon/me', 'foo', 'me:foo')
> >    endElement('http://bar.com', 'tuples', 'bar:tuples')
> >    endDocument()
> > I can spot 2 differences with the SAX logging: the prefix mapping
> starts
> > are in a different order (unimportant), and the endPrefixMapping are
> > missing...
> > I can't understand why they are missing: with the DOM model, either
> > attributes are present, or absent. How can this happend with a tree
> > structure?
>
> If you use a JAXP identity transform to convert from DOM to SAX and
> the endPrefixMapping() calls are missing, well, it could be a bug with
> whoever implement that transform. In practice, I would not expect this
> to cause serious problems, as most code does not rely on
> endPrefixMapping().
Well, It seems to be the case...

Using a File serializer, I also get a correct input with DOM. Am I
missing something important? Is the xsl used to "copy" the generated xml
in a textarea responsible for removing/altering namespace information?
I'm using this as a view:
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xsl:version="2.0">
    <head>
        <title>Bug Detail</title>
    </head>
    <body>
        <xforms:group>
            <h1>Users</h1>
            <textarea wrap="physical" cols="250" rows="10"><xsl:copy-of
select="/"/></textarea>          
        </xforms:group>
    </body>
</html>
and the page is defined this way:
 <c:page
        id="allUsersScala"
        path-info="/allusersscala"
        model="/pipes/scalaPipe_pipe.xpl"
        view="/views/allUsers_view.xsl"
        />
and the processor (in custom-processor.xml)
 <processors>
     <processor name="my:scala_processor"
xmlns:my="http://www.epfl.ch/lamp/processors">
         <class name="awusl.orbeonBridges.Pipe$class"/>
     </processor>
</processors>

Thanks again for your help. While I still can't understand why the
FileSerializer keeps attribute, and my xsl transforms do not, I can keep
on working with some confidence that my code is not totally buggy and
useless...

S?bastien Noir



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: SAXand DOM troubles...

Erik Bruchez
Administrator
Sebastien,

 > The SAX XML is generated by scala code, using standard java libraries
 > (mainly calling the various method of contentHandler). At this time,
 > this code is in a custom processor, for testing purpose. This custom
 > scala processors is compiled in regular java byte code, and referenced
 > in custom-processors.xml.

Sounds good so far.

 > The output of this processor is sent (thanks for this suggestion) to the
 > logging processor oxf:sax-debugger. The final output is just sent in a
 > textarea tag of a page, providing a quick wiev of what was generated.

Ah ha, but that's what I was interested to know, what is that "final
output: to get from SAX to an HTML textarea takes many steps, and I
was interested in knowing how you do this.

 > I use the term "generated XML", because its origin is in the scala code.
 > It doesn't come from Orbeon server. I'm building first the scala xml to
 > SAX/DOM xml processor. So, from the point of view of OPS, this
 > processors has no input. It produces/generates XML out of the blue.

Which is perfectly fine.

 >> If you use a JAXP identity transform to convert from DOM to SAX and
 >> the endPrefixMapping() calls are missing, well, it could be a bug with
 >> whoever implement that transform. In practice, I would not expect this
 >> to cause serious problems, as most code does not rely on
 >> endPrefixMapping().
 >
 > Well, It seems to be the case...
 >
 > Using a File serializer, I also get a correct input with DOM. Am I
 > missing something important? Is the xsl used to "copy" the generated xml
 > in a textarea responsible for removing/altering namespace information?

 >            <textarea wrap="physical" cols="250" rows="10"><xsl:copy-of
 > select="/"/></textarea>

There you go: in the end, you are going to obtain an XHTML document
with something like this:

<textarea>
   <bar:tuples ...>
     ...
   </bar:tuples>
</textarea>

But then, this is going through the HTML serializer, which will likely
introduce some changes on its own. Plus, it's not clear what the
behavior of a <textarea> should we when it contains markup!

The best way of displaying something close to the correct XML is to
use something like saxon:serialize:

http://www.saxonica.com/documentation/extensions/functions/serialize.html

 From XSLT, feed it with your document, and then display the resulting
string in your <textarea>.

You could also use <f:xml-source> (an OPS tag which calls an XML
formatter), which will look nicer, but which may cause some problems
with namespaces as well.

 > Thanks again for your help. While I still can't understand why the
 > FileSerializer keeps attribute, and my xsl transforms do not, I can keep
 > on working with some confidence that my code is not totally buggy and
 > useless...

It definitely doesn't appear to be!

-Erik




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws