type = ((Attr) attr).getSchemaTypeInfo().getTypeName();
type = ((Attr) attr).getSchemaTypeInfo().getTypeName();
private boolean typeInfo(String typeName) { TypeInfo typeInfo = _value.getSchemaTypeInfo(); return isType(typeInfo, typeName); }
public DOMTypeInfo getSchemaTypeInfo() { return wrap(_delegate.getSchemaTypeInfo()); }
/** * Gets the Attributes that are not namesapce declarations * @param attrs * @return */ private AttributesImpl getAttributes(NamedNodeMap attrs) { AttributesImpl atts = new AttributesImpl(); if(attrs == null) return EMPTY_ATTS; for(int i=0; i < attrs.getLength();i++) { Attr a = (Attr)attrs.item(i); //check if attr is ns declaration if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) { continue; } atts.addAttribute(fixNull(a.getNamespaceURI()),a.getLocalName(),a.getName(),a.getSchemaTypeInfo().getTypeName(),a.getValue()); } return atts; }
/** * Gets the Attributes that are not namesapce declarations * @param attrs * @return */ private AttributesImpl getAttributes(NamedNodeMap attrs) { AttributesImpl atts = new AttributesImpl(); if(attrs == null) return EMPTY_ATTS; for(int i=0; i < attrs.getLength();i++) { Attr a = (Attr)attrs.item(i); //check if attr is ns declaration if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) { continue; } atts.addAttribute(fixNull(a.getNamespaceURI()),a.getLocalName(),a.getName(),a.getSchemaTypeInfo().getTypeName(),a.getValue()); } return atts; }
/** * Gets the Attributes that are not namesapce declarations * @param attrs * @return */ private AttributesImpl getAttributes(NamedNodeMap attrs) { AttributesImpl atts = new AttributesImpl(); if(attrs == null) return EMPTY_ATTS; for(int i=0; i < attrs.getLength();i++) { Attr a = (Attr)attrs.item(i); //check if attr is ns declaration if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) { continue; } atts.addAttribute(fixNull(a.getNamespaceURI()),a.getLocalName(),a.getName(),a.getSchemaTypeInfo().getTypeName(),a.getValue()); } return atts; }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Attr attrid; Element acElem; TypeInfo attrTypeInfo; String typeName; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acElem = (Element) elemList.item(2); attrid = acElem.getAttributeNode("id"); attrTypeInfo = attrid.getSchemaTypeInfo(); typeName = attrTypeInfo.getTypeName(); assertEquals("typeinfogettypename03_1", "ID", typeName); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Element acElem; Attr titleAttr; TypeInfo attrTypeInfo; String typeNamespace; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acElem = (Element) elemList.item(0); titleAttr = acElem.getAttributeNode("title"); attrTypeInfo = titleAttr.getSchemaTypeInfo(); typeNamespace = attrTypeInfo.getTypeNamespace(); assertEquals("typeinfogettypename01_1", "http://www.w3.org/2001/XMLSchema", typeNamespace); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Attr classAttr; TypeInfo attrTypeInfo; String typeNamespace; Element acElem; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acElem = (Element) elemList.item(1); classAttr = acElem.getAttributeNode("class"); attrTypeInfo = classAttr.getSchemaTypeInfo(); typeNamespace = attrTypeInfo.getTypeNamespace(); assertEquals("typeinfogettypename03_1", "http://www.w3.org/1999/xhtml", typeNamespace); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Element docElem; NodeList elemList; Element acElem; Attr classAttr; TypeInfo attrTypeInfo; String typeName; boolean retValue; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acElem = (Element) elemList.item(1); classAttr = acElem.getAttributeNode("class"); attrTypeInfo = classAttr.getSchemaTypeInfo(); retValue = attrTypeInfo.isDerivedFrom("http://www.w3.org/1999/xhtml", "classType", 1); assertTrue("derivedFromClassType", retValue); retValue = attrTypeInfo.isDerivedFrom("http://www.w3.org/2001/XMLSchema", "string", 1); assertTrue("derivedFromString", retValue); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Element acronymElem; Attr attr; Element elem; String elemName; TypeInfo typeInfo; boolean isDerived; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acronymElem = (Element) elemList.item(0); attr = acronymElem.getAttributeNode("title"); typeInfo = attr.getSchemaTypeInfo(); assertNotNull("typeInfoNotNull", typeInfo); isDerived = typeInfo.isDerivedFrom("http://www.w3.org/TR/REC-xml", "CDATA", 0); assertFalse("isDerived0", isDerived); isDerived = typeInfo.isDerivedFrom("http://www.w3.org/TR/REC-xml", "CDATA", 15); assertFalse("isDerived15", isDerived); } /**
public String getAttributeType(int i) { Attr attr = getAttribute(i); if (attr.isId()) { return "ID"; } TypeInfo schemaType = null; try { schemaType = attr.getSchemaTypeInfo(); } catch (Throwable t) { //DOM level 2? schemaType = null; } return (schemaType == null) ? "CDATA" : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName(); }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Element acronymElem; Attr attr; Element elem; String elemName; TypeInfo typeInfo; boolean isDerived; String typeName; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acronymElem = (Element) elemList.item(2); attr = acronymElem.getAttributeNode("class"); typeInfo = attr.getSchemaTypeInfo(); assertNotNull("typeInfoNotNull", typeInfo); typeName = typeInfo.getTypeName(); assertEquals("nameIsString", "classType", typeName); isDerived = typeInfo.isDerivedFrom("http://www.w3.org/2001/XMLSchema", "anySimpleType", 15); assertTrue("derivedFromAnySimpleType", isDerived); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Element acronymElem; Attr attr; Element elem; String elemName; TypeInfo typeInfo; boolean isDerived; String typeName; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acronymElem = (Element) elemList.item(0); attr = acronymElem.getAttributeNode("title"); typeInfo = attr.getSchemaTypeInfo(); assertNotNull("typeInfoNotNull", typeInfo); typeName = typeInfo.getTypeName(); assertEquals("nameIsString", "string", typeName); isDerived = typeInfo.isDerivedFrom("http://www.w3.org/2001/XMLSchema", "anyType", 15); assertTrue("derivedFromAnyType", isDerived); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elemList; Element acronymElem; Attr attr; Element elem; String elemName; TypeInfo typeInfo; String typeNS; String typeName; doc = (Document) load("hc_staff", false); elemList = doc.getElementsByTagName("acronym"); acronymElem = (Element) elemList.item(2); attr = acronymElem.getAttributeNode("id"); typeInfo = attr.getSchemaTypeInfo(); assertNotNull("typeInfoNotNull", typeInfo); typeName = typeInfo.getTypeName(); assertEquals("nameIsID", "ID", typeName); typeNS = typeInfo.getTypeNamespace(); assertEquals("nsIsXmlSchema", "http://www.w3.org/2001/XMLSchema", typeNS); } /**
public String getAttributeType(int i) { Attr attr = getAttribute(i); if (attr.isId()) { return "ID"; } TypeInfo schemaType = null; try { schemaType = attr.getSchemaTypeInfo(); } catch (Throwable t) { //DOM level 2? schemaType = null; } return (schemaType == null) ? "CDATA" : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName(); }
public String getAttributeType(int i) { Attr attr = getAttribute(i); if (attr.isId()) { return "ID"; } TypeInfo schemaType = null; try { schemaType = attr.getSchemaTypeInfo(); } catch (Throwable t) { //DOM level 2? schemaType = null; } return (schemaType == null) ? "CDATA" : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName(); }
public String getAttributeType(int i) { Attr attr = getAttribute(i); if (attr.isId()) { return "ID"; } TypeInfo schemaType = null; try { schemaType = attr.getSchemaTypeInfo(); } catch (Throwable t) { //DOM level 2? schemaType = null; } return (schemaType == null) ? "CDATA" : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName(); }
public String getAttributeType(int i) { Attr attr = getAttribute(i); if (attr.isId()) { return "ID"; } TypeInfo schemaType = null; try { schemaType = attr.getSchemaTypeInfo(); } catch (Throwable t) { //DOM level 2? schemaType = null; } return (schemaType == null) ? "CDATA" : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName(); }