-
Notifications
You must be signed in to change notification settings - Fork 73
Allow <![CDATA[]]> to preserve whitespace in XML text content #821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow <![CDATA[]]> to preserve whitespace in XML text content #821
Conversation
daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/debugger/InteractiveDebugger.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/W3CDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/resources/test/sapi/mySchemaCDATA1.dfdl.xsd
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/JDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/JDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/JDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/JDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/JDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/JDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/W3CDOMInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
Outdated
Show resolved
Hide resolved
8908852
to
74ab456
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Minor fixes to doc strings in XSD.
daffodil-japi/src/main/scala/org/apache/daffodil/japi/infoset/Infoset.scala
Outdated
Show resolved
Hide resolved
daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have some questions.
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala
Outdated
Show resolved
Hide resolved
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
Outdated
Show resolved
Hide resolved
daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/resources/test/sapi/mySchemaCDATAFloat.dfdl.xsd
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/resources/test/sapi/mySchemaCDATAString.dfdl.xsd
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
Outdated
Show resolved
Hide resolved
...il-schematron/src/test/scala/org/apache/daffodil/validation/schematron/EmbeddedTesting.scala
Outdated
Show resolved
Hide resolved
daffodil-japi/src/main/scala/org/apache/daffodil/japi/infoset/Infoset.scala
Outdated
Show resolved
Hide resolved
daffodil-japi/src/main/scala/org/apache/daffodil/japi/infoset/Infoset.scala
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/debugger/InteractiveDebugger.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
0420201
to
c7dabd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Looks good except for some inconsistent formatting. Please fix and then you're good to squash and merge.
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
Outdated
Show resolved
Hide resolved
daffodil-lib/src/main/scala/org/apache/daffodil/api/XMLOutputStyle.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/infoset/Infoset.scala
Outdated
Show resolved
Hide resolved
daffodil-lib/src/main/scala/org/apache/daffodil/api/XMLOutputStyle.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Show resolved
Hide resolved
daffodil-japi/src/main/scala/org/apache/daffodil/japi/infoset/Infoset.scala
Outdated
Show resolved
Hide resolved
c7dabd7
to
0d813e1
Compare
daffodil-japi/src/main/java/org/apache/daffodil/japi/XMLOutputStyle.java
Outdated
Show resolved
Hide resolved
daffodil-japi/src/main/java/org/apache/daffodil/japi/XMLOutputStyle.java
Outdated
Show resolved
Hide resolved
daffodil-japi/src/main/scala/org/apache/daffodil/japi/packageprivate/Utils.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/infoset/Infoset.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/packageprivate/Utils.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another round of changes suggested by Steve and me.
daffodil-japi/src/main/scala/org/apache/daffodil/japi/packageprivate/Utils.scala
Outdated
Show resolved
Hide resolved
daffodil-japi/src/main/scala/org/apache/daffodil/japi/packageprivate/Utils.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/Daffodil.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/infoset/Infoset.scala
Outdated
Show resolved
Hide resolved
daffodil-sapi/src/test/scala/org/apache/daffodil/example/TestScalaAPI.scala
Show resolved
Hide resolved
e5b2e62
to
db285db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THere are a very small number of non-resolved conversations still to be fixed.
daffodil-sapi/src/main/scala/org/apache/daffodil/sapi/infoset/XMLTextEscapeStyle.scala
Show resolved
Hide resolved
db285db
to
c2ec22f
Compare
We need to update this pull request's title and description since they no longer match what this pull request actually does. We collectively decided not to create a tunable XMLOutputStyle, only pass an enum XMLTextEscapeStyle as a new constructor parameter to XMLTextInfosetOutputter. We decided not to address the question how to let a CLI option change infoset outputter settings in this pull request, even though this pull request's issue, DAFFODIL-2346, originally requested a CLI option to use <!CDATA[]]> to preserve whitespace in XML infosets' simple elements' text content. Note that another issue, DAFFODIL-2234, also wants a CLI option to not pretty print XML or JSON infosets. We already pass a boolean "pretty" as a constructor parameter to XMLTextInfosetOutputter, but we don't have any way for the CLI to change this constructor parameter's value from true to false in the places where the codebase passes true. If we still punt the question of how to let the CLI, or TDML Runner, change infoset outputter settings to DAFFODIL-2234 instead of this pull request, then I suggest we edit this pull request's new title and description to:
Also, I think we should consider adding new XMLTextInfosetOutputter methods which can change infoset outputter settings using "withXXX" calls instead of changing them in constructor parameters. Calling "withXXX" methods is a more upward compatible and extensible mechanism to change objects' settings since we can simply add new "withXXX" methods in the future. A "withXXX" method can also eliminate the need to pass a boolean or enum value since the "withXXX" method's name can describe the new setting as well, such as "withPrettyPrint" or "withCDATA". |
Agreed one the new PR title and commit message. Also agreed on new withXXX functions for setting parameters, that's a much cleaner API. I'd suggest we do that as a separate PR though. |
c2ec22f
to
0ecb138
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Yes, this pull request is ready for squashing and merging after a fix to some comments.
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
Show resolved
Hide resolved
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextEscapeStyle.scala
Outdated
Show resolved
Hide resolved
0ecb138
to
6656012
Compare
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
Show resolved
Hide resolved
Feature that can allow for this parameterizing of the infoset outputters is in #912 |
I've updated this PR and I believe all issues are resolved, including the latest of only escaping with CDATA if special chars or whitespace exist. Please take one last look at this to make sure it's ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
I gave this one more quick pass over the latest changes. Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Also looks good to me, even though a future PR to switch from constructor parameters to withXXX()
functions possibly might make the enums unnecessary depending on whether it makes sense to have two differently named no-argument withXXX()
methods or still pass an enum to a withXXX()
method. Let's merge anyway.
Add a new constructor parameter (an enum XMLTextEscapeStyle with Standard and CDATA as values) to XMLTextInfosetOutputter. When CDATA is passed instead of Standard, wrap simple XML elements' text contents in CDATA brackets to preserve any whitespace they contain. DAFFODIL-2346
7a7995e
to
1eb1b19
Compare
Add a new constructor parameter (an enum XMLTextEscapeStyle with
Standard and CDATA as values) to XMLTextInfosetOutputter. When CDATA is
passed instead of Standard, wrap simple XML elements' text contents in
CDATA brackets to preserve any whitespace they contain.
DAFFODIL-2346-preserve-whitespace-in-dfdl-infoset