當前位置: 首頁>>代碼示例>>Java>>正文


Java LocatorImpl.setLineNumber方法代碼示例

本文整理匯總了Java中org.xml.sax.helpers.LocatorImpl.setLineNumber方法的典型用法代碼示例。如果您正苦於以下問題:Java LocatorImpl.setLineNumber方法的具體用法?Java LocatorImpl.setLineNumber怎麽用?Java LocatorImpl.setLineNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.xml.sax.helpers.LocatorImpl的用法示例。


在下文中一共展示了LocatorImpl.setLineNumber方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseBindings

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
/**
 * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it.
 * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model
 *
 * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately
 * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder}
 *
 * @param receiver {@link ErrorReceiver}
 */
public final void parseBindings(ErrorReceiver receiver){
    for (InputSource is : bindingFiles) {
        XMLStreamReader reader =
                XMLStreamReaderFactory.create(is,true);
        XMLStreamReaderUtil.nextElementContent(reader);
        if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) {
            jaxwsCustomBindings.add(new RereadInputSource(is));
        } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) ||
                reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) {
            jaxbCustomBindings.add(new RereadInputSource(is));
        } else {
            LocatorImpl locator = new LocatorImpl();
            locator.setSystemId(reader.getLocation().getSystemId());
            locator.setPublicId(reader.getLocation().getPublicId());
            locator.setLineNumber(reader.getLocation().getLineNumber());
            locator.setColumnNumber(reader.getLocation().getColumnNumber());
            receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId()));
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:30,代碼來源:WsimportOptions.java

示例2: convertToSAXParseException

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
static void convertToSAXParseException(XMLParseException e) throws SAXException {
    Exception ex = e.getException();
    if (ex == null) {
        // must be a parser exception; mine it for locator info and throw
        // a SAXParseException
        LocatorImpl locatorImpl = new LocatorImpl();
        locatorImpl.setPublicId(e.getPublicId());
        locatorImpl.setSystemId(e.getExpandedSystemId());
        locatorImpl.setLineNumber(e.getLineNumber());
        locatorImpl.setColumnNumber(e.getColumnNumber());
        throw new SAXParseException(e.getMessage(), locatorImpl);
    }
    if (ex instanceof SAXException) {
        // why did we create an XMLParseException?
        throw (SAXException) ex;
    }
    throw new SAXException(ex);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:SchemaContentHandler.java

示例3: toLocation

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
private static Locator toLocation(XMLStreamReader xsr) {
    LocatorImpl loc = new LocatorImpl();
    Location in = xsr.getLocation();
    loc.setSystemId(in.getSystemId());
    loc.setPublicId(in.getPublicId());
    loc.setLineNumber(in.getLineNumber());
    loc.setColumnNumber(in.getColumnNumber());
    return loc;
}
 
開發者ID:ojdkbuild,項目名稱:lookaside_java-1.8.0-openjdk,代碼行數:10,代碼來源:LocatableWebServiceException.java

示例4: testSetLineNumberGetLineNumber

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setLineNumber",
        args = { int.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getLineNumber",
        args = { }
    )
})
public void testSetLineNumberGetLineNumber() {
    LocatorImpl l = new LocatorImpl();

    l.setLineNumber(ROW);
    assertEquals(ROW, l.getLineNumber());

    l.setLineNumber(0);
    assertEquals(0, l.getLineNumber());
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:22,代碼來源:LocatorImplTest.java

示例5: parseBindings

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
/**
 * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it.
 * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model
 *
 * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately
 * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder}
 *
 * @param receiver {@link ErrorReceiver}
 */
public final void parseBindings(ErrorReceiver receiver){
    for (InputSource is : bindingFiles) {
        XMLStreamReader reader =
                XMLStreamReaderFactory.create(is,true);
        XMLStreamReaderUtil.nextElementContent(reader);
        if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) {
            jaxwsCustomBindings.add(is);
        } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) ||
                reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) {
            jaxbCustomBindings.add(is);
        } else {
            LocatorImpl locator = new LocatorImpl();
            locator.setSystemId(reader.getLocation().getSystemId());
            locator.setPublicId(reader.getLocation().getPublicId());
            locator.setLineNumber(reader.getLocation().getLineNumber());
            locator.setColumnNumber(reader.getLocation().getColumnNumber());
            receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId()));
        }
    }
}
 
開發者ID:alexkasko,項目名稱:openjdk-icedtea7,代碼行數:30,代碼來源:WsimportOptions.java

示例6: testObjectFormatting

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
@Test
public void testObjectFormatting() throws Exception {
    String msg;
    AdvancedMessageFormat format;

    String pattern
        = "Here's a Locator: {locator}";
    format = new AdvancedMessageFormat(pattern);

    Map params = new java.util.HashMap();
    LocatorImpl loc = new LocatorImpl();
    loc.setColumnNumber(7);
    loc.setLineNumber(12);
    params.put("locator", loc);

    msg = format.format(params);
    assertEquals("Here\'s a Locator: 12:7", msg);
}
 
