Giter VIP home page Giter VIP logo

Comments (31)

krzyk avatar krzyk commented on July 20, 2024

@dmarkov ping

from jcabi-xml.

dmarkov avatar dmarkov commented on July 20, 2024

I'm aware of the task, give me some time to find a developer...

from jcabi-xml.

dmarkov avatar dmarkov commented on July 20, 2024

thanks for the report, I topped your acc for 15 mins, payment ID 000-52e05536

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@rultor release, tag is 0.14

from jcabi-xml.

rultor avatar rultor commented on July 20, 2024

@rultor release, tag is 0.14

@yegor256 OK, I will release it now. Please check the progress here

from jcabi-xml.

rultor avatar rultor commented on July 20, 2024

@rultor release, tag is 0.14

@yegor256 Oops, I failed. You can see the full log here (spent 8min)

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@rultor release, tag is 0.14

from jcabi-xml.

rultor avatar rultor commented on July 20, 2024

@rultor release, tag is 0.14

@yegor256 OK, I will release it now. Please check the progress here

from jcabi-xml.

rultor avatar rultor commented on July 20, 2024

@rultor release, tag is 0.14

@yegor256 Done! FYI, the full log is here (took me 11min)

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@krzyk look at XSLDocument.STRIP. I think this is what you're looking for

from jcabi-xml.

krzyk avatar krzyk commented on July 20, 2024

@yegor256 Unfortunately it introduces new lines between the tags.

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@krzyk true... let me think about something else

from jcabi-xml.

dmarkov avatar dmarkov commented on July 20, 2024

@jenya this task is yours, please help (see our key principles of work). If you have any technical questions, don't hesitate to ask right here

Task's budget is 30 mins (see this for explanation)

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@dmarkov please assign someone else

from jcabi-xml.

dmarkov avatar dmarkov commented on July 20, 2024

@dmarkov please assign someone else

@yegor256 no problem, I'll try to find somebody else

from jcabi-xml.

dmarkov avatar dmarkov commented on July 20, 2024

@pinaf this task is yours, please help (see our key principles of work). If you have any technical questions, don't hesitate to ask right here... Task's budget is 30 mins (see this for explanation)

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@dmarkov @yegor256 I can't fix the line break after tags issue with XSL. Setting indent="no" in the XSL should handle this as can be seen here, but it seems the default java implementation of the XSL processor does not honor that. Suggestions?

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@pinaf if it's a bug in Java XSL implementation, this is not our problem. But I think we're using Saxon in this library, aren't we?

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@yegor256 I don't see any reference to saxon in pom.xml.

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@pinaf in that case, implement it with indent=no and test with Saxon (or some other Java XSL implementation). And document in Javadoc, that this may not work with standard Java implementation.

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@yegor256 turns out the problem was something else. When the source XML already has line breaks, STRIP doesn't remove them. indent=no just keeps the XSL processor from adding indentation of its own. Also, STRIP doesn't ADD line breaks - those come from the call to trans.setOutputProperty(OutputKeys.INDENT, "yes") inside the method XMLDocument.asString, which gets called whenever you construct a XMLDocument from a String. Here's what STRIP does:

<hi>  <dude>  A </dude>      </hi>

yields

<hi><dude>  A </dude></hi>

But

<hi>
    <dude>  A </dude>
   </hi>

which already contains linebreaks, yields

<hi>
<dude>  A </dude>
</hi>

I can't get the XSL processor to strip those line breaks. Let me know if you just want STRIP to be used - if not, please give this taks to someone else who knows XSL.

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@pinaf looks like the problem is not with XSL, but with XMLDocument#toString(), right? This method adds indentation. Maybe we can introduce a new method XML#compact(), which will return another instance of XML, that prints itself without indentation:

new XMLDocument("<hi>\n<a>hey</a></hi>").compact().toString();

This will solve the problem, right?

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@yegor256 toString just returns a String field called xml which gets calculated in asString with indentation. xml is the internal representation (in String form) of the XML document and it is calculated from a Node given to the constructor. Once asString is finished, xml can no longer be changed (final) and since the original Node element was not kept, there is no way to go back to a pre-indentation String. We either need to keep the original Node element and use it to generate a String with no indentation or we change the implementation of asString so that it doesn't indent.

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@pinaf I see. So, we should document all this in the Javadoc of STRIP and call it a day. We simply can't provide the functionality asked by @krzyk. If he needs a compact (without indentation) presentation of an XML document, he should get Node from XML using node() method and then convert it into string using native Java transformer.

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@yegor256 Alright, but calling node() wouldn't work either because it creates a new Node from the String xml already constructed with indentation.

Is it alright to also add a link to this discussion in the Javadoc or is that something you don't like?

from jcabi-xml.

yegor256 avatar yegor256 commented on July 20, 2024

@pinaf it's better to keep the source code detached from the discussion tickets

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@dmarkov @krzyk PR #42

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@krzyk @dmarkov merged. please close.

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@dmarkov payment?

from jcabi-xml.

dmarkov avatar dmarkov commented on July 20, 2024

@pinaf I just added 30 mins to your account, many thanks for your contribution..... added +30 to your rating, now it is equal to +105

from jcabi-xml.

pinaf avatar pinaf commented on July 20, 2024

@dmarkov thanks

from jcabi-xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.