本文整理了Java中org.teiid.core.types.XMLType.getString()
方法的一些代码示例,展示了XMLType.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLType.getString()
方法的具体详情如下:
包路径:org.teiid.core.types.XMLType
类名称:XMLType
方法名:getString
暂无
代码示例来源:origin: teiid/teiid
@Test public void testGoodElement() throws Exception {
String xml = "<customer>\n" + //$NON-NLS-1$
"<name>ABC</name>" + //$NON-NLS-1$
"<age>32</age>" + //$NON-NLS-1$
"</customer>"; //$NON-NLS-1$
StringToSQLXMLTransform transform = new StringToSQLXMLTransform();
XMLType xmlValue = (XMLType)transform.transformDirect(xml);
assertEquals(xml.replaceAll("[\r]", ""), xmlValue.getString().replaceAll("[\r]", ""));
assertEquals(XMLType.Type.ELEMENT, xmlValue.getType());
}
代码示例来源:origin: teiid/teiid
@Test public void testTypeConversion() throws Exception {
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
String str = "hello world";
Object source = new StreamSource(new StringReader(str));
XMLType xml = (XMLType) ConnectorWorkItem.convertToRuntimeType(bm, source, DataTypeManager.DefaultDataClasses.XML, null);
assertEquals(str, xml.getString());
source = new StAXSource(XMLType.getXmlInputFactory().createXMLEventReader(new StringReader("<a/>")));
xml = (XMLType) ConnectorWorkItem.convertToRuntimeType(bm, source, DataTypeManager.DefaultDataClasses.XML, null);
XMLInputFactory in = XMLType.getXmlInputFactory();
XMLStreamReader reader = in.createXMLStreamReader(new StringReader(xml.getString()));
assertEquals(XMLEvent.START_DOCUMENT, reader.getEventType());
assertEquals(XMLEvent.START_ELEMENT, reader.next());
assertEquals("a", reader.getLocalName());
assertEquals(XMLEvent.END_ELEMENT, reader.next());
byte[] bytes = str.getBytes(Streamable.ENCODING);
source = new InputStreamFactory.BlobInputStreamFactory(BlobType.createBlob(bytes));
BlobType blob = (BlobType) ConnectorWorkItem.convertToRuntimeType(bm, source, DataTypeManager.DefaultDataClasses.BLOB, null);
assertArrayEquals(bytes, ObjectConverterUtil.convertToByteArray(blob.getBinaryStream()));
}
代码示例来源:origin: teiid/teiid
/**
* Helper to verify the result of an expression.
*
* @param expr SQL expression.
* @param result Expected result.
* @throws Exception
*/
public static void assertEval(String expr, String result)
throws Exception {
Expression ex = TestFunctionResolving.getExpression(expr);
Object val = Evaluator.evaluate(ex);
String valStr;
if (val instanceof Clob) {
valStr = ClobType.getString((Clob) val);
} else if (val instanceof XMLType) {
valStr = ((XMLType) val).getString();
} else {
valStr = val.toString();
}
assertEquals(result, valStr);
}
代码示例来源:origin: org.teiid/teiid-engine
throw new FunctionExecutionException();
case TEXT:
i = new StringValue(value.getString());
break;
case UNKNOWN:
代码示例来源:origin: teiid/teiid
@Test public void testXMLValue() throws Exception {
String testString = "<foo>this is an xml value test</foo>"; //$NON-NLS-1$
SQLXMLImpl xml = new SQLXMLImpl(testString);
XMLType xv = new XMLType(xml);
assertEquals(testString, xv.getString());
}
代码示例来源:origin: teiid/teiid
throw new FunctionExecutionException();
case TEXT:
i = new StringValue(value.getString());
break;
case UNKNOWN:
代码示例来源:origin: teiid/teiid
if(cellValue instanceof XMLType){
XMLType id = (XMLType)cellValue;
String actualDoc = id.getString();
if (expectedResults[i].size() == 1) {
compareDocuments((String)expectedResults[i].get(0), actualDoc);
代码示例来源:origin: org.jboss.teiid/teiid-engine
throw new FunctionExecutionException();
case TEXT:
i = new StringValue(value.getString());
break;
case UNKNOWN:
代码示例来源:origin: teiid/teiid
@Test public void testReferencePersistence() throws Exception {
String testString = "<foo>this is an xml value test</foo>"; //$NON-NLS-1$
SQLXMLImpl xml = new SQLXMLImpl(testString);
XMLType xv = new XMLType(xml);
xv.setReferenceStreamId(null);
// now force to serialize
XMLType read = UnitTestUtil.helpSerialize(xv);
assertEquals(testString, read.getString());
}
代码示例来源:origin: org.teiid/teiid-engine
} else {
XMLType x = (XMLType)lob;
String s = x.getString();
x.setReference(new SQLXMLImpl(s));
代码示例来源:origin: org.jboss.teiid/teiid-engine
} else {
XMLType x = (XMLType)lob;
String s = x.getString();
x.setReference(new SQLXMLImpl(s));
代码示例来源:origin: teiid/teiid
} else {
XMLType x = (XMLType)lob;
String s = x.getString();
x.setReference(new SQLXMLImpl(s));
内容来源于网络,如有侵权,请联系作者删除!