• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XMLInputSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.xerces.xni.parser.XMLInputSource的典型用法代码示例。如果您正苦于以下问题:Java XMLInputSource类的具体用法?Java XMLInputSource怎么用?Java XMLInputSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XMLInputSource类属于org.apache.xerces.xni.parser包,在下文中一共展示了XMLInputSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: XSDResolver

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
private XSDResolver() {
	EXISchemaFactory exiSchemaFactory = new EXISchemaFactory();
	EXISchemaFactoryExceptionHandler esfe = new EXISchemaFactoryExceptionHandler();
	exiSchemaFactory.setCompilerErrorHandler(esfe);
	
	InputStream isV2GCIMsgDef = getClass().getResourceAsStream(GlobalValues.SCHEMA_PATH_MSG_DEF.toString());
	XMLInputSource xmlISV2GCIMsgDef = new XMLInputSource(null, null, null, isV2GCIMsgDef, null);
	
	InputStream isV2GCIMsgHeader = getClass().getResourceAsStream(GlobalValues.SCHEMA_PATH_MSG_HEADER.toString());
	XMLInputSource xmlISV2GCIMsgHeader = new XMLInputSource(null, null, null, isV2GCIMsgHeader, null);
	
	InputStream isV2GCIMsgBody = getClass().getResourceAsStream(GlobalValues.SCHEMA_PATH_MSG_BODY.toString());
	XMLInputSource xmlISV2GCIMsgBody = new XMLInputSource(null, null, null, isV2GCIMsgBody, null);
	
	InputStream isV2GCIMsgDataTypes = getClass().getResourceAsStream(GlobalValues.SCHEMA_PATH_MSG_DATA_TYPES.toString());
	XMLInputSource xmlISV2GCIMsgDataTypes = new XMLInputSource(null, null, null, isV2GCIMsgDataTypes, null);
	
	InputStream isXMLDSig = getClass().getResourceAsStream(GlobalValues.SCHEMA_PATH_XMLDSIG.toString());
	XMLInputSource xmlISXMLDSig = new XMLInputSource(null, null, null, isXMLDSig, null);
	
	setEntity("V2G_CI_MsgDef.xsd", xmlISV2GCIMsgDef);
	setEntity("V2G_CI_MsgBody.xsd", xmlISV2GCIMsgBody);
	setEntity("V2G_CI_MsgHeader.xsd", xmlISV2GCIMsgHeader);
	setEntity("V2G_CI_MsgDataTypes.xsd", xmlISV2GCIMsgDataTypes);
	setEntity("xmldsig-core-schema.xsd", xmlISXMLDSig);
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:27,代码来源:XSDResolver.java


示例2: resolveEntity

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException {
	//logger.info("Resolving entity for: " + resourceIdentifier.getExpandedSystemId() + " namespace " + resourceIdentifier.getNamespace());
	
	try{
		URI originalURI = new URI(resourceIdentifier.getExpandedSystemId());
		if(xbrlSchemaRemap.containsKey(originalURI)){
			URI newURI = xbrlSchemaRemap.get(originalURI);
			
			return new XMLInputSource(null, newURI.toString(), newURI.toString(), fileCache.getFileInputStream(newURI.toString()), null);
		}
	}
	catch(URISyntaxException e){
		
	}
	
	return new XMLInputSource(resourceIdentifier.getPublicId(), 
			resourceIdentifier.getExpandedSystemId(), 
			resourceIdentifier.getExpandedSystemId(), 
			fileCache.getFileInputStream(resourceIdentifier.getExpandedSystemId()), 
			null);

}
 
开发者ID:chen4119,项目名称:tempeh,代码行数:24,代码来源:XbrlLoader.java


示例3: preparseGrammar

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
/**
 * Parse a grammar from a location identified by an
 * XMLInputSource.
 * This method also adds this grammar to the XMLGrammarPool
 *
 * @param type The type of the grammar to be constructed
 * @param is The XMLInputSource containing this grammar's
 * information
 * <strong>If a URI is included in the systemId field, the parser will not expand this URI or make it
 * available to the EntityResolver</strong>
 * @return The newly created <code>Grammar</code>.
 * @exception XNIException thrown on an error in grammar
 * construction
 * @exception IOException thrown if an error is encountered
 * in reading the file
 */
public Grammar preparseGrammar(String type, XMLInputSource
            is) throws XNIException, IOException {
    if (fLoaders.containsKey(type)) {
        XMLGrammarLoaderContainer xglc = (XMLGrammarLoaderContainer) fLoaders.get(type);
        XMLGrammarLoader gl = xglc.loader;
        if (xglc.modCount != fModCount) {
            // make sure gl's been set up with all the "basic" properties:
            gl.setProperty(SYMBOL_TABLE, fSymbolTable);
            gl.setProperty(ENTITY_RESOLVER, fEntityResolver);
            gl.setProperty(ERROR_REPORTER, fErrorReporter);
            // potentially, not all will support this one...
            if (fGrammarPool != null) {
                try {
                    gl.setProperty(GRAMMAR_POOL, fGrammarPool);
                } catch(Exception e) {
                    // too bad...
                }
            }
            xglc.modCount = fModCount;
        }
        return gl.loadGrammar(is);
    }
    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:41,代码来源:XMLGrammarPreparser.java


示例4: parseDTD

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
DTDGrammar parseDTD(XMLInputSource is) 
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fDTDLoader.setEntityResolver(resolver);
    }
    fDTDLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to the application...
    DTDGrammar grammar = (DTDGrammar)fDTDLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD,
                                  new Grammar[]{grammar});
    }
    
    return grammar;

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:22,代码来源:XMLGrammarCachingConfiguration.java


