I have a bit of a trouble understanding GWT's architecture. I can see two packages: com.google.gwt.dom.client and com.google.gwt.xml.client. As far as I understand, the first gives a wrapper for the HTML DOM and the second is for own DOM Documents. Is this correct?
What I need is an own Document (i.e. not the HTML Document) with Mutation Events. What would I use in this case? Is this possible in GWT or do I have to write my own DOM implementation, based on com.google.gwt.xml.client?
com.google.gwt.dom.client Javadoc :
Classes for low-level DOM programming. This package contains classes that expose the W3C standard HTML document object model for programmatic access and manipulation of HTML pages directly in client-side Java source, accounting for most browser variations. These classes provide an efficient, type-safe, and IDE-friendly alternative to writing JavaScript Native Interface (JSNI) methods for many common tasks
com.google.gwt.xml.client Javadoc :
Basic classes used in XML DOM parsing and XML document generation.
The classes in this package support parsing XML documents and creating new XML documents. The implementation uses the underlying browser.
Briefly, dom.client package is html parser (manipulation of HTML pages) and xml.client is for parsing XML documents. In your situation you can use gwt xml parser and here is good example for it xml parser in gwt
Related
There is a ESTree spec describing JavaScript AST format, which is used in several libraries for JS code transformations (refactoring, transpiling, minification, etc).
Are there any tools/libraries with API focused on generating the ESTree AST from scratch (not from existing JS code) and manipulate it? Preferably in TypeScript to get the advantage of static typing of ESTree nodes.
I have an XML format specified with XSD and I want to generate the corresponding Java (or Kotlin) sources including (de)serialization. I know JAXB, but as far as I understand, it heavily relies on reflection. This is no option for me, because I want the generated sources to be ready for transpilation to JavaScript (by GWT or Kotlin/JavaScript for example). Because of this, these are the requirements:
Using an XSD schema, generate the corresponding Java or Kotlin source code
Do not use reflection, but plain old Java classes which include serialize/deserialize methods
Inject an XML IO interface (like StaX) with the required methods (which I can instatiate depending on the target: JVM, JavaScript, Android, ...)
Do you know a tool for this task or do I have to create my own solution?
Is there any template engine which I could use to convert a JSON-LD response into HTML using javascript in the browser (or with nodejs)?
I know of SPARQL Web Pages and SPARQL Template Transformation Language. They appear to be monumental standards, which will never be implemented on any language. (At least I did not find any implementation of them.)
The closest I have found is Jassa, which is surely not production ready, or even close to it (33% coverage).
Anything else worth mentioning?
Using the Ruby JSON-LD and rdf-rdfa gems you can turn JSON-LD into RDF and serials to HTML, which uses a customizable Haml template. This is used in rdf.greggkellogg.net and linter.structured-data.org.
The other strategy is to just use it as JSON and use a regular templating engine. The earl gem does this, for example.
I'm building an app for iPhone which will hopefully use the new JavaScriptCore framework added to iOS 7. I am using javascript as I need to add a javascript library citeproc-js to my project. I can get this library up and running by loading it in a UIWebView but I need to use it from a background thread so am trying to load it in a JSContext instead.
The problem I'm having is the library relies on using the DOMParser of webkit but the parser never loads when the framework is loaded into a JSContext.
Should it be possible to access a DOMParser from a JSContext? If not is there an alternative?
Thanks!
The JavaScript API provided by JSContext is actually the core API of the language - it even lacks stuff like console.log and setTimeout, because those are provided by browsers. Because DOMParser is another API defined outside of JavaScriptCore it shouldn't be accessible in JSContext.
What you can do is expose a native XML parser like TBXML to the JSContext via the JSExport mechanism and consume that instead.
In case it simplifies things for readers hitting this question, the citeproc-js implementation of CSL now contains a string-based XML parser written in pure JavaScript. No exceptional setup is required beyond the essentials: if the processor is fed a valid XML string, it will work with it.
(Posting as the author and maintainer of citeproc-js)
I'm creating an xml schema for a document that will eventually be translated into javascript. It would be really useful to allow the insertion of custom js scripts right within the document. This isn't hard to accomplish (a node can just contain text, that will be the javascript), but what is difficult is to get Visual Studio to give JS Intellisenseinside the tag instead of xml Intellisense.
If found this article that describes htmlequivalent annotation that says you can tell the xml editor to treat a tag as the equivalent HTML tag (in this case the script tag, and this is even the example given). But my attempts at using it have failed. Does anybody have any ideas on how to use this? There is very little documentation on msdn about this annotation and about the same on google/bing.
The MSDN article regarding the annotation: http://msdn.microsoft.com/en-us/library/aa713989(v=VS.71).aspx
Unfortunately there's no documentation available for newer XML Schema annotations - the one on MSDN is for VS2003. Your best bet is to check out the already available XML Schemas in the folder:
[VSInstallFolder]\Common7\Packages\schemas\html\
The HTML5 one should give you a good overview of the available features. There are even more features in XML Schemas in WebMatrix 3 beta, like supplemental Schemas, but they are still not available in VS.
However I'm not sure that the functionality you're trying to achieve is possible.