How to solve validation error on xsi:noNamespaceSchemaLocation in jdoconfig.xml - eclipse

Since I updated today to GAE 1.7.2.1, I'm having validation errors in eclipse in all my jdoconfig.xml files.
I have the default jdoconfig.xml content :
[...]
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
[...]
And eclipse validation throws:
Referenced file contains errors (http://java.sun.com/xml/ns/jdo/jdoconfig).
For more information, right click on the message in the Problems View and
select "Show Details..."
When clicking on details I can see a bunch of lines like:
s4s-elt-character: Non-whitespace characters are not allowed in schema elements
other than 'xs:appinfo' and 'xs:documentation'. Saw 'var_U = "undefined";'.
In different lines and different content in "Saw ... "
It occurs in every single project I start using the "New Web Application Project..." from the google plugin.
So does anyone have this problem? Any fix?

Try this:
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">
Per the answer here Validating jdoconfig with incorrect url
The xmlns is not a real file/directory, more a namespace, so ought not exist! The version is appended to get the real XSD file, namely http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd

There are a couple problems here.
The syntactic problem is that the URI you are giving as the value of xsi:noNamespaceSchemaLocation is redirected to http://www.oracle.com/technetwork/java/index.html and returns an HTML document. The XSD validator you are using is trying without success to parse
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />
<script type="text/javascript">
var _U = "undefined";
var g_HttpRelativeWebRoot = "/ocom/";
var SSContributor = false;
...
as an XSD schema document, and for one reason or another its attempts to explain what went wrong focus on finding the string var_U = "undefined" in a place where it was not expecting to see character data.
Then there are some conceptual problems.
Your document is in a namespace named http://java.sun.com/xml/ns/jdo/jdoconfig. Why on earth are you pointing the schema validator to a schema without a target namespace (which is that noNamespaceSchemaLocation does), if you want to validate your document? Given that (at least some of) your document's elements are namespace-qualified, you will want (as joncalhoun has already suggested) to use xsi:schemaLocation and provide a pair telling the validator where it can find a schema document for each namespace you want it to know about.
It's possible that a schema document used to be served from the location http://java.sun.com/xml/ns/jdo/jdoconfig, but since it's apparently the standard namespace named for your vocabulary, that's not actually very likely. Most systems distinguish fairly reliably between namespaces, which are abstract and poorly defined things, and schema documents, which are typically XML documents that define specific XSD schema components for a given namespace. It's not illegal to use the URI for a schema document as the name of a namespace, but it is unusual.
Note that the URL given by joncalhoun for the schema document (http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd) actually does resolve (after redirection to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jdo/jdoconfig_3_0.xsd) to a schema document, which specifies http://java.sun.com/xml/ns/jdo/jdoconfig as its target namespace. (This means that even if you did succeed in retrieving this schema document by giving its URI as the value of xsi:noNamespaceSchemaLocation, you'd then get an error because it's not a schema document for elements and attributes with no namespace.)
This makes me think that you should read joncalhoun's answer again and try it again, carefully. If it didn't work when you tried it, my money says that either you tried something similar but not exactly what he suggested, or it solved this problem but that simply exposed some other problem, which is easy to mistake for failure.

One solution is setting XML Catalog in Eclipse preferences.
Details:
Entry element: URI
Location: http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd
URI: http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd
Key type: Namespace name
Key: http://java.sun.com/xml/ns/jdo/jdoconfig

The syntactic and conceptual issues C.M. mentions are a problem with the plugin and Google's settings where both recommend,
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig
I don't specifically use jdo but I still get the validation error with this namespace. It was fine with this namespace until just recently.
I used LuboM's method and it worked for me. Neither LuboM's nor joncalhoun's is the answer though since it ties me in to jdo 3.0
Oracle is going to have to provide the fix. Apparently their intent was to resolve the namespace issues themselves across versions of jdo.

This is what I did to fix it:
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">

I am success on this:
Right Click Project -> Properties -> Validation -> XML Syntax
Enable Project Specific Settings (If you need)
Under Validating Files, For No grammar Specified Select "Warning"
Click "Ok"
If you ask for Validating the file, Click "Yes"
You can do the same for all the projects by going to Windows -> Preferences.
Make sure you are validating the file (Step 4).

I had the same issue, and excluded just this jdoconfig.xml file from Eclipse's validation. Even though your Eclipse throws an error for it, it in no way affects being able to deploy the project to GAE correctly.
Here is how to exclude just the jdoconfig.xml file to get rid of that pesky error:
Right click on your Eclipse Project, ->Properties->Validation->XML Validator, click on the "..." button for further options.
You should see Include Group and Exclude Group options. Click Exclude Group->Add Rule...->Folder or file name, and browse to your file.
Clean or rebuild your project. The validation error should be gone.
This worked for me in Eclipse Luna.

You might have try this path to solve your problem:
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">

Related

VS Code Regex search to remove references based on containing text in string

I am attempting to remove all references of a managed package that is going to be uninstalled that spans throughout code base in VS Code
I have using a query to find the field permissions but am wondering if there is a way to search for the reference outside of specifying the exact field name compared to the field containing only "agf" since they are all using it.
Below is the search query:
<fieldPermissions>
<editable>false</editable>
<field>User.agf_Certified_Product_Owner__c</field>
<readable>false</readable>
</fieldPermissions>
In the field, I want to be able to find and delete the 5 associated lines from multiple files if they match "agf" in any combination. Something like the below:
<fieldPermissions>
<editable>false</editable>
<field>agf</field>
<readable>false</readable>
</fieldPermissions>
With any combination of agf in the field, delete all from any file it appears in.
Not an answer but too long for a comment
You don't have to? Profiles/perm sets don't block package's delete. Probably neither do reports.
You'd use your time better by searching for all instances of agf__ (that's with double underscore), should find fields, objects... used in classes, flows, page layouts etc. And search for agf. (with dot) should find all instances where your Apex code calls their classes marked as global.
Alternatively Apex / VF pages with dependencies on package will have it listed in their "meta.xml", for example
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>54.0</apiVersion>
<packageVersions>
<majorNumber>236</majorNumber>
<minorNumber>1</minorNumber>
<namespace>SBQQ</namespace>
</packageVersions>
<status>Active</status>
</ApexClass>
Last but not least - why not just spawn a dev sandbox and attempt the delete there? If it succeeds - great. If not - it'll list the dependencies that blocked the delete. It'll be "the real thing", it'll smite you even if your VSCode project doesn't contain all flows, layouts and thus could lull you into false sense of security. I'd seriously do it in sandbox and then run all tests for good measure, just in case there are some dynamic soql queries that don't count as hard, delete-blocking references.
After delete's done - fetch Profiles / Permsets from this org and the field references will be gone from the xml.

