Using multiple DTDs (from mozilla.org) - xhtml

I need use XHTML.
In the URL https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL/Using_multiple_DTDs (updated in Sept 9 2019) Mozilla say:
""" If you want to use multiple DTDs with your XUL file, you can simply list all of the DTDs inside your DTD declaration: """
<!DOCTYPE window [
<!ENTITY % commonDTD SYSTEM "chrome://myextensions/locale/common.dtd">
%commonDTD;
<!ENTITY % mainwindowDTD SYSTEM "chrome://myextension/locale/mainwindow.dtd">
%mainwindowDTD;
]>
but: how I can load the "official" www.w3.org/TR/xhtml11/DTD/xhtml11.dtd + MyOwn.tdt" ??
Logically this structure is wrong, but please: how I can fixed this?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html[
<!ENTITY % commonDTD PUBLIC "chrome://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
%commonDTD;
<!ENTITY % qfc SYSTEM "chrome://myweb.com/DTD/my.dtd">
%qfc;
]>
I need load two DTD, one remote:
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
and other local:
mydtd.dtd
the first with "PUBLIC" and second with "SYSTEM".
However mozilla.org don't show a example to load one PUBLIC + other SYSTEM.
Thanks by your help.

Related

How to generate language file using linguist and lrelease

I have some code in a proprietary language. Its specially generated to make "plugin-code" and formulars. The main program is developed in c++.
The code looks like
a$ = pm("Datum")
b$ = pm("Seite %1!", page$)
The first argument in the pm() function is the text to be translated. "%1"... should be replaced by the following arguments, that must be strings. "a$", "b$" and "page$" are string variables.
The handout says, to use this function, I need a "foreign language catalogue". To make this I have to use "linguist" and "lrelease".
I have installed (all version 5.12.3)
linguist
lrelease
lpupdate
So how could I make language files?
I tried lupdate -recursive '.' -ts HAUSMITTEIL_de.ts (see here) but get the message
Scanning directory '.'...
Updating 'HAUSMITTEIL_de.ts'...
Found 0 source text(s) (0 new and 0 already existing)
and a XML file HAUSMITTEIL_de.ts
<?xml version="1.0" encoding="utf8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
</TS>
I miss the strings to be translated.

What language is this file generated by Mascot version 1.0 written in?

I have been assigned a task to retrieve information from files that were processed from raw mass spectrophotometry data (file.mzML).
These files have just ".data" as extension and when I open them, I cannot recognize the language and therefore I cannot load them into R and work on them.
The files with the .data extension are contained in this folder:
ftp://ftp.pride.ebi.ac.uk/pride/data/archive/2015/11/PXD000299/
Could someone take a look at any of the files.data and tell me the language is in (e.g. F010439)?
EDIT: these is are some snippets
Lines 1 to 10
MIME-Version: 1.0 (Generated by Mascot version 1.0)
Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08jU534c0p
--gc0p4Jq0M2Yt08jU534c0p
Content-Type: application/x-Mascot; name="parameters"
LICENSE=Licensed to: INRA Tours, P-F Proteomique Analytique & Fonction.,Nouzilly (0085-0000003524/1), (2 processors).
MP=
NM=
COM=
Lines 120 to 130
NeutralLoss3_master=63.998285
--gc0p4Jq0M2Yt08jU534c0p
Content-Type: application/x-Mascot; name="unimod"
<?xml version="1.0" encoding="UTF-8" ?>
<umod:unimod xmlns:umod="http://www.unimod.org/xmlns/schema/unimod_2" majorVersion="2" minorVersion="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.unimod.org/xmlns/schema/unimod_2 unimod_2.xsd">
<umod:elements>
<umod:elem avge_mass="1.00794" full_name="Hydrogen" mono_mass="1.007825035" title="H"/>
<umod:elem avge_mass="2.014101779" full_name="Deuterium" mono_mass="2.014101779" title="2H"/>
<umod:elem avge_mass="6.941" full_name="Lithium" mono_mass="7.016003" title="Li"/>
<umod:elem avge_mass="12.0107" full_name="Carbon" mono_mass="12" title="C"/>
It looks like that file is MIME-encoded "multi-part" file that contains (at least) two components files.
You can decode the multi-part using a MIME decoder.
The first component file looks like a simple "name=value" property file
The second component file is XML.
I don't know if this is relevant, but a search for Mascot file format gave me this reference page:
http://www.matrixscience.com/help/data_file_help.html
Also, there were some interesting hits when I searched for parser "x-mascot" and parser mascot. If you can find an existing parser, then you may be able to save yourself implementation effort.

