I'm using the GGeoXml object to overlay KML on an embedded Google Map. I need to customize the popup balloon for placemarks, so I'm trying to use the <BalloonStyle> element:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://earth.google.com/kml/2.0">
<name>Concessions</name>
<Style id="masterPolyStyle">
...
<BalloonStyle>
<text>
<![CDATA[
<h6>Concession</h6>
<h4>$[name]</h4>
<p>$[description]</p>
]]>
</text>
<displayMode>default</displayMode>
<bgColor>DDA39B81</bgColor>
</BalloonStyle>
</Style>
...
</Document>
This works as expected in Google Earth, but the embedded map API appears to ignore this altogether. I suppose I could just leave out the <name> element altogether and just put everything in HTML inside the <description> element, but I'd like to be able to take advantage of the <ExtendedData> element to display custom data in a structured way.
This is now documented here (2009/04):
http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html
< BalloonStyle > no
(When did you ask this ? This forum/service needs a big fat DATE on each question, with a year in it :-) )
2$c,
*pike
No, like you have mentioned, html in the description is the only way I know that you can control the style of balloons through kml/georss feed.
Actually, the document referenced above (http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html) must have changed, b/c now it says:
<BalloonStyle> partially only <text>
is supported
My problem is that the <text> seems to work for one KML file, but not another. The one that works for has polygon placemarkers, the other has points represented by icons - I wonder if that is why...
Related
For a personal project I need to get information from an excel-sheet into xml-data (xml-schema needed) but if I try to validate it this error shows: "Non-HTML Content-Type: text/xml ."
The excel sheet includes information such as basic text, which is quite simple to transport into xml, but also has long html inside its cells which later should be used as content of a wordpress site/post. So this hmtl begins with visualcomposer elemnts like "[vc_row][vc_column][vc_column_text]" and further more contains very standard html elements like paragraphs or tables. All html is wrapped inside .
So I wonder if this could be the source of my problem as, with my very slim coding and debugging knowledge, this came in my mind first.
Some extra information:
the xml-schema is edited with Dreamweaver CC 2015 which also does the validation
the xml-file is characterized, with: <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<materialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Data inside the xml is structured like: <matData><ID>3001</ID><author>1</author> ... </matData>
I suspect what you need is to correctly enclose the values that will include html in cdata tags so there not seen as xml.
<exampleOfACDATA>
<![CDATA[
Since this is a CDATA section
I can use all sorts of reserved characters
like > < " and &
or write things like
<foo></bar>
but my document is still well formed!
]]>
</exampleOfACDATA>
see further details here
What does <![CDATA[]]> in XML mean?
I'm looking to display some XML data but am having issues.
The xml data I'm looking to display is listed below:
<?xml version="1.0" encoding="utf-8"?>
<rooms>
<not_in_rooms>
</not_in_rooms>
<room name="Room1" description="text" users="0" id="r12" passworded="false" owner_username="admin" owner_siteid="" >
</room>
<room name="Room2" description="text" users="0" id="r13" passworded="false" owner_username="admin" owner_siteid="" >
<user ip="0.0.0.0" name="user1" siteId="" gender="male" cam="0" camIsPrivate="false" mic="0" >
</user>
</room>
I want to display the Room Names (i.e. Room1, Room2) and the users in each room (i.e. user1). I found generic xml to html tutorials but they don't explain what to do when there are attributes called within each element.
You could use several methods, based on what you want. Probably the easiest is XSLT or parsing it with a server-side scripting language like PHP.
XSLT is probably the closest to the "standard" way to do this. You just have to link to/embed the XML file and add an element to the file stating that you should use an XSLT stylesheet. There are plenty of XSLT tutorials online. If you are wondering about how to read all the attributes, see this question.
You could also use PHP to parse and output the HTML. This would be much more complicated but also more flexible.
You can use pure JavaScript and DOM parser to parse your XML.
Assume you have your XML as a variable in JavaScript:
var txt = "<XML></XML>"
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(txt,"text/xml");
}
else // Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(txt);
}
//get take data..
xmlDoc.getElementsByTagName("Yourtagname")[0]
//Get Attribute Data...
xmlDoc.getElementsByTagName("Yourtagname")[0].getAttribute('YourAttributeInTag')
Here is a test fiddle from friends to try out.
http://jsfiddle.net/D2QpZ/
I've been playing around with the Fusion Tables/Google Maps stuff to create some flight paths between different places but I can't figure out how to style the lines correctly.
This is an example KML that I imported:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>LineStyle.kml</name>
<open>1</open>
<Style id="linestyleExample">
<LineStyle>
<color>00FF00</color>
<width>4</width>
<gx:labelVisibility>1</gx:labelVisibility>
</LineStyle>
</Style>
<Placemark>
<name>LineStyle Example</name>
<styleUrl>#linestyleExample</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<coordinates>-0.47364383,51.824664,0.0 -122.364152,37.824322,0.0</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
And it draws the line correctly but it's always red no matter what value I put inside the LineStyle section.
Anyone got any ideas how to get a different colour? I've tried everything I can think of but I'm stuck!
Thanks in advance,
Mark
You can style them (polylines, polygons, and markers) in FusionTables using the User Interface (in Visualize:Map, click on Configure Styles). It is easiest if you put style information in a column (unless you want them all the same)
You can also configure up to 5 styles dynamically in the Google Maps API v3 on a (single) FusionTablesLayer.
Fusion Tables does not import style information, you have to re-style using the Fusion Tables interface
So from what I understand of the CDATA tags on an XML document, it's meant to allow HTML tags inside it to function as they normally would.
I am working with a website template here that uses XML files, and while editing one of the documents to add a href or image to it, I rather get a string. Here's the code, if you can help me that would be greatly appreciated.
I have tried modifying the code to use the < / > that it seems to want to suggest in the output text, but that doesn't help either. If anybody can explain or link me to relevant information, or both, it would be amazing =)
<?xml version="1.0"?>
<xmldata section="Address">
<content>
<image src="resources/images/streetmap1.png" />
<bodytext><![CDATA[Shop 6, 106 Foster Street
Dandenong, 3175
Street Map:
<image src="resources/images/streetmap1.png" />
]]></bodytext>
</content>
</xmldata>
EDIT - Supplying accompanying .js file.
http://pastebin.com/Td2EYiKH
So from what I understand of the CDATA tags on an XML document, it's meant to allow HTML tags inside it to function as they normally would.
No. It is so that characters with special meaning in XML (such as <) can be included as data without escaping.
Here's the code
You need to look at the code that transforms the XML data into the HTML content. You haven't shared that with us.
<image src="resources/images/streetmap1.png" />
The HTML element is img not image and it should have an alt attribute.
I am writing my own templating engine mainly for web applications.
It is actually mix of my own XML tags and HTML.
Here is the sample:
<lp:view xmlns:lp="http://sminit.com/view" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://sminit.com/view view.xsd ">
<lp:list name="my_items">
<lp:list_header>
<table>
</lp:list_header>
<lp:list_item>
<tr><td>$title$</td></tr>
</lp:list_item>
<lp:list_footer>
</table>
</lp:list_footer>
</lp:list>
</lp:view>
A little explanation:
Those tags prefixed with "lp" belong to my templating engine and are kind of "processing instructions" for it. The lp:view is a root node, then there is a lp:list node which having received some data source will produce a list: first it will include content of lp:list_header, then repeat proper times content of lp:list_item (replacing $title$ by actual data, but this does not matter here), then it will add content of lp:list_footer node. As you can see, for this reason I have html tag "table" splitting across my tags.
I have met two major problems here:
1. Eclipse complains that "table" is not properly closed -- I want Eclipse to stop complaining, treat this tag as a text or -- maybe you can suggest something?
2. Eclipse will not show any code hint if I am inside any of html tags. (code hint: attributes that maybe used by this tag like "class" or "id" etc)
I understand that I'm asking a weird freak question, but maybe there are some XSD gurus here who can direct me:
Eclipse should treat my xml template file as the following:
1. the tags prefixed "lp" are gods! They have precedence over anything other. Only errors from that tags (missing required attributes, missing required child elements etc) should be displayed.
2. All the other tags (any stuff in between angle brackets) are HTML tags. Eclipse should display code hint for them, but should anything be "incorrect" (like in my sample: no closing /table tag) -- Eclipse should not complain.
I hope this is possible.
thanks!
You would have to wrap your HTML in CDATA blocks. This will make the XML parser consider the contents (the unclosed <table>) to be plain text, and not a broken tag.
<lp:list_header><![CDATA[
<table>
]]></lp:list_header>
This is just a partial answer, but I'll still put it as an answer because it's too long to type into a comment.
To stop Eclipse complaining about unclosed tags, you should wrap the content in a <![CDATA[..]] section like so:
<lp:view xmlns:lp="http://sminit.com/view" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sminit.com/view view.xsd ">
<lp:list name="my_items">
<lp:list_header>
<![CDATA[ <table> ]]>
</lp:list_header>
<lp:list_item>
<tr><td>$title$</td></tr>
</lp:list_item>
<lp:list_footer>
<![CDATA[ </table> ]]>
</lp:list_footer>
</lp:list>
They will be treated as text and Eclipse will not complain, but in that case you will lose any Eclipse completion inside the CDATA section.
To get completion working for HTML tags, I think you can try adding a default namespace for XHTML to your root tag, like so:
<?xml version="1.0" ?>
<lp:view xmlns="http://www.w3.org/1999/xhtml" xmlns:lp="http://sminit.com/view" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sminit.com/view view.xsd ">
<lp:list name="my_items">
<lp:list_header>
<![CDATA[ <table> ]]>
</lp:list_header>
<lp:list_item>
<tr><td>$title$</td></tr>
</lp:list_item>
<lp:list_footer>
<![CDATA[ </table> ]]>
</lp:list_footer>
</lp:list>
EDIT: I think the second part won't work though, because the XHTML schema defines that the root element should be <html>. I just tried in Eclipse and completion for HTML tags only starts working when I first insert an <html> tag somewhere in the document. Maybe some other people can weigh in.