本文整理匯總了Java中org.w3c.dom.TypeInfo類的典型用法代碼示例。如果您正苦於以下問題:Java TypeInfo類的具體用法?Java TypeInfo怎麽用?Java TypeInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TypeInfo類屬於org.w3c.dom包,在下文中一共展示了TypeInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test1
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
@Test
public void test1() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
dbf.setAttribute(SCHEMA_SOURCE, Bug4966143.class.getResource("Bug4966143.xsd").toExternalForm());
Document document = dbf.newDocumentBuilder().parse(Bug4966143.class.getResource("Bug4966143.xml").toExternalForm());
TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_LIST));
Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_RESTRICTION));
Assert.assertTrue(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_EXTENSION));
Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
}
示例2: test1
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
@Test
public void test1() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
dbf.setAttribute(SCHEMA_SOURCE, Bug4966138.class.getResource("test.xsd").toExternalForm());
Document document = dbf.newDocumentBuilder().parse(Bug4966138.class.getResource("test.xml").toExternalForm());
TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
String typeName = type.getTypeName();
System.out.println(typeName);
Assert.assertNotNull(typeName);
Assert.assertTrue(typeName.length() != 0, "returned typeName shouldn't be empty");
String typeNs = type.getTypeNamespace();
System.out.println(typeNs);
Assert.assertNotNull(typeNs);
Assert.assertTrue(typeNs.length() != 0, "returned typeNamespace shouldn't be empty");
}
示例3: testGetTypeInfo
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
* Check usage of TypeInfo interface introduced in DOM L3.
*
* @throws Exception If any errors occur.
*/
@Test
public void testGetTypeInfo() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
docBuilder.setErrorHandler(new MyErrorHandler());
Document document = docBuilder.parse(xmlFile);
Element userId = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "UserID").item(0);
TypeInfo typeInfo = userId.getSchemaTypeInfo();
assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger"));
assertTrue(typeInfo.getTypeNamespace().equals(W3C_XML_SCHEMA_NS_URI));
Element role = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Role").item(0);
TypeInfo roletypeInfo = role.getSchemaTypeInfo();
assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell"));
assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
}
示例4: testGetTypeInfo
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
* Check usage of TypeInfo interface introduced in DOM L3.
*
* @throws Exception If any errors occur.
*/
@Test(groups = {"readLocalFiles"})
public void testGetTypeInfo() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
docBuilder.setErrorHandler(new MyErrorHandler());
Document document = docBuilder.parse(xmlFile);
Element userId = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "UserID").item(0);
TypeInfo typeInfo = userId.getSchemaTypeInfo();
assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger"));
assertTrue(typeInfo.getTypeNamespace().equals(W3C_XML_SCHEMA_NS_URI));
Element role = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Role").item(0);
TypeInfo roletypeInfo = role.getSchemaTypeInfo();
assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell"));
assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
}
示例5: simpleTypeIsDerivedFrom
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
protected boolean simpleTypeIsDerivedFrom(SimpleType simpleType,
String typeNamespace,
String typeName,
int derivationMethod)
{
switch (derivationMethod)
{
case TypeInfo.DERIVATION_RESTRICTION:
SimpleType baseType = simpleType.baseType;
while (baseType != null)
{
if (baseType.name.getNamespaceURI().equals(typeNamespace) &&
baseType.name.getLocalPart().equals(typeName))
{
return true;
}
baseType = baseType.baseType;
}
break;
// TODO other methods
}
return false;
}
示例6: getAttributeType
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
public String getAttributeType(int index) {
String attrType = null;
Attr attr = (Attr)getAttributes().get(index);
TypeInfo typeInfo = attr.getSchemaTypeInfo();
if (typeInfo != null) {
attrType = typeInfo.getTypeName();
}
if (attrType == null) {
try {
attrType = (String) attr.getUserData(SAAJConverter.OM_ATTRIBUTE_KEY);
if (log.isDebugEnabled()) {
log.debug("Retrieving attrType from UserData: " + attrType);
}
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("An error occured while getting attrType: " + e.getMessage());
}
}
}
return attrType;
}
示例7: toJavaTypeName
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
public String toJavaTypeName(XSObject xs, Map<String, NamespaceDesc> nsdMap) {
String name = xs.getName();
if (name == null) {
if (xs instanceof TypeInfo) {
name = ((TypeInfo) xs).getTypeName();
if (name != null && name.startsWith("#")) {
name = name.substring(1);
}
}
}
return model.toJavaTypeName(name, xs.getNamespace());
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:13,代碼來源:XSDModelLoader.java
示例8: getSchemaTypeInfo
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
* Method getSchemaTypeInfo.
* @return TypeInfo
*/
public TypeInfo getSchemaTypeInfo(){
if(needsSyncData()) {
synchronizeData();
}
return this;
}
示例9: getAttributeType
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
private TypeInfo getAttributeType( int index ) {
checkState(false);
if( index<0 || fAttributes.getLength()<=index )
throw new IndexOutOfBoundsException(Integer.toString(index));
Augmentations augs = fAttributes.getAugmentations(index);
if (augs == null) return null;
AttributePSVI psvi = (AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
return getTypeInfoFromPSVI(psvi);
}
示例10: getSchemaTypeInfo
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
* Method getSchemaTypeInfo.
*
* @return TypeInfo
*/
public TypeInfo getSchemaTypeInfo() {
if (needsSyncData()) {
synchronizeData();
}
return this;
}
示例11: test1
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
@Test
public void test1() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
dbf.setAttribute(SCHEMA_SOURCE, Bug4966142.class.getResource("Bug4966142.xsd").toExternalForm());
Document document = dbf.newDocumentBuilder().parse(Bug4966142.class.getResource("Bug4966142.xml").toExternalForm());
TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
}
示例12: test
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
@Test
public void test() throws Exception {
TypeInfo typeInfo = getTypeOfRoot(SCHEMA_INSTANCE, "<?xml version='1.0'?>\n" + "<test1 xmlns=\"testNS\"><code/></test1>\n");
assertEquals(typeInfo.getTypeName(), "Test");
assertEquals(typeInfo.getTypeNamespace(), "testNS");
}
示例13: getSchemaTypeInfo
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
* <b>DOM</b>: Implements {@link org.w3c.dom.Element#getSchemaTypeInfo()}.
*/
public TypeInfo getSchemaTypeInfo() {
if (typeInfo == null) {
typeInfo = new ElementTypeInfo();
}
return typeInfo;
}
示例14: getSchemaTypeInfo
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
* <b>DOM</b>: Implements {@link org.w3c.dom.Attr#getSchemaTypeInfo()}.
*/
public TypeInfo getSchemaTypeInfo() {
if (typeInfo == null) {
typeInfo = new AttrTypeInfo();
}
return typeInfo;
}
示例15: getAttributeType
import org.w3c.dom.TypeInfo; //導入依賴的package包/類
public String getAttributeType(int index)
{
if (current != null)
{
NamedNodeMap attrs = current.getAttributes();
if (attrs == null)
return null;
Attr attr = (Attr) attrs.item(index);
TypeInfo ti = attr.getSchemaTypeInfo();
return (ti == null) ? "CDATA" : ti.getTypeName();
}
return super.getAttributeType(index);
}