Package org.dom4j

Examples of org.dom4j.DocumentType


            reader.setEntityResolver(new JBossEntityResolver());

            // get the element and start parsing...
            Document doc = reader.read(url);
            element = doc.getRootElement();
            DocumentType type = doc.getDocType();

            version = validateVersionString(type.getPublicID());
            if (version == NO_VERSION)
            {
               version = validateVersionString(type.getSystemID());
            } // end of if ()

         }
         else
         {
View Full Code Here


            Document document = reader.read(url);

            println("Document URI: " + document.getName());

            // now lets set a doc type if one isn't set
            DocumentType docType = document.getDocType();
            if (docType == null) {
                println("Adding an NITF doc type");
                document.addDocType("nitf", null, "nitf.dtd");
            }
View Full Code Here

         * accepts only the elementName property. This is used when only an
         * internal DTD subset is being provided via the <!DOCTYPE foo [...]>
         * syntax, in which case there is neither a SYSTEM nor PUBLIC
         * identifier.
         */
        DocumentType expected = new DefaultDocumentType();

        expected.setElementName("greeting");

        expected.setInternalDeclarations(getInternalDeclarations());

        /*
         * Parse the test XML document and compare the expected and actual
         * DOCTYPEs.
         */
 
View Full Code Here

     */
    public void testExternalDTDSubset() {
        /*
         * Setup the expected DocumentType.
         */
        DocumentType expected = new DefaultDocumentType("another-greeting",
                null, DTD_SYSTEM_ID);

        expected.setExternalDeclarations(getExternalDeclarations());

        /*
         * Parse the test XML document and compare the expected and actual
         * DOCTYPEs.
         */
 
View Full Code Here

     */
    public void testMixedDTDSubset() {
        /*
         * Setup the expected DocumentType.
         */
        DocumentType expected = new DefaultDocumentType("another-greeting",
                null, DTD_SYSTEM_ID);

        expected.setInternalDeclarations(getInternalDeclarations());

        expected.setExternalDeclarations(getExternalDeclarations());

        /*
         * Parse the test XML document and compare the expected and actual
         * DOCTYPEs.
         */
 
View Full Code Here

        }

        List items = null;

        if (doc != null && xml) {
            DocumentType docType = doc.getDocType();

            if (docType != null && "svn".equalsIgnoreCase(docType.getName())) {
                items = new ArrayList();

                addNodes(items, doc.selectNodes("//dir/@name"), true);
                addNodes(items, doc.selectNodes("//file/@name"), false);
            }
View Full Code Here

/*     */
/* 252 */         reader.setEntityResolver(new JBossEntityResolver());
/*     */
/* 255 */         Document doc = reader.read(this.url);
/* 256 */         this.element = doc.getRootElement();
/* 257 */         DocumentType type = doc.getDocType();
/*     */
/* 259 */         version = validateVersionString(type.getPublicID());
/* 260 */         if (version == -1)
/*     */         {
/* 262 */           version = validateVersionString(type.getSystemID());
/*     */         }
/*     */
/*     */       }
/*     */       else
/*     */       {
View Full Code Here

/*     */   }
/*     */
/*     */   public void endDTD() throws SAXException {
/* 360 */     this.insideDTDSection = false;
/*     */
/* 362 */     DocumentType docType = getDocument().getDocType();
/*     */
/* 364 */     if (docType != null) {
/* 365 */       if (this.internalDTDDeclarations != null) {
/* 366 */         docType.setInternalDeclarations(this.internalDTDDeclarations);
/*     */       }
/*     */
/* 369 */       if (this.externalDTDDeclarations != null) {
/* 370 */         docType.setExternalDeclarations(this.externalDTDDeclarations);
/*     */       }
/*     */     }
/*     */
/* 374 */     this.internalDTDDeclarations = null;
/* 375 */     this.externalDTDDeclarations = null;
View Full Code Here

/*     */   {
/* 661 */     LocatorImpl locator = new LocatorImpl();
/*     */
/* 663 */     String publicID = null;
/* 664 */     String systemID = null;
/* 665 */     DocumentType docType = document.getDocType();
/*     */
/* 667 */     if (docType != null) {
/* 668 */       publicID = docType.getPublicID();
/* 669 */       systemID = docType.getSystemID();
/*     */     }
/*     */
/* 672 */     if (publicID != null) {
/* 673 */       locator.setPublicId(publicID);
/*     */     }
View Full Code Here

/* 683 */     this.contentHandler.setDocumentLocator(locator);
/*     */   }
/*     */
/*     */   protected void entityResolver(Document document) throws SAXException {
/* 687 */     if (this.entityResolver != null) {
/* 688 */       DocumentType docType = document.getDocType();
/*     */
/* 690 */       if (docType != null) {
/* 691 */         String publicID = docType.getPublicID();
/* 692 */         String systemID = docType.getSystemID();
/*     */
/* 694 */         if ((publicID != null) || (systemID != null))
/*     */           try {
/* 696 */             this.entityResolver.resolveEntity(publicID, systemID);
/*     */           } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.dom4j.DocumentType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.