How to comment a GPX file? - comments

How I can make a comment in a GPX files?
I checked on Google and here with no luck. Thank you !

Assuming GPX = GPS eXchange Format it's just XML so a standard XML comment is all you'd need:
<!-- XML Comment -->

Waypoint, Routes and Tracks in Gpx have a formal tag <cmt /> and <desc /> The other main types have something called <extensions /> that allow you to add whatever content you want. The only requirement is that what you put in there is linked to a different schema so you can't use the default namespace for your tags.
You can put something like <myns:cmt>Comment here</myns:cmt> in there assuming you define the myns namespace in the top.
You can read more about this in the Gpx specs here
Garmin uses extensions extensively. To get an idea how they do it you can get their schema here

Related

B2C custom UI based,on parameter

Perhaps I am missing something but here is my problem.
Say I create multiple containers for custom UI.
https://your-storage-account.blob.core.windows.net/container1/customize-ui.html
https://your-storage-account.blob.core.windows.net/container2/customize-ui.html
...
https://your-storage-account.blob.core.windows.net/containerN/customize-ui.html
then i define in custom policy extension file the following
<ContentDefinitions>
<ContentDefinition Id="api.signuporsignin">
<LoadUri>https://your-storage-account.blob.core.windows.net/templates/{oauth-kv:containerName}/customize-ui.html</LoadUri>
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:unifiedssp:1.0.0</DataUri>
<Metadata>
<Item Key="DisplayName">Signin and Signup</Item>
</Metadata>
</ContentDefinition>
</ContentDefinitions>
when parameter is passed say 'containerName=container1' all is good and my UI looks like the one defined by files from container1
https://your-storage-account.blob.core.windows.net/templates/container1/customize-ui.html
but if parameter is not specified i want to use some default container say 'default', is there a way to do that?
as of now if parameter is not specified i get error since the resulting url would look like this:
https://your-storage-account.blob.core.windows.net/templates//customize-ui.html
having '//' is a culprit.
anyone had to deal with similar challenge? am i approaching it entirely wrong?
thank you
Mark

Validate format and content of XSD file

