Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocBookDialect |
|
| 1.0;1 |
1 | /************************************************************************** | |
2 | OmegaT - Computer Assisted Translation (CAT) tool | |
3 | with fuzzy matching, translation memory, keyword search, | |
4 | glossaries, and translation leveraging into updated projects. | |
5 | ||
6 | Copyright (C) 2000-2006 Keith Godfrey and Maxym Mykhalchuk | |
7 | 2007 Didier Briel | |
8 | 2008 Fabian Mandelbaum, Didier Briel | |
9 | Home page: http://www.omegat.org/ | |
10 | Support center: http://groups.yahoo.com/group/OmegaT/ | |
11 | ||
12 | This program is free software; you can redistribute it and/or modify | |
13 | it under the terms of the GNU General Public License as published by | |
14 | the Free Software Foundation; either version 2 of the License, or | |
15 | (at your option) any later version. | |
16 | ||
17 | This program is distributed in the hope that it will be useful, | |
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | GNU General Public License for more details. | |
21 | ||
22 | You should have received a copy of the GNU General Public License | |
23 | along with this program; if not, write to the Free Software | |
24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 | **************************************************************************/ | |
26 | ||
27 | package org.omegat.filters3.xml.docbook; | |
28 | ||
29 | import java.util.regex.Pattern; | |
30 | ||
31 | import org.omegat.filters3.xml.DefaultXMLDialect; | |
32 | ||
33 | /** | |
34 | * This class specifies DocBook XML Dialect. | |
35 | * | |
36 | * @author Maxym Mykhalchuk | |
37 | * @author Didier Briel | |
38 | * @author Fabian Mandelbaum | |
39 | */ | |
40 | public class DocBookDialect extends DefaultXMLDialect { | |
41 | 3605 | public static final Pattern DOCBOOK_PUBLIC_DTD = Pattern.compile("-//OASIS//DTD DocBook.*"); |
42 | 3605 | public static final Pattern DB5_XMLNS = Pattern |
43 | .compile("xmlns(:\\w+)?=\"http://docbook.org/ns/docbook\""); | |
44 | 3688 | private String nsString = null; // the value of the NS, if any |
45 | ||
46 | 3688 | public DocBookDialect() { |
47 | 3688 | defineConstraint(CONSTRAINT_PUBLIC_DOCTYPE, DOCBOOK_PUBLIC_DTD); |
48 | ||
49 | 3688 | defineParagraphTags(new String[] { "book", "bookinfo", "title", "subtitle", "authorgroup", "author", |
50 | "firstname", "surname", "affiliation", "orgname", "address", "email", "edition", "pubdate", | |
51 | "copyright", "year", "holder", "isbn", "keywordset", "keyword", "preface", "title", "para", | |
52 | "chapter", "table", "tgroup", "thead", "tbody", "row", "entry", "revhistory", "revision", | |
53 | "revnumber", "date", "authorinitials", "revremark", "itemizedlist", "listitem", "member", }); | |
54 | ||
55 | 3688 | defineOutOfTurnTags(new String[] { "indexterm", }); |
56 | ||
57 | 3688 | definePreformatTags(new String[] { "screen", "programlisting", }); |
58 | ||
59 | 3688 | defineTranslatableAttributes(new String[] { "url", "lang", "xml:lang" }); |
60 | ||
61 | 3688 | } |
62 | ||
63 | // TODO: Can we can read db xml content here to try to determinate if | |
64 | // the root element has a NS declaration to be able to handle | |
65 | // namespaced-tags properly? We'd actually need to read only the | |
66 | // root element together with its attributes. | |
67 | } |