What I'm trying to do is take an XML document, let's say http://example.org/data.xml and show it with an XSL stylesheet applied.
(I cannot modify the document itself and add a directive)
So there are a couple of utility XML files like this:
wrapper.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wrapper [
<!ENTITY content SYSTEM "http://example.org/data.xml">
]>
<?xml-stylesheet type="text/xsl" href="unwrap.xsl" ?>
<wrapper>
&content;
</wrapper>
unwrap.xsl:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="stylesheet.xsl"/>
<xsl:template match="/wrapper/node()[1]">
<xsl:apply-imports/>
</xsl:template>
</xsl:stylesheet>
So to summarize: stylesheet.xsl is written for http://example.org/data.xml, the browser is pointed to wrapper.xml and the user should see the transformed http://example.org/data.xml.
This is one of those rare cases where things work as expected in IE (and Chrome) but not Firefox.
AFAIK Firefox supports external XML entities, but it seems like they are invisible in XSL code. I found this article from 2006, it describes this problem in Firefox 1.5 (I'm using 3.5.3)
Is there any workaround for this?
That XML looks familiar ;)
Currently, FireFox will not load external DTD's and entity references, because of security and Denial of Service concerns. For example: http://en.wikipedia.org/wiki/Billion_laughs
There is an open Mozilla bug describing the reasons why and lengthy debate about whether or not to make it something that is configurable: https://bugzilla.mozilla.org/show_bug.cgi?id=22942
There does appear to be one workaround to loading DTDs, but I'm guessing that probably isn't a viable solution for you.
Firefox will load local DTD files
if you put them in this directory for Windows:
C:\Program Files\Mozilla Firefox\res\dtd\...
The directory for Linux:
/**mileage may vary**/MozillaFirefox/lib/res/dtd/
One idea to get around using the entity reference:
If you can control the content of the wrapper.xml, then you could fetch the contents of http://example.org/data.xml (server side) and echo it out as the full contents of the wrapper file, with the addition of the Stylesheet Processing Instruction(assuming you have some dynamic server-side capabilities).
Related
We have a Visual Studio Extension that we host in a private gallery. Having installed the initial version, if one returns to the Extension And Updates page, one sees it listed in the list of Installed extensions. Highlighting it shows the [Disable] and [Uninstall] links and in the right-hand pane, one sees the correct 'Created By', 'Date Installed', 'Version' and the 'Automatically update this extension' is checked.
When we prepare an update, we do the following release process:
In the AssemblyInfo.cs, we update the 'AssemblyVersion' and 'AssemblyFileVersion' to the next version, e.g. "1.12.1.0"
In the source.extension.vsixmanifest, we update the 'Version' to the next version (for which we use the same value, i.e. "1.12.1.0")
We then sign the VSIX package
We then put the VSIX file on our private gallery
We then update the atom.xml file - more on this later. The atom.xml file happens to exist in the same folder as our VSIX since we only have a limited number of these extensions.
However, the extension doesn't automatically update when you start Visual Studio, nor does it appear as an update when you visit the 'Extensions and Updates'. Users therefore have to be notified of the new version and then manually uninstall the existing one, and install the update.
Okay, I'm pretty sure that there is nothing untoward with the VSIX file itself; I suspect the atom.xml may be at fault. There are several posts on how to author the atom.xml file, but there is a little inconsistency between these, e.g. MSDN, justinmchase, Kornfeld Eliyahu Peter, stackoverflow etc.
Okay. Here is my atom.xml (slightly edited)
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Our Extension Gallery</title>
<id>uuid:b62cf56a-8a60-4eb6-b217-5e2972e01b39;id=1</id>
<updated>2017-02-28T11:57:22Z</updated>
<entry>
<id>MyAssemblyName.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286</id>
<title type="text">Description One</title>
<summary type="text">Description Two</summary>
<published>2017-01-31T11:57:22Z</published>
<updated>2017-02-28T11:57:22Z</updated>
<author>
<name>Me!</name>
</author>
<content type="octet/stream" src="http://server/VisualStudioGallery/MyAssemblyName.vsix" />
<Vsix
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>0681eb6c-4275-4d64-9333-dfdabe14f286</Id>
<Version>1.12.1.0</Version>
</Vsix>
</entry>
</feed>
So what of this do we update in the atom.xml?
feed/updated
feed/entry/updated
feed/entry/Vsix/version
Format of the date
In some examples I've seen '2011-04-14T14:24:22-07:00', whilst in
others I've seen '2012-11-06T22:19:45Z'. Does it matter?
I've tried using the "Time" portion as 'T00:00:01Z' just in case there was any confusion between UTC, Server and Client time. No success.
'feed/entry/id' vs 'feed/entry/Vsix/Id'
Have I got the casing correct for these XML elements?
for 'feed/entry/id', I found that to download I needed to have 'MyAssemblyName.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286', but for feed/entry/Vsix/Id it was just '0681eb6c-4275-4d64-9333-dfdabe14f286'.
I feel like I've tinkered with just about every part of the XML but to no avail. I'm sure it's simple....but what that is eludes me.
Thanks
Griff
For 'feed/entry/id', which is A unique id of the entry. It MUST be exactly the same as to id of the VSIX package!
For feed/entry/Vsix/Id, which is the id of the VSIX package.
Please modify them as the same as the product id of your vsix package.
Thanks to Cole Wu's helpful comments, I finally got this to work.
The two IDs needed to match to get the update to work.
So, just to clarify I have the following:
AssemblyInfo.cs
[assembly: AssemblyVersion("1.15.0.0")]
[assembly: AssemblyFileVersion("1.15.0.0")]
source.extension.manifest
ProductID: MyApplication.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286
Version: 1.15
atom.xml
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Our Extension Gallery</title>
<id>uuid:b62cf56a-8a60-4eb6-b217-5e2972e01b39;id=1</id>
<updated>2017-02-28T00:00:01Z</updated>
<entry>
<id>MyApplication.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286</id>
<title type="text">Description 1</title>
<summary type="text">Description 2</summary>
<published>2017-01-31T00:00:01Z</published>
<updated>2017-03-01T00:00:01Z</updated>
<author>
<name>Me</name>
</author>
<content type="octet/stream" src="http://server/VisualStudioGallery/application.vsix" />
<Vsix
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>MyApplication.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286</Id>
<Version>1.15</Version>
</Vsix>
</entry>
</feed>
feed/entry/id = feed/entry/Vsix/Id = source.extension.manifest.ProductID
feed/entry/Vsix/Version = source.extension.manifest.Version
So i have created a handful of SQL snippets from some common scripts i run here.
I am using Snippet Designer and Visual Studio 2013.
Every time i try to import them i get the message "Selected snippets are not valid".
being that some of them are fairly large I did a little bit of digging looking for invalid chars (very new to snippets so could have easily missed some). This still did not work.
So I decided, lets make a VERY simple snippet.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Keywords>
<Keyword>Why</Keyword>
<Keyword>Does</Keyword>
<Keyword>This</Keyword>
<Keyword>Not</Keyword>
<Keyword>Work</Keyword>
</Keywords>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>SimpleSnipThantShouldNotFailAndDoes</Title>
<Author>I am</Author>
<Description>some thing in here</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>simplesnip</Shortcut>
</Header>
<Snippet>
<Declarations>
</Declarations>
<Code Language="sql"><![CDATA[select *
from sometable]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
still manages to throw the error, Im hoping that one of you snippet gurus out there can point out the issue here and that may let me identify the issue for the others.
Thanks in advance!
Maybe a bit late, but I will answer anyway, maybe it will be useful for others coming here.
The problem is, that you defined a Code Snippet for SQL and try to import it into Visual Studio. However, your VS does not have the ability to "write SQL".
If you change the Code Language tag to e.g. <Code Language="CSHARP"> the snippet will import correctly and will be available in C# files.
(see HERE for more language values)
As is see it, you can only add snippets for the language that are available in the dropdown menu in the upper left of the Code Snippet Manager (CTRL + K, CTRL + B).
If you want TSQL Code as a snippet in your C# code, simply change it, as the snippet will not be parsed against compiler rules (it will, after you inserted it).
Otherwise, your xml imports into SMSS just fine.
I'm working on a project that's been having difficulty with <?xml ... ?> declarations sneaking into the HTML output. Ensuring that every new and existing jspx file inclues <jsp:output omit-xml-declaration="yes" /> has become a pain.
Is there a way to set this option project-wide?
As you all know, once you have installed an extension in the Joomla backend, the description shows. You can either have a plain description from the XML or have a language based one. I have never had problems in the past with language based descriptions however this time I do. The extension is a admin component and has no frontend folder and is for Joomla 2.5.
When I install the component, the description appears as COM_PROJECTS_DESC
The language folder and files are in the correct location and the XML shows as
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">
<name>Projects</name>
<author>JoomJunk</author>
<creationDate>15th Jul 2012</creationDate>
<copyright>Copyright (C) 2012 JoomJunk</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html</license>
<authorEmail>admin#joomjunk.co.uk</authorEmail>
<authorUrl>http://www.joomjunk.co.uk</authorUrl>
<version>1.0.0</version>
<description>COM_PROJECTS_DESC</description>
<administration>
<menu img="components/com_projects/assets/images/cpanel_16.png">COM_PROJECT_TO_DO</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>controller.php</filename>
<filename>helper.php</filename>
<filename>projects.php</filename>
<folder>views</folder>
<folder>tables</folder>
<folder>models</folder>
<folder>controllers</folder>
<folder>assets</folder>
</files>
<languages folder="admin">
<language tag="en-GB">languages/en-GB/en-GB.com_projects.ini</language>
<language tag="en-GB">languages/en-GB/en-GB.com_projects.sys.ini</language>
</languages>
</administration>
</extension>
The odd thing is, the description doesnt work when installing for the first time, but if I install the coomponent over it (upgrade) then it does work.
I have used the language debug tool the the language file seems to be loading so Im not sure what the problem is. I has only ever happend to me with extensions specifically for the admin backend and that have no frontend referrence.
Any help would be much apreciated.
Regards
You can display the installable description text and if you need to install any sample values through install.joomjunk.php.
I think this link will be helpful for you.
http://docs.joomla.org/Using_the_installer_API_to_support_package_installation
I am transforming an XML file to WML using XSLT. Everything is fine until I try to open the WML in M3Gate. It gives the error "Bad WML syntax. 'Fatal Error. Ln 1, Col 38 Expected whitespace'."
Here is the offending code. However, I've tried moving things around and it gives the same error.
<?xml version="1.0" encoding="UTF-16"?>
<wml>
<card id=...>
Is this some obscure problem I'm missing? I've compared it with a WML I've made previously and the first line is exactly the same.
It works perfectly in Opera Web Browser.
Silly me. Opera Browser ignores the fact that there is no DOCTYPE declaration, however M3Gate generates this obscure error message. Add the following to your code, beneath the xsl:stylsheet element
<xsl:output method="xml" doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"
doctype-public="-//WAPFORUM//DTD WML 1.1//EN"/>