gmazza 2005/01/05 16:56:26 Modified: examples/fo/advanced cid-fonts.fo examples/fo/basic pdfoutline.fo src/java/org/apache/fop/fo Constants.java FOElementMapping.java FOTreeBuilder.java FObj.java FObjMixed.java PropertySets.java src/java/org/apache/fop/fo/extensions ExtensionElementMapping.java src/java/org/apache/fop/fo/flow InlineLevel.java src/java/org/apache/fop/fo/pagination/bookmarks Bookmark.java BookmarkTree.java Added: src/java/org/apache/fop/fo/pagination/bookmarks BookmarkTitle.java Removed: src/java/org/apache/fop/fo/extensions Label.java Log: 1.) fox:label converted to 1.1 fo:bookmark-title. 2.) FObj, FObjMixed, InlineLevel made abstract. Revision Changes Path 1.6 +16 -17 xml-fop/examples/fo/advanced/cid-fonts.fo Index: cid-fonts.fo =================================================================== RCS file: /home/cvs/xml-fop/examples/fo/advanced/cid-fonts.fo,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- cid-fonts.fo 4 Jan 2005 00:21:46 -0000 1.5 +++ cid-fonts.fo 6 Jan 2005 00:56:25 -0000 1.6 @@ -2,8 +2,7 @@ <!DOCTYPE fo:root [ <!ENTITY nbsp " "> ]> -<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" - xmlns:fox="http://xml.apache.org/fop/extensions"> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="A4" page-width="21cm" @@ -18,61 +17,61 @@ <fo:bookmark-tree> <fo:bookmark internal-destination="sec0"> - <fox:label>Adding Fonts to FOP</fox:label> + <fo:bookmark-title>Adding Fonts to FOP</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec1"> - <fox:label>Adding additional Type 1 fonts</fox:label> + <fo:bookmark-title>Adding additional Type 1 fonts</fo:bookmark-title> <fo:bookmark internal-destination="sec1-1"> - <fox:label>Generating a font metrics file</fox:label> + <fo:bookmark-title>Generating a font metrics file</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec1-2"> - <fox:label>Register the fonts within FOP</fox:label> + <fo:bookmark-title>Register the fonts within FOP</fo:bookmark-title> </fo:bookmark> </fo:bookmark> <fo:bookmark internal-destination="sec2"> - <fox:label>Adding additional TrueType fonts</fox:label> + <fo:bookmark-title>Adding additional TrueType fonts</fo:bookmark-title> <fo:bookmark internal-destination="sec2-1"> - <fox:label>Generating a font metrics file</fox:label> + <fo:bookmark-title>Generating a font metrics file</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec2-2"> - <fox:label>TrueType collections</fox:label> + <fo:bookmark-title>TrueType collections</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec2-3"> - <fox:label>Register the fonts within FOP</fox:label> + <fo:bookmark-title>Register the fonts within FOP</fo:bookmark-title> </fo:bookmark> </fo:bookmark> <fo:bookmark internal-destination="sec3"> - <fox:label>Embedding fonts in the PDF</fox:label> + <fo:bookmark-title>Embedding fonts in the PDF</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4"> - <fox:label>Example embedding MSGothic</fox:label> + <fo:bookmark-title>Example embedding MSGothic</fo:bookmark-title> <fo:bookmark internal-destination="sec4-1"> - <fox:label>Setup CLASSPATH</fox:label> + <fo:bookmark-title>Setup CLASSPATH</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4-2"> - <fox:label>Create the metrics file</fox:label> + <fo:bookmark-title>Create the metrics file</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4-3"> - <fox:label>Edit msgothic.xml</fox:label> + <fo:bookmark-title>Edit msgothic.xml</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4-4"> - <fox:label>Register the font with FOP</fox:label> + <fo:bookmark-title>Register the font with FOP</fo:bookmark-title> </fo:bookmark> </fo:bookmark> <fo:bookmark internal-destination="sec5"> - <fox:label>Japanese Examples</fox:label> + <fo:bookmark-title>Japanese Examples</fo:bookmark-title> </fo:bookmark> </fo:bookmark-tree> 1.7 +110 -130 xml-fop/examples/fo/basic/pdfoutline.fo Index: pdfoutline.fo =================================================================== RCS file: /home/cvs/xml-fop/examples/fo/basic/pdfoutline.fo,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- pdfoutline.fo 4 Jan 2005 00:21:46 -0000 1.6 +++ pdfoutline.fo 6 Jan 2005 00:56:25 -0000 1.7 @@ -11,141 +11,121 @@ - fo:page-number-citation (computes dynamically the page number in section 'content') --> -<!-- note the extensions namespace (fox) --> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> -<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" - xmlns:fox="http://xml.apache.org/fop/extensions"> - <fo:layout-master-set> - - <!-- layout for the first page --> - <fo:simple-page-master master-name="first" - page-height="29.7cm" - page-width="21cm" - margin-top="1cm" - margin-bottom="2cm" - margin-left="2.5cm" - margin-right="2.5cm"> - <fo:region-body margin-top="3cm"/> - <fo:region-before extent="3cm"/> - <fo:region-after extent="1.5cm"/> - </fo:simple-page-master> - - <!-- layout for the other pages --> - <fo:simple-page-master master-name="rest" - page-height="29.7cm" - page-width="21cm" - margin-top="1cm" - margin-bottom="2cm" - margin-left="2.5cm" - margin-right="2.5cm"> - <fo:region-body margin-top="2.5cm"/> - <fo:region-before extent="2.5cm"/> - <fo:region-after extent="1.5cm"/> - </fo:simple-page-master> - - <fo:page-sequence-master master-name="basicPSM" > - <fo:repeatable-page-master-alternatives> - <fo:conditional-page-master-reference master-reference="first" - page-position="first" /> - <fo:conditional-page-master-reference master-reference="rest" - page-position="rest" /> - <!-- recommended fallback procedure --> - <fo:conditional-page-master-reference master-reference="rest" /> - </fo:repeatable-page-master-alternatives> - </fo:page-sequence-master> - - </fo:layout-master-set> - <!-- end: defines page layout --> - - -<!-- bookmark section --> - <fo:bookmark-tree> - <fo:bookmark internal-destination="sec1"> - <fox:label>What is FOP?</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec2"> - <fox:label>Downloading FOP</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec3"> - <fox:label>Running FOP</fox:label> - - <fo:bookmark internal-destination="sec3-1"> - <fox:label>Prerequisites</fox:label> - - <fo:bookmark internal-destination="sec3-1-1"> - <fox:label>Java 1.1</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec3-1-2"> - <fox:label>XML Parser</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec3-1-3"> - <fox:label>XSLT Processor</fox:label> - </fo:bookmark> - + <fo:layout-master-set> + <!-- layout for the first page --> + <fo:simple-page-master master-name="first" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="2.5cm" + margin-right="2.5cm"> + <fo:region-body margin-top="3cm"/> + <fo:region-before extent="3cm"/> + <fo:region-after extent="1.5cm"/> + </fo:simple-page-master> + + <!-- layout for the other pages --> + <fo:simple-page-master master-name="rest" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="2.5cm" + margin-right="2.5cm"> + <fo:region-body margin-top="2.5cm"/> + <fo:region-before extent="2.5cm"/> + <fo:region-after extent="1.5cm"/> + </fo:simple-page-master> + + <fo:page-sequence-master master-name="basicPSM" > + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference master-reference="first" + page-position="first" /> + <fo:conditional-page-master-reference master-reference="rest" + page-position="rest" /> + <!-- recommended fallback procedure --> + <fo:conditional-page-master-reference master-reference="rest" /> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + + + <!-- bookmark section --> + <fo:bookmark-tree> + <fo:bookmark internal-destination="sec1"> + <fo:bookmark-title>What is FOP?</fo:bookmark-title> </fo:bookmark> - - <fo:bookmark internal-destination="sec3-2"> - <fox:label>Starting FOP</fox:label> + <fo:bookmark internal-destination="sec2"> + <fo:bookmark-title>Downloading FOP</fo:bookmark-title> </fo:bookmark> - - </fo:bookmark> - - <fo:bookmark internal-destination="sec4"> - <fox:label>Embedding FOP</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec5"> - <fox:label>What's Implemented?</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec6"> - <fox:label>Limitations</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec7"> - <fox:label>Bugs</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec8"> - <fox:label>Compiling FOP</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec9"> - <fox:label>Getting Involved</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec10"> - <fox:label>FOP Relevant Specifications</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec11"> - <fox:label>License</fox:label> - </fo:bookmark> - </fo:bookmark-tree> - - <!-- actual layout --> - <fo:page-sequence master-reference="basicPSM"> - - -<fo:static-content flow-name="xsl-region-before"> -<fo:block text-align="end" font-size="10pt" font-family="serif" line-height="14pt" color="red" > -This is not the latest Fop documentation, but just an fo example. FOP - p. <fo:page-number/> -</fo:block> -</fo:static-content> - - -<fo:flow flow-name="xsl-region-body"> - -<fo:block id="secA" font-size="18pt" font-family="sans-serif" line-height="24pt" space-after.optimum="15pt" background-color="blue" color="white" text-align="center" padding-top="3pt">FOP: An Open-Source XSL Formatter and Renderer</fo:block> - + <fo:bookmark internal-destination="sec3"> + <fo:bookmark-title>Running FOP</fo:bookmark-title> + <fo:bookmark internal-destination="sec3-1"> + <fo:bookmark-title>Prerequisites</fo:bookmark-title> + <fo:bookmark internal-destination="sec3-1-1"> + <fo:bookmark-title>Java 1.1</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec3-1-2"> + <fo:bookmark-title>XML Parser</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec3-1-3"> + <fo:bookmark-title>XSLT Processor</fo:bookmark-title> + </fo:bookmark> + </fo:bookmark> + <fo:bookmark internal-destination="sec3-2"> + <fo:bookmark-title>Starting FOP</fo:bookmark-title> + </fo:bookmark> + </fo:bookmark> + <fo:bookmark internal-destination="sec4"> + <fo:bookmark-title>Embedding FOP</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec5"> + <fo:bookmark-title>What's Implemented?</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec6"> + <fo:bookmark-title>Limitations</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec7"> + <fo:bookmark-title>Bugs</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec8"> + <fo:bookmark-title>Compiling FOP</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec9"> + <fo:bookmark-title>Getting Involved</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec10"> + <fo:bookmark-title>FOP Relevant Specifications</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec11"> + <fo:bookmark-title>License</fo:bookmark-title> + </fo:bookmark> + </fo:bookmark-tree> + <!-- actual layout --> + <fo:page-sequence master-reference="basicPSM"> -<fo:block id="sec1" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >A) - What is FOP?</fo:block> - <fo:block space-after.optimum="3pt" font-family="serif">FOP is the world's first print formatter driven by XSL formatting - objects. It is a Java 1.1 application that reads a formatting object - tree and then turns it into a PDF document. The formatting object - tree, can be in the form of an XML document (output by an XSLT engine - like XT or Xalan) or can be passed in memory as a DOM Document or (in - the case of XT) SAX events. + <fo:static-content flow-name="xsl-region-before"> + <fo:block text-align="end" font-size="10pt" font-family="serif" line-height="14pt" color="red" > + This is not the latest Fop documentation, but just an fo example. FOP - p. <fo:page-number/> + </fo:block> + </fo:static-content> + + <fo:flow flow-name="xsl-region-body"> + + <fo:block id="secA" font-size="18pt" font-family="sans-serif" line-height="24pt" space-after.optimum="15pt" background-color="blue" color="white" text-align="center" padding-top="3pt">FOP: An Open-Source XSL Formatter and Renderer</fo:block> + + <fo:block id="sec1" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >A) + What is FOP?</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">FOP is the world's first print formatter driven by XSL formatting + objects. It is a Java 1.1 application that reads a formatting object + tree and then turns it into a PDF document. The formatting object + tree, can be in the form of an XML document (output by an XSLT engine + like XT or Xalan) or can be passed in memory as a DOM Document or (in + the case of XT) SAX events. </fo:block> <fo:block space-after.optimum="3pt" font-family="serif">FOP is part of Apache's XML project. The homepage of FOP is 1.23 +3 -2 xml-fop/src/java/org/apache/fop/fo/Constants.java Index: Constants.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Constants.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Constants.java 4 Jan 2005 00:21:46 -0000 1.22 +++ Constants.java 6 Jan 2005 00:56:25 -0000 1.23 @@ -115,7 +115,8 @@ int FO_WRAPPER = 56; int FO_BOOKMARK_TREE = 57; int FO_BOOKMARK = 58; - int FRM_OBJ_COUNT = 58; + int FO_BOOKMARK_TITLE = 59; + int FRM_OBJ_COUNT = 59; // Masks int COMPOUND_SHIFT = 9; 1.11 +7 -0 xml-fop/src/java/org/apache/fop/fo/FOElementMapping.java Index: FOElementMapping.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOElementMapping.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- FOElementMapping.java 4 Jan 2005 00:21:46 -0000 1.10 +++ FOElementMapping.java 6 Jan 2005 00:56:25 -0000 1.11 @@ -47,6 +47,7 @@ foObjs.put("color-profile", new ColorProfileMaker()); foObjs.put("bookmark-tree", new BookmarkTreeMaker()); foObjs.put("bookmark", new BookmarkMaker()); + foObjs.put("bookmark-title", new BookmarkTitleMaker()); foObjs.put("page-sequence", new PageSequenceMaker()); foObjs.put("layout-master-set", new LayoutMasterSetMaker()); foObjs.put("page-sequence-master", @@ -156,6 +157,12 @@ static class BookmarkMaker extends ElementMapping.Maker { public FONode make(FONode parent) { return new org.apache.fop.fo.pagination.bookmarks.Bookmark(parent); + } + } + + static class BookmarkTitleMaker extends ElementMapping.Maker { + public FONode make(FONode parent) { + return new org.apache.fop.fo.pagination.bookmarks.BookmarkTitle(parent); } } 1.58 +3 -2 xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java Index: FOTreeBuilder.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- FOTreeBuilder.java 28 Oct 2004 10:00:19 -0000 1.57 +++ FOTreeBuilder.java 6 Jan 2005 00:56:25 -0000 1.58 @@ -246,8 +246,9 @@ "Error: First element must be fo:root formatting object")); } } else { // check that incoming node is valid for currentFObj - if (namespaceURI.equals(FOElementMapping.URI) || - namespaceURI.equals(ExtensionElementMapping.URI)) { + if (namespaceURI.equals(FOElementMapping.URI)) { + // currently no fox: elements to validate + // || namespaceURI.equals(ExtensionElementMapping.URI) */) { try { currentFObj.validateChildNode(locator, namespaceURI, localName); } catch (ValidationException e) { 1.90 +1 -1 xml-fop/src/java/org/apache/fop/fo/FObj.java Index: FObj.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- FObj.java 3 Jan 2005 13:06:27 -0000 1.89 +++ FObj.java 6 Jan 2005 00:56:25 -0000 1.90 @@ -35,7 +35,7 @@ /** * Base class for representation of formatting objects and their processing. */ -public class FObj extends FONode implements Constants { +public abstract class FObj extends FONode implements Constants { public static PropertyMaker[] propertyListTable = null; /** The immediate child nodes of this node. */ 1.46 +1 -1 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java Index: FObjMixed.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- FObjMixed.java 24 Dec 2004 12:06:25 -0000 1.45 +++ FObjMixed.java 6 Jan 2005 00:56:26 -0000 1.46 @@ -29,7 +29,7 @@ * (i.e., those that can contain both child FO's and text nodes/PCDATA). * It should not be instantiated directly. */ -public class FObjMixed extends FObj { +public abstract class FObjMixed extends FObj { /** * @param parent FONode that is the parent of this object */ 1.15 +7 -2 xml-fop/src/java/org/apache/fop/fo/PropertySets.java Index: PropertySets.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertySets.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- PropertySets.java 4 Jan 2005 00:21:46 -0000 1.14 +++ PropertySets.java 6 Jan 2005 00:56:26 -0000 1.15 @@ -205,12 +205,17 @@ elem.addContent(Constants.FO_BOOKMARK); elem = elements[Constants.FO_BOOKMARK]; -// elem.addContent(Constants.FO_BOOKMARK_TITLE); + elem.addContent(Constants.FO_BOOKMARK_TITLE); elem.addContent(Constants.FO_BOOKMARK); elem.addProperties(CommonAccessibilityProperties); elem.addProperty(Constants.PR_EXTERNAL_DESTINATION); elem.addProperty(Constants.PR_INTERNAL_DESTINATION); elem.addProperty(Constants.PR_STARTING_STATE); + + elem = elements[Constants.FO_BOOKMARK_TITLE]; + elem.addProperties(CommonAccessibilityProperties); + elem.addProperty(Constants.PR_FONT_STYLE); + elem.addProperty(Constants.PR_FONT_WEIGHT); elem = elements[Constants.FO_PAGE_SEQUENCE]; elem.addProperty(Constants.PR_COUNTRY); 1.7 +1 -8 xml-fop/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java Index: ExtensionElementMapping.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ExtensionElementMapping.java 4 Jan 2005 00:21:46 -0000 1.6 +++ ExtensionElementMapping.java 6 Jan 2005 00:56:26 -0000 1.7 @@ -44,13 +44,6 @@ protected void initialize() { if (foObjs == null) { foObjs = new HashMap(); - foObjs.put("label", new L()); - } - } - - static class L extends ElementMapping.Maker { - public FONode make(FONode parent) { - return new Label(parent); } } } 1.3 +3 -3 xml-fop/src/java/org/apache/fop/fo/flow/InlineLevel.java Index: InlineLevel.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/InlineLevel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- InlineLevel.java 24 Dec 2004 12:06:26 -0000 1.2 +++ InlineLevel.java 6 Jan 2005 00:56:26 -0000 1.3 @@ -35,9 +35,9 @@ /** * Class modelling the commonalities of several inline-level - * formatting objects. It should not be instantiated directly. + * formatting objects. */ -public class InlineLevel extends FObjMixed { +public abstract class InlineLevel extends FObjMixed { protected CommonBorderPaddingBackground commonBorderPaddingBackground; protected CommonAccessibility commonAccessibility; protected CommonMarginInline commonMarginInline; 1.2 +33 -7 xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java Index: Bookmark.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Bookmark.java 4 Jan 2005 00:21:46 -0000 1.1 +++ Bookmark.java 6 Jan 2005 00:56:26 -0000 1.2 @@ -19,15 +19,13 @@ package org.apache.fop.fo.pagination.bookmarks; import java.util.ArrayList; - import org.xml.sax.Attributes; import org.xml.sax.Locator; - import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.extensions.Label; +import org.apache.fop.fo.ValidationException; /** @@ -36,7 +34,7 @@ * XSL 1.1 WD evolves. */ public class Bookmark extends FObj { - private Label bookmarkTitle; + private BookmarkTitle bookmarkTitle; private ArrayList childBookmarks = new ArrayList(); private String internalDestination; @@ -76,11 +74,39 @@ } /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + XSL/FOP: (bookmark-title, bookmark*) + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws ValidationException { + if (nsURI == FO_URI && localName.equals("bookmark-title")) { + if (bookmarkTitle != null) { + tooManyNodesError(loc, "fo:bookmark-title"); + } + } else if (nsURI == FO_URI && localName.equals("bookmark")) { + if (bookmarkTitle == null) { + nodesOutOfOrderError(loc, "fo:bookmark-title", "fo:bookmark"); + } + } else { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws FOPException { + if (bookmarkTitle == null) { + missingChildElementError("(bookmark-title, bookmark*)"); + } + } + + /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode obj) { - if (obj instanceof Label) { - bookmarkTitle = (Label)obj; + if (obj instanceof BookmarkTitle) { + bookmarkTitle = (BookmarkTitle)obj; } else if (obj instanceof Bookmark) { childBookmarks.add(obj); } @@ -92,7 +118,7 @@ * @return the bookmark title string or an empty string if not found */ public String getBookmarkTitle() { - return bookmarkTitle == null ? "" : bookmarkTitle.toString(); + return bookmarkTitle == null ? "" : bookmarkTitle.getTitle(); } public String getInternalDestination() { 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java Index: BookmarkTree.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BookmarkTree.java 4 Jan 2005 00:21:46 -0000 1.2 +++ BookmarkTree.java 6 Jan 2005 00:56:26 -0000 1.3 @@ -67,7 +67,7 @@ /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - XSL/FOP: (conditional-page-master-reference+) + XSL/FOP: (bookmark+) */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { 1.1 xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java Index: BookmarkTitle.java =================================================================== /* * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* $Id $ */ package org.apache.fop.fo.pagination.bookmarks; import org.xml.sax.Locator; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; /** * The fo:bookmark-title formatting object, first introduced in the * XSL 1.1 WD. Prototype version only, subject to change as XSL 1.1 WD * evolves. */ public class BookmarkTitle extends FObj { private String title = ""; /** * Create a new BookmarkTitle object. * * @param parent the fo node parent */ public BookmarkTitle(FONode parent) { super(parent); } /** * Add the characters to this BookmarkTitle. * The text data inside the BookmarkTitle xml element * is used for the BookmarkTitle string. * * @param data the character data * @param start the start position in the data array * @param end the end position in the character array * @param locator location in fo source file. */ protected void addCharacters(char data[], int start, int end, PropertyList pList, Locator locator) { title += new String(data, start, end - start); } /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: empty */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { invalidChildError(loc, nsURI, localName); } /** * Get the title for this BookmarkTitle. * * @return the bookmark title */ public String getTitle() { return title; } /** * @see org.apache.fop.fo.FObj#getName() */ public String getName() { return "fo:bookmark-title"; } /** * @see org.apache.fop.fo.FObj#getNameId() */ public int getNameId() { return FO_BOOKMARK_TITLE; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]