How Eclipse download and store XSD external files? - eclipse

When I open XSD file in Eclipse( in XSD Editor), it download all xsd:import's are contained in file. But if I don't have internet, editor cannot download, it's obvious. In preferences(Window -> Preferences) is XML-> XML Catalog. Is possible add my xsd:import (xsd files) to catalog and Eclipse will use it in offline mode?

Yes you can add your xsd/dtd file to the catalog.
I did it like this (for test) and eclipse does not complain:
Entry element: URI
Location: C:\Users\me\Desktop\log4j.dtd
URI: file:///C:/Users/me/Desktop/log4j.dtd
Key type: URI
Key: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd
I used the native URL in my log4j.xml afterwards
<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
I suppose this should also work with xsd files.
This comes from another answer from me.

Related

Bring back the original project from a WSDL file or a WAR file

We have lost our java code that implement a web service. Now we have only a wsdl file (and a WAR file) published in tomcat. We need to bring back the original java project so I have tried to generate java source code from WSDL file (and WAR file) and I succeeded -by using axis2 (WSDL2JAVA) plugin- but I think it generates only the java classes that should exist in the src package of the project.. no welcome pages or index.xml etc.. I Don't know what other things are missing and how to bring them back.
My question is: what to do after generating java classes from WSDL file? should I complete the other project parts in my own? Is there a way to bring back exactly the original project from WSDL or WAR file?
As per the Scenario you mentioned for WAR file you can use JAD tool to unpack the whole code but with certain limitations like you cannot edit or save the code and I am not sure about the copy feature because it was not working for previous version.
Here is the link below.
https://varaneckas.com/jad/

Eclipse plugin to automatically generate a template TLD file

Is there and Eclipse plugin to automatically generate a template TLD file (.tld) when writing custom tags?
Thanks to nitind answer :
Eclipse:
You can create one using the New XML File wizard; the DTD and schema files for tag libraries should be in the built-in catalog.
If you're building .tag files, you won't need one.

.ttf files are not served to CSS from JSP

I created a Dynamic Web Project in Eclipse and wanted to use some font faces in the JSP files. I added a .css file to the project in Eclipse and put the following code in the file:
#font-face{
font-family: "Font Name";
src: url("FontName.ttf") format("truetype");
}
I put the FontName.ttf file manually (NOT by adding it using Eclipse) in the WebContent folder. .css file also lies in the same folder.
Problem:
I am using Tomcat server and whenever the browser requests this file, server responds with 404 Resource Not Found . Why does this occur?
Checks done:
The web.xml in of Tomcat contains appropriate mime types to handle the .ttf files. Specifically, these lines are present in this file:
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
I also put the FontName.ttf file in the main project directory. That was also not working.
I had thought that the problem was caused because of not adding the .ttf through Eclipse? If this is indeed the case, how can I add this file to the project using Eclipse? I could not find an appropriate way.

How to add a DTD to XML Catalog in Eclipse?

I try to add a DTD created by myself to the XML Catalog in Eclipse.
Which values do I have to enter into the fields?
Where do I have to locate the DTD in best case?
I have multiple Java projects in my Eclipse IDE. So what would be the best practice to make the DTD accessible for all projects?
I tried to use Window-->Preferences-->XML-->XML Catalog-->Add to get a catalog entry under User Specified Entries.
Currently it looks like this:
Entry element: System
Location: cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
URI: platform:/resource/cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
Key type: System ID
Key: dataset file:////services/utils/test-db/src/main/resources/cc_dataset.dtd
Referencing the DTD in the XML file, Eclipse complains:
No grammar constraints (DTD or XML Schema) referenced in the document.
and
The file cannot be validated as the XML definition "C:\develop\Projects\...\ws\services\utils\test-db\src\main\resources\globaltestdata\cc\cc_dataset.dtd (The system can't find the specified file)" that is specified as describing the syntax of the file cannot be located.
(I have partially translated from German into English.)
How do I have to make the XML Catalog entry that the DTD can be referenced (in best case over all projects in Eclipse IDE) to validate the XML file when using
<!DOCTYPE dataset SYSTEM "cc_dataset.dtd">
in it.
Where should be to DTD located (in the filesystem) to make it best accessible?
I changed my XMLC atalog entry:
Entry element: System
Location: cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
URI: platform:/resource/cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
Key type: System ID
Key: ccdataset
The reference in the XML file:
<!DOCTYPE dataset SYSTEM "ccdataset">
Eclipse's reaction:
The file cannot be validated as the XML definition "C:\develop\Projects\EOBR\ws\services\utils\test-db\src\main\resources\globaltestdata\cc\ccdataset (Das System kann die angegebene Datei nicht finden)" that is specified as
describing the syntax of the file cannot be located.
cc_dataset.dtd is located at C:\develop\Projects\EOBR\ws\services\utils\test-db\src\main\resources\ i don't know why Eclipse extends this to the path of the XML file with the declaration.

