public String getNamespacePrefix(Object o) { if (isElement(o)) { return ((Element)o).getNamespacePrefix(); } else if (isAttribute(o)) { return ((Attribute)o).getNamespacePrefix(); } else if (o instanceof XPathNamespace) { return ((XPathNamespace)o).getNamespacePrefix(); } return null; }
/** * Get the prefix of the name of the node. This is defined only for elements and attributes. * If the node has no prefix, or for other kinds of node, return a zero-length string. * * @return The prefix of the name of the node. */ public String getPrefix() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getNamespacePrefix(); case Type.ATTRIBUTE: return ((Attribute) node).getNamespacePrefix(); default: return ""; } }
/** * Get the prefix of the name of the node. This is defined only for elements and attributes. * If the node has no prefix, or for other kinds of node, return a zero-length string. * * @return The prefix of the name of the node. */ public String getPrefix() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getNamespacePrefix(); case Type.ATTRIBUTE: return ((Attribute) node).getNamespacePrefix(); default: return ""; } }
/** * Get the prefix of the name of the node. This is defined only for elements and attributes. * If the node has no prefix, or for other kinds of node, return a zero-length string. * * @return The prefix of the name of the node. */ public String getPrefix() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getNamespacePrefix(); case Type.ATTRIBUTE: return ((Attribute) node).getNamespacePrefix(); default: return ""; } }
public XmlName(Attribute attribute) { this.prefix = attribute.getNamespacePrefix(); this.localName = attribute.getLocalName(); this.namespace = attribute.getNamespaceURI(); }
public XmlName(Attribute attribute) { this.prefix = attribute.getNamespacePrefix(); this.localName = attribute.getLocalName(); this.namespace = attribute.getNamespaceURI(); }
public XmlName(Attribute attribute) { this.prefix = attribute.getNamespacePrefix(); this.localName = attribute.getLocalName(); this.namespace = attribute.getNamespaceURI(); }
protected void processUnexpectedAttributes(Element element, List<SwordValidationInfo> attributeItems) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for (int i = 0; i < attributeCount; i++) { attribute = element.getAttribute(i); XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo info = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); info.setContentDescription(attribute.getValue()); attributeItems.add(info); } }
protected void processUnexpectedAttributes(Element element, ArrayList<SwordValidationInfo> attributeItems) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo info = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); info.setContentDescription(attribute.getValue()); attributeItems.add(info); } }
protected void processUnexpectedAttributes(Element element, List<SwordValidationInfo> attributeItems) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo info = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); info.setContentDescription(attribute.getValue()); attributeItems.add(info); } }
public DefaultField(Element elm) { this.name = elm.getLocalName(); this.namespace = elm.getNamespaceURI(); this.prefix = elm.getNamespacePrefix(); for(int i = 0; i<elm.getAttributeCount(); i++) { Attribute attribute = elm.getAttribute(i); fields.add(new DefaultField(attribute.getNamespaceURI(), attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getValue())); } this.content = XmlUtil.innerToString(elm); }
private void writeAttribute(Attribute attr) { writeIndex(attr.getNamespacePrefix(), attr.getLocalName()); int type = ATTRIBUTE; if (attr.getNamespaceURI().length() == 0) { type = Util.noNamespace(type); } else { writeIndex(attr.getNamespaceURI()); } writeIndex(attr.getValue()); nodeTokens.add((byte)type); nodeTokens.add(Util.getAttributeTypeCode(attr)); }
private void writeAttribute(Attribute attr) { writeIndex(attr.getNamespacePrefix(), attr.getLocalName()); int type = ATTRIBUTE; if (attr.getNamespaceURI().length() == 0) { type = Util.noNamespace(type); } else { writeIndex(attr.getNamespaceURI()); } writeIndex(attr.getValue()); nodeTokens.add((byte)type); nodeTokens.add(Util.getAttributeTypeCode(attr)); }
attributeValidationItems.add(info); } else { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI());
/** * This method overrides the XmlElement definition so that it can allow * the definition of the href attribute. All other attributes are * shown as 'Unknown Attribute' info elements. * * @param element The element that contains the attributes * @param info The info object that will hold the validation info. */ @Override protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for (int i = 0; i < attributeCount; i++) { attribute = element.getAttribute(i); if (!ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName())) { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } } }
/** * This method overrides the XmlElement definition so that it can allow * the definition of the href attribute. All other attributes are * shown as 'Unknown Attribute' info elements. * * @param element The element that contains the attributes * @param info The info object that will hold the validation info. */ @Override protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); if( ! ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName()) ) { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } } }
/** * This method overrides the XmlElement definition so that it can allow * the definition of the href attribute. All other attributes are * shown as 'Unknown Attribute' info elements. * * @param element The element that contains the attributes * @param info The info object that will hold the validation info. */ @Override protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); if( ! ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName()) ) { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } } }
/** * Add the information to the unmarshall attribute section of the specified * info object. * * @param element XML element to process * @param info validation information item about elements/attributes */ protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for (int i = 0; i < attributeCount; i++) { attribute = element.getAttribute(i); XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } }
/** * Add the information to the unmarshall attribute section of the specified * info object. * * @param element * @param info */ protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } }
/** * Add the information to the unmarshall attribute section of the specified * info object. * * @param element * @param info */ protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } }