Code Monkey home page Code Monkey logo

Comments (3)

cearny avatar cearny commented on August 23, 2024

I was able to very easily prepare a PR for this:

#96

Please let me know if it requires any changes.

from itextsharp.lgplv2.core.

VahidN avatar VahidN commented on August 23, 2024

Thank you.

from itextsharp.lgplv2.core.

cearny avatar cearny commented on August 23, 2024

@VahidN thanks for the very quick turnaround, but it seems I miscalculated the issue.

Let me explain, using some screenshots from iText RUPS.

Initially, the library used to behave like this, when replacing the XFA form:

image

The change above fixes this. But that was actually not the full issue. If you pay attention (as I did not), you'll see that the first element is not <xfa:datasets> but instead its child <xfa:data> as the code is using XmlNode.WriteContentTo, which only writes the InnerXml content, so when serializing an element, the element itself does not get written to the output stream!

So, now the output is:

image

This is also incorrect.

The other library is using XmlTextWriter which is all and good, but is not available in .NET Standard 1.3 (not even as a NuGet) so it's a no-go to simply use the same, unless you are okay with a nasty breaking change.

Alternatively, XmlSerializer can be used, which only requires a new dependency in .NET Standard 1.3 (namely System.Xml.XmlSerializer). I changed the implementation to use that one and it seems to be working and compiling fine on all targets.

Now the output is the following:

image

I have prepared a second PR for this, which also updates the test so now it looks to see that the element really is serialized in the output. You can find it at #97

By the way I found another usage for XmlNode.WriteContentTo in XmpReader at https://github.com/VahidN/iTextSharp.LGPLv2.Core/blob/master/src/iTextSharp.LGPLv2.Core/iTextSharp/text/xml/xmp/XmpReader.cs#L105 ; not sure if that one also causes a similar issue, but from a cursory glance, there is a difference to iTextSharp-LGPL's implementation (see: https://github.com/schourode/iTextSharp-LGPL/blob/master/src/core/iTextSharp/text/xml/xmp/XmpReader.cs#L153)

I apologize for missing the whole issue the first time around!

from itextsharp.lgplv2.core.

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.