类org.xml.sax.Locator源码实例Demo

下面列出了怎么用org.xml.sax.Locator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TencentKona-8   文件: Element.java
/**
 * Define its content model.
 */
void define(short contentModelType, Term contentModel, Locator locator) {
    assert this.contentModel==null; // may not be called twice
    this.contentModelType = contentModelType;
    this.contentModel = contentModel;
    this.locator = locator;
    contentModel.normalize(normalizedBlocks,false);

    for( Block b : normalizedBlocks ) {
        if(b.isRepeated || b.elements.size()>1) {
            for( Element e : b.elements ) {
                owner.getOrCreateElement(e.name).mustBeClass = true;
            }
        }
    }
}
 
源代码2 项目: jdk8u60   文件: CPropertyInfo.java
protected CPropertyInfo(String name, boolean collection, XSComponent source,
                        CCustomizations customizations, Locator locator) {
    this.publicName = name;
    String n = null;

    Model m = Ring.get(Model.class);
    if (m != null) {
        n = m.getNameConverter().toVariableName(name);
    } else {
        n = NameConverter.standard.toVariableName(name);
    }

    if(!JJavaName.isJavaIdentifier(n))
        n = '_'+n;  // avoid colliding with the reserved names like 'abstract'.
    this.privateName = n;

    this.isCollection = collection;
    this.locator = locator;
    if(customizations==null)
        this.customizations = CCustomizations.EMPTY;
    else
        this.customizations = customizations;
    this.source = source;
}
 
源代码3 项目: openjdk-jdk9   文件: SchemaBuilderImpl.java
public ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException {
    for (Enumeration e = defines.keys();
            e.hasMoreElements();) {
        String name = (String) e.nextElement();
        RefPattern rp = (RefPattern) defines.get(name);
        if (rp.getPattern() == null) {
            sb.error("reference_to_undefined", name, rp.getRefLocator());
            rp.setPattern(sb.pb.makeError());
        }
    }
    Pattern start = startRef.getPattern();
    if (start == null) {
        sb.error("missing_start_element", (Locator) loc);
        start = sb.pb.makeError();
    }
    return start;
}
 
@Override
public Object[] adaptArguments(Object[] arguments) {
	for (int i = 0; i < arguments.length; i++) {
		if (arguments[i] instanceof Locator) {
			arguments[i] = null;
		}
	}
	return arguments;
}
 
源代码5 项目: jdk8u60   文件: XMLFilterImpl.java
/**
 * Filter a new document locator event.
 *
 * @param locator The document locator.
 */
public void setDocumentLocator (Locator locator)
{
    this.locator = locator;
    if (contentHandler != null) {
        contentHandler.setDocumentLocator(locator);
    }
}
 
源代码6 项目: TencentKona-8   文件: SchemaImpl.java
public SchemaImpl(SchemaSetImpl _parent, Locator loc, String tns) {
    if (tns == null)
        // the empty string must be used.
        throw new IllegalArgumentException();
    this.targetNamespace = tns;
    this.parent = _parent;
    this.locator = loc;
}
 
源代码7 项目: jdk8u60   文件: Locator2Impl.java
/**
 * Copy an existing Locator or Locator2 object.
 * If the object implements Locator2, values of the
 * <em>encoding</em> and <em>version</em>strings are copied,
 * otherwise they set to <em>null</em>.
 *
 * @param locator The existing Locator object.
 */
public Locator2Impl (Locator locator)
{
    super (locator);
    if (locator instanceof Locator2) {
        Locator2    l2 = (Locator2) locator;

        version = l2.getXMLVersion ();
        encoding = l2.getEncoding ();
    }
}
 
源代码8 项目: jdk8u60   文件: elementDeclBody.java
public elementDeclBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, boolean _isGlobal) {
    super(source, parent, cookie);
    $runtime = runtime;
    this.locator = _locator;
    this.isGlobal = _isGlobal;
    $_ngcc_current_state = 48;
}
 
源代码9 项目: openjdk-jdk9   文件: attributeDeclBody.java
public attributeDeclBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, boolean _isLocal, String _defaultValue, String _fixedValue) {
    super(source, parent, cookie);
    $runtime = runtime;
    this.locator = _locator;
    this.isLocal = _isLocal;
    this.defaultValue = _defaultValue;
    this.fixedValue = _fixedValue;
    $_ngcc_current_state = 13;
}
 
源代码10 项目: openjdk-jdk8u   文件: Util.java
/**
 * Compares if two {@link Locator}s point to the exact same position.
 */
