OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] How to programmatically get a list of elements of DocBook 4 and DocBook 5?


Hi Bob,

On Mon, 26 Nov 2012 08:53:12 -0800
"Bob Stayton" <bobs@sagehill.net> wrote:

> You might also investigate the XML-related Perl modules at CPAN.  They are 
> probably in better shape.
> 

thanks for the hint. After playing with several DTD parser modules on CPAN, I
realised that none of them could do what I want. However, eventually I found
out that python-lxml (based on libxml2) could do that and provided some routines
for DTD introspection. So I wrote a python program to do that, and called it
from the rest of the code, which was written in Perl and Bash (don't you love
UNIX?) and eventually it worked.

You can find what I have here:

https://bitbucket.org/shlomif/vim-docbook-5-support

Anyway, since python-lxml appears to have this feature which is not present in
XML::LibXML, I guess it is my job as the latter's maintainer to add it. I
guess I could use python-lxml's code as a reference or (licence permitting)
even copy+paste+adapt code.  

Thanks!

Regards,

	Shlomi Fish

> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
> 
> --------------------------------------------------
> From: "Shlomi Fish" <shlomif@shlomifish.org>
> Sent: Monday, November 26, 2012 1:14 AM
> To: "Bob Stayton" <bobs@sagehill.net>
> Cc: <docbook-apps@lists.oasis-open.org>
> Subject: Re: [docbook-apps] How to programmatically get a list of elements 
> of DocBook 4 and DocBook 5?
> 
> > Hi Bob,
> >
> > On Sun, 25 Nov 2012 09:29:17 -0800
> > "Bob Stayton" <bobs@sagehill.net> wrote:
> >
> >> Hi Shlomi,
> >> If you don't mind working in Perl, my LiveDTD Perl program parses a DTD 
> >> and
> >> creates a @ELEMENT array that includes all the active element names.  You
> >> could use part of that program to generate your list.  It is available 
> >> for
> >> free from here:
> >>
> >> http://www.sagehill.net/livedtd/
> >>
> >
> > I see. Well, I don't mind working with Perl, as my code there is already 
> > in
> > Perl and Bash, and I've worked with Perl since 1996.
> >
> > However, I do wish there was an easier way to introspect the DTD than
> > tweaking the code of a monolithic program, which suffers from many bad
> > programming habits:
> >
> > * http://perl-begin.org/tutorials/bad-elements/ (my link)
> >
> > * http://www.slideshare.net/thaljef/cpan-for-private-code
> >
> > *
> > http://www.theopensourceway.org/book/The_Open_Source_Way-How_to_tell_if_a_FLOSS_project_is_doomed_to_FAIL.html
> >
> > BTW, what is the licence of this code? The first paragraph is similar to 
> > the
> > MIT/X11 licence (see http://en.wikipedia.org/wiki/MIT_License ) but it has 
> > some
> > other paragraphs following it.
> >
> > Regards,
> >
> > Shlomi Fish
> >
> >> Bob Stayton
> >> Sagehill Enterprises
> >> bobs@sagehill.net
> >>
> >> --------------------------------------------------
> >> From: "Shlomi Fish" <shlomif@shlomifish.org>
> >> Sent: Saturday, November 24, 2012 11:32 PM
> >> To: <docbook-apps@lists.oasis-open.org>
> >> Subject: [docbook-apps] How to programmatically get a list of elements of
> >> DocBook 4 and DocBook 5?
> >>
> >> > Hi all,
> >> >
> >> > here:
> >> >
> >> > https://bitbucket.org/shlomif/vim-docbook-5-support
> >> >
> >> > I have a repository where I am trying to get a machine readable list of
> >> > DocBook
> >> > 4 and DocBook 5 elements. What I have done of parsing the DocBook 5's 
> >> > RNG
> >> > appears to work fine, but I'm having trouble with parsing the DocBook 4
> >> > RNGs
> >> > from
> >> > http://www.docbook.org/rng/4.5/ and some elements, suck as <ulink /> 
> >> > are
> >> > missing. Should I just parse and extract <element name=..."> from all 
> >> > the
> >> > RNG
> >> > fragments and then concatenate them and remove duplicates? Or is there 
> >> > a
> >> > better
> >> > way?
> >> >
> >> > I tried to find a way to extract this information out of the DocBook 
> >> > 4.x
> >> > DTD,
> >> > but could not find a DTD parser that allowed for introspection.
> >> >
> >> > Regards,
> >> >
> >> > Shlomi Fish
> >> >
> >> > -- 
> >> > -----------------------------------------------------------------
> >> > Shlomi Fish       http://www.shlomifish.org/
> >> > First stop for Perl beginners - http://perl-begin.org/
> >> >
> >> > Chuck Norris can read Perl code that was RSA encrypted.
> >> >
> >> > Please reply to list if it's a mailing list post - 
> >> > http://shlom.in/reply .
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> >> > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
> >> >
> >> >
> >> >
> >
> >
> >
> > -- 
> > -----------------------------------------------------------------
> > Shlomi Fish       http://www.shlomifish.org/
> > First stop for Perl beginners - http://perl-begin.org/
> >
> > <Botje>  Khisanth =~ s/must sleep/must give Botje all my money/ .
> >    — Freenode’s #perl
> >
> > Please reply to list if it's a mailing list post - http://shlom.in/reply .
> >
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
> 



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

God gave us two eyes and ten fingers so we will type five times as much as we
read.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]