I have the beginning of this code to create a preference window for an addon:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<!DOCTYPE korpuslex SYSTEM "chrome://korpuslex/locale/korpuslex.dtd">
<prefwindow type="prefwindow"
id="korpuslex-prefs"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 42em; min-height: 37.5em;"
title="&korpuslex.PrefsTitle;">
<script src="options.js" />
...
I got an "error analysis XML" if I call a parameter from the *.dtd file as in "title="&korpuslex.PrefsTitle;">"but everything is OK if no parameters are used.
I tried to match my code with other addons but can't find why it doesn't work.
The document type declaration must name the document's root element type, in your case prefwindow.
Change it to
<!DOCTYPE prefwindow SYSTEM "chrome://korpuslex/locale/korpuslex.dtd">
Related
In an .xsl file I want to use nodes from a separate file ("foo.xsd"). The .xsl file uses an explicit namespace prefix, the external file doesn't but rather relies on a default namespace. Their namespace URIs match up.
Reading in the nodes, with ant.xslt the following XPath expression results in an ArrayIndexOutOfBounds exception later
document('foo.xsd')/xsd:schema/xsd:*
while it works when removing the last reference to the namespace prefix
document('foo.xsd')/xsd:schema/*
Here is a minimal example that reproduces the issue. The transformation input file
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<element name="bar"/>
</schema>
and a transformation .xsl file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xsl:variable name="nodeSet" select="document('foo.xsd')/xsd:schema/xsd:*[#name]"/>
<xsl:template match="/xsd:schema/xsd:element">
<xsl:value-of select="$nodeSet/#name"/>
</xsl:template>
</xsl:stylesheet>
The referenced foo.xsd is just a copy of the input file, so in this cut down example I'm running over one instance of the file and reading in the other instance in the stylesheet.
Goold ol' xsltproc is extracting the right attribute value ("bar"). ant.xslt with the default processor (Xalan) throws an ArrayIndexOutOfBoundsException (I presume when looking for the colon insided the element name).The problem only arises when referencing nodeSet as in the <xsl:value-of> element.
The <xsl:template> matches in all cases, using prefixes.
My question is: Did I hit a bug in Xalan, or am I doing something generally wrong?
I'm aware of the various work-arounds concerning namespace prefixes, like using [local-name() = 'element'] and such, so please don't post answers in that vein. I'm looking for a general answer whether this should work (like, according to the specs).
Background Material
Stacktrace (part.) that hints at Xalan:
...
Caused by: javax.xml.transform.TransformerException: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 512
at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:783)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:370)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:201)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:870)
... 126 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 512
at java.xml/com.sun.org.apache.xml.internal.utils.SuballocatedIntVector.elementAt(SuballocatedIntVector.java:441)
at java.xml/com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase._firstch(DTMDefaultBase.java:523)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.SAXImpl.access$200(SAXImpl.java:73)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.SAXImpl$NamespaceChildrenIterator.next(SAXImpl.java:1431)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.CurrentNodeListIterator.setStartNode(CurrentNodeListIterator.java:158)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator.setStartNode(StepIterator.java:97)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator.setStartNode(StepIterator.java:97)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.DupFilterIterator.setStartNode(DupFilterIterator.java:97)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.dom.CachedNodeListIterator.setStartNode(CachedNodeListIterator.java:57)
at jdk.translet/die.verwandlung.test.topLevel()
at jdk.translet/die.verwandlung.test.transform()
at java.xml/com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:624)
at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:776)
... 129 more
Invokation is through Gradle via shell command gradlew mytask using the Gradle built-in Ant using its built-in ant.xslt task.
build.gradle:
tasks.register('mytask') {
doLast {
ant.xslt(
baseDir: '.',
in: 'input.xsd',
out: 'out.xml',
style: 'stylefile.xsl'
)
}
}
Your xslt/xml code is fine (works with Saxon). So it's either something in the way you're running the transformation, or it's a bug in the version of Xalan that you're using.
Xalan shouldn't be throwing an ArrayIndexOutOfBounds exception anyway. It's presumably Xalan code on the stack trace?
When I run my test, I get all the output I would expect from the test such as
✔ Element <body> was visible after 12 milliseconds.
✔ Testing if element <input[id="usernameID"]> is visible.
✔ Testing if element <#usernameID> is visible.
✔ Testing if element <#passwordID> is visible.
✔ Testing if value of <#usernameID> contains: "".
But when I open the XML file that is generated there is nothing there, just the header, footer and a bunch of blank lines.
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites errors="0"
failures="0"
tests="2">
<testsuite name="loginTests"
errors="0" failures="0" hostname="" id="" package="login" skipped="0"
tests="2" time="15.87" timestamp="Mon, 08 Feb 2016 21:01:16 GMT">
<testcase name="Login Page Load Test" time="10.68" assertions="1">
</testcase>
<testcase name="Login/Logout Test" time="5.195" assertions="23">
</testcase>
</testsuite>
</testsuites>
Here is a snippet of the code.
'Login/Logout Test' : function(client) {
client
.waitForElementVisible("body", client.globals.waitForConditionTimeout)
.assert.visible('input[id="usernameID"]')
.assert.visible('#usernameID')
.assert.visible('#passwordID')
.end
I must be missing something simple.
Apparently this is the way it is... does not make a lot of sense but...
To get this information out of the test run a custom reporter is used.
I have done this, now I can write the information anywhere I want I chose to write it to a DB table.
I have an xml like this as mentioned below. I am trying to obtain value for Cardnumber using following expression.
XPATH :
paymentService/ns0:submit/ns0:order/ns0:paymentDetails/ns0:VISA-SSL/cardNumber
But it's giving me error. Can any1 guide me on this?
<?xml version="1.0" encoding="UTF-8"?>
<paymentService version="1.0">
<ns0:submit xmlns:ns0="http://www.tibco.com/ns/no_namespace_schema_location/Payment/PaymentProcessors/WorldPay_CC/SharedResources/Schemas/paymentService_v1.dtd">
<ns0:order>
<description>description</description>
<amount value="500" currencyCode="EUR" exponent="2"/>
<ns0:paymentDetails>
<ns0:VISA-SSL>
<cardNumber>00009875083428500</cardNumber>
<expiryDate>
<date month="02" year="2008"/>
</expiryDate>
<cardHolderName>test</cardHolderName>
</ns0:VISA-SSL>
<session shopperIPAddress="192.165.22.35" id=""/>
</ns0:paymentDetails>
<shopper>
<browser>
<acceptHeader>text/html</acceptHeader>
<userAgentHeader>mozilla 5.0</userAgentHeader>
</browser>
</shopper>
</ns0:order>
</ns0:submit>
</paymentService>
Thanks
Your xmlns:ns0 is misplaced, and (think of this way) because ns0 is defined after <ns0:submit> tag, ns0:submit is "undefined" and thus the parse error.
Edit:
If you need to use this XPath in PHP, you'll either have to declare the namespace before use:
<?xml version="1.0" encoding="UTF-8"?>
<paymentService version="1.0" xmlns:ns0="http://www.tibco.com/ns/no_namespace_schema_location/Payment/PaymentProcessors/WorldPay_CC/SharedResources/Schemas/paymentService_v1.dtd">
<ns0:submit>
Or register the namespace before evaluating your XPath (Thanks to #MiMo for pointing out):
$xml->registerXPathNamespace("ns0","http://www.tibco.com/ns/no_namespace_schema_location/Payment/PaymentProcessors/WorldPay_CC/SharedResources/Schemas/paymentService_v1.dtd");
Also add a slash before your XPATH:
/paymentService/ns0:submit/ns0:order/ns0:paymentDetails/ns0:VISA-SSL/cardNumber
Live demo with declaration first or Live demo with namespace registration (both are demonstrated in PHP).
The problem is the node
<paymentService version="1.0">
Since this is not ended you have to comment it or end it properly.
If you comment that try out with this XPATH
/ns0:submit/ns0:order/ns0:paymentDetails/ns0:VISA-SSL/cardNumber
You need to register the namespace before evaluating the XPath:
$xml->registerXPathNamespace('ns0', 'http://www.tibco.com/ns/no_namespace_schema_location/Payment/PaymentProcessors/WorldPay_CC/SharedResources/Schemas/paymentService_v1.dtd');
where $xml is a SimpleXMLElement variable containing your XML.
Your XPath needs to start with / as per Passerby answer:
/paymentService/ns0:submit/ns0:order/ns0:paymentDetails/ns0:VISA-SSL/cardNumber
My Firefox extension is not hosted on the official extension site. It is hosted on a secure (https) server. From what I have read, I do not need to sign my add-on, right?
The problem is that it is not working. I install my plugin, and click on 'Check for updates', but it says no updates have been found. I have set the version in the update manifest and in the install manifest from initial.rev332 to initial.rev333.
Could someone shed some light on my situation? Thanks very much :)
My install manifest...
<?xml version="1.0" encoding="utf-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>jid0-BsYlcooDmgR331LCKZwABfD4yQk#jetpack</em:id>
<em:version>initial.rev333</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:unpack>false</em:unpack>
<!-- Firefox -->
<em:targetApplication>
<Description>
<em:id>{jid0-BsYlcooDmgR331LCKZwABfD4yQk#jetpack}</em:id>
<em:minVersion>3.4</em:minVersion>
<em:maxVersion>30.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>iStyla</em:name>
<em:description>iStyla is a marketplace for themes for Facebook, Twitter and Google+ </em:description>
<em:creator>iStyla</em:creator>
<em:homepageURL>https://www.istyla.com/</em:homepageURL>
<em:updateURL>https://www.istyla.com/Updates/firefox.rdf</em:updateURL>
</Description>
</RDF>
My Update Manifest
<?xml version="1.0"?>
<r:RDF xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/2004/em-rdf#">
<r:Description about="urn:mozilla:extension:jid0-BsYlcooDmgR331LCKZwABfD4yQk#jetpack">
<updates>
<r:Seq>
<r:li>
<r:Description>
<version>initial.rev333</version>
<targetApplication>
<r:Description>
<id>{jid0-BsYlcooDmgR331LCKZwABfD4yQk#jetpack}</id>
<minVersion>3.0</minVersion>
<maxVersion>30.*</maxVersion>
<updateLink>https://www.istyla.com/Updates/Firefox.xpi</updateLink>
<updateHash>
sha256:af031d8bb9303a42ab1f270845e9c692d65cd4fc
</updateHash>
</r:Description>
</targetApplication>
</r:Description>
</r:li>
</r:Seq>
</updates>
</r:Description>
</r:RDF>
I think your addon version number needs to be in a different format: https://developer.mozilla.org/en/Install_Manifests#version
Try the versioning format listed here to differentiate versions: https://developer.mozilla.org/en/Toolkit_version_format
Maybe try <em:version>0.0.333</em:version>
Also, I don't think <em:maxVersion>30.*</em:maxVersion> is valid (I could be wrong though. If you're not hosting it on AMO it might work alright). Here is the list of valid Firefox version numbers available FWIW: https://addons.mozilla.org/en-US/firefox/pages/appversions/
My errors/local.xml content:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<skin>default</skin>
<report>
<action>print</action>
<subject>Store Debug Information</subject>
<email_address></email_address>
<trash>trash</trash>
</report>
</config>
Is it possible to display warning in browser?
PS:
I can see errors in browser when they are.
But I would like to see warnings also, not just in log file.
Enable developer mode. In Magento > 1.3 you need only set an environment variable (MAGE_IS_DEVELOPER_MODE) as this is evaluated in index.php.
You can uncomment errors settings in index.php