Get Source of XmlSerializer FormatException? - xmlserializer

i'm deserializing some XML Data i get from a WebService using the XmlSerialzier. This worked quite good until now, but since some days i get an FormatException while the Serializer parses the XML.
Is there any Chance to get the Value/Element/Tagname the Serialzer tried to parse when the Exeption was thrown? I haven't found anything in the Exception Details.
Thanks and Greetings
Kornelis

If the format exception doesn't give you enough information to solve the problem, you can go one step further and debug the specific code that produces the problem. The XmlSerializer works by generating a assembly at runtime which is responsible for serializing/deserializing the type you want. This generated code can be debugged in the following way (check link).

Related

SAPUI5 invalid MIME part type with Remote oDATA Service

I need help showing the data from my own remote server with oDATA.
When I want to show the data in the view, I get the following error
invalid MIME part type.
These are the Captures of Error
my https://******/$metadata?
My Table control from SApui5 Course App example
Error when executing the application
And Console error
When I insert this.getModel().setUseBatch(false) in the init : function () of the Component.js, it does not give me the error, nor in the console, but it does not show me the records either .. Can someone give me an idea?
It's an old question, but recently I've got the same error with batch request processing and in my case the root cause was that when building batch processing response with content type multipart/mixed you have to use CRLF as a text line separator ('\r\n') and not only '\n'. See also here in multipart response specification. The hard part was that correct and incorrect responses look absolutely identical when debugging.

Is it possible to log the output of MarkupTemplateEngine in grails?

I am using groovys MarkupTemplateEngine to craft a xml like response for a calling application - to help in tracing issues I would like to log within my application the responses being provided to the calling app. Essentially i am looking to see if it is possible to log the generated template as returned to the client?
edit: So far I have tried using a response interceptor to access the response fields in both the after and afterview events with no luck
in log4j there is a special builder that could wrap your original writer and will write output into two destinations: log and original writer. (or it could be outputstream)
https://logging.apache.org/log4j/2.x/log4j-iostreams/apidocs/org/apache/logging/log4j/io/IoBuilder.html
Writer loggingWriter = IoBuilder.
forLogger(your_class_or_logger).
filter(original_writer).
buildWriter();

How to parse Nokogiri/libXML XML errors to human-friendly errors?

We are using Nokogiri to validate XML files using a XSD. The problem is that the error messages that Nokogiri generates are not very friendly and very hard to translate:
"Element '{http://www.portalfiscal.inf.br/nfe}infNFe': The attribute 'Id' is required but missing."
Does anyone know of a parser or any other way to capture the info needed from the error to generate a more human friendly error?
Until then, we will be doing a custom parser for them... ouch!
I created a gem for this that is now open source: https://rubygems.org/gems/xml_errors_parser
It seems to work pretty well so far, but number of errors parsed is very few for now. It is however very easy to add new errors, so we will be adding them as needed.
Code reviews and pull requests are always great :)

NSXMLParserErrorDomain error 64

I have to call xml parsing I am receiving this error "NSXMLParserErrorDomain error 64", if I will parse dynamically I will get this error. statically parsing on that same xml I get my attribute values.
If i will try another one server different request,url and response it will working properly the xml parsing and i am getting attribute values.
Please check this link==>http://brandontreb.com/wordpress-for-iphoneipad-nsxmlparsererrordomain-error-64-resolved
*After scouring the internet, I found that this could be the result of a few issues.
1) Special characters in a post body that are not supported by NSXMLParser
2) Special characters in a comment
3) Invalid post or comment RSS
4) An error in a theme/plugin file
For me, this turned out to be an issue with the comments RSS feed. I loaded it up in the browser and long behold, even the browser threw an error. But what could be causing this? Turns out, I had left a space in a plugin that I created. This caused a space to be output at the beginning of the comments XML, causing it to error. Notice the space between ?> and
After removing the space from this plugin, I loaded up WordPress for iPhone and it added my blog without a problem.
So, the take away from this is don’t output spaces when you create a plugin.*
Hope this helps you...:-)
In my case, it was only the blank line at the beginning of the file that was causing the issue. Error code 64 is for misplaced XML declaration as you can see in the documentation:
NSXMLParserMisplacedXMLDeclarationError = 64,
Misplaced XML declaration.

BIRT Engine Integration In Struts2

I am integrating the BIRT Engine with Struts2 following this link http://birtworld.blogspot.com/2010/02/birt-and-struts-2.html at basic level it is ok.
But I am facing following issues...
Passing parameter to Task renderer...
task.setParameterValue("csvFilePath", req.getParameter("csvFilePath"));
this is thorwing an exception "The type of parameter "csvFilePath" is expected as
"string", not "[Ljava.lang.String;", I dont know what is mean by string here
please help in the context.
Drill down report has broken link.
I have two reports report1 and report2. report2 is not coming up when followed the hyperlink in report1.
The hyperlink seems to be broken, report has this hyperlink "http://localhost:8080/ReportEngineIntegration/run?__report=%2FE%3A%2FDashboardReportEngine%...". I wonder why this happening and why /run? is coming in the ulr.
Please help me in the context.
Thanks in advance
getParameter returns a string array. If a method takes a string, send only one string. (Making some assumptions about what req is here.)
That said, if you're using Struts 2, why are you accessing the request anyway?

Resources