public static boolean equals(Locator lhs, Locator rhs) {
    return lhs.getLineNumber()==rhs.getLineNumber()
    && lhs.getColumnNumber()==rhs.getColumnNumber()
    && equals(lhs.getSystemId(),rhs.getSystemId())
    && equals(lhs.getPublicId(),rhs.getPublicId());
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: DelayedRef.java
DelayedRef( PatcherManager _manager, Locator _source, SchemaImpl _schema, UName _name ) {

        this.schema = _schema.getRoot();
        this.manager = _manager;
        this.name = _name;
        this.source = _source;

        if(name==null)  throw new InternalError();

        manager.addPatcher(this);
    }
 
源代码12 项目: openjdk-jdk8u   文件: modelGroupBody.java
public modelGroupBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, String _compositorName) {
    super(source, parent, cookie);
    $runtime = runtime;
    this.locator = _locator;
    this.compositorName = _compositorName;
    $_ngcc_current_state = 6;
}
 
源代码13 项目: TencentKona-8   文件: CEnumLeafInfo.java
public CEnumLeafInfo(Model model,
                     QName typeName,
                     CClassInfoParent container,
                     String shortName,
                     CNonElement base,
                     Collection<CEnumConstant> _members,
                     XSComponent source,
                     CCustomizations customizations,
                     Locator _sourceLocator) {
    this.model = model;
    this.parent = container;
    this.shortName = model.allocator.assignClassName(parent,shortName);
    this.base = base;
    this.members = _members;
    this.source = source;
    if(customizations==null)
        customizations = CCustomizations.EMPTY;
    this.customizations = customizations;
    this.sourceLocator = _sourceLocator;
    this.typeName = typeName;

    for( CEnumConstant mem : members )
        mem.setParent(this);

    model.add(this);

    // TODO: can we take advantage of the fact that enum can be XmlRootElement?
}
 
源代码14 项目: openjdk-jdk9   文件: TransformerHandlerImpl.java
/**
 * Implements org.xml.sax.ContentHandler.setDocumentLocator()
 * Receive an object for locating the origin of SAX document events.
 */
@Override
public void setDocumentLocator(Locator locator) {
    _locator = locator;

    if (_handler != null) {
        _handler.setDocumentLocator(locator);
    }
}
 
源代码15 项目: TencentKona-8   文件: Util.java
/**
 * Compares if two {@link Locator}s point to the exact same position.
 */