How do you change a NetBeans project type after it has been created?

I created a project from existing sources as a PHP project in an older version of NetBeans.
I now want to change the project type to an HTML5/CSS project in NetBeans 7.4.
Is there any easy way to change the type of an existing project in NetBeans?
I'm trying to avoid creating a new project from existing sources as I have all my server connection variables already configured.
The project data is stored within the main project directory in a subdirectory named nbproject.
The file project.xml contains the main configuration data for the TYPE of the project. The type and data xml namexspace settings determine the basic project type. Here is a PHP version:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>codex-slp</name>
</data>
</configuration>
</project>
Here is an HTML5 project version:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>csa</name>
</data>
</configuration>
</project>
Note the line is different. The HTML 5 project uses the namespace org.netbeans.modules.web.clientproject. The PHP version is at org.netbeans.modules.php.project.
Also of note is the data xmlns entry with HTML5 pointing to the clientside-project directory while PHP points to the php-project directory.
How to change the project? Not easily. Your best bet:
Close out the NetBeans IDE.
Go to the project directory.
Remove (or rename) the nbproject subdirectory.
Open NetBeans.
Create a new HTML5 project from existing sources.
That will switch the project type from PHP to HTML5 and give you the corresponding dialogue boxes.
The reason I decided to take this approach is there are a lot of other things that hang off this namespace specification. The project.properties file, for example, has very different entries for a PHP project, thinks like the PHP version, that do not exist for the HTML5 project. The HTML5 project has new properties that are not present in PHP projects.
There is also an entire private subdirectory that has a plethora of options set in the private.properties file that contains things like the source remote connection for a PHP project that does not exist nor seem to even be SUPPORTED for an HTML5 project.
There are far too many disparities between the two project types to simply hack up the nbproject directory files and hope it works.
IMO your best option is to follow the steps above to recreate the project.
Sadly, it does not appear as though HTML5 project types have matured to the point of the PHP project types with things like supporting remote pull/push of changed files. For this particular project I've reverted back to the PHP project type even though this is not really a PHP project. I heavily rely upon the automatic remote server push via FTP. How did I restore the project? I renamed my nbproject directory to saved_nbproject, so to revert:
Close Netbeans.
Go to project directory.
Rename my saved_nbproject directory back to nbproject.
Restart NetBeans.
Maybe changing project types AND HTML5 remote server support will be available in the future. For now, with NetBeans 7.4 it does not appear this transition is readily available.
If anyone else has input or other feedback I'd love to hear it as NetBeans has become my go-to tool for complex code projects.
NOTE: I would strongly suggest to create a new project from existing sources to ensure everything will work as expected. In most cases its faster and less problematic.
(If you persist....)
Following the accepted answer may result in an error. Besides what Charleston Software Associates posted, you may need to copy other variables included in "project.properties" file.
For example, these are for PHP: (adjust properly. I suggest to see some of your other projects to prevent mistakes).
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_create_2e_tests=false
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_all=false
ignore.path=
include.path=
php.version=PHP_53
source.encoding=UTF-8
src.dir=/var/www/example
tags.asp=false
tags.short=false
web.root=.
These are for HTML5:
auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=--style compressed
auxiliary.org-netbeans-modules-css-prep.sass_2e_configured=true
auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=true
auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true
auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js
config.folder=${file.reference.example-config}
file.reference.example-config=config
file.reference.example-test=test
file.reference.www-example=/var/www/example
files.encoding=UTF-8
site.root.folder=${file.reference.www-example}
test.folder=${file.reference.example-test}
You can mix both in a single file without any problem.
Using: Netbeans 8.0.1
Try to edit your project.xml replace type with
<type>org.netbeans.modules.web.clientproject</type>
Guys this has changed for version 7.4?
in private.properties
remote.connection=remotename
remote.directory=/public_html/
remote.upload=ON_SAVE
run.as=REMOTE
url=http://remotename.com
I tried changing xml and that didn't work well for me. I fiddled around and found a way that seems simpler to me - just delete and create a new project!
Right click the project in netbeans, and click delete. (make sure to NOT check the box that says delete sources!). That clears out the netbeans project info. Then just make a new project of whatever type you want. Go to File->New Project. Select project type (in this case HTML5 Project with existing sources), making sure to select the one that has "with existing sources". Hit next. Now here is a key part. The site root is your mysite/public_html folder most likely. The project directory is your mysite folder. The netbeans config will be put in the mysite folder.
Then you should be good to go!
Close Netbeans.
Delete nbproject folder inside your app folder. It can be hidden folder , so , in windows, go to folder properties and activate hidden folder.
Reopen Net Beans. Create a new project of the correct type.