Are there any good ways of converting xhtml to json? I couldn't find any existing scripts to do that, so I'm not sure if the best way is to somehow write a script to parse the xhtml, convert it to some other format and then to json.
I've found XML to JSON converters and HTML to JSON converters online with a few Google searches. You may be able to use these together to convert XHTML to JSON, or you could spend a few minutes Googling and you may find an alternative.
Related
can someone tell me which APIs exactly use XML data format and which use JSON data format to represent data? I came across different answers on the internet and can't make a difference between SOAP, REST, RESTful, or WS and realize which of them is actually an API that support JSON or XML.
I came across this service from stackoverflow
https://api.stackexchange.com/2.3/questions?fromdate=1519862400&todate=1522368000&order=desc&sort=activity&site=stackoverflow&tagged=python
I believe the source is from a database. How do I build an Xml to spit me out data in similar format?
I use the below logical lines
xmldoc.Load(xmlFileName);
Newtonsoft.Json.JsonConver.SerializeXmlNode(xmldoc);
Any recommendation of how to build the Xml which is a reverse process? My solutions are heavily dependant on Xml and flatFiles
According to https://api.stackexchange.com/docs the StackExchange API only supports JSON output, not XML. So you will have to convert the JSON to XML.
My own preference is to do this conversion "by hand" using XSLT 3.0 rather than using a standard library, because standard libraries often give you XML that's rather difficult to work with.
So i have started to work with conversion from XML or JSON to Edifact (EDI), and i have no idea where to begin. i have started to read a bit about edifact and i thought id post a question here to maybe get some pointers of what is good to know and also maybe of some links and places to start learning about conversion to edifact.
So i have started with trying to convert XML to Edifact and soon realized that i would need an XSD for that. And i thought If Edifact is a pretty tightly kept standard, is there any already existing XSDs for Edifact 911 ORDERS and also DESADV. I couldn't find any.
Any information would be helpful at this moment. Thank you!
I don't think you'll find any schemas that aren't proprietary to a translation package. Any schema would probably be a generic representation of the standard, and not specific to your implementation, or your trading partner's guidelines.
Your XML / JSON is proprietary to you (or your ERP). So you'll need to take the XML tags or JSON objects and convert them into the segment/element enveloped structure of the EDIFACT document. BOTS might be able to help you here, as it is open source (Python, I think). Outside of that, there are really great drag/drop mapping tools out there that will allow you to solve your problem.
Json is better than xml for sure, i was wondering if there is any case we should use xml instead of json
If speaking in terms of REST, neither is better. Plain XML or plain JSON does not say anything about data transferred in either format. Though if you use well known formats like:
application/atom+xml
application/vnd.collection+json
comparison will boil down to which format suits your needs better.
If you compare XML to JSON from programming language perspective, yes XML adds extra layer between code and data, though nothing special. Oh and XML is little verbose and larger in terms of bytes.
XML has been around for a long time, and there's a lot of tools in place that JSON does not yet have, are not commonplace or ubiquitous.
XML has XSchema, RelaxNG, DTD. JSON does have an equivalent but it's not as common place.
XML has namespacing, which is great for mixing different document types. JSON does have some ideas on how to do namespacing (such as JSON-LD) but doing this correctly tends to take why people tend to enjoy JSON over XML for.
Namespacing in XML is everywhere, which gives you a very standard framework to re-use existing XML schemas for integration.
So I don't want to say, "you should do XML" or "you should do JSON", but I would rather say that if you need to integrate with existing XML systems, or you needs would strongly benefit from features such as namespacing, schemas, linking, re-use of existing XML documents, XSLT, etc... XML might be a better choice.
I have the documentation for the aircraft i`m flying in my airline as XML files with associated DTD files. Our library person use a special program from the manufacturer to convert these xml files to pdf. but the generated pdf files are not user friendly. So I suggested that we maybe can convert these XML files to XHTML and generate a simple documentation website for the pilots with easier navigation for the books.
I tried to figure out the schematics of the DTD and XML files but it seems too complicated.
Any suggestions on how to do convert these files to HTML?
I searched through google about this issue but most search results didn`t give any help.
Thanks in advance :)
The DTD defines the tags in the XML. Without knowing what type of XML the file is, converting it to HTML will be hard if not impossible. XML can be basic and common like XHTML or Open XML but is often custom made. In XML you can make your own tags and that makes it hard to convert without tag data.
Typically, the easiest way to convert XML to some other Markup is by using an XSLT transform. If you can't find one you could write your own.
If you're looking at a complex DTD you probably have complex XML. A transform may not be easy in that case but is probably your best option.