GSettings, glib-compile-schemas and Eclipse

I am building this Gtkmm3 application in Ubuntu and wanted to explore GSettings. All was going well while following the instructions at the 'Using GSettings' page and then it was time to configure the make files. I use Eclipse 2019-12 IDE with CDT (V9.10) and 'GNU Make Builder' as the builder. I'm totally perplexed as to how to introduce the macros listed in the GNOME page into the make files. I even tried changing the project to a 'C/C++ Autotools Project' using Eclipse but still the necessary make files to add the macros were missing. Creating a new project with GNU Autotools does create the necessary make files but I was not able to get pkg-config to work with it.
Can anyone point me to some resource which explains how to compile the schema and how & where to load the resultant binary file (externally if necessary). I'll consider myself blessed if someone has already made a Gtkmm3 C++ application with GSettings support using Eclipse IDE in Linux and can share the details.
Finally I figured. Thought I'll share my findings here. Actually some one out there had explained this for python (link below).
Using GSettings with Python/PyGObject
Creating the schema
For the developer the work starts with defining a schema for the settings. A schema is an XML file that looks something like this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE schemalist SYSTEM "gio_gschema.dtd" >
<schemalist>
<schema id="org.gtk.skanray.emlibrary"
path="/org/skanray/emlibrary/" gettext-domain="emlibrary">
<key name="wave-pressure-ptrach-visible" type="b">
<default>true</default>
<summary>Set visibility of 'Ptrach' trace in pressure waveform.</summary>
<description>The pressure waveform shows multiple traces where 'PAW' is always enabled and additionally 'Ptrach' can be displayed. This settings affects the visibility of the trachial pressure trace shown in this waveform channel.</description></key>
</schema>
</schemalist>
The file name has to have a ‘.gschema.xml’ suffix. The schema file should be in the project path, only so that it gets pushed to SVN.
Best would be to use an XML editor (e.g. Eclipse) that supports design of XML files from a DTD file. Use following DTD file.
gschema.dtd
It is possible to store anything derived from GVariant into GSettings. Refer to following page to understand the basic types and the ‘type’ attribute to be used in the schema.
GVariant Format Strings
Compiling the schema
With the schema ready, (sudo) copy it into /usr/share/glib-2.0/schemas/ then run,
> sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
At this point, the newly added settings can be seen / modified using dconf editor.
Accessing GSettings from the application
Coming to the main event of the show, this is how an application can read ( and / or write) settings. It is not necessary that one needs to bind property of an object to a ‘key’ in GSettings, it may be queried and used as well. Refer to GSettings API reference for details.
Glib::RefPtr <Gio::Settings> refSettings = Gio::Settings::create(“org.gtk.skanray.emlibrary”);
CLineTrace * pTrace = NULL; // CLineTrace is derived from Gtk::Widget
…
pTrace = …
…
if(refSettings)
{
refSettings->bind("wave-pressure-ptrach-visible",
pTrace,
"visible",
Gio::SETTINGS_BIND_DEFAULT);
}
Now you can fire up dconf editor and test the settings.
NOTE
Bindings are usually preferred to be made in class constructors. However binding to ‘visible’ property of a widget could be a bit tricky. Typically the top level window does a show_all() as the last line in its constructor. However constructors of the children of top level window would have completed executing including making the bindings. If there were settings that had stored ‘visibility’ as false then the top level window’s call to show_all() would mess up with that setting. In such cases it is advised to perform the bind one time in the on_map() handler of the respective class.

