本文整理匯總了Java中org.xml.sax.helpers.LocatorImpl.setSystemId方法的典型用法代碼示例。如果您正苦於以下問題:Java LocatorImpl.setSystemId方法的具體用法?Java LocatorImpl.setSystemId怎麽用?Java LocatorImpl.setSystemId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.xml.sax.helpers.LocatorImpl
的用法示例。
在下文中一共展示了LocatorImpl.setSystemId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSetSystemIdGetSystemId
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "setSystemId",
args = { String.class }
),
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "getSystemId",
args = { }
)
})
public void testSetSystemIdGetSystemId() {
LocatorImpl l = new LocatorImpl();
l.setSystemId(SYS);
assertEquals(SYS, l.getSystemId());
l.setSystemId(null);
assertEquals(null, l.getSystemId());
}
示例2: 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()));
}
}
}
示例3: parseSchema
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
public void parseSchema( String systemId, Element element ) {
checkAbsoluteness(systemId);
try {
DOMScanner scanner = new DOMScanner();
// use a locator that sets the system ID correctly
// so that we can resolve relative URLs in most of the case.
// it still doesn't handle xml:base and XInclude and all those things
// correctly. There's just no way to make all those things work with DOM!
LocatorImpl loc = new LocatorImpl();
loc.setSystemId(systemId);
scanner.setLocator(loc);
scanner.setContentHandler(getParserHandler(systemId));
scanner.scan(element);
} catch (SAXException e) {
// since parsing DOM shouldn't cause a SAX exception
// and our handler will never throw it, it's not clear
// if this will ever happen.
fatalError(new SAXParseException2(
e.getMessage(), null, systemId,-1,-1, e));
}
}
示例4: 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);
}
示例5: 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;
}
示例6: 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()));
}
}
}
示例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: 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: 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);
}
}
示例13: 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);
}
}
示例14: parseResource
import org.xml.sax.helpers.LocatorImpl; //導入方法依賴的package包/類
private boolean parseResource() {
boolean fail = false;
Reporter reporter = getReporter();
reporter.logInfo(reporter.message("i.011", "Parsing resource ..."));
try {
BufferedReader r = new BufferedReader(new CharArrayReader(getCharArray(resourceBuffer)));
String line;
int lineNumber = 0;
LocatorImpl locator = new LocatorImpl();
locator.setSystemId(resourceUriString);
while ((line = r.readLine()) != null) {
locator.setLineNumber(++lineNumber);
if (lineNumber == 1) {
if (!parseHeaderLine(line, locator)) {
reporter.logInfo(reporter.message(locator, "i.012", "Skipping remainder of resource due to bad header."));
fail = true;
break;
}
} else if (!line.isEmpty()) {
if (!parseContentLine(line, locator)) {
reporter.logError(reporter.message(locator, "e.006", "Content line parse failure."));
fail = true;
}
}
}
reporter.logInfo(reporter.message("i.013", "Read {0} lines.", lineNumber));
if (lineNumber == 0) {
if (reporter.isWarningEnabled("empty-input")) {
if (reporter.logWarning(reporter.message(locator, "w.011", "Empty input resource (no lines).")))
fail = true;
}
}
} catch (Exception e) {
reporter.logError(e);
}
return !fail && (reporter.getResourceErrors() == 0);
}
示例15: 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;
}