XML-Schema

Home Forums cherrytree XML-Schema

This topic contains 8 replies, has 4 voices, and was last updated by  acry 3 months, 1 week ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #125029

    acry
    Member

    Hi again,

    I want to write an XSL Tranformation Sheet for DTD:Doctype to Cherrytree-XML,
    because I have a bunch of reference manuals I want to put into a Cherrytree-
    File.

    But before I do that I want to be able to validate the result, so wrote an XML
    Schema. You can find the xsd in my github repo.

    https://github.com/Acry/CT-Z-Sandbox/blob/master/ct.xsd

    Since I am not a Webdeveloper I ask for your thoughts, code-review and maybe
    some help.

    I was able to validate my C-Knowledge DB.

    $ ls -lh C-KDB.ctd 
    163M C-KDB.ctd

    -about 3.3k nodes

    xmllint --huge --stream --noout --schema ct.xsd C-KDB.ctd
    C-KDB.ctd validates

    –Cheers,
    Cass aka. Acry

    #125137

    jeremyp
    Member

    Hi,

    I don’t know if you’ve made further progress on this. I did want to let you know that I am placing CherryTree/OneNote work on my calendar for 12/24 – 1/1. So, if you have anything new, let me know. Otherwise, if you have the time and want to actively work on it collaboratively during that time-frame, also let me know.

    Edit: oops, I was referring to OneNote -> CherryTree functionality specifically, not necessarily what you are referring to in this post, sorry!

    Thanks!
    Jeremy

    • This reply was modified 6 months, 2 weeks ago by  jeremyp.
    #125139

    acry
    Member

    Hi,
    No problem. I am finishing the proof of concept code on tags TextMarks, TextIters, TextTags in my code base. After that I am reflecting the deep forest to the sqlite DB with a closure table. Then I need to patch those changes into my CT dev version. I hope I can work on XLST between that time also.

    Cheers,
    Cass

    #125207

    eureka
    Member

    I am just popping back to the forum to explore anything new.

    XML Copy Editor is a useful tool for validating XML files and can open *.ctd files.

    http://xml-copy-editor.sourceforge.net/

    Another tip is to upload cherrytree files as documents in collections in eXist-db. See the examples.

    http://exist-db.org/exist/apps/homepage/index.html

    #125214

    johnp
    Member

    Hi @acry
    What system will you be moving these reference manuals from? What is the current format that they are in and that you will be transforming from?
    I, like @jeremyp, am interested in working on a conversion from OneNote to CT. But I am not sure if any of your XSL transformations will apply to us.

    #125234

    acry
    Member

    An XML-Schema is used to describe the layout of the context and can be used to validate it.
    Another use-case is to transform (that is what XSLT is for) from one xml-layout to any kind of data-layout.

    A Cherrytree *.ctd is an XML-File and Onenote can export to XML.
    So transforming back and forth is possible with the right xsl file and two valid Schemas.

    XSLT is quite powerful and with that comes complexity. If I manage to import a docbook I’ll make the xsd-file available.

    Actually my pointing to an XML-Schema is an ask for help with XML/XSLT. So if anyone is quite comfortable using XSLT/XPath I’d be happy if you contact me.

    Even so PyGTK is pretty outdated it is still quite powerful, I solved some issues that been bugging me for ages, like having pixmaps at any places without affecting line/font-size.

    I really do not like all those browser based working/searching(stackoverflow), web-clipping and we all know that lists do not scale very well, that is why we prefer a Tree (aka directed Graph), circular would be even better – and that is why some of us use CT.

    Hope I can go into more detail soon (in a rush atm) with a short video about my efforts, since my repository is in an insane state and I may be not able to push the next two months.
    My View was the code of pygtk-demo which is pretty handy for a few demos, but it does not scale well either from user perspective. My codebase now has 60 directories and 1079 files – need a better solution, since I want to integrate the PyGTK-reference manual/PyGTK-FAQ and PyGTK-Tutorial with the codebase – before I move on. Those are either XML or html.

    Enjoy your day,
    Acry

    #125236

    johnp
    Member

    Hi @acry – I’ve worked with XML/XSLT/XPATH. I believe that you are confusing issues by discussing pygtk (Python wrappers for the GTK+ graphical user interface library). Converting from one XML format to another is not related to this.

    To do the conversion, you can use any XSLT processor that you prefer and in any language that you prefer. And you DO NOT need to use whatever language CT is written. The conversion can be done independently. If you prefer Pyhon, I believe there are a number of XSLT processors available, including the one that is part of its XML Core services package. (I do not myself program in Python.)

    You seemed to have answered my prior question about “what format are your manuals in?”. You mentioned you are converting docbook manuals.

    docbook uses XML tags like: book, chapter, part, article, chapter, appendix, para, etc.

    Your main work in converting from docbook to CT XML will be deciding how each tag in docbook will be mapped to the XML used by CT.
    This work will be different than the work involved in mapping each tag in OneNote to a corresponding tag in CT.
    Some tags may map fine with no problems. Some tags may not map at all.

    EDIT: I suggest that you first write your XSLT transformations using an online tool like: http://xslttest.appspot.com/ or https://www.freeformatter.com/xsl-transformer.html
    You can then later write some Python code to execute your transformations after you have them working.

    John

    • This reply was modified 3 months, 1 week ago by  johnp.
    • This reply was modified 3 months, 1 week ago by  johnp.
    #125239

    acry
    Member

    I know exactly what I am talking about and I know that a online fiddle tool exists for nearly everything.

    I do it with a few lines of codes:

    from lxml import etree
    dom = etree.parse("any.xml")
    xslt = etree.parse("any.xsl")
    transform = etree.XSLT(xslt)
    result = transform(dom)
    print(result)

    But as long CT uses PyGTK it is involved also. Btw: I was using docbook like ten years ago.
    But if you worked professional with that stuff you should be able to write a proper conversion file in no time. So why are we talking then?

    #125240

    acry
    Member

    I was mixing, but not confusing topics to save my time.

    OneNote to CT is a requested feature (__very__ important imo (import and export)).

    CT uses xml already!!! -> modules/imports.py:import xml.dom.minidom

    Using a module or script and dedicated xsd’s can do a headless transformation – no CT launch necessary (also requested feature). Having a tools or script dir like in future/scripts is quite common and useful.

    CT uses https://developer.gnome.org/pygtk/stable/class-gtktreemodel.html for internal mappings. And that is why I was mixing in PyGTK. GTK+ is more than a GUI-TK, access to the GLib https://developer.gnome.org/glib/ is just one thing.

    Cheers,
    Acry

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.