Error after login in M2 Backend in dev mode only

Anybody experience with this error? I see nothing in the logs that helps me.
Exception #0 (LogicException): Could not create an acl object: Invalid
Document Element 'resource': The attribute 'title' is required but
missing. Line: 5
0 /generated/code/Magento/Framework/Acl/Builder/Proxy.php(95): Magento\Framework\Acl\Builder->getAcl()
I have also experienced this issue some time ago. Actually, the problem is one of your custom or third party module contains <resource> tag in acl.xml in etc folder file and the title attribute is missing over there, which is the cause of this exception. Therefore, I would suggest you to check acl.xml files and if title attribute is missing in any of your module then add a title to <resource> tag something like this:
File etc/acl.xml in one of your module:
<resource id="Custom_Module::config" title="Module Title" />
You can also check this Magento 2.2.0 Invalid Document Element 'resource': The attribute 'title' is required but missing from where I found the solution to my problem.
I had the same issue because I had disabled all MSI modules.
Try to enable them and check if this fixed your issue.
In Addition to verifying the title against the most inner resource tag, also verify that you have not added extra id="Custome_Module::config" in any of your acl.xml or some spelling mistake etc.

How do I get Eclipse to ignore errors in WSDL file?

EDIT: To be clear, I want to get rid of the big red X on my project, not just filter the errors from the "Problems" list.
I get a bunch of these errors. How do I make Eclipse ignore them? I donøt have the option of fixing the actual problem :(
src-resolve.4.2: Error resolving component 'ser:char'. It was detected that 'ser:char' is in namespace 'http://schemas.microsoft.com/2003/10/Serialization/', but components from this namespace are not referenceable from schema document 'file:///Users/itunesuser/git/online-service-wizard/suppression-extension/src/main/resources/com/satorisoftware/ws/infuse/multiservice/multiservice.wsdl'. If this is the incorrect namespace, perhaps the prefix of 'ser:char' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///Users/itunesuser/git/online-service-wizard/suppression-extension/src/main/resources/com/satorisoftware/ws/infuse/multiservice/multiservice.wsdl'. multiservice.wsdl /Scrubbr-suppression-extension/src/main/resources/com/satorisoftware/ws/infuse/multiservice line 623 WSDL Problem
Go to window > preferences search for validations(it is not under any menu) > scroll down for wsdl and uncheck the wsdl in the list see the screenshot like below.
Go to Properties, find Validation, switch off WSDL validation entirely.
Not ideal, but better than nothing.

GWT i18n - Plural Forms doesn't work at all?

I'm using GWT internationalization Messages. The documentation for Plural Forms says this should work:
#DefaultMessage("{0} {1,number} hours {2}")
#PluralText({"one", "an hour"})
String hours(String prefix, #PluralCount int count, String suffix);
Well, it doesn't. Whatever value of count it still delivers DefaultMessage (e.g. "1 hours ago"). Same if I use a .properties file:
hours[one]=an hour
hours[few]=some hours
hours={0} {1,number} hours {2}
Is there a bug in the docs or in GWT (I'm using GWT 2.0.3) or in me? If any of the two former, anyone knows of a workaround?
EDIT: More clues to this mystery. I can get plural handling to work if I don't rely on default locale handling. That is, I need:
In my module's gwt.xml file:
<extend-property name="locale" values="en"/>
In my Messages extentsion:
#DefaultLocale("en")
public interface MyMessages extends Messages { ...
Explicitly load the "en" locale by appending to the URL
&locale=en
See http://groups.google.com/group/google-web-toolkit/browse_thread/thread/80ae300213cc6adb where I have cross posted this question.
EDIT 2: The reason I entered this GWT plurals land is that I'm creating a "GWT HUman Readable Relative Timestamps" module. Open sourced at GitHub: http://github.com/PEZ/GWT-Relative-Time Please check it out. It'll very soon have correct singular forms and support for some languages. =)
Also I think it will save people time to know that the default English plural rule only supports "other" and "one".
DefaultRule_en.java uses DefaultRule_1_0n.java
So you have to redefine DefaultRule_en.java if you want to use "none","two",few"...
You can see the available rules in the package com.google.gwt.i18n.client.impl.plurals.
Getting used to answering my own questions =) Here's cross post of my "answer" on the GWT Google group:
There seems to be a bug with the default locale handling. Here's how I have reached that conclusion:
I wanted to add some locales to my module. Figured I could get a boiler plate for the properties file if I used the #Generate annotation. I noticed that it created both an _en.properties file and a _default.properties. What's more; the _en file completely lacked the plural form info! The _default file had them though.
I then moved the _defaults file to the same directory as my TimeMessages.java file and renamed it TimeMessages_default.properties.
With this in place I can remove <extend-property name="locale" values="en"/> from my module's .gwt.xml file and, more important, the &locale=en from the URL when running my app. I still need the #DefaultLocale("en") annotation though, even though the documentation clearly states that this is not necessary.
In conclusion, if you run into this problem, try:
generating properties files using #Generate
place YourMessages_default.properties side by side with YourMessages.java
prepend the YourMessages interface with a #DefaultLocale("en") annotation.
About that #Generate. This is what worked for me. Just before my extension of the Message interface:
#Generate(format = {"com.google.gwt.i18n.rebind.format.PropertiesFormat"})
The GWT log said it created my properties file, but I couldn't find it. I fixed that by adding the compiler flag -extra extras and then found the properties files generated in the extras directory. Including this info here since I spent more than an hour figuring it out.
Another solution from the gwt issue list here:
You have to define the #DefaultLocale in the MyMessages.java:
#DefaultLocale("en")
public interface MyMessages extends Messages {
public String items(#PluralCount #Optional int count);
}
and in MyMessages.properties:
items={0} items
items[one]=one item
One more thing I found is that you can define a fallback locale like this:
<set-property-fallback name="locale" value="en"/> in your module XML file