public static boolean equals(Locator lhs, Locator rhs) {
    return lhs.getLineNumber()==rhs.getLineNumber()
    && lhs.getColumnNumber()==rhs.getColumnNumber()
    && equals(lhs.getSystemId(),rhs.getSystemId())
    && equals(lhs.getPublicId(),rhs.getPublicId());
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: CollisionInfo.java
private String printLocator(Locator loc) {
    if( loc==null )     return "";

    int line = loc.getLineNumber();
    String sysId = loc.getSystemId();
    if(sysId==null)     sysId = Messages.format(Messages.MSG_UNKNOWN_FILE);

    if( line!=-1 )
        return Messages.format( Messages.MSG_LINE_X_OF_Y,
                Integer.toString(line), sysId );
    else
        return sysId;
}
 
源代码17 项目: openjdk-jdk9   文件: DAnnotation.java
public Attribute(String ns, String localName, String prefix, String value, Locator loc) {
    this.ns = ns;
    this.localName = localName;
    this.prefix = prefix;
    this.value = value;
    this.loc = loc;
}
 
源代码18 项目: TencentKona-8   文件: SchemaBuilderImpl.java
public ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException {
    // TODO: do this check by the caller
    if (parent == null) {
        sb.error("parent_ref_outside_grammar", (Locator) loc);
        return sb.makeErrorPattern();
    }
    return parent.makeRef(name, loc, anno);
}
 
源代码19 项目: Tomcat7.0.67   文件: Digester.java
/**
 * Sets the document locator associated with our parser.
 *
 * @param locator The new locator
 */
@Override
public void setDocumentLocator(Locator locator) {

    if (saxLog.isDebugEnabled()) {
        saxLog.debug("setDocumentLocator(" + locator + ")");
    }

    this.locator = locator;

}
 
源代码20 项目: openjdk-jdk8u-backup   文件: Definitions.java
public Definitions(AbstractDocument document, Locator locator) {
    super(locator);
    _document = document;
    _bindings = new ArrayList();
    _imports = new ArrayList();
    _messages = new ArrayList();
    _portTypes = new ArrayList();
    _services = new ArrayList();
    _importedNamespaces = new HashSet();
    _helper = new ExtensibilityHelper();
}
 
源代码21 项目: jdk8u60   文件: SimpleTypeImpl.java
SimpleTypeImpl(
    SchemaDocumentImpl _parent,
    AnnotationImpl _annon,
    Locator _loc,
    ForeignAttributesImpl _fa,
    String _name,
    boolean _anonymous,
    Set<XSVariety> finalSet,
    Ref.SimpleType _baseType) {

    super(_parent, _annon, _loc, _fa, _parent.getTargetNamespace(), _name, _anonymous);

    this.baseType = _baseType;
    this.finalSet = finalSet;
}
 
源代码22 项目: JDKSourceCode1.8   文件: ParserAdapter.java
/**
 * Adapter implementation method; do not call.
 * Adapt a SAX1 document locator event.
 *
 * @param locator A document locator.
 * @see org.xml.sax.ContentHandler#setDocumentLocator
 */
public void setDocumentLocator (Locator locator)
{
    this.locator = locator;
    if (contentHandler != null) {
        contentHandler.setDocumentLocator(locator);
    }
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: Binding.java
public Binding(Defining defining, Locator locator, ErrorReceiver receiver) {
    super(defining, locator, receiver);
    _operations = new ArrayList();
    _helper = new ExtensibilityHelper();
}
 
源代码24 项目: openjdk-jdk8u-backup   文件: SchemaParser.java
private void warning(String key, Locator loc) throws SAXException {
    warning(new SAXParseException(localizer.message(key), loc));
}
 
源代码25 项目: openjdk-jdk9   文件: ErrorReceiver.java
public final void error( Locator loc, String msg, Exception e ) {
    error( new SAXParseException2(msg,loc,e) );
}
 
源代码26 项目: netcdf-java   文件: Dap4EventHandler.java
public void yyevent(SaxEvent saxtoken) throws SAXException {
  if (accepted) {
    throw new SAXException("yyevent called after parser has accepted");
  }

  SaxEventType event = saxtoken.eventtype;
  String name = saxtoken.name;
  int yytoken = 0;
  Lexeme element = null;
  Lexeme attr = null;

  element = elementmap.get(name);

  switch (event) {

    case STARTELEMENT:
      if (element == null) {// undefined
        yytoken = UNKNOWN_ELEMENT_;
        break;
      }
      yytoken = element.open;
      if (yytoken == OTHERXML_) {
        otherxml = true;
        textok = true;
      } else if (!otherxml && yytoken == VALUE_)
        textok = true;
      break;

    case ATTRIBUTE:
      String lcname = name.toLowerCase();
      attr = attributemap.get(lcname);
      if (attr == null) {
        if (lcname.startsWith(SPECIALATTRPREFIX))
          yytoken = ATTR_SPECIAL;
        else
          yytoken = UNKNOWN_ATTR;
      } else
        yytoken = attr.atoken;
      break;

    case ENDELEMENT:
      if (element == null) {// undefined
        yytoken = _UNKNOWN_ELEMENT;
        break;
      }
      yytoken = element.close;
      if (yytoken == _OTHERXML) {
        otherxml = false;
        textok = false;
      } else if (!otherxml && yytoken == _VALUE)
        textok = false;
      break;

    case CHARACTERS:
      if (!textok)
        return; // ignore
      yytoken = TEXT;
      break;

    case ENDDOCUMENT:
      yytoken = EOF;
      break;

    default:
      return; // ignore

  } // switch

  int status = 0;
  try {
    Locator loc = getLocator();
    Dap4BisonParser parser = (Dap4BisonParser) this;
    // Bison.Position pos = new Bison.Position(loc);
    // Dap4BisonParser.Location yyloc = parser.new Location(pos);
    status = parser.push_parse(yytoken, saxtoken);
  } catch (Exception e) {
    throw new SAXException(e);
  }
  if (status == YYABORT)
    throw new SAXException("YYABORT");
  else if (status == YYACCEPT)
    accepted = true;
}
 
源代码27 项目: TencentKona-8   文件: WildcardImpl.java
protected WildcardImpl( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, int _mode ) {
    super(owner,_annon,_loc,_fa);
    this.mode = _mode;
}
 
源代码28 项目: TencentKona-8   文件: SchemaParser.java
private void error(String key, String arg, Locator loc) throws SAXException {
    error(new SAXParseException(localizer.message(key, arg), loc));
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: SchemaParser.java
private void warning(String key, String arg1, String arg2, Locator loc)
        throws SAXException {
    warning(new SAXParseException(localizer.message(key, arg1, arg2), loc));
}
 
源代码30 项目: spring-analysis-note   文件: DomContentHandler.java
@Override
public void setDocumentLocator(Locator locator) {
}