org.xml.sax.Locator Java Examples

The following examples show how to use org.xml.sax.Locator. 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: Element.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
            }
        }
    }
}
 
Example #2
Source File: SchemaBuilderImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: CPropertyInfo.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: modelGroupBody.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: TransformerHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #6
Source File: SchemaImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #7
Source File: CEnumLeafInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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?
}
 
Example #8
Source File: XMLFilterImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #9
Source File: ParserAdapter.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #10
Source File: AbstractStaxXMLReaderTestCase.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public Object[] adaptArguments(Object[] arguments) {
	for (int i = 0; i < arguments.length; i++) {
		if (arguments[i] instanceof Locator) {
			arguments[i] = null;
		}
	}
	return arguments;
}
 
Example #11
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #12
Source File: SimpleTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: Definitions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example #14
Source File: Locator2Impl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 ();
    }
}
 
Example #15
Source File: SchemaBuilderImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #16
Source File: elementDeclBody.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: DelayedRef.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
 
Example #18
Source File: DAnnotation.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #19
Source File: CollisionInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #20
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #21
Source File: Digester.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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;

}
 
Example #22
Source File: attributeDeclBody.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #23
Source File: SOAPExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected SOAPBinding getSOAPBinding(Locator location){
    return new SOAPBinding(location);
}
 
Example #24
Source File: ParticleImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public ParticleImpl( SchemaDocumentImpl owner, AnnotationImpl _ann, Ref.Term _term, Locator _loc ) {
    this(owner,_ann,_term,_loc,1,1);
}
 
Example #25
Source File: DelayedRef.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Element( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
    super(manager,loc,schema,name);
}
 
Example #26
Source File: Binding.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public Binding(Defining defining, Locator locator, ErrorReceiver receiver) {
    super(defining, locator, receiver);
    _operations = new ArrayList();
    _helper = new ExtensibilityHelper();
}
 
Example #27
Source File: ValidatorHandlerImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void setDocumentLocator(Locator locator) {
    fSAXLocatorWrapper.setLocator(locator);
    if (fContentHandler != null) {
        fContentHandler.setDocumentLocator(locator);
    }
}
 
Example #28
Source File: SOAP12ExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override protected SOAPBinding getSOAPBinding(Locator location) {
    return new SOAP12Binding(location);
}
 
Example #29
Source File: ForeignAttributesImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public ForeignAttributesImpl(ValidationContext context, Locator locator, ForeignAttributesImpl next) {
    this.context = context;
    this.locator = locator;
    this.next = next;
}
 
Example #30
Source File: ToXMLSAXHandler.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator)
 */
public void setDocumentLocator(Locator arg0)
{
    super.setDocumentLocator(arg0);
    m_saxHandler.setDocumentLocator(arg0);
}