I would like to find the best way to parse an UML Diagram that detail the security tomcat configuration for a web application, then generate the concerned file (web.xml).
For the beginning, I have a Metamodel and his instance created with Magic Draw, I have to export them and use them in a kind of java application (plugin? API?) then parse and validate them against some constraint (OCL?) finally I have to generate the Web.xml file.
So, I made some research and I found that I can use EMF to catch my models, but its not so clear and handily to create a peace of java code that can handle my model remotely from an URI then validate em.
Do you have any suggestions/advises to made this please? Do I must use EMF? or there is another framework?
Thanks
web.xml from UML? Sorry, I don't think it's a useful idea. It doesn't take long to hand edit such a thing. The effort it would take to automate such a thing wouldn't be worth it. I'd open up a text editor, create the web.xml, and spend the time you save doing more useful things.
But, if you must, I'd find a way to export your object model into an XML document. I'd parse that into a DOM tree, walk the tree, and emit the elements I needed into a web.xml.
I know that Magic Draw has the capability to export UML as XML. See if that helps you.
But there's no way to do it directly from the Magic Draw tool that I know of. You'll have to write this Java post-process and run it on the command line using the exported model XML as input.
Related
I am now familiar with "basic" Typo3 - Usage and templating. Right now, I am stuck though, because I am not familiar with custom extensions etc.
I am looking for a way to represent Objects, that I get via methods of my own php-class from an XML-DB-Interface, in Typo3.
To be more precise :
I have a really complex XML-Interface and a php-class which is complete already, to interact with that interface, making methods available, that are meant to interact with different object-types in the underlying DB.
I now want to create abstract objects with the corresponding attributes in Typo3 to be able to work with them in typo3 (display/create/modify).
Furthermore, it would be helpful to find a way to "link" the functions of my php class to typo3-functions, so I can (perhaps?!) build up some kind of simple report-generator that generates conditional reports of those objects.
Could anybody lead me into the right direction and link (a) HowTo(s) or perhaps even examples that I could modify?
Thanks in advance, Oliver
Check how DBAL extension is coded.
https://docs.typo3.org/typo3cms/extensions/dbal/
You might want to implement this XML system as your own abstraction system to store your objects and use TYPO3 backend forms to manipulate those.
I would like to generate a graphical documentation of some XSD files (XML schema definition).
I know, there are a few projects that do a good job generating a textual documentation. But I use XmlSpy and I really love the tree that I get when I click on "print".
I would like to generate this automatically on a continuous integration server.
The question is: how can I get this scripted? I found a forum post that sais "it's possible", but I don't have a clue where to start.
EDIT: the focus here is doing it from the command line rather than having a graphical editor.
Some ideas:
You may like Xsdvi, which converts an input XSD into an SVG diagram like this one (which I think is a logical choice: it's an XML to XML conversion). It is simple to use and its output can be rendered to any scale, it is SVG after all.
This tool was mentioned in this off-topic and deleted post (requires 20k+ rep to view). And there's XSDiagram, check it out.
Apparently, JDeveloper can be used for this, as this post shows, which is free for registered users.
I have not tried any of these, I'm happy with what oXygen provides. Try them out. Be aware that asking for tools is typically off-topic on StackOverflow, though continuous-integration is not (hence I decided to answer anyway).
You can also use the stylesheets from the XS3P project. You can apply them using a standard XSLT transformation engine (Saxon...).
Thanks to #Abel for pointing me to XSD Diagram. Since version 1.0 this program can also write the annotations into the generated image.
I am using it in the following way now:
XSDDiagramConsole.exe -o picture.png -r rootnode -d -y -e 10 schema.xsd
Is there a quick way to find out all the mandatory field in a xsd file?
I need to quickly see all the mandatory fields in the schema
thanks
Not sure if you're looking to do this through code. If not, Altova XMLSpy, for example, provides an option to "Generate Sample XML File" - with options to generate only mandatory fields.
Otherwise, if you're working with Java, for example, you can use something like the Eclipse XSD project for programmatic access to the XSD. (It even works without Eclipse.) Some additional details at Are there any other frameworks that parse XSD other than XSOM? .
Take a look at this post; instead of exporting all fields, there's also an option to get only the mandatory ones... One significant difference compared with the answer you accepted is in that you can also generate an Excel or CSV file, in addition to the XML file; not to mention that the sample XML approach is deficient by definition... I would pay attention to the way mandatory choices, abstract typed elements or abstract elements with substitution groups play in your case.
I would like to read excel file in java. For that no classes are provided by java standard library. I have downloaded required classes but I am not able to import them.
One solution is jsp:usebean but they are near about 300-400 classes so I can't use usebean.
Please suggest another solution.
Do not write Java code in JSP files. There it is not for. Use a real Java class. In this case a Servlet class is the right choice. You can make use of the doGet() method to preprocess requests before displaying results in a JSP file. As it's not entirely clear what you would like to do with the Excel file after all, I can't give a more detailed code example.
To learn more about JSP/Servlets, I can recommend the tutorials at Coreservlets.com.
Good luck.
as part of our application i need to build component that will output code in php and asp
that have the same functionality ( and maybe latter jsp ) .
how can i design this kind of component to be generic as possible ?
You need to be able to create a parse tree out of all input languages.
For each output language, you will need to create a set of tree transforming grammar.
You may also require a runtime library to help translate routines that are not available in your output language.
I would personally go with the Strategy Pattern. You could have a master code maker class and instantiate it with a strategy.
PHPCodeStrategy
ASPCodeStrategy
Then each would have a method called execute maybe. Bu then you could add further strategies down the line and extend your application.
Andrew