示例5: createXMLInputSource

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
/**
 * Creates an XMLInputSource from a SAX InputSource.
 */
private XMLInputSource createXMLInputSource(InputSource source, String baseURI) {
 
    String publicId = source.getPublicId();
    String systemId = source.getSystemId();
    String baseSystemId = baseURI;
    InputStream byteStream = source.getByteStream();
    Reader charStream = source.getCharacterStream();
    String encoding = source.getEncoding();
    XMLInputSource xmlInputSource =
        new XMLInputSource(publicId, systemId, baseSystemId);
    xmlInputSource.setByteStream(byteStream);
    xmlInputSource.setCharacterStream(charStream);
    xmlInputSource.setEncoding(encoding);
    return xmlInputSource;
    
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:EntityResolver2Wrapper.java


示例6: saxToXMLInputSource

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
private static XMLInputSource saxToXMLInputSource(InputSource sis) {
    String publicId = sis.getPublicId();
    String systemId = sis.getSystemId();
    
    Reader charStream = sis.getCharacterStream();
    if (charStream != null) {
        return new XMLInputSource(publicId, systemId, null, charStream,
                null);
    }
    
    InputStream byteStream = sis.getByteStream();
    if (byteStream != null) {
        return new XMLInputSource(publicId, systemId, null, byteStream,
                sis.getEncoding());
    }
    
    return new XMLInputSource(publicId, systemId, null);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:19,代码来源:XMLSchemaLoader.java


示例7: validateAnnotations

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
private void validateAnnotations(ArrayList annotationInfo) {
    if (fAnnotationValidator == null) {
        createAnnotationValidator();
    }
    final int size = annotationInfo.size();
    final XMLInputSource src = new XMLInputSource(null, null, null);
    fGrammarBucketAdapter.refreshGrammars(fGrammarBucket);
    for (int i = 0; i < size; i += 2) {
        src.setSystemId((String) annotationInfo.get(i));
        XSAnnotationInfo annotation = (XSAnnotationInfo) annotationInfo.get(i+1);
        while (annotation != null) {
            src.setCharacterStream(new StringReader(annotation.fAnnotation));
            try {
                fAnnotationValidator.parse(src);
            }
            catch (IOException exc) {}
            annotation = annotation.next;
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:21,代码来源:XSDHandler.java


示例8: resolveSchema

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);    
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);         
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement); 
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:18,代码来源:XSDHandler.java


示例9: resolveSchemaSource

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
private XMLInputSource resolveSchemaSource(XSDDescription desc, boolean mustResolve,
        Element referElement, boolean usePairs) {

    XMLInputSource schemaSource = null;
    try {
        Hashtable pairs = usePairs ? fLocationPairs : EMPTY_TABLE;
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    
    return schemaSource;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:24,代码来源:XSDHandler.java


示例10: getSchemaDocument1

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
/**
 * Error handling code shared between the various getSchemaDocument() methods.
 */
private Element getSchemaDocument1(boolean mustResolve, boolean hasInput, 
        XMLInputSource schemaSource, Element referElement, IOException ioe) {
    // either an error occured (exception), or empty input source was
    // returned, we need to report an error or a warning
    if (mustResolve) {
        if (hasInput) {
            reportSchemaError("schema_reference.4",
                    new Object[]{schemaSource.getSystemId()},
                    referElement, ioe);
        }
        else {
            reportSchemaError("schema_reference.4",
                    new Object[]{schemaSource == null ? "" : schemaSource.getSystemId()},
                    referElement, ioe);
        }
    }
    else if (hasInput) {
        reportSchemaWarning("schema_reference.4",
                new Object[]{schemaSource.getSystemId()},
                referElement, ioe);
    }
    
    fLastSchemaWasDuplicate = false;
    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:29,代码来源:XSDHandler.java


示例11: openInputSourceStream

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
/**
 * This method tries to open the necessary stream for the given
 * XMLInputSource. If the input source already has a character
 * stream (java.io.Reader) or a byte stream (java.io.InputStream)
 * set, this method returns immediately. However, if no character
 * or byte stream is already open, this method attempts to open
 * an input stream using the source's system identifier.
 *
 * @param source The input source to open.
 */
protected void openInputSourceStream(XMLInputSource source)
    throws IOException {
    if (source.getCharacterStream() != null) {
        return;
    }
    InputStream stream = source.getByteStream();
    if (stream == null) {
        String systemId = source.getSystemId();
        try {
            URL url = new URL(systemId);
            stream = url.openStream();
        }
        catch (MalformedURLException e) {
            stream = new FileInputStream(systemId);
        }
        source.setByteStream(stream);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:29,代码来源:AbstractConfiguration.java


示例12: resolveEntity

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier identifier)
		throws XNIException, IOException {

	String systemId = identifier.getExpandedSystemId();
	String redirectedSystemId = systemId != null ? redirect(systemId)
			: null;
	LOG.debug("'" + systemId + "' -> '" + redirectedSystemId + "'");
	if (redirectedSystemId != null
			&& redirectedSystemId.startsWith("https:")) {
		InputStream is = UrlUtils.open(new URL(redirectedSystemId));
		return new XMLInputSource(null, systemId, redirectedSystemId, is,
				null);
	}
	return new XMLInputSource(null, redirectedSystemId, null);
}
 
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:17,代码来源:RedirectingEntityResolver.java


示例13: endElement

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
@Override
public void endElement(QName element, Augmentations augs) throws XNIException {
  if (currentOsmlTag != null && "script".equalsIgnoreCase(element.rawname)) {
    QName endingTag = currentOsmlTag;
    currentOsmlTag = null;

    XMLInputSource scriptSource = new XMLInputSource(null, null, null);
    scriptSource.setCharacterStream(new StringReader(scriptContent.toString()));
    scriptContent.setLength(0);

    // Evaluate the content of the script block immediately
    scanner.evaluateInputSource(scriptSource);

    super.endElement(endingTag, augs);
  } else {
    super.endElement(element, augs);
  }
}
 
开发者ID:inevo,项目名称:shindig-1.1-BETA5-incubating,代码行数:19,代码来源:NekoSimplifiedHtmlParser.java


示例14: setEntity

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
public void setEntity(String literalSystemId, XMLInputSource xmlInput) {
	if (xmlInputSourceEntities == null) {
		xmlInputSourceEntities = new HashMap<String, XMLInputSource>();
	}
	
	xmlInputSourceEntities.put(literalSystemId, xmlInput);
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:8,代码来源:XSDResolver.java


示例15: resolveEntity

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) 
		throws XNIException, IOException {
	String literalSystemId = resourceIdentifier.getLiteralSystemId(); 
	
	if (xmlInputSourceEntities != null && xmlInputSourceEntities.containsKey(literalSystemId)) {
		return xmlInputSourceEntities.get(literalSystemId);
	}

	return null;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:12,代码来源:XSDResolver.java


示例16: resolveEntity

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException {
    XMLInputSource entity = catalogResolver.resolveEntity(resourceIdentifier);
    if (entity == null) {
        LOGGER.info("Could not resolve entity: {}", resourceIdentifier.getBaseSystemId());
        LOGGER.info("Identifer: {}", catalogResolver.resolveIdentifier(resourceIdentifier));
        return null;
    }
    LOGGER.info("Resolve entity: {} --> {}", resourceIdentifier.getBaseSystemId(), entity.getBaseSystemId());
    return entity;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:12,代码来源:MCREntityResolver.java


示例17: createSchema

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
public Schema createSchema(SAXSource source, PropertyMap properties)
        throws IOException, SAXException, IncorrectSchemaException {
  SymbolTable symbolTable = new SymbolTable();
  XMLGrammarPreparser preparser = new XMLGrammarPreparser(symbolTable);
  XMLGrammarPool grammarPool = new XMLGrammarPoolImpl();
  preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
  preparser.setGrammarPool(grammarPool);
  ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
  SAXXMLErrorHandler xeh = new SAXXMLErrorHandler(eh);
  preparser.setErrorHandler(xeh);
  EntityResolver er = properties.get(ValidateProperty.ENTITY_RESOLVER);
  if (er != null)
    preparser.setEntityResolver(new EntityResolverWrapper(er));
  try {
    preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, toXMLInputSource(source.getInputSource()));
    Name attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
    if (attributeOwner != null) {
      Reader r = new StringReader(createWrapper(attributeOwner));
 	preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,
                                new XMLInputSource(null, null, null, r, null));
    }
  }
  catch (XNIException e) {
    throw ValidatorImpl.toSAXException(e);
  }
  if (xeh.getHadError())
    throw new IncorrectSchemaException();
  return new SchemaImpl(new SynchronizedSymbolTable(symbolTable),
                        new CachingParserPool.SynchronizedGrammarPool(grammarPool),
                        properties,
                        supportedPropertyIds);
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:33,代码来源:SchemaReaderImpl.java


示例18: toXMLInputSource

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
private static XMLInputSource toXMLInputSource(InputSource in) {
  XMLInputSource xin = new XMLInputSource(in.getPublicId(), in.getSystemId(), null);
  xin.setByteStream(in.getByteStream());
  xin.setCharacterStream(in.getCharacterStream());
  xin.setEncoding(in.getEncoding());
  return xin;
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:8,代码来源:SchemaReaderImpl.java


示例19: resolveExternalSubsetAndRead

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
/**
 * <p>Attempt to locate an external subset for a document that does not otherwise
 * have one. If an external subset is located, then it is scanned.</p>
 */
protected void resolveExternalSubsetAndRead()
    throws IOException, XNIException {
    
    fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
    fDTDDescription.setRootName(fElementQName.rawname);
    XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);
    
    if (src != null) {
        fDoctypeName = fElementQName.rawname;
        fDoctypePublicId = src.getPublicId();
        fDoctypeSystemId = src.getSystemId();
        // call document handler
        if (fDocumentHandler != null) {
            // This inserts a doctypeDecl event into the stream though no 
            // DOCTYPE existed in the instance document.
            fDocumentHandler.doctypeDecl(fDoctypeName, fDoctypePublicId, fDoctypeSystemId, null);
        }
        try {
            if (fValidationManager == null || !fValidationManager.isCachedDTD()) {
                fDTDScanner.setInputSource(src);
                while (fDTDScanner.scanDTDExternalSubset(true));
            }
            else {
                // This sends startDTD and endDTD calls down the pipeline.
                fDTDScanner.setInputSource(null);
            }
        }
        finally {
            fEntityManager.setEntityHandler(XMLDocumentScannerMMImpl.this);
        }
    }
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:37,代码来源:XMLDocumentScannerMMImpl.java


示例20: validate

import org.apache.xerces.xni.parser.XMLInputSource; //导入依赖的package包/类
public static WSDLValidationInfo validate(XMLInputSource xmlInputSource) throws Exception {
	XMLGrammarPreparser preparser = new XMLGrammarPreparser();
	preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
       preparser.setFeature(NAMESPACES_FEATURE_ID, true);
       preparser.setFeature(VALIDATION_FEATURE_ID, true);
       preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
       WSDLValidationInfo validationInfo = new WSDLValidationInfo();
       preparser.setErrorHandler(new ErrorHandler(validationInfo));
       preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, xmlInputSource);
       return validationInfo;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:12,代码来源:SchemaValidator.java



注:本文中的org.apache.xerces.xni.parser.XMLInputSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DrawPolygons类代码示例发布时间:2022-05-21
下一篇:
Java ModifiableClassLoaderRepository类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap