Comments (31)
@dmarkov ping
from jcabi-xml.
I'm aware of the task, give me some time to find a developer...
from jcabi-xml.
thanks for the report, I topped your acc for 15 mins, payment ID 000-52e05536
from jcabi-xml.
@rultor release, tag is 0.14
from jcabi-xml.
@rultor release, tag is
0.14
@yegor256 OK, I will release it now. Please check the progress here
from jcabi-xml.
@rultor release, tag is
0.14
@yegor256 Oops, I failed. You can see the full log here (spent 8min)
from jcabi-xml.
@rultor release, tag is 0.14
from jcabi-xml.
@rultor release, tag is
0.14
@yegor256 OK, I will release it now. Please check the progress here
from jcabi-xml.
@rultor release, tag is
0.14
@yegor256 Done! FYI, the full log is here (took me 11min)
from jcabi-xml.
@krzyk look at XSLDocument.STRIP
. I think this is what you're looking for
from jcabi-xml.
@yegor256 Unfortunately it introduces new lines between the tags.
from jcabi-xml.
@krzyk true... let me think about something else
from jcabi-xml.
@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.
@dmarkov please assign someone else
from jcabi-xml.
@dmarkov please assign someone else
@yegor256 no problem, I'll try to find somebody else
from jcabi-xml.
@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.
@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.
@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.
@yegor256 I don't see any reference to saxon in pom.xml.
from jcabi-xml.
@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.
@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.
@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.
@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.
@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.
@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.
@pinaf it's better to keep the source code detached from the discussion tickets
from jcabi-xml.
from jcabi-xml.
@krzyk @dmarkov merged. please close.
from jcabi-xml.
@dmarkov payment?
from jcabi-xml.
@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.
@dmarkov thanks
from jcabi-xml.
Related Issues (20)
- not enough ctors in XSLDocument
- new parent 1.33.0 HOT 4
- refresh HOT 4
- Reusing `TransformerFactory.newInstance()` HOT 2
- compatibility with Saxon 11 HOT 4
- more logs about factories HOT 4
- load XSL only once per XSLDocument HOT 4
- cache of factories in XSLDocument may grow too big HOT 1
- Dependency Dashboard
- improve logging messages HOT 7
- `XSLDocument` is not thread-safe HOT 14
- XSLDocument ctor must accept SystemId in most cases HOT 4
- trace() instead of debug() HOT 3
- XMLDocument.with(Sources) forgets the SID HOT 6
- Challenges with Separating Error Messages and Exceptions in Saxon Library HOT 1
- Schema.check() must throw an exception with all inner exceptions inside
- XMLDocument.xpath returns only one element
- XMLDocumentTest.java:59-64: Implement XPath 2.0... HOT 8
- Add more constructors for SaxonDocument HOT 2
- Altered formatting of original XML
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jcabi-xml.