Why url-generator does not preserve xml comments when using url with file: protocol?

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

Why url-generator does not preserve xml comments when using url with file: protocol?

thao nguyen
Hello orbeon-experts,

I am using orbeon-cli.jar for calling my pipeline. I am currently use
version 3.8. However, during the process, my xml file has no xml comment
anymore. I upgrade to orbeon 3.9 according to the  announcement
<http://wiki.orbeon.com/forms/doc/developer-guide/release-notes/39#TOC-XML-comments-in-XPL-and-XForms>  
that "Orbeon Forms now has XML / HTML comments support in XPL and in the
XForms engine." In fact it does, but in a strange way.

I simplify the process to a simple xpl file, where it only read the xml file
and write it down. Here is my test:
1. I use relative path in <url>: the output xml has xml comments, as
expected.

<p:processor name="oxf:url-generator">
      <p:input name="config">
          <config>
              <url>export.xml</url>
          </config>
      </p:input>
      <p:output name="data" id="main-input"/>
  </p:processor>
  <p:processor name="oxf:xml-converter">
       <p:input name="config">
           <config>
               <encoding>utf-8</encoding>
           </config>
       </p:input>
       <p:input name="data" href="#main-input"/>
       <p:output name="data" id="input-converted"/>
  </p:processor>
  <p:processor name="oxf:file-serializer">
    <p:input name="config">
        <config>
          <file>file_written_relative_path.xml</file>
        </config>
    </p:input>
    <p:input name="data" href="#input-converted"/>
  </p:processor>

2. But in fact, what we need is a absolute-path in <url>, as:

<p:processor name="oxf:url-generator">
    <p:input name="config">
        <config>
          <url>file:///D:/path/to/file/export.xml</url>
          <mode>xml</mode>
          <encoding>utf-8</encoding>
          <force-encoding>true</force-encoding>
          <content-type>application/xml</content-type>
          <force-content-type>true</force-content-type>
          <handle-lexical>true</handle-lexical>
          <cache-control>
            <use-local-cache>false</use-local-cache>
          </cache-control>
        </config>
    </p:input>
    <p:output name="data" id="main-input-absolute"/>
  </p:processor>

  <p:processor name="oxf:xml-converter">
       <p:input name="config">
           <config>
               <encoding>utf-8</encoding>
           </config>
       </p:input>
       <p:input name="data" href="#main-input-absolute"/>
       <p:output name="data" id="input-absolute-converted"/>
  </p:processor>
  <p:processor name="oxf:file-serializer">
    <p:input name="config">
        <config>
          <file>file_written_absolute_path.xml</file>
        </config>
    </p:input>
    <p:input name="data" href="#input-absolute-converted"/>
  </p:processor>

To me, it seems like "url-generator" has different ways to load file in
those cases. Even though I have tried all possible configs for url-generator
in [2], it does not keep all comments as in [1]. Why it doesn't? Is it a
bug? Is there any way to workaround? Or is there some where else it can be
configured?

Thanks for any hint,
Thao

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Why url-generator does not preserve xml comments when using url with file: protocol?

Alessandro  Vernet
Administrator
Hi Thao,

I've already posted a comment on your question on Stack Overflow (see link
below), and my suggestion would be for you to reproduce this with 2018.2. If
the issue also happens with 2018.2, then create a minimal example showing
the problem, post it here. I can't guarantee it will dealt with in a snap,
but this is a start :).

https://stackoverflow.com/questions/54357931/why-url-generator-does-not-preserve-xml-comments-when-using-url-with-file-proto

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Why url-generator does not preserve xml comments when using url with file: protocol?

thao nguyen
Hi Alex,

Thanks for your answer.

I have tried also the newer version. The latest version: 2018.2 CE, I can't
use as it has no orbeon-cli.jar inside. I have tried version  4.5 CE
<https://github.com/orbeon/orbeon-forms/releases/download/tag-release-4.5-ce/orbeon-4.5.0.201404080036-CE.zip>  
but it has the same problem as 3.9.

The difficulty for us is that we have custom processors which are all built
for orbeon 3.8 and 3.9. It will be costy to upgrade to version 4 (we would
have to upgrade if version 4.5 has solved the issue).

My intend is very simple: to read the xml file and write it down, so that
everything is kept in the output xml.   test_xml_comment.xpl
<http://discuss.orbeon.com/file/t102740/test_xml_comment.xpl>   is the
pipeline to do that. The  recipes.xml
<http://discuss.orbeon.com/file/t102740/recipes.xml>   with  recipes.dtd
<http://discuss.orbeon.com/file/t102740/recipes.dtd>   has comments inside.
I run it by:

java -Xmx1024m -jar "D:\orbeon4.5\WEB-INF\orbeon-cli.jar" -r .
oxf:/test_xml_comment.xpl

The results: expected that output_absolute_4.5.0.xml and
output_relative_4.5.0.xml are the same, as it reads from one file. However,
output_relative_4.5.0.xml has comments, but not in
output_absolute_4.5.0.xml.

I hope this small example is enough to reproduce the issue.

With best regards,
Thao


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Why url-generator does not preserve xml comments when using url with file: protocol?

Alessandro  Vernet
Administrator
Hi Thao,

Got it. I'm wondering if comments are only properly handled when the file is
handled by a resource manager. If you want to read
`D:/path/to/file/export.xml`; instead of pointing to the file with
`file:///D:/path/to/file/export.xml`, could you try on the command line
setting `-r D:/path` and then referring to the file as
`<url>/to/file/export.xml</url>` or `<url>oxf:/to/file/export.xml</url>`?
You'll let me know if this works for you.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Why url-generator does not preserve xml comments when using url with file: protocol?

thao nguyen
Hi Alex,

I forgot to tell, that using oxf: protocol has no problem, we have tried
that. But it's not the case we can do, as the absolute path is transfered
from some where else, it's dynamic and we would like just pass it to the
url-generator.

Any chances that it could be fixed, somehow?

Regards,
Thao

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Why url-generator does not preserve xml comments when using url with file: protocol?

Alessandro  Vernet
Administrator
Hi Thao,

Got it, then I'd just recommend you get the source and debug the issue. As
you noticed, there must be something going on when files are parsed without
going through a resource manager, but given how the product is used by our
customers, this is we're very unlikely to prioritize investigating an issue
like this. Luckily, you have the source :). You'll let us know what you find
if you if you get a chance to work on it.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet