I'm using the XML Tree API and the XML Parser API in c++, and I would like to prohibit entities creation in my XML documents.
What is the best way to do that when using these API's?
I've only seen examples of how to prohibit DTD entities when using XML Reader, and none when using the XML Tree or Parser API.
Thanks!
When using the tree API, you can call xmlGetIntSubset and inspect the xmlDtd structure to check whether a document contains entity declarations. When using the SAX parser, you can register an entityDeclSAXFunc callback.
Related
The XML data to be used with the Model is available as an org.w3c.dom.Element, due to unmarshalling an XML wrapper containing up to 100 individual rdf:RDF nodes.
Currently I'm converting the DOM tree to a string, and an InputStream fed with the String can be passed to the Model read method.
Isn't there a more direct method for feeding a Model?
There is class DOM2Model.create(...).load(...) which might work - very old code.
The main RDF/XML parsing is SAX-based and streaming, not XML-tree based.
When generating swagger is there a best practice on wither to use annotation or XML Comments. I have a number of pointend with both xml comments and annotation. Should the endpoints just contain one or the other.
Is there an ant task for generating an XSD from POJOs?
I'm presuming that you want to serialize a Java POJO object and then use XSD to validate the serialised XML data, or author new object instances which can instantiated via your de-serialization process.
Thing is Java XML serialization comes in two favours (Examples follow):
Xstream XML is dynamically generated from fixed object class description
XMLBeans Java classes dynamically generated from fixed XML Schema
Now perhaps you're using something else that combines both approaches?
What I'd recommend is create (or generate) an XSD based on the XML your object creates when serialized. Relatively speaking Java objects don't change that often and when they do a far great challenge is supporting multiple versions (Reading data encoded for the older version of your object). To address this challenge I'd recommend reading the following article for one possible solution:
http://java.dzone.com/articles/migrate-serialized-java
I seek a iPhone json library that parse json strings into Custom Objects (such as Employee, Course, etc, not into NSDictionary or NSArray)
Thanks.
I don't think one exists. How would you design a general one, without knowing in advance about the kinds of objects that you'll need to parse into? And more critically, JSON is only designed to encode basic data types; it is not intended to be a full object serialization framework (those are usually language specific or have language-specific bindings). However, it should be very easy to write a converter to your custom objects.
How can I edit a xml file using JQGrid? I am using ASP.Net MVC 3.5 with C#. Is it possible to return a JSon object from controller method for this purpose?
Everything is possible. But the most work which you have to do is independ from the jqGrid. Moreover general XML file can be not good represented in a grid. If the deepness of the XML file not so long, you can use subgrid feature of the jqGrid. One more restriction existing in the jqGrid can make the work more comple: jqGrid not support data with attributs other as ids. So if you will have to map attributes to the sub-elements on the server side to be able to use jqGrid.
The ASP.NET MVC site can for example read the XML file with respect of some desirialization methods and initialize the object with the same information as the XML has. Then can use the object to fill the jqGrid and modify the data. Because th data are no mo represented as a XML, the server can use JSON to communicate with the jqGrid. At the end one can use one from wel known serialization methods so save modified data in the XML file back.