開發者ID:pellcorp,項目名稱:fop,代碼行數:19,代碼來源:AdvancedMessageFormatTestCase.java

示例7: getLocator

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
private Locator getLocator(XMLStreamReader reader) {
    Location location = reader.getLocation();
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(location.getSystemId());
        loc.setLineNumber(location.getLineNumber());
    return loc;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:WSDLParserExtensionFacade.java

示例8: doError

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
private void doError(String message, Token tok) {
  hadError = true;
  if (eh != null) {
    LocatorImpl loc = new LocatorImpl();
    loc.setLineNumber(tok.beginLine);
    loc.setColumnNumber(tok.beginColumn);
    loc.setSystemId(sourceUri);
    try {
      eh.error(new SAXParseException(message, loc));
    }
    catch (SAXException se) {
      throw new BuildException(se);
    }
  }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:CompactSyntax.java

示例9: reportEscapeSyntaxException

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
private void reportEscapeSyntaxException(EscapeSyntaxException e) {
  if (eh != null) {
    LocatorImpl loc = new LocatorImpl();
    loc.setLineNumber(e.getLineNumber());
    loc.setColumnNumber(e.getColumnNumber());
    loc.setSystemId(sourceUri);
    try {
      eh.error(new SAXParseException(localizer.message(e.getKey()), loc));
    }
    catch (SAXException se) {
      throw new BuildException(se);
    }
  }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:15,代碼來源:CompactSyntax.java

示例10: getLocator

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
/**
 * @deprecated
 *      No line number available for the "root" component.
 */
public Locator getLocator() {
    LocatorImpl r = new LocatorImpl();
    r.setLineNumber(-1);
    r.setColumnNumber(-1);
    return r;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:Model.java

示例11: documentLocator

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
/**
 * The {@link org.xml.sax.Locator}is only really useful when parsing a
 * textual document as its main purpose is to identify the line and column
 * number. Since we are processing an in memory tree which will probably
 * have its line number information removed, we'll just use -1 for the line
 * and column numbers.
 * 
 * @param document
 *            DOCUMENT ME!
 * 
 * @throws SAXException
 *             DOCUMENT ME!
 */
protected void documentLocator(Document document) throws SAXException
{
    LocatorImpl locator = new LocatorImpl();

    String publicID = null;
    String systemID = null;
    DocumentType docType = document.getDocType();

    if (docType != null)
    {
        publicID = docType.getPublicID();
        systemID = docType.getSystemID();
    }

    if (publicID != null)
    {
        locator.setPublicId(publicID);
    }

    if (systemID != null)
    {
        locator.setSystemId(systemID);
    }

    locator.setLineNumber(-1);
    locator.setColumnNumber(-1);

    contentHandler.setDocumentLocator(locator);
}
 
開發者ID:iOffice1,項目名稱:iOffice,代碼行數:43,代碼來源:SAXWriter.java

示例12: toLocator

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
/**
 * Creates a locator from the given SAX parse exception.
 * @param ex The SAX Parse exception
 * @return the corresponding locator.
 */
private static Locator toLocator(SAXParseException ex) {
  LocatorImpl locator = new LocatorImpl();
  locator.setLineNumber(ex.getLineNumber());
  locator.setColumnNumber(ex.getColumnNumber());
  locator.setPublicId(ex.getPublicId());
  locator.setSystemId(ex.getSystemId());
  return locator;
}
 
開發者ID:pageseeder,項目名稱:berlioz,代碼行數:14,代碼來源:Errors.java

示例13: error

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
/**
 * error level report
 * 
 * @param msg
 */
protected void error(String msg) {
	if (this.errorReceiver != null) {
		LocatorImpl locator = new LocatorImpl();
		locator.setLineNumber(-1);
		locator.setSystemId("module : " + this.getName().toString());
		this.errorReceiver.error(locator, msg);
	}
}
 
開發者ID:maxep,項目名稱:max-ws,代碼行數:14,代碼來源:AbstractWSClientModule.java

示例14: warn

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
protected void warn(String msg) {
	if (this.errorReceiver != null) {
		LocatorImpl locator = new LocatorImpl();
		locator.setLineNumber(-1);
		locator.setSystemId("module : " + this.getName().toString());
		this.errorReceiver.warning(locator, msg);
	}
}
 
開發者ID:maxep,項目名稱:max-ws,代碼行數:9,代碼來源:AbstractWSClientModule.java

示例15: startDocument

import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
public void startDocument() throws SAXException {
  if (locator == null) {
    LocatorImpl tem = new LocatorImpl();
    tem.setLineNumber(-1);
    tem.setColumnNumber(-1);
    locator = tem;
  }
  openElements.push(new OpenElement("", "#root"));
  try {
    constraint.activate(this);
  }
  catch (WrappedSAXException e) {
    throw e.exception;
  }
}
 
開發者ID:relaxng,項目名稱:jing-trang,代碼行數:16,代碼來源:ValidatorImpl.java


注:本文中的org.xml.sax.helpers.LocatorImpl.setLineNumber方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。