I'm getting this warning in PHPStorm for a PHPUnit test but am not sure what it's talking about?
Namespace not bound
<phpunit colors="true" bootstrap="./tests/bootstrap.php">
<testsuite name="IniParserTest">
<directory>./tests/Test</directory>
</testsuite>
</phpunit>
You have to specificy the XML Schema in the opening element node, like to:
<phpunit colors="true" bootstrap="./tests/bootstrap.php" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd">
<testsuite name="IniParserTest">
<directory>./tests/Test</directory>
</testsuite>
</phpunit>
Note the xmlns:xsi and xsi:noNamespaceSchemaLocation attributes in .
Now your XML should be valid and it should no longer give you the error.
Source: https://phpunit.de/manual/3.7/en/appendixes.configuration.html
Related
In my Android Studio project I have a font file called 'cutive.xml'
The file path is: resources -> font -> cutive.xml
The file looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res/android" //Lint problem here
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="Cutive"
app:fontProviderCerts="#array/com_google_android_gms_fonts_certs">
As you can see, the app namespace is not formed correctly:
xmlns:app="http://schemas.android.com/apk/res/android"
In the MainActivity, I create a static Typeface object that references the font:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
typeface0024 = getResources().getFont(R.font.cutive); //app will crash if app namespace is corrected
else typeface0024 = Typeface.create(Typeface.SANS_SERIF,Typeface.BOLD_ITALIC);
The app loads correctly and finds the font, even though Lint claims that there is an error.
When I switch the app namespace to the correct form as such:
xmlns:app="http://schemas.android.com/apk/res-auto"
The app crashes on the line:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
typeface0024 = getResources().getFont(R.font.cutive);
the error logs gives the following reason: A RuntimeException
Caused by: android.content.res.Resources$NotFoundException: Font resource ID #0x7f090000
How can I fix the error given by Lint? Or, should I just suppress the error and even though the app namespace is not formed correctly the font and app will load correctly.
Any suggestions
I was able to fix the problem by using the 'android' namespace NOT the 'app' namespace.
According to the Android docs make sure you the have the following support library:
compile "com.android.support:support-compat:28.0.0"
Now it works and it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
android:fontProviderAuthority="com.google.android.gms.fonts"
android:fontProviderPackage="com.google.android.gms"
android:fontProviderQuery="Cutive"
android:fontProviderCerts="#array/com_google_android_gms_fonts_certs">
</font-family>
When i extracted excel generated using docx4j implementation I can see below extra namespaces:
<xdr:wsDr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:cdr="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" xmlns:c14="http://schemas.microsoft.com/office/drawing/2007/8/2/chart" xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:dsp="http://schemas.microsoft.com/office/drawing/2008/diagram" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:xvml="urn:schemas-microsoft-com:office:excel" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:pvml="urn:schemas-microsoft-com:office:powerpoint" xmlns:cppr="http://schemas.microsoft.com/office/2006/coverPageProps" xmlns:odx="http://opendope.org/xpaths" xmlns:odc="http://opendope.org/conditions" xmlns:odq="http://opendope.org/questions" xmlns:oda="http://opendope.org/answers" xmlns:odi="http://opendope.org/components" xmlns:odgm="http://opendope.org/SmartArt/DataHierarchy" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns:msink="http://schemas.microsoft.com/ink/2010/main" xmlns:cdr14="http://schemas.microsoft.com/office/drawing/2010/chartDrawing" xmlns:c15="http://schemas.microsoft.com/office/drawing/2012/chart" xmlns:cs="http://schemas.microsoft.com/office/drawing/2012/chartStyle" xmlns:ns38="http://www.w3.org/1998/Math/MathML" xmlns:ns39="http://www.w3.org/2003/InkML" xmlns:a13cmd="http://schemas.microsoft.com/office/drawing/2013/main/command" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:c16="http://schemas.microsoft.com/office/drawing/2014/chart" xmlns:dgm1611="http://schemas.microsoft.com/office/drawing/2016/11/diagram" xmlns:c173="http://schemas.microsoft.com/office/drawing/2017/03/chart" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:an18="http://schemas.microsoft.com/office/drawing/2018/animation" xmlns:anam3d="http://schemas.microsoft.com/office/drawing/2018/animation/model3d" xmlns:iact="http://schemas.microsoft.com/office/powerpoint/2014/inkAction" xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:wetp="http://schemas.microsoft.com/office/webextensions/taskpanes/2010/11" xmlns:we="http://schemas.microsoft.com/office/webextensions/webextension/2010/11" xmlns:comp="http://schemas.openxmlformats.org/drawingml/2006/compatibility" xmlns:lc="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas" xmlns:dgm14="http://schemas.microsoft.com/office/drawing/2010/diagram" xmlns:a15="http://schemas.microsoft.com/office/drawing/2012/main" xmlns:pic14="http://schemas.microsoft.com/office/drawing/2010/picture" xmlns:c16ac="http://schemas.microsoft.com/office/drawing/2014/chart/ac" xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" xmlns:a1611="http://schemas.microsoft.com/office/drawing/2016/11/main" xmlns:dgm1612="http://schemas.microsoft.com/office/drawing/2016/12/diagram" xmlns:a16svg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" xmlns:adec="http://schemas.microsoft.com/office/drawing/2017/decorative" xmlns:a18hc="http://schemas.microsoft.com/office/drawing/2018/hyperlinkcolor" xmlns:wp15="http://schemas.microsoft.com/office/word/2012/wordprocessingDrawing">
How do i remove this?
Code implementation link :
Excel size decreases on resaving using docx4j library implementation
Try using MOXy, or set property docx4j.jaxb.marshal.canonicalize=true
From https://github.com/plutext/docx4j/blob/master/docx4j-samples-resources/src/main/resources/docx4j.properties#L160
# Whether to canonicalize during marshalling (defaults to false).
# This is mainly for aesthetic purposes: the Sun/Oracle JAXB reference implementation
# writes a lot of unnecessary namespaces (each one in the JAXB context?). MOXy is better.
# Set this to true to get rid of them via an extra step: canonicalization
# since docx4j 3.3.1
docx4j.jaxb.marshal.canonicalize=false
Run an XSLT 2.0+ transformation consisting essentially of
<xsl:copy-of select="/" copy-namespaces="no"/>
I use JSF for my project and I define a converter in faces-config.xml like bellow:
<converter>
<description>myDateTimeConverter</description>
<display-name>myDateTimeConverter</display-name>
<converter-id>myDateTimeConverter</converter-id>
<converter-for-class>java.util.Date</converter-for-class>
<converter-class>controller.MyDateTimeConverter</converter-class>
</converter>
And I get an error in (in eclipse):
cvc-complex-type.2.4.a: Invalid content was found starting with element 'converter-for-class'. One of '{"http://java.sun.com/xml/ns/javaee":converter-class}' is
expected.
Either use converter-id or either use converter-class. If you use id then JSF expects converter-class after it. That's why it says 'One of '{"http://java.sun.com/xml/ns/javaee":converter-class}' is
expected.'. If you copied this from a tutorial, the tutorial contains an error ;-).
I was looking for a fast and easy way to write a very cross platform desktop application. This leads me to thinking that the JVM is the place to be. Since Groovy (Grails) is used in my workplace I thought I would try Griffon since they claim it is essentially Grails for the desktop.
I wanted a persistence management layer and it doesn't not appear that GORM is showtime ready in this environment so I moved towards hibernate using the Hibernate4 plugin for Griffon.
Not that I've really used Hibernate in general however I believe, based on the guides, that I am doing things correctly. My gatherings indicate that this doesn't support annotations to wire up classes so I am using hbm.xml files.
The provided sample for the plugin isn't complex but I don't understand where I am deviating.
Here is a sample class file as it stands:
package gwash
import groovy.beans.Bindable
class DeliveryMethodModel {
// #Bindable String propName
}
Here is some of the stack trace:
org.hibernate.InvalidMappingException: Could not parse mapping document from res
ource gwash\DeliveryMethod.hbm.xml
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Con
figuration.java:3415)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueu
e(Configuration.java:3404)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(C
onfiguration.java:3392)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:
1341)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1737)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1788)
at org.hibernate.cfg.Configuration$buildSessionFactory.call(Unknown Sour
ce)
at griffon.plugins.hibernate4.Hibernate4Connector.connect(Hibernate4Conn
ector.groovy:72)
at griffon.plugins.hibernate4.Hibernate4Connector.connect(Hibernate4Conn
ector.groovy)
at griffon.plugins.hibernate4.Hibernate4Connector$connect.call(Unknown S
ource)
at Hibernate4GriffonAddon.addonInit(Hibernate4GriffonAddon.groovy:27)
at griffon.core.GriffonAddon$addonInit.call(Unknown Source)
at griffon.core.GriffonAddon$addonInit.call(Unknown Source)
at org.codehaus.griffon.runtime.util.AddonHelper.handleAddon(AddonHelper
.groovy:155)
at org.codehaus.griffon.runtime.util.AddonHelper.handleAddonsAtStartup(A
ddonHelper.groovy:105)
at org.codehaus.griffon.runtime.core.DefaultAddonManager.doInitialize(De
faultAddonManager.java:33)
at org.codehaus.griffon.runtime.core.AbstractAddonManager.initialize(Abs
tractAddonManager.java:101)
at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.initialize
AddonManager(GriffonApplicationHelper.java:320)
at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.prepare(Gr
iffonApplicationHelper.java:123)
at org.codehaus.griffon.runtime.core.AbstractGriffonApplication.initiali
ze(AbstractGriffonApplication.java:221)
at griffon.swing.AbstractSwingGriffonApplication.bootstrap(AbstractSwing
GriffonApplication.java:74)
at griffon.swing.AbstractSwingGriffonApplication.run(AbstractSwingGriffo
nApplication.java:131)
at griffon.swing.SwingApplication.main(SwingApplication.java:36)
Caused by: org.hibernate.PropertyNotFoundException: field [id] not found on gwas
h.DeliveryMethodModel
at org.hibernate.property.DirectPropertyAccessor.getField(DirectProperty
Accessor.java:182)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectProperty
Accessor.java:189)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectProperty
Accessor.java:189)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectProperty
Accessor.java:189)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectProperty
Accessor.java:189)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectProperty
Accessor.java:174)
at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropert
yAccessor.java:197)
at org.hibernate.internal.util.ReflectHelper.getter(ReflectHelper.java:2
53)
at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(Refl
ectHelper.java:229)
at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.
java:326)
at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:449)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBi
nder.java:382)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:322)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:173)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Con
My xml mapping file:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="gwash">
<class name="DeliveryMethodModel" table="[DELIVERY METHODS]">
<id name="id" column="[DELIVERY METHOD ID]">
<generator class="increment"/>
</id>
<property name="method" column="[DELIVERY METHOD]"/>
</class>
</hibernate-mapping>
EDIT: I've removed the brackets and spaces as indicated. Changed the DataSource.groovy to 'create' on the DB side. Still experiencing the same issues. The examples for hibernate integration with griffon/hsqldb/groovy are scant on details. Do I need to create all given properties for the model files for this to parse correctly? I've never used hibernate. Nor groovy. Nor griffon. I would definitely provide feedback for the community if I can get this resolved, if not I'll be rolling me own ORM since this is a rather small project. Rather not roll me own.
do you actually have the strings wrapped with [and ]?
I would suspect that for a class defined as
package gwash
import groovy.beans.Bindable
class DeliveryMethodModel {
Long id
#Bindable String method
}
the mapping file would be
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="gwash">
<class name="DeliveryMethodModel" table="DELIVERY_METHODS">
<id name="id" column="DELIVERY_METHOD_ID">
<generator class="increment"/>
</id>
<property name="method" column="DELIVERY_METHOD"/>
</class>
</hibernate-mapping>
I am using EMF with an XSD generated ecore. Now I've got the propblem, that the generated file isn't valid.
There are 2 Reasons:
There is a DocumentRoot element inserted
The attributes have the wrong capitalization.
The thing is: It is not a problem of the model, it is Propblem of the saving process (since in the EMF generated editor the output is correct.
First the correct result:
<?xml version="1.0" encoding="UTF-8"?>
<model:widgetspecification xmlns:model="http://test.com/model" Description="DESC" Name="NAME">
<model:Property Name="PROP1"/>
<model:Property Name="PROP2/>
</model:widgetspecification>
The actual result:
<?xml version="1.0" encoding="ASCII"?>
<model:DocumentRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:model="http://test.com/model">
<widgetspecification description="DESC" name="NAME">
<property name="PROP1"/>
<property name="PROP2"/>
</widgetspecification>
</model:DocumentRoot>
And finally the save procedure (just output to sysout)
Resource resource = new XMIResourceImpl();
resource.getContents().add(modelRoot);
resource.save(System.out, Collections.EMPTY_MAP);
Sadly I couldn't find any relevant differences in the saving routines (although of course the EMF generated code is a lot more complicated) - I guess I may have missed s.th. but I still haven't found anything).
Also interesting is the fact, that the EMF generated file is UTF-8, but I can't find any reference where this option is set.
Use XMLResource instead of XMIResource and set OPTION_EXTENDED_META_DATA to true.
XMLResource resource = new XMLResourceImpl();
resource.setEncoding("UTF-8");
resource.getContents().add(modelRoot);
Map<Object, Object> options = new HashMap<>();
options.put(XMLResource.OPTION_EXTENDED_META_DATA, true);
resource.save(System.out, options);