本文整理汇总了Java中com.sun.xml.internal.bind.unmarshaller.DOMScanner类的典型用法代码示例。如果您正苦于以下问题:Java DOMScanner类的具体用法?Java DOMScanner怎么用?Java DOMScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DOMScanner类属于com.sun.xml.internal.bind.unmarshaller包,在下文中一共展示了DOMScanner类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: unmarshal0
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
public final Object unmarshal0( Node node, JaxBeanInfo expectedType ) throws JAXBException {
try {
final DOMScanner scanner = new DOMScanner();
InterningXmlVisitor handler = new InterningXmlVisitor(createUnmarshallerHandler(null,false,expectedType));
scanner.setContentHandler(new SAXConnector(handler,scanner));
if(node.getNodeType() == Node.ELEMENT_NODE) {
scanner.scan((Element)node);
} else if(node.getNodeType() == Node.DOCUMENT_NODE) {
scanner.scan((Document)node);
} else {
throw new IllegalArgumentException("Unexpected node type: "+node);
}
Object retVal = handler.getContext().getResult();
handler.getContext().clearResult();
return retVal;
} catch( SAXException e ) {
throw createUnmarshalException(e);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:UnmarshallerImpl.java
示例2: parseSchema
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的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
示例3: unmarshal0
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
public final Object unmarshal0( Node node, JaxBeanInfo expectedType ) throws JAXBException {
try {
final DOMScanner scanner = new DOMScanner();
InterningXmlVisitor handler = new InterningXmlVisitor(createUnmarshallerHandler(null,false,expectedType));
scanner.setContentHandler(new SAXConnector(handler,scanner));
if(node.getNodeType() == Node.ELEMENT_NODE)
scanner.scan((Element)node);
else
if(node.getNodeType() == Node.DOCUMENT_NODE)
scanner.scan((Document)node);
else
// no other type of input is supported
throw new IllegalArgumentException("Unexpected node type: "+node);
Object retVal = handler.getContext().getResult();
handler.getContext().clearResult();
return retVal;
} catch( SAXException e ) {
throw createUnmarshalException(e);
}
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:24,代码来源:UnmarshallerImpl.java
示例4: writeTo
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
String soapNsUri = soapVersion.nsUri;
if (!parsedMessage) {
DOMScanner ds = new DOMScanner();
ds.setContentHandler(contentHandler);
ds.scan(sm.getSOAPPart());
} else {
contentHandler.setDocumentLocator(NULL_LOCATOR);
contentHandler.startDocument();
contentHandler.startPrefixMapping("S", soapNsUri);
startPrefixMapping(contentHandler, envelopeAttrs,"S");
contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs));
if (hasHeaders()) {
startPrefixMapping(contentHandler, headerAttrs,"S");
contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs));
MessageHeaders headers = getHeaders();
for (Header h : headers.asList()) {
h.writeTo(contentHandler, errorHandler);
}
endPrefixMapping(contentHandler, headerAttrs,"S");
contentHandler.endElement(soapNsUri, "Header", "S:Header");
}
startPrefixMapping(contentHandler, bodyAttrs,"S");
// write the body
contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs));
writePayloadTo(contentHandler, errorHandler, true);
endPrefixMapping(contentHandler, bodyAttrs,"S");
contentHandler.endElement(soapNsUri, "Body", "S:Body");
endPrefixMapping(contentHandler, envelopeAttrs,"S");
contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:SAAJMessage.java
示例5: scan
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
/**
* Generates the whole set of SAX events by treating
* element e as if it's a root element.
*/
public void scan( Element e, ContentHandler contentHandler ) throws SAXException {
DOMScanner scanner = new DOMScanner();
// insert the location resolver into the pipe line
LocationResolver resolver = new LocationResolver(scanner);
resolver.setContentHandler(contentHandler);
// parse this DOM.
scanner.setContentHandler(resolver);
scanner.scan(e);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DOMForestScanner.java
示例6: writeTo
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
String soapNsUri = soapVersion.nsUri;
if (!parsedMessage) {
DOMScanner ds = new DOMScanner();
ds.setContentHandler(contentHandler);
ds.scan(sm.getSOAPPart());
} else {
contentHandler.setDocumentLocator(NULL_LOCATOR);
contentHandler.startDocument();
contentHandler.startPrefixMapping("S", soapNsUri);
startPrefixMapping(contentHandler, envelopeAttrs,"S");
contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs));
if (hasHeaders()) {
startPrefixMapping(contentHandler, headerAttrs,"S");
contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs));
HeaderList headers = getHeaders();
int len = headers.size();
for (int i = 0; i < len; i++) {
// shouldn't JDK be smart enough to use array-style indexing for this foreach!?
headers.get(i).writeTo(contentHandler, errorHandler);
}
endPrefixMapping(contentHandler, headerAttrs,"S");
contentHandler.endElement(soapNsUri, "Header", "S:Header");
}
startPrefixMapping(contentHandler, bodyAttrs,"S");
// write the body
contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs));
writePayloadTo(contentHandler, errorHandler, true);
endPrefixMapping(contentHandler, bodyAttrs,"S");
contentHandler.endElement(soapNsUri, "Body", "S:Body");
endPrefixMapping(contentHandler, envelopeAttrs,"S");
contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope");
}
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:36,代码来源:SAAJMessage.java
示例7: writeTo
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
DOMScanner ds = new DOMScanner();
ds.setContentHandler(contentHandler);
ds.scan(node);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:DOMHeader.java
示例8: createBinder
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
@Override
public Binder<Node> createBinder() {
return new BinderImpl<Node>(this,new DOMScanner());
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:JAXBContextImpl.java
示例9: LocationResolver
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; //导入依赖的package包/类
LocationResolver( DOMScanner _parent ) {
this.parent = _parent;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:DOMForestScanner.java
注:本文中的com.sun.xml.internal.bind.unmarshaller.DOMScanner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论