本文整理汇总了Java中org.apache.xerces.xni.XMLLocator类的典型用法代码示例。如果您正苦于以下问题:Java XMLLocator类的具体用法?Java XMLLocator怎么用?Java XMLLocator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLLocator类属于org.apache.xerces.xni包,在下文中一共展示了XMLLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startDTD
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/**
* The start of the DTD.
*
* @param locator The document locator, or null if the document
* location cannot be reported during the parsing of
* the document DTD. However, it is <em>strongly</em>
* recommended that a locator be supplied that can
* at least report the base system identifier of the
* DTD.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startDTD (XMLLocator locator, Augmentations augs) throws XNIException {
if (DEBUG_EVENTS) {
System.out.println ("==>startDTD");
if (DEBUG_BASEURI) {
System.out.println (" expandedSystemId: "+locator.getExpandedSystemId ());
System.out.println (" baseURI:"+ locator.getBaseSystemId ());
}
}
fInDTD = true;
if (locator != null) {
fBaseURIStack.push (locator.getBaseSystemId ());
}
if (fDeferNodeExpansion || fDocumentImpl != null) {
fInternalSubset = new StringBuffer (1024);
}
}
示例2: createXMLParseException
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/** Creates an XMLParseException from a SAXParseException. */
protected static XMLParseException createXMLParseException(SAXParseException exception) {
final String fPublicId = exception.getPublicId();
final String fExpandedSystemId = exception.getSystemId();
final int fLineNumber = exception.getLineNumber();
final int fColumnNumber = exception.getColumnNumber();
XMLLocator location = new XMLLocator() {
public String getPublicId() { return fPublicId; }
public String getExpandedSystemId() { return fExpandedSystemId; }
public String getBaseSystemId() { return null; }
public String getLiteralSystemId() { return null; }
public int getColumnNumber() { return fColumnNumber; }
public int getLineNumber() { return fLineNumber; }
public int getCharacterOffset() { return -1; }
public String getEncoding() { return null; }
public String getXMLVersion() { return null; }
};
return new XMLParseException(location, exception.getMessage(),exception);
}
示例3: startDTD
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/**
* The start of the DTD.
*
* @param locator The document locator, or null if the document
* location cannot be reported during the parsing of
* the document DTD. However, it is <em>strongly</em>
* recommended that a locator be supplied that can
* at least report the base system identifier of the
* DTD.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {
// initialize state
fNDataDeclNotations.clear();
fDTDElementDecls.clear();
// the grammar bucket's DTDGrammar will now be the
// one we want, whether we're constructing it or not.
// if we're not constructing it, then we should not have a reference
// to it!
if( !fGrammarBucket.getActiveGrammar().isImmutable()) {
fDTDGrammar = fGrammarBucket.getActiveGrammar();
}
// call handlers
if(fDTDGrammar != null )
fDTDGrammar.startDTD(locator, augs);
if (fDTDHandler != null) {
fDTDHandler.startDTD(locator, augs);
}
}
示例4: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
fErrorReporter = (XMLErrorReporter)config.getProperty(ERROR_REPORTER);
fGenerateSyntheticAnnotation = config.getFeature(GENERATE_SYNTHETIC_ANNOTATION);
fHasNonSchemaAttributes.clear();
fSawAnnotation.clear();
schemaDOM = new SchemaDOM();
fCurrentAnnotationElement = null;
fAnnotationDepth = -1;
fInnerAnnotationDepth = -1;
fDepth = -1;
fLocator = locator;
fNamespaceContext = namespaceContext;
schemaDOM.setDocumentURI(locator.getExpandedSystemId());
}
示例5: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext namespaceContext, Augmentations augs) throws XNIException {
super.startDocument(locator, encoding, namespaceContext, augs);
this.locator = locator;
Node node = null ;
try {
node = (Node) this.getProperty( "http://apache.org/xml/properties/dom/current-element-node" );
}
catch( org.xml.sax.SAXException ex )
{
System.err.println( "except" + ex );;
}
if( node != null )
node.setUserData( "startLine", String.valueOf( locator.getLineNumber() ), null ); // Save location String into node
}
示例6: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/**
* Override the document start to record whether HTML, HEAD or BODY have been seen
*/
@Override
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext nscontext, Augmentations augs)
throws XNIException {
super.startDocument(locator, encoding, nscontext, augs);
for (int i = fElementStack.top - 1; i >= 0; i--) {
fSeenAnything = true;
if (fElementStack.data[i].element.code == HTMLElements.HTML) {
fSeenRootElement = true;
}
if (fElementStack.data[i].element.code == HTMLElements.HEAD) {
fSeenHeadElement = true;
}
if (fElementStack.data[i].element.code == HTMLElements.BODY) {
fSeenBodyElement = true;
}
}
}
示例7: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/** Start document. */
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext nscontext, Augmentations augs)
throws XNIException {
// reset state
fElementStack.top = 0;
if (fragmentContextStack_ != null) {
fragmentContextStackSize_ = fragmentContextStack_.length;
for (int i=0; i<fragmentContextStack_.length; ++i) {
final QName name = fragmentContextStack_[i];
final Element elt = HTMLElements.getElement(name.localpart);
fElementStack.push(new Info(elt, name));
}
}
else {
fragmentContextStackSize_ = 0;
}
fSeenAnything = false;
fSeenDoctype = false;
fSeenRootElement = false;
fSeenRootElementEnd = false;
fSeenHeadElement = false;
fSeenBodyElement = false;
// pass on event
if (fDocumentHandler != null) {
XercesBridge.getInstance().XMLDocumentHandler_startDocument(fDocumentHandler, locator, encoding, nscontext, augs);
}
}
示例8: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
@Override
public void startDocument(XMLLocator arg0, String arg1,
NamespaceContext arg2, Augmentations arg3) throws XNIException {
if(DEBUG_UNUSED) {
Out.println("startDocument");
}
}
示例9: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/**
* The start of the document.
*
* @param locator The document locator, or null if the document
* location cannot be reported during the parsing
* of this document. However, it is <em>strongly</em>
* recommended that a locator be supplied that can
* at least report the system identifier of the
* document.
* @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 namespaceContext
* The namespace context in effect at the
* start of this document.
* This object represents the current context.
* Implementors of this class are responsible
* for copying the namespace bindings from the
* the current context (and its parent contexts)
* if that information is important.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
fNamespaceContext = namespaceContext;
try {
// SAX1
if (fDocumentHandler != null) {
if (locator != null) {
fDocumentHandler.setDocumentLocator(new LocatorProxy(locator));
}
fDocumentHandler.startDocument();
}
// SAX2
if (fContentHandler != null) {
if (locator != null) {
fContentHandler.setDocumentLocator(new LocatorProxy(locator));
}
fContentHandler.startDocument();
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例10: XMLParseException
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/** Constructs a parse exception. */
public XMLParseException(XMLLocator locator, String message) {
super(message);
if (locator != null) {
fPublicId = locator.getPublicId();
fLiteralSystemId = locator.getLiteralSystemId();
fExpandedSystemId = locator.getExpandedSystemId();
fBaseSystemId = locator.getBaseSystemId();
fLineNumber = locator.getLineNumber();
fColumnNumber = locator.getColumnNumber();
fCharacterOffset = locator.getCharacterOffset();
}
}
示例11: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
/**
* The start of the document.
*
* @param locator The document locator, or null if the document
* location cannot be reported during the parsing
* of this document. However, it is <em>strongly</em>
* recommended that a locator be supplied that can
* at least report the system identifier of the
* document.
* @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 namespaceContext
* The namespace context in effect at the
* start of this document.
* This object represents the current context.
* Implementors of this class are responsible
* for copying the namespace bindings from the
* the current context (and its parent contexts)
* if that information is important.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
fNamespaceContext = namespaceContext;
try {
// SAX1
if (fDocumentHandler != null) {
if (locator != null) {
fDocumentHandler.setDocumentLocator(new LocatorProxy(locator));
}
// The application may have set the DocumentHandler to null
// within setDocumentLocator() so we need to check again.
if (fDocumentHandler != null) {
fDocumentHandler.startDocument();
}
}
// SAX2
if (fContentHandler != null) {
if (locator != null) {
fContentHandler.setDocumentLocator(new LocatorProxy(locator));
}
// The application may have set the ContentHandler to null
// within setDocumentLocator() so we need to check again.
if (fContentHandler != null) {
fContentHandler.startDocument();
}
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例12: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
public void startDocument(XMLLocator locator, String encoding,
NamespaceContext namespaceContext, Augmentations augs)
throws XNIException {
if (fContentHandler != null) {
try {
fContentHandler.startDocument();
}
catch (SAXException e) {
throw new XNIException(e);
}
}
}
示例13: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException {
fNamespaceContext = namespaceContext;
fContentHandler.setDocumentLocator(new LocatorProxy(locator));
try {
fContentHandler.startDocument();
} catch (SAXException e) {
throw new XNIException(e);
}
}
示例14: startDTD
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
public void startDTD(XMLLocator locator, Augmentations augmentations)
throws XNIException {
fValidationManager.setEntityState(this);
if (fDTDHandler != null) {
fDTDHandler.startDTD(locator, augmentations);
}
}
示例15: startDocument
import org.apache.xerces.xni.XMLLocator; //导入依赖的package包/类
public void startDocument(
XMLLocator locator,
String encoding,
NamespaceContext namespaceContext,
Augmentations augs)
throws XNIException {
side.startDocument(locator, encoding, namespaceContext, augs);
next.startDocument(locator, encoding, namespaceContext, augs);
}