Java Code Examples for org.xml.sax.Locator

The following are top voted examples for showing how to use org.xml.sax.Locator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: DomHandlerEx.java   View source code 6 votes vote down vote up
ResultImpl() {
    try {
        DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
        s2d = new SAX2DOMEx(factory);
    } catch (ParserConfigurationException e) {
        throw new AssertionError(e);    // impossible
    }

    XMLFilterImpl f = new XMLFilterImpl() {
        @Override
        public void setDocumentLocator(Locator locator) {
            super.setDocumentLocator(locator);
            location = new LocatorImpl(locator);
        }
    };
    f.setContentHandler(s2d);

    setHandler(f);
}
 
Example 2
Project: OpenJSharp   File: TypeUtil.java   View source code 6 votes vote down vote up
/**
 * Obtains a {@link JType} object for the string representation
 * of a type.
 */
public static JType getType( JCodeModel codeModel,
    String typeName, ErrorReceiver errorHandler, Locator errorSource ) {

    try {
        return codeModel.parseType(typeName);
    } catch( ClassNotFoundException ee ) {

        // make it a warning
        errorHandler.warning( new SAXParseException(
            Messages.ERR_CLASS_NOT_FOUND.format(typeName)
            ,errorSource));

        // recover by assuming that it's a class that derives from Object
        return codeModel.directClass(typeName);
    }
}
 
Example 3
Project: openjdk-jdk10   File: CPropertyInfo.java   View source code 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
Project: OpenJSharp   File: TWSDLParserContextImpl.java   View source code 6 votes vote down vote up
public QName translateQualifiedName(Locator locator, String s) {
    if (s == null)
        return null;

    String prefix = XmlUtil.getPrefix(s);
    String uri = null;

    if (prefix == null) {
        uri = getDefaultNamespaceURI();
    } else {
        uri = getNamespaceURI(prefix);
        if (uri == null) {
            errorReceiver.error(locator, WsdlMessages.PARSING_UNKNOWN_NAMESPACE_PREFIX(prefix));
        }
    }

    return new QName(uri, XmlUtil.getLocalPart(s));
}
 
Example 5
Project: OpenJSharp   File: ElementPattern.java   View source code 5 votes vote down vote up
ElementPattern(NameClass nameClass, Pattern p, Locator loc) {
  super(false,
        ELEMENT_CONTENT_TYPE,
        combineHashCode(ELEMENT_HASH_CODE,
                        nameClass.hashCode(),
                        p.hashCode()));
  this.nameClass = nameClass;
  this.origNameClass = nameClass;
  this.p = p;
  this.loc = loc;
}
 
Example 6
Project: lazycat   File: Digester.java   View source code 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 7
Project: OpenJSharp   File: ParserAdapter.java   View source code 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 8
Project: OpenJSharp   File: ModelGroupDeclImpl.java   View source code 5 votes vote down vote up
public ModelGroupDeclImpl( SchemaDocumentImpl owner,
    AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
    String _targetNamespace, String _name,
    ModelGroupImpl _modelGroup ) {

    super(owner,_annon,_loc,_fa,_targetNamespace,_name,false);
    this.modelGroup = _modelGroup;

    if(modelGroup==null)
        throw new IllegalArgumentException();
}
 
Example 9
Project: openjdk-jdk10   File: CElementPropertyInfo.java   View source code 5 votes vote down vote up
public CElementPropertyInfo(String name, CollectionMode collection, ID id, MimeType expectedMimeType, XSComponent source,
                            CCustomizations customizations, Locator locator, boolean required) {
    super(name, collection.col, source, customizations, locator);
    this.required = required;
    this.id = id;
    this.expectedMimeType = expectedMimeType;
    this.isValueList = collection.val;
}
 
Example 10
Project: openjdk-jdk10   File: ModelGroupImpl.java   View source code 5 votes vote down vote up
public ModelGroupImpl( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
                       Compositor _compositor, ParticleImpl[] _children ) {

    super(owner,_annon,_loc,_fa);
    this.compositor = _compositor;
    this.children = _children;

    if(compositor==null)
        throw new IllegalArgumentException();
    for( int i=children.length-1; i>=0; i-- )
        if(children[i]==null)
            throw new IllegalArgumentException();
}
 
