On Fri, 30 Sep 2011 06:52:13 -0700 (PDT)
Todd Mars wrote:
> I'm playing with xml @auto import. (using @settings @data
> import_xml_tags)
Just so you know, there's also the xml_edit plugin, which works with
the attrib_edit plugin.
Provides commands (Alt-x) for importing and exporting XML from a Leo
outline. These commands are to XML what ``@auto-rst`` is to
reStructuredText.
``xml2leo`` imports an .xml file into the node following the currently
selected node. ``leo2xml`` exports the current subtree to an .xml file
the user selects.
``xml_validate``, if executed on the top node in the
Leo xml tree, reports any errors in XML generation or DTD validation,
based on the DTD referenced from the XML itself. If there's no DTD
it reports that as an error.
``leo2xml2leo`` takes the selected Leo subtree representing an XML file,
converts it to XML internally, and then creates a new Leo subtree from
that XML after the original, with 'NEW ' at the start of the top node's
name. This updates all the headlines, so that the convenience only
previews (see below) are updated. The original can be deleted if the
new subtree seems correct.
Conventions
===
This is a valid XML file::
Here's some text
Note the processing instruction (xml-stylesheet), the DTD (DOCTYPE),
the trailing comment (after the closing tag), and the pernicious
mixed content (three separate pieces of text in the element).
These commands attempt to deal with all of this.
- A top level Leo node is created to hold these top level parts. Its
headline is the basename of the file.
- The xml declaration is placed in the body of
this top level Leo node
- Below that, in the same body text, appears a simple namespace map::
http://example.com/
other: http://other.com/
...
i.e. the default namespace first, and then any prefixed name spaces.
- Below that, in the same body text, appears the ``DOCTYPE`` declaration
- Children are added to this top level Leo node to represent the
top level elements in the xml file. Headlines have the following
meanings:
- ``? pi-target some="other" __CHK`` - i.e. questionmark,
space, name of processing instruction target, start of processing
instruction content. Only the questionmark, which indicates
the processing instruction, and the first word, which indicates
the processing instruction target, matter. The remainder is just
a convenience preview of the processing instruction content, which
is the Leo node's body text.
- ``# This is *really* imp`` - i.e. hash,
space, start of comment content. Only the hash, which indicates
the comment, matters. The remainder is just
a convenience preview of the comment content, which
is the Leo node's body text.
- ``tagname name_attribute start of element text`` - i.e. the name
of an element followed by a convenience preview of the element's
text content. If the element has a ``name`` attribute that's
included at the start of the text preview. Only the first word
matters, it's the name of the element.
- Element's text is placed in the Leo node's body. If the element has
tailing text (the ``" text"`` tailing the element
in the above example), that occurs in the Leo node's body separated
by the `tailing text sentinel`::
@TAIL_TEXT___
- Element's attributes are stored in a dict ``p.v.u['_XML']['_edit']``
on the Leo node. ``'_XML'`` is the uA prefix for these commands, and
``'_edit'`` is used by the ``attrib_edit`` plugin to identify
attributes it should present to the user for editing. The
``attrib_edit`` plugin **should be enabled** and its ``v.u mode``
activated (through its submenu on the Plugins menu). The attribute
edit panel initially appears as a tab in the log pane, although it
can be moved around by right clicking on the pane dividers if the
``viewrendered`` and ``free_layout`` plugins are enabled.
Cheers -Terry
> I'm wondering about what we old folks used to call transfer edit. Read
> one file but Write a different one, transferring so that the original
> is not clobbered!
>
> Make any sense?
> todd.
>
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.