本文整理匯總了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()));
}
}
}
示例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);
}
示例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;
}
示例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());
}
示例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()));
}
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
}