com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLDTDProcessor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * A referenced element in a mixed or children content model. * * @param elementName The name of the referenced element. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void element(String elementName, Augmentations augs) throws XNIException { // check VC: No duplicate Types, in a single mixed-content declaration if (fMixed && fValidation) { if (fMixedElementTypes.contains(elementName)) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "DuplicateTypeInMixedContent", new Object[]{fDTDElementDeclName, elementName}, XMLErrorReporter.SEVERITY_ERROR); } else { fMixedElementTypes.add(elementName); } } // call handlers if(fDTDGrammar != null) fDTDGrammar.element(elementName, augs); if (fDTDContentModelHandler != null) { fDTDContentModelHandler.element(elementName, augs); } }
Example #2
Source File: XMLDTDValidator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * A processing instruction. Processing instructions consist of a * target name and, optionally, text data. The data is only meaningful * to the application. * <p> * Typically, a processing instruction's data will contain a series * of pseudo-attributes. These pseudo-attributes follow the form of * element attributes but are <strong>not</strong> parsed or presented * to the application as anything other than text. The application is * responsible for parsing the data. * * @param target The target. * @param data The data or null if none specified. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "processing instruction"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.processingInstruction(target, data, augs); } }
Example #3
Source File: XMLDTDProcessor.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * A notation declaration * * @param name The name of the notation. * @param identifier An object containing all location information * pertinent to this notation. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { // VC: Unique Notation Name if (fValidation) { DTDGrammar grammar = (fDTDGrammar != null ? fDTDGrammar : fGrammarBucket.getActiveGrammar()); if (grammar.getNotationDeclIndex(name) != -1) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "UniqueNotationName", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if(fDTDGrammar != null) fDTDGrammar.notationDecl(name, identifier, augs); if (fDTDHandler != null) { fDTDHandler.notationDecl(name, identifier, augs); } }
Example #4
Source File: XMLDTDValidator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * A comment. * * @param text The text in the comment. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by application to signal an error. */ public void comment(XMLString text, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "comment"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.comment(text, augs); } }
Example #5
Source File: XMLDTDProcessor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * A referenced element in a mixed or children content model. * * @param elementName The name of the referenced element. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void element(String elementName, Augmentations augs) throws XNIException { // check VC: No duplicate Types, in a single mixed-content declaration if (fMixed && fValidation) { if (fMixedElementTypes.contains(elementName)) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "DuplicateTypeInMixedContent", new Object[]{fDTDElementDeclName, elementName}, XMLErrorReporter.SEVERITY_ERROR); } else { fMixedElementTypes.add(elementName); } } // call handlers if(fDTDGrammar != null) fDTDGrammar.element(elementName, augs); if (fDTDContentModelHandler != null) { fDTDContentModelHandler.element(elementName, augs); } }
Example #6
Source File: XMLDTDValidator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * A processing instruction. Processing instructions consist of a * target name and, optionally, text data. The data is only meaningful * to the application. * <p> * Typically, a processing instruction's data will contain a series * of pseudo-attributes. These pseudo-attributes follow the form of * element attributes but are <strong>not</strong> parsed or presented * to the application as anything other than text. The application is * responsible for parsing the data. * * @param target The target. * @param data The data or null if none specified. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "processing instruction"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.processingInstruction(target, data, augs); } }
Example #7
Source File: XMLDTDValidator.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * A comment. * * @param text The text in the comment. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by application to signal an error. */ public void comment(XMLString text, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "comment"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.comment(text, augs); } }
Example #8
Source File: XMLDTDScannerImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * start a parameter entity dealing with the textdecl if there is any * * @param name The name of the parameter entity to start (without the '%') * @param literal Whether this is happening within a literal */ protected void startPE(String name, boolean literal) throws IOException, XNIException { int depth = fPEDepth; String pName = "%"+name; if (fValidation && !fEntityStore.isDeclaredEntity(pName)) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR); } fEntityManager.startEntity(false, fSymbolTable.addSymbol(pName), literal); // if we actually got a new entity and it's external // parse text decl if there is any if (depth != fPEDepth && fEntityScanner.isExternal()) { scanTextDecl(); } }
Example #9
Source File: XMLDTDValidator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * This method notifies the start of a general entity. * <p> * <strong>Note:</strong> This method is not called for entity references * appearing as part of attribute values. * * @param name The name of the general entity. * @param identifier The resource identifier. * @param encoding The auto-detected IANA encoding name of the entity * stream. This value will be null in those situations * where the entity encoding is not auto-detected (e.g. * internal entities or a document entity that is * parsed from a java.io.Reader). * @param augs Additional information that may include infoset augmentations * * @exception XNIException Thrown by handler to signal an error. */ public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException { if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); // fixes E15.1 if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "ENTITY"}, XMLErrorReporter.SEVERITY_ERROR); } if (fGrammarBucket.getStandalone()) { XMLDTDLoader.checkStandaloneEntityRef(name, fDTDGrammar, fEntityDecl, fErrorReporter); } } if (fDocumentHandler != null) { fDocumentHandler.startGeneralEntity(name, identifier, encoding, augs); } }
Example #10
Source File: XMLDTDValidator.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * A processing instruction. Processing instructions consist of a * target name and, optionally, text data. The data is only meaningful * to the application. * <p> * Typically, a processing instruction's data will contain a series * of pseudo-attributes. These pseudo-attributes follow the form of * element attributes but are <strong>not</strong> parsed or presented * to the application as anything other than text. The application is * responsible for parsing the data. * * @param target The target. * @param data The data or null if none specified. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "processing instruction"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.processingInstruction(target, data, augs); } }
Example #11
Source File: XMLDTDProcessor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * An element declaration. * * @param name The name of the element. * @param contentModel The element content model. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void elementDecl(String name, String contentModel, Augmentations augs) throws XNIException { //check VC: Unique Element Declaration if (fValidation) { if (fDTDElementDecls.contains(name)) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_ELEMENT_ALREADY_DECLARED", new Object[]{ name}, XMLErrorReporter.SEVERITY_ERROR); } else { fDTDElementDecls.add(name); } } // call handlers if(fDTDGrammar != null ) fDTDGrammar.elementDecl(name, contentModel, augs); if (fDTDHandler != null) { fDTDHandler.elementDecl(name, contentModel, augs); } }
Example #12
Source File: XMLDTDValidator.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * This method notifies the start of a general entity. * <p> * <strong>Note:</strong> This method is not called for entity references * appearing as part of attribute values. * * @param name The name of the general entity. * @param identifier The resource identifier. * @param encoding The auto-detected IANA encoding name of the entity * stream. This value will be null in those situations * where the entity encoding is not auto-detected (e.g. * internal entities or a document entity that is * parsed from a java.io.Reader). * @param augs Additional information that may include infoset augmentations * * @exception XNIException Thrown by handler to signal an error. */ public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException { if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); // fixes E15.1 if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "ENTITY"}, XMLErrorReporter.SEVERITY_ERROR); } if (fGrammarBucket.getStandalone()) { XMLDTDLoader.checkStandaloneEntityRef(name, fDTDGrammar, fEntityDecl, fErrorReporter); } } if (fDocumentHandler != null) { fDocumentHandler.startGeneralEntity(name, identifier, encoding, augs); } }
Example #13
Source File: XMLDTDScannerImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * start a parameter entity dealing with the textdecl if there is any * * @param name The name of the parameter entity to start (without the '%') * @param literal Whether this is happening within a literal */ protected void startPE(String name, boolean literal) throws IOException, XNIException { int depth = fPEDepth; String pName = "%"+name; if (fValidation && !fEntityStore.isDeclaredEntity(pName)) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR); } fEntityManager.startEntity(fSymbolTable.addSymbol(pName), literal); // if we actually got a new entity and it's external // parse text decl if there is any if (depth != fPEDepth && fEntityScanner.isExternal()) { scanTextDecl(); } }
Example #14
Source File: XMLEntityScanner.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Checks whether the value of the specified Limit exceeds its limit * * @param limit The Limit to be checked * @param entity The current entity * @param offset The index of the first byte * @param length The length of the entity scanned */ protected void checkLimit(Limit limit, ScannedEntity entity, int offset, int length) { fLimitAnalyzer.addValue(limit, entity.name, length); if (fSecurityManager.isOverLimit(limit, fLimitAnalyzer)) { fSecurityManager.debugPrint(fLimitAnalyzer); Object[] e = (limit == Limit.ENTITY_REPLACEMENT_LIMIT) ? new Object[]{fLimitAnalyzer.getValue(limit), fSecurityManager.getLimit(limit), fSecurityManager.getStateLiteral(limit)} : new Object[]{entity.name, fLimitAnalyzer.getValue(limit), fSecurityManager.getLimit(limit), fSecurityManager.getStateLiteral(limit)}; fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, limit.key(), e, XMLErrorReporter.SEVERITY_FATAL_ERROR); } if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) { fSecurityManager.debugPrint(fLimitAnalyzer); fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "TotalEntitySizeLimit", new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT), fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT), fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)}, XMLErrorReporter.SEVERITY_FATAL_ERROR); } }
Example #15
Source File: XMLDTDProcessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * A referenced element in a mixed or children content model. * * @param elementName The name of the referenced element. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void element(String elementName, Augmentations augs) throws XNIException { // check VC: No duplicate Types, in a single mixed-content declaration if (fMixed && fValidation) { if (fMixedElementTypes.contains(elementName)) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "DuplicateTypeInMixedContent", new Object[]{fDTDElementDeclName, elementName}, XMLErrorReporter.SEVERITY_ERROR); } else { fMixedElementTypes.add(elementName); } } // call handlers if(fDTDGrammar != null) fDTDGrammar.element(elementName, augs); if (fDTDContentModelHandler != null) { fDTDContentModelHandler.element(elementName, augs); } }
Example #16
Source File: XMLDTDProcessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * An element declaration. * * @param name The name of the element. * @param contentModel The element content model. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void elementDecl(String name, String contentModel, Augmentations augs) throws XNIException { //check VC: Unique Element Declaration if (fValidation) { if (fDTDElementDecls.contains(name)) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_ELEMENT_ALREADY_DECLARED", new Object[]{ name}, XMLErrorReporter.SEVERITY_ERROR); } else { fDTDElementDecls.add(name); } } // call handlers if(fDTDGrammar != null ) fDTDGrammar.elementDecl(name, contentModel, augs); if (fDTDHandler != null) { fDTDHandler.elementDecl(name, contentModel, augs); } }
Example #17
Source File: XMLEntityManager.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Adds an unparsed entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param publicId The public identifier of the entity. * @param systemId The system identifier of the entity. * @param notation The name of the notation. * * @see SymbolTable */ public void addUnparsedEntity(String name, String publicId, String systemId, String baseSystemId, String notation) { if (!fEntities.containsKey(name)) { Entity.ExternalEntity entity = new Entity.ExternalEntity(name, new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null), notation, fInExternalSubset); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }
Example #18
Source File: ASCIIReader.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Read characters into a portion of an array. This method will block * until some input is available, an I/O error occurs, or the end of the * stream is reached. * * @param ch Destination buffer * @param offset Offset at which to start storing characters * @param length Maximum number of characters to read * * @return The number of characters read, or -1 if the end of the * stream has been reached * * @exception IOException If an I/O error occurs */ public int read(char ch[], int offset, int length) throws IOException { if (length > fBuffer.length) { length = fBuffer.length; } int count = fInputStream.read(fBuffer, 0, length); for (int i = 0; i < count; i++) { int b0 = fBuffer[i]; if (b0 < 0) { throw new MalformedByteSequenceException(fFormatter, fLocale, XMLMessageFormatter.XML_DOMAIN, "InvalidASCII", new Object [] {Integer.toString(b0 & 0x0FF)}); } ch[offset + i] = (char)b0; } return count; }
Example #19
Source File: XMLEntityStorage.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Adds an unparsed entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param publicId The public identifier of the entity. * @param systemId The system identifier of the entity. * @param notation The name of the notation. * * @see SymbolTable */ public void addUnparsedEntity(String name, String publicId, String systemId, String baseSystemId, String notation) { fCurrentEntity = fEntityManager.getCurrentEntity(); if (!fEntities.containsKey(name)) { Entity entity = new Entity.ExternalEntity(name, new XMLResourceIdentifierImpl(publicId, systemId, baseSystemId, null), notation, fInExternalSubset); // (fCurrentEntity == null) ? fasle : fCurrentEntity.isEntityDeclInExternalSubset()); // fCurrentEntity.isEntityDeclInExternalSubset()); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }
Example #20
Source File: ASCIIReader.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Read characters into a portion of an array. This method will block * until some input is available, an I/O error occurs, or the end of the * stream is reached. * * @param ch Destination buffer * @param offset Offset at which to start storing characters * @param length Maximum number of characters to read * * @return The number of characters read, or -1 if the end of the * stream has been reached * * @exception IOException If an I/O error occurs */ public int read(char ch[], int offset, int length) throws IOException { if (length > fBuffer.length) { length = fBuffer.length; } int count = fInputStream.read(fBuffer, 0, length); for (int i = 0; i < count; i++) { int b0 = fBuffer[i]; if (b0 < 0) { throw new MalformedByteSequenceException(fFormatter, fLocale, XMLMessageFormatter.XML_DOMAIN, "InvalidASCII", new Object [] {Integer.toString(b0 & 0x0FF)}); } ch[offset + i] = (char)b0; } return count; }
Example #21
Source File: XMLDTDScannerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * start a parameter entity dealing with the textdecl if there is any * * @param name The name of the parameter entity to start (without the '%') * @param literal Whether this is happening within a literal */ protected void startPE(String name, boolean literal) throws IOException, XNIException { int depth = fPEDepth; String pName = "%"+name; if (fValidation && !fEntityStore.isDeclaredEntity(pName)) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR); } fEntityManager.startEntity(false, fSymbolTable.addSymbol(pName), literal); // if we actually got a new entity and it's external // parse text decl if there is any if (depth != fPEDepth && fEntityScanner.isExternal()) { scanTextDecl(); } }
Example #22
Source File: ASCIIReader.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Read characters into a portion of an array. This method will block * until some input is available, an I/O error occurs, or the end of the * stream is reached. * * @param ch Destination buffer * @param offset Offset at which to start storing characters * @param length Maximum number of characters to read * * @return The number of characters read, or -1 if the end of the * stream has been reached * * @exception IOException If an I/O error occurs */ public int read(char ch[], int offset, int length) throws IOException { if (length > fBuffer.length) { length = fBuffer.length; } int count = fInputStream.read(fBuffer, 0, length); for (int i = 0; i < count; i++) { int b0 = fBuffer[i]; if (b0 < 0) { throw new MalformedByteSequenceException(fFormatter, fLocale, XMLMessageFormatter.XML_DOMAIN, "InvalidASCII", new Object [] {Integer.toString(b0 & 0x0FF)}); } ch[offset + i] = (char)b0; } return count; }
Example #23
Source File: XMLEntityStorage.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Adds an unparsed entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param publicId The public identifier of the entity. * @param systemId The system identifier of the entity. * @param notation The name of the notation. * * @see SymbolTable */ public void addUnparsedEntity(String name, String publicId, String systemId, String baseSystemId, String notation) { fCurrentEntity = fEntityManager.getCurrentEntity(); if (!fEntities.containsKey(name)) { Entity entity = new Entity.ExternalEntity(name, new XMLResourceIdentifierImpl(publicId, systemId, baseSystemId, null), notation, fInExternalSubset); // (fCurrentEntity == null) ? fasle : fCurrentEntity.isEntityDeclInExternalSubset()); // fCurrentEntity.isEntityDeclInExternalSubset()); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }
Example #24
Source File: XMLDTDValidator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * A comment. * * @param text The text in the comment. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by application to signal an error. */ public void comment(XMLString text, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "comment"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.comment(text, augs); } }
Example #25
Source File: XMLEntityManager.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Adds an unparsed entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param publicId The public identifier of the entity. * @param systemId The system identifier of the entity. * @param notation The name of the notation. * * @see SymbolTable */ public void addUnparsedEntity(String name, String publicId, String systemId, String baseSystemId, String notation) { if (!fEntities.containsKey(name)) { Entity.ExternalEntity entity = new Entity.ExternalEntity(name, new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null), notation, fInExternalSubset); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }
Example #26
Source File: UTF8Reader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Throws an exception for invalid surrogate bits. */ private void invalidSurrogate(int uuuuu) throws MalformedByteSequenceException { throw new MalformedByteSequenceException(fFormatter, fLocale, XMLMessageFormatter.XML_DOMAIN, "InvalidHighSurrogate", new Object[] {Integer.toHexString(uuuuu)}); }
Example #27
Source File: XMLEntityStorage.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Adds an internal entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param text The text of the entity. * * @see SymbolTable */ public void addInternalEntity(String name, String text) { if (!fEntities.containsKey(name)) { Entity entity = new Entity.InternalEntity(name, text, fInExternalSubset); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }
Example #28
Source File: XMLDTDValidator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Root element specified. */ private final void rootElementSpecified(QName rootElement) throws XNIException { if (fPerformValidation) { String root1 = fRootElement.rawname; String root2 = rootElement.rawname; if (root1 == null || !root1.equals(root2)) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, "RootElementTypeMustMatchDoctypedecl", new Object[]{root1, root2}, XMLErrorReporter.SEVERITY_ERROR); } } }
Example #29
Source File: XMLEntityManager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Adds an internal entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param text The text of the entity. * * @see SymbolTable */ public void addInternalEntity(String name, String text) { if (!fEntities.containsKey(name)) { Entity entity = new Entity.InternalEntity(name, text, fInExternalSubset); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }
Example #30
Source File: XMLEntityManager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Adds an external entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param publicId The public identifier of the entity. * @param literalSystemId The system identifier of the entity. * @param baseSystemId The base system identifier of the entity. * This is the system identifier of the entity * where <em>the entity being added</em> and * is used to expand the system identifier when * the system identifier is a relative URI. * When null the system identifier of the first * external entity on the stack is used instead. * * @see SymbolTable */ public void addExternalEntity(String name, String publicId, String literalSystemId, String baseSystemId) throws IOException { if (!fEntities.containsKey(name)) { if (baseSystemId == null) { // search for the first external entity on the stack int size = fEntityStack.size(); if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) { baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId(); } for (int i = size - 1; i >= 0 ; i--) { Entity.ScannedEntity externalEntity = (Entity.ScannedEntity)fEntityStack.elementAt(i); if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) { baseSystemId = externalEntity.entityLocation.getExpandedSystemId(); break; } } } Entity entity = new Entity.ExternalEntity(name, new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId, expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } }