Wordfile for KML

Wordfile for KML

6
NewbieNewbie
6

    Jan 05, 2012#1

    Hello,

    I need a wordfile for the Google Earth KML format. KML files are XML files. I have no experience in writing wordfiles for syntax highlighting. I found the syntax tools macros, but do not know what to do with them.

    I downloaded the official XSD files for this file format, but don't want to extract all tags manually. What must I do to create the wordfile? I found no tutorial to learn it.

    Best regards
    tribun

    6,681583
    Grand MasterGrand Master
    6,681583

      Jan 07, 2012#2

      Well, to create a wordfile you best start either with another, similar wordfile or use Template for syntax highlighting language wordfile.

      I have attached a KML.uew for you created quickly using KML Reference. But I don't have read the reference. I just copied the element names and some attributes and verified the wordfile using animatedupdate_example.kml. You have to read the reference to determine if opening tag of an element can exist only as
      • <element </element> because this element always requires an attribute on start tag and requires always an end tag (like <kml);
      • <element> </element> because this element has always a start tag without attributes and requires always an end tag (as many elements);
      • <element <element> </element> because this element has a start tag which can but must not have attributes, but has always an end tag.
      Also it looks like some elements in the reference do not really exist in *.kml files like <AbstractView>. So you need to remove the strings <element> </element> from the wordfile for those elements which do not really exist in *.kml files.

      The goal of a syntax highlighting wordfile should not be to just syntax highlight a file, it should help you with the addition of auto-complete and auto-correct feature also on editing the file and detecting mistakes in syntax. So if an element requires always an attribute, <element> should not be in the wordfile because then <element> would be displayed with normal text color clearly indicating that this is definitely wrong.

      Of course instead of putting all elements in color group 1, you can split them up into more color groups. For example all elements with gx prefix could be in a separate color group. Or all elements existing only in <Camera> or in <LookAt> are highlighted with a different color to easily see also the block structure.

      Note: If the KML wordfile you create should be helpful for other UltraEdit and KML users too, take into consideration that more than 8 color groups are not supported by UltraEdit versions prior v17.00. So you either limit the number of color groups used to 8 or you create 2 wordfiles, one with just 8 color groups (all element tags in one color group) and a second one with more than 8 color groups (several color groups for the elements).

      Attached wordfile replaced by an updated wordfile, see below.

      6
      NewbieNewbie
      6

        Jan 27, 2012#3

        Thank you for your work. That really helped me.

        I've almost finished the work, eliminated all nodes which cannot be used directly, divided the nodes in sections and added some missing nodes.
        But I still need some more help:

        Variables in KML files appear like $[varname], used in balloon windows. How do I have to define the /Variable String = ?
        There might be CDATA sections like <![CDATA[the data]]>, how to set the identification for this? I want to color them.

        6,681583
        Grand MasterGrand Master
        6,681583

          Jan 28, 2012#4

          Don't add lines starting with /Member String = or /Variable String = to your wordfile for KML. Those definitions are only for the Intellitips feature of UEStudio for some programming languages. They are useless for an XML file and are both not used for syntax highlighting.


          I uploaded the wordfile for KML with the line

          /Delimiters = " 'tab,<=>

          With that definition of word delimiting characters a string like $[varname] is interpreted by the syntax highlighting engine as "word" if surrounded by those characters.

          So you can define a color group with a substring definition to highlight all "words" starting with $[ using a substring definition.

          /C8"Variables" STYLE_VARIABLE
          ** $[


          ** at beginning of a line in the wordfile means highlight all lines starting with the characters as defined on this line separated by a space character. If such variables can exist also in the middle of a text without a delimiter character on right and/or left side, you could probably add $ and ] to the list of delimiters and add ] also to the color group for variables.


          A character data section <![CDATA[the data]]> can span also over multiple lines according to XML CDATA. I suggest to use the alternate block comment to syntax highlight character data sections. The alternate block comment definition must be added to the first line.

          /L20"KML" XML_LANG Noquote Block Comment On = <!-- Block Comment Off = --> Block Comment On Alt = <![CDATA[ Block Comment Off Alt = ]]> File Extensions = KML

          For the alternate block comment a separate color can be customized in the syntax highlighting configuration dialog.

          6
          NewbieNewbie
          6

            Jan 31, 2012#5

            Yeah, that works. Many, many thanks.

            I will test the kml wordfile for a while. When it's optimized, I'll load it up to the repository for wordfiles.

            Here is my wordfile for KML V 2.2. I called it beta. It seems to work well, but maybe you can add some improvements.
            I added a sample kml from google you can download at

            http://code.google.com/p/kml-samples/

            as a reference to check the wordfile. Thank you for looking at the file.

            Sample KML file and wordfile removed, see below.

            6,681583
            Grand MasterGrand Master
            6,681583

              Feb 01, 2012#6

              I looked on your beta version of the KML wordfile first by using the macros SortLanguage, TestForDuplicate and TestForInvalid from the ultimate syntax highlighting tools. TestForDuplicate reported following:

              Code: Select all

              Sorry! Found following duplicate words:
              
              <leftFov> -> in /C3
              <leftFov> -> in /C5
              
              </leftFov> -> in /C3
              </leftFov> -> in /C5
              
              <overlayXY> -> in /C5
              <overlayXY> -> in /C5
              
              </overlayXY> -> in /C5
              </overlayXY> -> in /C5
              I removed useless <leftFov> and </leftFov> from color group Geo & View because UltraEdit uses always the color of the group with lower number if a word is defined twice in two different color groups.

              I was a little bit confused on <overlayXY> and </overlayXY> because after using macro SortLanguage it is not possible that the same word exists twice in the same color group. But then I detected that you have used /C5 for Geo & View and for Appearence. I moved <kml and </kml> of first color group to color group KML Nodes, removed /C1"ROOT element" and renumbered the first 4 remaining color groups to fix this issue.

              Next I used your example KML file and the small one I mentioned in my first post to validate the tags. I made some corrections for some tags and added some attributes and values to /C8. I also added $ to the list of word delimiting characters for variables highlighting although I could find such variables only in character data sections which are highlighted completely with the alternate block comment color.

              In the attached ZIP file there is updated kml2.2beta.uew with your color and font style settings for C1 to C6. For some unknown reason the color and font style settings for C7, C8 and the standard color groups are missing. You should set the colors for the other groups also in the Syntax Highlighting configuration dialog.

              Second file kml2.2beta_nocolors.uew is like updated kml2.2beta.uew, but without any color and font style settings created by running macro SettingsDelAll from SyntaxTools.mac on the wordfile and saving the modified wordfile with a different name. Please do the same before you send the final KML wordfile to IDM for the wordfiles download page.
              kml_wordfile_2.zip (4.09 KiB)   429
              Updated wordfile for KML

              6
              NewbieNewbie
              6

                Feb 01, 2012#7

                Hm, shame on me. How much easier is the work with the fantastic macros. I tried to eliminate duplicates manually, but machines can do this better. I understand your correction method for the tags, but the color management is still very confusing. UE is not our main editor. We normally use an IDE for XML work. UE is the editor for the quick work "in the field", so we are not that deep in it's structure and functionality. Thank you for your work.

                Yes, in the sample file the variables are within a CDATA tag, but that is only one solution. Variables are built for extending the KML XSD with custom data structures and display the data via the variables in bubble windows in Google Earth. This is done with styles. CDATA is often used in styles when HTML tags are part of them.

                We will upload the version without colors. The KML syntax is a standard for exchanging data and is used very often, not only for building Google Earth files. I hope the KML wordfile will be welcomed by the UE users.

                Thank you again for your great work.

                  Feb 01, 2012#8

                  I uploaded the KML wordfile and a tag list, too.

                  Have fun.

                  1

                    Jun 25, 2012#9

                    Hi Tribun

                    Where can I find the uploaded KML wordfile?

                    (I am trying to edit and import a number of locations (lat and long) with headings - I need to display these headings in Google Earth.)

                    Thanks and best regards,

                    Rean

                    6
                    NewbieNewbie
                    6

                      Jun 26, 2012#10

                      Hello reanbootsma,

                      I sent the file to the IDM support team on Feb 1st 2012, but it seems they never added it to the wordfiles. So I sent it to them again today.

                      The file I sent is attached to this message. It contains the tag list file kml2.2.txt and the syntax highlighting wordfile kml2.2nocolors.uew.

                      Update: The wordfile kml2.uew was updated on 2013-05-10 once more and can be downloaded from page User-submitted wordfiles for UltraEdit/UEStudio. It is listed with name KML 2.2. The wordfile in the attached ZIP file is not the latest version anymore. But the tag list file in ZIP file is still up-to-date.
                      kml2.2nocolors.zip (4.33 KiB)   404