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


Java LocatorImpl類代碼示例

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


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

示例1: testSetDocumentLocator

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    method = "setDocumentLocator",
    args = { Locator.class }
)
public void testSetDocumentLocator() {
    Locator l = new LocatorImpl();

    adapter.setDocumentLocator(l);

    assertEquals(logger.size(), 1);
    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { l }, logger.getArgs());

    adapter.setDocumentLocator(null);

    assertEquals(logger.size(), 2);
    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { null }, logger.getArgs());
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:21,代碼來源:ParserAdapterTest.java

示例2: 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());
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:22,代碼來源:LocatorImplTest.java

示例3: createInstance

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:ClassBeanInfoImpl.java

示例4: 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

示例5: 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));
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:SchemaCompilerImpl.java

示例6: ResultImpl

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:DomHandlerEx.java

示例7: 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

示例8: 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

示例9: startTagPairs

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
@DataProvider(name = "startTagPairs")
Object[][] startTagPairs() {
  final Name foo = new Name("", "foo");
  final Name bar = new Name("", "bar");
  Set<Name> nameSet = new HashSet<Name>();
  nameSet.add(foo);
  nameSet.add(bar);
  final NormalizedNameClass foobarNNC = new NormalizedNsNameClass(nameSet, EMPTY_MAP);
  final Locator loc = new LocatorImpl();
  return new Object[][] {
          { rootMatcher(makeChoice(makeElement(new SimpleNameClass(foo), makeEmpty(), loc),
                                   makeElement(new SimpleNameClass(bar), makeEmpty(), loc))),
            foobarNNC }

  };
}
 
開發者ID:relaxng,項目名稱:jing-trang,代碼行數:17,代碼來源:PatternMatcherTest.java

示例10: attributePairs

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
@DataProvider(name = "attributePairs")
Object[][] attributePairs() {
  final Name foo = new Name("", "foo");
  final Name bar = new Name("", "bar");
  Set<Name> nameSet = new HashSet<Name>();
  nameSet.add(foo);
  nameSet.add(bar);
  final NormalizedNameClass foobarNNC = new NormalizedNsNameClass(nameSet, EMPTY_MAP);
  final Locator loc = new LocatorImpl();
  return new Object[][] {
          { rootAttributeMatcher(makeElement(new SimpleNameClass(root),
                                             makeGroup(makeAttribute(new SimpleNameClass(foo), makeText(), loc),
                                                       makeAttribute(new SimpleNameClass(bar), makeText(), loc)),
                                             loc)),
            foobarNNC }                    
  };
}
 
開發者ID:relaxng,項目名稱:jing-trang,代碼行數:18,代碼來源:PatternMatcherTest.java

示例11: hasTextField

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
private int hasTextField(LocatorImpl locator, String[] parts, int partIndex, NonTextAttributeTreatment nonTextAttributeTreatment) {
    while (partIndex < parts.length) {
        String field = parts[partIndex];
        if (field.length() == 0) {
            return -1;
        } else {
            int[] delims = countTextAttributeDelimiters(field);
            if (inTextAttribute) {
                if ((delims[1] > 0) && (delims[0] < delims[1]))
                    inTextAttribute = false;
                return partIndex;
            } else if (isTextField(locator, field, partIndex, nonTextAttributeTreatment)) {
                return partIndex;
            } else if ((delims[0] > 0) && (delims[0] > delims[1])) {
                inTextAttribute = true;
                return partIndex;
            } else
                return -1;
        }
    }
    return -1;
}
 
開發者ID:skynav,項目名稱:ttt,代碼行數:23,代碼來源:Converter.java

示例12: createInstance

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {
    
    BeanT bean = null;        
    if (factoryMethod == null){
       bean = ClassFactory.create0(jaxbType);
    }else {
        Object o = ClassFactory.create(factoryMethod);
        if( jaxbType.isInstance(o) ){
            bean = (BeanT)o;
        } else {
            throw new InstantiationException("The factory method didn't return a correct object");
        }
    }
    
    if(xmlLocatorField!=null)
        // need to copy because Locator is mutable
        try {
            xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
        } catch (AccessorException e) {
            context.handleError(e);
        }
    return bean;
}
 
開發者ID:GeeQuery,項目名稱:cxf-plus,代碼行數:24,代碼來源:ClassBeanInfoImpl.java

示例13: testSetDocumentLocator

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
@TestTargetNew(
    level = TestLevel.COMPLETE,
    method = "setDocumentLocator",
    args = { Locator.class }
)
public void testSetDocumentLocator() {
    Locator l = new LocatorImpl();

    child.setDocumentLocator(l);

    assertEquals(logger.size(), 1);
    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { l }, logger.getArgs());

    child.setDocumentLocator(null);

    assertEquals(logger.size(), 2);
    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { null }, logger.getArgs());
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:21,代碼來源:XMLFilterImplTest.java

示例14: testSetPublicIdGetPublicId

import org.xml.sax.helpers.LocatorImpl; //導入依賴的package包/類
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setPublicId",
        args = { String.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getPublicId",
        args = { }
    )
})
public void testSetPublicIdGetPublicId() {
    LocatorImpl l = new LocatorImpl();

    l.setPublicId(PUB);
    assertEquals(PUB, l.getPublicId());

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

示例15: 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


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