Use spaces into the tab titles with liferay tabs

I'm working with Spring MVC for portlets and liferay tabs. I'm having a problem to put spaces into the tab title. Let's say I want to define something like this inside a JSP:
<liferay-ui:tabs
names="Sample Tab 1, Sample Tab 2"
refresh="false"
value="${myControllerValue}"
>
<liferay-ui:section>
<jsp:include page='/jsp/myPage1.jsp' flush="true"/>
</liferay-ui:section>
<liferay-ui:section>
<jsp:include page='/jsp/myPage2.jsp' flush="true"/>
</liferay-ui:section>
</liferay-ui:tabs>
This is not working at all (Eventhough, it's exactly the example from the documentation) and the problem is just the spaces into the names (It works fine if I use names="tab1,tab2", but that's not what I want to show in the tab titles)
Besides, I need to control the tab I show from the controller. Something like this:
if(whatever){
renderrequest.setAttribute("myControllerValue", "Sample Tab 1");
}
And this causes another problem, because I need to show the tab names in several languages, so I'd need to pass the tab I want in the locale language to match the jsp id. The best thing to do would be to split the title from the tab id and use the tabValues param, but no idea how to do it...
I read something about redefine the Languages-ext.properties, but I just import the tab,
<%#taglib prefix="liferay-ui" uri="http://liferay.com/tld/ui" %>
So I don't have this properties file, and no clue how to solve it.
I'd really appreciate any kind of help with this issue.
Thanks in advance!
EDIT:
Trying to apply the answer posted below I'm having the next error:
07:26:12,297 ERROR [PortletLocalServiceImpl:542] com.liferay.portal.kernel.xml.DocumentException: Error on line 20 of document : cvc-complex-type.2.4.a: Invalid content was found starting with element 'resource-bundle'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":portlet-info, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":portlet-preferences, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":security-role-ref, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supported-processing-event, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supported-publishing-event, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supported-public-render-parameter, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":container-runtime-option}' is expected.
And this is my portlet.xml file:
<portlet-app
version="2.0"
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>MyAPP</portlet-name>
<display-name>MyAPP</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/portlet/MyAPP-portlet.xml</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>gl_ES</supported-locale>
<supported-locale>es_ES</supported-locale>
<resource-bundle>messages</resource-bundle>
<resource-bundle>content/Language</resource-bundle>
<portlet-info>
<title>MyAPP</title>
<short-title>MyAPP</short-title>
<keywords>MyAPP</keywords>
</portlet-info>
</portlet>
</portlet-app>
You can use Language.properties to have the exact title names you want in the tab.
In the <liferay-ui:tabs> you can have:
<liferay-ui:tabs
names="sample-tab-1, sample-tab-2"
refresh="false"
value="${myControllerValue}"
>
which are nothing but keys in the Language.properties files as:
sample-tab-1=Sample Tab 1
sample-tab-2=Sample Tab 2
You can define the Language.properties file in the portlet.xml as:
<portlet>
...
...
<resource-bundle>content/Language</resource-bundle>
...
</portlet>
And this file and other Language files would reside in the source package inside the content folder, something like this:
docroot
|
|--> src
|
|--> content
|--> Language.properties
|--> Language_en.properties
|--> Language_ja.properties
|--> Language_de.properties
...
So in your controller you would use:
if(whatever){
renderrequest.setAttribute("myControllerValue", "sample-tab-1");
}
More about Liferay Localization.

How can I verify a SVG doc is correct? (version 1.2)

