Package javax.xml.stream.events

Examples of javax.xml.stream.events.DTD


        er.setProperty(WstxInputProperties.P_BASE_URL, new URL(URI));
        assertTrue(er.nextEvent().isStartDocument());
        XMLEvent evt = er.nextEvent(); // DTD
        assertTokenType(DTD, evt.getEventType());

        DTD dtd = (DTD) evt;
        List<?> nots = dtd.getNotations();
        assertEquals(1, nots.size());
        NotationDeclaration2 notDecl = (NotationDeclaration2) nots.get(0);

        assertEquals(URI, notDecl.getBaseURI());
    }
View Full Code Here


                            if (fStAXValidatorHandler != null) {
                                fStAXValidatorHandler.entityReference((EntityReference) fCurrentEvent);
                            }
                            break;
                        case XMLStreamConstants.DTD:
                            DTD dtd = (DTD) fCurrentEvent;
                            processEntityDeclarations(dtd.getEntities());
                            if (fStAXValidatorHandler != null) {
                                fStAXValidatorHandler.doctypeDecl(dtd);
                            }
                            break;
                    }
View Full Code Here

     */
    public void add(javax.xml.stream.events.XMLEvent xMLEvent) throws javax.xml.stream.XMLStreamException {
        int type = xMLEvent.getEventType();
        switch(type){
            case XMLEvent.DTD:{
                DTD dtd = (DTD)xMLEvent ;
                if (DEBUG)System.out.println("Adding DTD = " + dtd.toString());
                fStreamWriter.writeDTD(dtd.getDocumentTypeDeclaration());
                break;
            }
            case XMLEvent.START_DOCUMENT :{
                StartDocument startDocument = (StartDocument)xMLEvent ;
                if (DEBUG)System.out.println("Adding StartDocument = " + startDocument.toString());
View Full Code Here

                            if (fStAXValidatorHandler != null) {
                                fStAXValidatorHandler.entityReference((EntityReference) fCurrentEvent);
                            }
                            break;
                        case XMLStreamConstants.DTD:
                            DTD dtd = (DTD) fCurrentEvent;
                            processEntityDeclarations(dtd.getEntities());
                            if (fStAXValidatorHandler != null) {
                                fStAXValidatorHandler.doctypeDecl(dtd);
                            }
                            break;
                    }
View Full Code Here

            dtdBuilder.append(" SYSTEM \"");
            dtdBuilder.append(systemId).append("\"");
        }
        dtdBuilder.append(">");

        final DTD event = eventFactory.createDTD(dtdBuilder.toString());
        try {
            this.consumeEvent(event);
        }
        catch (XMLStreamException ex) {
            throw new SAXException("Could not create DTD: " + ex.getMessage(), ex);
View Full Code Here

            Assert.assertSame(((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler().getClass(), transformerHandler.getClass());
        }
    }

    public void checkXmlEvent(Class<?> clazz, boolean fake) throws Exception {
        DTD dtd = invokeMethod(clazz.newInstance(), "eventDTD");
        XMLEventFactory factory = invokeMethod(clazz.newInstance(), "eventFactory");

        Assert.assertEquals(__XMLEventFactory.class.getName(), factory.getClass().getName());

        if (fake) {
            Assert.assertEquals(FakeDTD.class.getName(), dtd.getClass().getName());
        } else {
            Assert.assertSame(XMLEventFactory.newInstance().createDTD("blah").getClass(), dtd.getClass());
        }
    }
View Full Code Here

    if (o == null)
      return false;
    if (this == o)
      return true;

    DTD dtd = (DTD) o;

    return
      getDocumentTypeDeclaration().equals(dtd.getDocumentTypeDeclaration()) &&
      getEntities().equals(dtd.getEntities()) &&
      getNotations().equals(dtd.getNotations()) &&
      getProcessedDTD().equals(dtd.getProcessedDTD());
  }
View Full Code Here

    if (o == null)
      return false;
    if (this == o)
      return true;

    DTD dtd = (DTD) o;

    return
      getDocumentTypeDeclaration().equals(dtd.getDocumentTypeDeclaration()) &&
      getEntities().equals(dtd.getEntities()) &&
      getNotations().equals(dtd.getNotations()) &&
      getProcessedDTD().equals(dtd.getProcessedDTD());
  }
View Full Code Here

    {
        if (o == this) return true;
        if (o == null) return false;
        if (!(o instanceof DTD)) return false;

        DTD other = (DTD) o;

        /* Hmmh. Comparison for this event get very
         * tricky, very fast, if one tries to do it correctly
         * (partly due to Stax2 incompleteness, but not just
         * because of that)... let's actually try to minimize
         * work here
         */
        return stringsWithNullsEqual(getDocumentTypeDeclaration(),
                                     other.getDocumentTypeDeclaration());
    }
View Full Code Here

TOP

Related Classes of javax.xml.stream.events.DTD

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.