Example #1
0
        public virtual void testContentData()
        {
            d = new JDFDoc("JDF");
            n = d.getJDFRoot();
            n.setType(EnumType.Approval);
            JDFRunList rl = (JDFRunList)n.addResource(ElementName.RUNLIST, EnumUsage.Input);

            pl = rl.appendPageList();
            pl.makeRootResource("PageList", null, true);

            cl = pl.appendContentList();
            cl.makeRootResource("ContentList", null, true);
            JDFContentData cd0 = cl.appendContentData();

            cd0.setAttribute(AttributeName.CONTENTLISTINDEX, "1 2 3");
            KElement book = cd0.appendElement("ContentMetaData");

            book.setAttribute("ISBN", "0123456789");
            JDFComment abstrakt = (JDFComment)book.appendElement("Comment");

            abstrakt.setName("Abstract");
            abstrakt.setText("Abstract of the book\nin english");
            JDFEmployee editor = (JDFEmployee)book.appendElement(ElementName.EMPLOYEE);

            editor.appendPerson().setFamilyName("authorName");
            editor.setRoles(new VString("Editor", null));
            book.setAttribute("Title", "book thing");
            int p = 1;

            for (int i = 1; i < 4; i++)
            {
                JDFContentData cd = cl.appendContentData();
                cd.setAttribute("ID", "CD_" + i);
                KElement chap = cd.appendElement("ContentMetaData");
                chap.setAttribute("Title", "Chapter " + i);
                JDFEmployee author = (JDFEmployee)chap.appendElement(ElementName.EMPLOYEE);
                author.appendPerson().setFamilyName("authorName" + i);
                author.setRoles(new VString("Author", null));

                JDFPageData         pd = pl.appendPageData();
                JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList();
                integerRangeList.Append(p, p + i);
                p += i + 1;
                pd.setAttribute("PageIndex", integerRangeList.ToString());
                JDFPageElement pe = pd.appendPageElement();
                pe.setAttribute("ContentDataRefs", cd.getID());
            }
            pl.setXMLComment("Note that multiple page elements may but need not be specified\nit is also possible to reference only on pageEleemnt that spans the entire book");

            d.write2File(sm_dirTestDataTemp + "ContentMetaData.jdf", 2, false);
        }