Example 11
Project: openjdk-jdk10   File: SchemaBuilderImpl.java   View source code 5 votes vote down vote up
public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno)
        throws BuildException {
    try {
        return pb.makeDataExcept(dtb.createDatatype(), (Pattern) except, (Locator) loc);
    } catch (DatatypeException e) {
        String detail = e.getMessage();
        if (detail != null) {
            error("invalid_params_detail", detail, (Locator) loc);
        } else {
            error("invalid_params", (Locator) loc);
        }
        return pb.makeError();
    }
}
 
Example 12
Project: openjdk-jdk10   File: ContentHandlerTest.java   View source code 5 votes vote down vote up
/**
 * Write setDocumentLocator tag when meet setDocumentLocator event.
 */
@Override
public void setDocumentLocator(Locator locator) {
    try {
        this.locator = locator;
        println("setDocumentLocator...");
    } catch (SAXException ex) {
        System.err.println(WRITE_ERROR + ex);
    }
}
 
Example 13
Project: openjdk-jdk10   File: CEnumConstant.java   View source code 5 votes vote down vote up
/**
 * @param name
 */
public CEnumConstant(String name, String javadoc, String lexical, XSComponent source, CCustomizations customizations, Locator loc) {
    assert name!=null;
    this.name = name;
    this.javadoc = javadoc;
    this.lexical = lexical;
    this.source = source;
    this.customizations = customizations;
    this.locator = loc;
}
 
Example 14
Project: OpenJSharp   File: Definitions.java   View source code 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 15
Project: OpenJSharp   File: AttributeDeclImpl.java   View source code 5 votes vote down vote up
public AttributeDeclImpl( SchemaDocumentImpl owner,
    String _targetNamespace, String _name,
    AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, boolean _anonymous,
    XmlString _defValue, XmlString _fixedValue,
    Ref.SimpleType _type ) {

    super(owner,_annon,_loc,_fa,_targetNamespace,_name,_anonymous);

    if(_name==null) // assertion failed.
        throw new IllegalArgumentException();

    this.defaultValue = _defValue;
    this.fixedValue = _fixedValue;
    this.type = _type;
}
 
Example 16
Project: OpenJSharp   File: AbstractCElement.java   View source code 4 votes vote down vote up
public Locator getLocator() {
    return locator;
}
 
Example 17
Project: openjdk-jdk10   File: BIElement.java   View source code 4 votes vote down vote up
/**
 * Gets the source location where this element is declared.
 */
public Locator getLocation() {
    return DOMLocator.getLocationInfo(e);
}
 
Example 18
Project: TuLiPA-frames   File: LemmaContentHandler.java   View source code 4 votes vote down vote up
public Locator getLocator() {
	return locator;
}
 
Example 19
Project: OpenJSharp   File: BIElement.java   View source code 4 votes vote down vote up
/**
 * Gets the source location where this element is declared.
 */
public Locator getLocation() {
    return DOMLocator.getLocationInfo(e);
}
 
Example 20
Project: OpenJSharp   File: SimpleType_Union.java   View source code 4 votes vote down vote up
public SimpleType_Union(NGCCRuntimeEx runtime, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
    this(null, runtime, runtime, -1, _annotation, _locator, _fa, _name, _finalSet);
}
 
Example 21
Project: openjdk-jdk10   File: ModelObject.java   View source code 4 votes vote down vote up
public Locator getLocator(){
    return entity.getLocator();
}
 
Example 22
Project: openjdk-jdk10   File: SchemaContentHandler.java   View source code 4 votes vote down vote up
public void setDocumentLocator(Locator locator) {
    fSAXLocatorWrapper.setLocator(locator);
}
 
Example 23
Project: incubator-netbeans   File: ParsingLayerCacheManager.java   View source code 4 votes vote down vote up
public void setDocumentLocator(Locator locator) {
    this.locator = locator;
}
 
