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


Java TypeInfo類代碼示例

本文整理匯總了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));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:Bug4966143.java

示例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");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:Bug4966138.java

示例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));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:AuctionController.java

示例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));
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:29,代碼來源:AuctionController.java

示例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;
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:24,代碼來源:XMLSchemaTypeInfo.java

示例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;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:24,代碼來源:XMLStreamReaderFromDOM.java

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

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

示例10: getSchemaTypeInfo

import org.w3c.dom.TypeInfo; //導入依賴的package包/類
/**
 * Method getSchemaTypeInfo.
 *
 * @return TypeInfo
 */
public TypeInfo getSchemaTypeInfo() {
    if (needsSyncData()) {
        synchronizeData();
    }
    return this;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:ElementImpl.java

示例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));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:Bug4966142.java

示例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");

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:TypeInfoTest.java

示例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;
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:10,代碼來源:AbstractElement.java

示例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;
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:10,代碼來源:AbstractAttr.java

示例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);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:14,代碼來源:XIncludeFilter.java


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