I searched under and over for this, but I think I am not using the correct words for my query.
I need to validate the format and content of an XML Schema (xsd) file. I also need to do this by command line. To give more guidance, I would like something like the Eclipse schema editor as an example (but by command line).
Let's say I have this schema:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/ExampleXMLSchema"
xmlns:tns="http://www.example.org/ExampleXMLSchema"
xmlns:external="http://www.example.org/ExternalXMLSchema"
elementFormDefault="unqualified">
<import schemaLocation="ExternalXMLSchema.xsd"
namespace="http://www.example.org/ExternalXMLSchema">
</import>
<complexType name="ExampleComplexType">
<sequence>
<element name="ExternalElement"
type="external:ExternalComplexType"></element>
</sequence>
</complexType>
</schema>
I want a tool that validate the format (no missing brackets, no missing end tags, etc), but also make sure that external references are correct. In this example, it would fail if the validator could not find the ExternalXMLSchema.xsd file and its types.
The eclipse editor gives this error for this situation:
src-resolve: Cannot resolve the name 'external:ExternalComplexType' to a(n) 'type definition' component.
Thanks for taking a look at this! Sorry if something is not clear, first post here, trying my best.
Any schema validator will have the schema for schema documents built in, so any schema validator should be in a position to validate a schema document.
Checking for bad external references goes beyond checking the schema-validity of the schema document; with some validators I have used, the validator checks external references if you ask it to validate a schema document; with others, it doesn't.
So in general the most reliable way of getting a validator to check a schema document is to attempt to use it to validate an XML instance. I find it convenient to have an instance with a well understood validity error. If the validator issues an error message concerning that problem in the XML instance, the schema is OK; if the validator issues no error messages at all, it's not building the schema or something else is wrong. If it issues a list of complaints about problems in the schema, well, that's what you were looking for, wasn't it?
Among schema validators which can be invoked from the command line are Xerces-J, Xerces-C, Saxon, msv, and libxml (but n.b. libxml's support for XSD is incomplete).

jstl/jsp print name of file beutiful

I have my tag ${file.name} in a jsp file to display a name of file to download
name containt a full file name,include file extension. for example
testfile.png
a-file.zip
testfile-test505454654.png
a-filenum5468.docx
other_file_with_a_name_very_very_very_larrrrrrrrrrrrrrrrrrrrrge.pdf
Files with very long names, crash my layout.
I think the way to format the file name to shorten it but include the extention. Maybe
testfile.png
a-file.zip
testfile-test505454....png *
a-filenum5468.docx
other_file_with_a_na....pdf *
How I can do?
in href no problem because it is done by id ${file.id}
If file is a POJO, you may add a getter-method to the POJO (something like String getShortName(){}) that returns a short version of the file name. And then use the method in your EL expression: ${file.shortName}.
I would write and register a custom tag that would take care of shortening the output to a maximum length
<custom:short value="${file.name}" var="shortFileName" />
The tag would take care of shortening based on defaults or values you specify in the element and putting it the result in a request attribute you can use anywhere after that declaration.
Since the requirements can be used many times so You should go with CUSTOM Tag solution like #Sotirios Delimanolis suggested.
JSTL function ( Like c:fn ) is another solution. Using jstl function get better performance than Custom tag ( simple / classic model )
Link: http://www.noppanit.com/how-to-create-a-custom-function-for-jstl/

Examining Magento's final XML structure

Anyway to examine the final XML structure magento comes up with after parsing & combining all the different XML files?
There is nothing of that sort which turned up on searching on the internet and I think for someone like me, magento layouts were a bit too much in the beginning & I would try to do everything on the code side.
Another thing which will help in picking up the name of different nodes that we can use, right away from the final XML structure.
Never ran into this but I believe we will have a better picture of what's overriding what.
The following will get you the merged configuration from app/etc/*.xml, app/etc/modules/*.xml, as well as each (active) module's config.xml file; when retrieving the config though there is no indication of what was overwritten, as the merges happen as each config file is being parsed:
Mage::getConfig()->getNode()->asNiceXml(); // or asXML() | asArray() | etc.
However, you seem to be asking about how the application makes use of this information. This is a function of application design.
Also, you mention "all of the different XML files." It's worth noting that these are not maintained in one massive object instance. For example, layout XML is accessed using the layout update object Mage_Core_Model_Layout_Update and can be accessed meaningfully after it's been loaded and manipulated for a given rendering scope (e.g. loadLayout() in a controller action):
Mage::app()->getLayout()->getUpdate()->asString(); // or asSimplexml() or asArray()
Yes - Commercebug. As well as a whole load of other useful features, you can also view the entire XML structure that Magento has produced.
http://store.pulsestorm.net/products/commerce-bug-2
I believe the following will output the XML: echo Mage::getConfig()->getXmlString();
You can create a script with something like this:
header("Content-Type:text/xml");
require_once '../app/Mage.php';
Mage::app();
echo Mage::getConfig()->getXmlString();
based on answer from benmarks I did
echo "<pre>".htmlspecialchars(Mage::getConfig()->getNode()->asNiceXml())."</pre>";
If you want for example to see the blocks configuration in Magento 1 you can put this in a file, place the file at the root of the site and navigate to it in a browser:
<?php
include("app/Mage.php");
Mage::app();
//just see blocks...
echo "<pre>".htmlspecialchars(Mage::getConfig()->getNode()->global->blocks->asNiceXml())."</pre>";
die();

RSS pubsubhubbub implementation

According to pubsubhubbub I need add
<link rel="hub" href="http://pubsubhubbub.appspot.com"/>
to my channel tag, but my channel already contains a link tag to my own site, and adding another link means I can't pass verification because of there being two link tags in the same channel.
Unfortunately I couldn't open new issue in pubsubhubbub
Is there any way to deal with two link in the same channel?
Thanks!
Of course you can add several the <link> tags in your <channel>, but the link tags need to be in the Atom namespace, not in the RSS namespace, and yes, they can both be used in the same feed, as long as you prefix tags in the atom namespace with atom and later define what it means by using xmlns:atom="http://www.w3.org/2005/Atom".
For example, you can have this :
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="hub" href="http://superfeedr.com"/>
Also remember that the namespace definitions are "herited" from the parent elements. SO you can just add in the <channel> element and you can just write:
<atom:link rel="hub" href="http://superfeedr.com"/>
UPDATE The answer above applies to PubSubHubbub 0.3 which was specific to both RSS/Atom feeds. The latest version of the spec brings support for any mime type, which means that discovery has to be performed at the HTTP level using 2 Link headers.
If you are not defining your feed as an atom feed you can do this:
<link>http://www.your-site.com/</link>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com"/>
the xmls:atom attribute has to be there to use the atom namespace. I don't think you would need to use more than once though. With the atom namespace you can use more than one link.

Resources