Example 24
Project: OpenJSharp   File: ErrorReporter.java   View source code 4 votes vote down vote up
void warning( Locator loc, String prop, Object... args ) {
    errorReceiver.warning( new SAXParseException(
        Messages.format(prop,args), loc ));
}
 
Example 25
Project: openjdk-jdk10   File: CPluginCustomization.java   View source code 4 votes vote down vote up
public CPluginCustomization(Element element, Locator locator) {
    this.element = element;
    this.locator = locator;
}
 
Example 26
Project: incubator-netbeans   File: NbMessageEmitter.java   View source code 4 votes vote down vote up
public void setDocumentLocator(Locator locator) {
}
 
Example 27
Project: openjdk-jdk10   File: RestrictionViolationException.java   View source code 4 votes vote down vote up
Locator getLocator() {
    return loc;
}
 
Example 28
Project: openjdk-jdk10   File: SchemaBuilderImpl.java   View source code 4 votes vote down vote up
private void error(String key, Locator loc) throws BuildException {
    error(new SAXParseException(localizer.message(key), loc));
}
 
Example 29
Project: openjdk-jdk10   File: GlobalEntity.java   View source code 4 votes vote down vote up
public GlobalEntity(Defining defining, Locator locator, ErrorReceiver errorReceiver) {
    super(locator);
    _defining = defining;
    this.errorReceiver = errorReceiver;
}
 
Example 30
Project: openjdk-jdk10   File: MemberSubmissionAddressingExtensionHandler.java   View source code 4 votes vote down vote up
private void warn(Locator location) {
    errReceiver.warning(location,
            ModelerMessages.WSDLMODELER_WARNING_MEMBER_SUBMISSION_ADDRESSING_USED(
                    AddressingVersion.MEMBER.nsUri, W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME));
}
 
Example 31
Project: openjdk-jdk10   File: CClassInfo.java   View source code 4 votes vote down vote up
public CClassInfo(Model model,JPackage pkg, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations) {
    this(model,model.getPackage(pkg),shortName,location,typeName,elementName,source,customizations);
}
 
Example 32
Project: openjdk-jdk10   File: DOMForestScanner.java   View source code 4 votes vote down vote up
public String getPublicId() {
    Locator l = findLocator();
    if(l!=null)     return l.getPublicId();
    return          null;
}
 
Example 33
Project: OpenJSharp   File: ToXMLSAXHandler.java   View source code 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);
}
 
Example 34
Project: openjdk-jdk10   File: CodeModelClassFactory.java   View source code 4 votes vote down vote up
public JDefinedClass createClass( JClassContainer parent, int mod, String name, Locator source ) {
    return createClass(parent,mod,name,source,ClassType.CLASS);
}
 
Example 35
Project: openjdk-jdk10   File: wildcardBody.java   View source code 4 votes vote down vote up
public wildcardBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator) {
    super(source, parent, cookie);
    $runtime = runtime;
    this.locator = _locator;
    $_ngcc_current_state = 10;
}
 
Example 36
Project: OpenJSharp   File: SchemaBuilderImpl.java   View source code 4 votes vote down vote up
public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)
        throws BuildException {
    return pb.makeAttribute((NameClass) nc, (Pattern) p, (Locator) loc);
}
 
Example 37
Project: OpenJSharp   File: ForkingFilter.java   View source code 4 votes vote down vote up
@Override
public void setDocumentLocator(Locator locator) {
    super.setDocumentLocator(locator);
    this.loc = locator;
}
 
Example 38
Project: HtmlCompat   File: HtmlToSpannedConverter.java   View source code 4 votes vote down vote up
public void setDocumentLocator(Locator locator) {
}
 
Example 39
Project: openjdk-jdk10   File: LocatorTable.java   View source code 4 votes vote down vote up
public Locator getEndLocation( Element e ) {
    return (Locator)endLocations.get(e);
}
 
Example 40
Project: openjdk-jdk10   File: SchemaParser.java   View source code 4 votes vote down vote up
private void warning(String key, String arg, Locator loc) throws SAXException {
    warning(new SAXParseException(localizer.message(key, arg), loc));
}