c++ dom parsing problem - xml-parsing

hi every body
i'm new to xercses C++dom parser.can anyone tell me
can we write our own getElementsBytagName,GetNodeValue etc function ?
how to write these function and use them in my code ?
can anybody explain me the process of Dom parsing?

xerces provides methods like getElementsBytagName so you can use them in your application.
Have a look at xerces programming guide you can find there how to parse xml file and how to get elements and attributes.

Related

how to parse kotlin code?

I need to analyse kotlin files code, to detect the keyword "data" and "?".
The issue is I don't find any libs like JavaParser.
I don't need powerfull tools, just something who return me the number of the lines.
Any idea?
I use antlr4 to do it. And I create an open source lib:
https://github.com/sarahBuisson/kotlin-parser
<dependency
<groupId>com.github.sarahbuisson</groupId>
<artifactId>kotlin-parser</artifactId>
</dependency>
Besides the tools mentioned in other answers, here is another one someone may find useful:
https://github.com/kotlinx/ast
You would need to either find a Kotlin parser, or write your own.
For this subset of parsing you may be able to cheat, as data is a keyword, so if you see data with non letters each side you know it is the keyword.
For ?, it depends which meaning you want, the elvis one can be detected by the dot else try the nullable meaning if the ? is next to a letter.
You can try Kastree -- simple library to manipulate Kotlin source code as a set of AST objects.
https://github.com/cretz/kastree
See this [0] Kotlin code parsing related discussion. They talk about using antlr v4 grammar to parse the Kotlin code.
[0] https://discuss.kotlinlang.org/t/kotlin-parser/1728
I have not yet written a Kotlin language grammar for it.
But I have implemented a parser in Kotlin, id that is any use.
It is Kotlin common code, so should work for any target platform.
There is an article about it here, and the code is on github.
https://medium.com/#dr.david.h.akehurst/agl-your-dsl-in-the-web-c9f54595691b

avro code generation /Dynamic typing

This might be a silly question, but can anyone explain to me what is meant by dynamic typing ,code generation in context to AVRO ? . I am pretty new to AVRO and would really appreciate if someone can help me in detail to understand this.
Also , AVRO has a datatype named fixed, what would be a practical scenario to use this data type ?
Code generation refers to the code which we generate based on our file schema using avro tools. So when you say serialize/deserialize the data without code generation then it means you rae including the schema in your program and vice-versa. You can read more from https://avro.apache.org/docs/1.7.7/gettingstartedjava.html#Serializing+and+deserializing+without+code+generation

How to parse comments / documentation in Groovy code?

I'd like to parse the JavaDocs / GroovyDocs in my Groovy source code and build a JSON file with the parts that I'm interested in. Is there a clean way of doing this? I'd like to retrieve the class docs, field docs, method docs, etc. Example:
/** Please parse me. */
class Foo { /** And me too */ def prop }
One of the responses in the following thread was helpful in mentinoing GroovyDocTool / GroovyLexer / GroovyRecognizer, but I could really use a concrete example of how to add my own custom parsing: How to parse groovy code?
My current workaround is to attempt parsing the HTML that the "groovydoc" and "grails doc" commands generate. I'll probably try using NekoHTML to convert the HTML into well-formed XML, then use XmlSlurper. See: http://www.codercorp.com/blog/groovy/reading-html-using-groovys-xmlslurper.html
You may try ANTLR and create a parser. But this will be a brand new parser you may have to write

ZF2 BBCode Parser

Hiho,
I use the ckeditor on my website for special textareas like forum
or signatures.
But I have a problem with the output. I use ZF2 and would like to
use ZendMarkup to render the output bbcode back in html.
But at every time I call
$bbcode->render(...)
I got the error
There is no Zend_Markup_Root markup.
The ZendMarkup is an extension inspired by the Zend_Markup from ZF1.
But I can't find any thing on API or other guides.
Does someone has any idea what as the problem is?
The ZendMarkup library is very old (last update is 10 months ago!) so I wouldn't use such library. If you would like, I think I traced the error down.
On this line there is a reference to Zend_Markup_Root while that should be ZendMarkup\Renderer\Markup\Html\Root. Try to change that line and see what happens.
Another way is to replace the ZendMarkup library with another library which does work and is updated regularly. An example is Decoda. If you load mjohnson/decoda in your composer.json, you can use Decoda in your Zend Framework 2 application:
<?php
use Decoda\Decoda;
$parser = new Decoda($bbcode);
$html = $parser->parse();
With tools like composer, there is no need to use solely Zend* components when there are better alternatives.

How do i access v8 parse tree how can it be done?

I like to take the v8 engine and to transform its code to other programming language
based on this for example if i understand it right first step i need to get the parse tree
my question is :
can i get it already from v8 or do i need to generate it from the js code .
what is the easer way ?
It looks hard to get the AST (Annotated Syntax Tree, the Parse tree) from V8 itself but there are plenty of other parsers for JavaScript that will do what you're looking for. I'd recommend having a look at Esprima (http://esprima.org/) which is a JavaScript parser written in JavaScript. This allows you to give some JavaScript source code and get back a JavaScript object version of the AST which you can transform into another language if you want (or modify then transform back into JavaScript or use for some other reason).
They've got some great online demos that should give you a feel for what it can do: http://esprima.org/demo/index.html

Resources