本文整理匯總了Java中org.xml.sax.helpers.LocatorImpl.setColumnNumber方法的典型用法代碼示例。如果您正苦於以下問題:Java LocatorImpl.setColumnNumber方法的具體用法?Java LocatorImpl.setColumnNumber怎麽用?Java LocatorImpl.setColumnNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.xml.sax.helpers.LocatorImpl
的用法示例。
在下文中一共展示了LocatorImpl.setColumnNumber方法的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: testSetColumnNumberGetColumnNumber
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "setColumnNumber",
args = { int.class }
),
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "getColumnNumber",
args = { }
)
})
public void testSetColumnNumberGetColumnNumber() {
LocatorImpl l = new LocatorImpl();
l.setColumnNumber(COL);
assertEquals(COL, l.getColumnNumber());
l.setColumnNumber(0);
assertEquals(0, l.getColumnNumber());
}
示例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: 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);
}
}
}
示例8: 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);
}
}
}
示例9: 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;
}
示例10: 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);
}
示例11: 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;
}
示例12: 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;
}
}
示例13: extractLocator
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
private Locator extractLocator(SAXParseException e) {
LocatorImpl locator = new LocatorImpl();
locator.setSystemId(e.getSystemId());
locator.setLineNumber(e.getLineNumber());
locator.setColumnNumber(e.getColumnNumber());
return locator;
}
示例14: parse
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
@Override
public Document parse(InputSource source) throws SAXException, IOException {
if (source == null) {
throw new IllegalArgumentException("source == null");
}
String namespaceURI = null;
String qualifiedName = null;
DocumentType doctype = null;
String inputEncoding = source.getEncoding();
String systemId = source.getSystemId();
DocumentImpl document = new DocumentImpl(
dom, namespaceURI, qualifiedName, doctype, inputEncoding);
document.setDocumentURI(systemId);
KXmlParser parser = new KXmlParser();
try {
parser.keepNamespaceAttributes();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, namespaceAware);
if (source.getByteStream() != null) {
parser.setInput(source.getByteStream(), inputEncoding);
} else if (source.getCharacterStream() != null) {
parser.setInput(source.getCharacterStream());
} else if (systemId != null) {
URL url = new URL(systemId);
URLConnection urlConnection = url.openConnection();
urlConnection.connect();
// TODO: if null, extract the inputEncoding from the Content-Type header?
parser.setInput(urlConnection.getInputStream(), inputEncoding);
} else {
throw new SAXParseException("InputSource needs a stream, reader or URI", null);
}
if (parser.nextToken() == XmlPullParser.END_DOCUMENT) {
throw new SAXParseException("Unexpected end of document", null);
}
parse(parser, document, document, XmlPullParser.END_DOCUMENT);
parser.require(XmlPullParser.END_DOCUMENT, null, null);
} catch (XmlPullParserException ex) {
if (ex.getDetail() instanceof IOException) {
throw (IOException) ex.getDetail();
}
if (ex.getDetail() instanceof RuntimeException) {
throw (RuntimeException) ex.getDetail();
}
LocatorImpl locator = new LocatorImpl();
locator.setPublicId(source.getPublicId());
locator.setSystemId(systemId);
locator.setLineNumber(ex.getLineNumber());
locator.setColumnNumber(ex.getColumnNumber());
SAXParseException newEx = new SAXParseException(ex.getMessage(), locator);
if (errorHandler != null) {
errorHandler.error(newEx);
}
throw newEx;
} finally {
IoUtils.closeQuietly(parser);
}
return document;
}
示例15: parse
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
@Override
public Document parse(InputSource source) throws SAXException, IOException {
if (source == null) {
throw new IllegalArgumentException();
}
String namespaceURI = null;
String qualifiedName = null;
DocumentType doctype = null;
String inputEncoding = source.getEncoding();
String systemId = source.getSystemId();
DocumentImpl document = new DocumentImpl(
dom, namespaceURI, qualifiedName, doctype, inputEncoding);
document.setDocumentURI(systemId);
try {
KXmlParser parser = new KXmlParser();
parser.keepNamespaceAttributes();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, namespaceAware);
if (source.getByteStream() != null) {
parser.setInput(source.getByteStream(), inputEncoding);
} else if (source.getCharacterStream() != null) {
parser.setInput(source.getCharacterStream());
} else if (systemId != null) {
URL url = new URL(systemId);
URLConnection urlConnection = url.openConnection();
urlConnection.connect();
// TODO: if null, extract the inputEncoding from the Content-Type header?
parser.setInput(urlConnection.getInputStream(), inputEncoding);
} else {
throw new SAXParseException(
"InputSource needs a stream, reader or URI", null);
}
if(parser.nextToken() == XmlPullParser.END_DOCUMENT) {
throw new SAXParseException(
"Unexpected end of document", null);
}
parse(parser, document, document, XmlPullParser.END_DOCUMENT);
parser.require(XmlPullParser.END_DOCUMENT, null, null);
} catch (XmlPullParserException ex) {
if(ex.getDetail() instanceof IOException) {
throw (IOException)ex.getDetail();
}
if(ex.getDetail() instanceof RuntimeException) {
throw (RuntimeException)ex.getDetail();
}
LocatorImpl locator = new LocatorImpl();
locator.setPublicId(source.getPublicId());
locator.setSystemId(systemId);
locator.setLineNumber(ex.getLineNumber());
locator.setColumnNumber(ex.getColumnNumber());
SAXParseException newEx = new SAXParseException(ex.getMessage(),
locator);
if (errorHandler != null) {
errorHandler.error(newEx);
}
throw newEx;
}
return document;
}