I used a program called Fritzing to draw some basic Arduino schematics, and then export the output as a SVG. This works just as expected, but then I noticed that the SVG output only looks okay in some browsers and only okay in some versions of Firefox.
Since Fritzing is a open source app I figured that I could look into the code (and maybe help out a little).
But now over to the question, what is a correct SVG supposed to look like? What verifier over at W3C can I use to check the file?
I tried to use the verifiers found on this page: http://validator.w3.org/dev/tests/
But they all complained a lot, especially about the SVG version. The verifiers seem to like version 1.0 and 1.1, but when I look at the top of this file seems to be using version 1.2?
This is the top three lines from the problematic file (reformatted for readability):
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with Fritzing (http://www.fritzing.org/) -->
<svg width="3.50927in"
x="0in"
version="1.2"
y="0in"
xmlns="http://www.w3.org/2000/svg"
height="2.81713in"
viewBox="0 0 252.667 202.833"
baseProfile="tiny"
xmlns:svg="http://www.w3.org/2000/svg">
Is there a specific SVG 1.2 verifier I can use?
Or shall I try to verify the SVG as if it was a classical XML file?
(As a side note, Fritzing seems to use Qt, so if there some QTest I can use it may be useful.)
You can use e.g http://validator.nu. Since your file is standalone, select xml parsing, paste the RNG url in the schema textfield (the schema url you're looking can be found in the relevant specification, in this case SVG 1.2 Tiny: http://www.w3.org/TR/SVGTiny12/relaxng/Tiny-1.2.rng ).
Even your three line snippet isn't valid SVG 1.2 Tiny content (x and y attributes are not allowed on the <svg> element in Tiny). You should add a link to your file somewhere, otherwise it's hard to say what it should look like.
There is a python utility in terminal svgcheck, which claims to target version 1.2, as defined in draft-7996-bis. A promising utility, IMHO.
SVG Checking Procedure.
pip install svgcheck
svgcheck ~/path/to/mysvgfile.svg
The svg file with proper standards will give something like:
$ svgcheck alert-circle.svg
Parsing file alert-circle.svg
INFO: File conforms to SVG requirements.
Make sure you have pip installed and python configured properly
For the subset SVG Tiny 1.2 Portable/Secure (SVG P/S), used for example in Brand Indicators for Message Identification (BIMI), see Using the RNC Schema to Validate BIMI SVG Images. It shows how to perform Relax NG Compact (RNC) XML schema validation on the command line.
pip3 install jingtrang
wget 'https://bimigroup.org/resources/SVG_PS-latest.rnc.txt'
pyjing -c SVG_PS-latest.rnc.txt my-image.svg
For my use-case, a PNG logotype converted to SVG Tiny 1.2 using png2svg, this was the output.
my-image.svg:1:159: error: value of attribute "baseProfile" is invalid; must be equal to "tiny-ps"
my-image.svg:1:174: error: element "g" not allowed yet; missing required element "title"
Errors were easily fixed by editing the baseProfile value and adding <title>A very nice image title</title>.

XQuery: weird xsi attribute being inserted into my XQuery output

Here is an example of the XQuery output that I get:
<clinic>
<Name xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Healthy Kids Pediatrics</Name>
<Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">510 W 27th St, Los Angeles, CA 90007</Address>
<PhoneNumberList>213-555-5845</PhoneNumberList>
<NumberOfPatientGroups>2</NumberOfPatientGroups>
</clinic>
As you can see, in the <Name> and <Address> tag, there are these strange xmlns:xsi tags being added to it.
The funny thing is if I go to the top of my xml file, and remove:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="vaccination.xsl"?>
<Vaccination xsi:noNamespaceSchemaLocation="vaccination.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
the phrase
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Then now my XQuery XML output will look like this (which is what I want)
<clinic>
<Name>Healthy Kids Pediatrics</Name>
<Address>510 W 27th St, Los Angeles, CA 90007</Address>
<PhoneNumberList>213-555-5845</PhoneNumberList>
<NumberOfPatientGroups>2</NumberOfPatientGroups>
</clinic>
BUT, when I view my XML in my browser, it will give an error and display something like:
XML Parsing Error: prefix not bound to a namespace
Location: file:///C:/Users/Pac/Desktop/csci585-hw3/vaccination.xml
Line Number 3, Column 1:<Vaccination xsi:noNamespaceSchemaLocation="vaccination.xsd">
^
Does anyone have an idea of how to remove those xsi tags from my XQuery output without breaking my XML/XSL ?
Removing the namespace declaration from the top node makes the XML document invalid, as the xsi prefix is used but not declared. This should have caused an error when you try to load the document in a query.
I assume that the Name and Address nodes are copied directly from the source document and the other nodes are constructed.
When copying a node from the source document, the in scope namespaces from the source node are combined with the in scope namespaces in the node that contains the copy. The way these are combined is specified by the copy-namespaces-mode.
In your case you want namespaces to be inherited from the parent node (the node in the query), but you do not want to preserve namespaces in the source document where they are unnecessary.
This can be achieved by adding the following line to the top of the query:
declare copy-namespaces no-preserve, inherit;

Resources