Package org.xmlpull.infoset

Examples of org.xmlpull.infoset.XmlAttribute


     * @param name
     * @param oldValue
     * @param newValue
     */
    public static void replaceAttributeValue(XmlElement element, String name, String oldValue, String newValue) {
        XmlAttribute attribute = element.attribute(name);
        if (null != attribute && oldValue.equals(attribute.getValue())) {
            element.removeAttribute(attribute);
            element.setAttributeValue(name, newValue);
        }
        Iterable iterator = element.children();
        for (Object object : iterator) {
View Full Code Here


        }

    }

    public static boolean attributeExist(XmlElement element, String name, String value) {
        XmlAttribute attribute = element.attribute(name);
        if (null != attribute && value.equals(attribute.getValue())) {
            return true;
        }
        Iterable iterator = element.children();
        boolean ret = false;
        for (Object object : iterator) {
View Full Code Here

        return getObjectOfType(getSimpleTypeIndex(qName), obj);
    }

    public static int getSimpleTypeIndex(XmlElement element) {

        XmlAttribute type = element.attribute(STR_TYPE);
        if (null == type) {
            return -1;
        }
        String typeQNameString = type.getValue();
        String typeName = XMLUtil.getLocalPartOfQName(typeQNameString);
        String prefix = XMLUtil.getPrefixOfQName(typeQNameString);
        XmlNamespace namespace = element.lookupNamespaceByPrefix(prefix);
        if (namespace == null) {
            return -1;
        }
        QName typeQname = new QName(namespace.getName(), typeName, prefix);
        int simpleTypeIndex = getSimpleTypeIndex(typeQname);
        if (-1 == simpleTypeIndex) {
            return -1;
        }

        XmlAttribute maxOccurs = element.attribute(STR_MAX_OCCURS);
        if (maxOccurs != null && STR_UNBOUNDED.equals(maxOccurs.getValue())) {
            // this is the comvention the arraytype index is simplextye index + NUM
            return NUM + simpleTypeIndex;
        } else {
            return simpleTypeIndex;
        }
View Full Code Here

                // invokeService.addAttribute("name", arg1)
                QName partnerLinkTypeQName = link.getPartnerLinkTypeQName();
                Iterator<org.xmlpull.infoset.XmlElement> plIterator = partnerLinkTypes.iterator();
                while (plIterator.hasNext()) {
                    org.xmlpull.infoset.XmlElement plType = plIterator.next();
                    XmlAttribute plTypeName = plType.attribute(NAME);
                    if (plTypeName.getValue().equals(partnerLinkTypeQName.getLocalPart())) {
                        // found the correct partnerlink type
                        // now find the porttype

                        XmlAttribute plPortType = plType.element("role").attribute("portType");
                        String portTypeQnameString = plPortType.getValue();
                        String[] portTypeSegs = portTypeQnameString.split(":");
                        Iterator<org.xmlpull.infoset.XmlNamespace> namespaceIterator = wsdlXml.namespaces().iterator();
                        QName portTypeQname = null;
                        // find the qname of the porttype
                        while (namespaceIterator.hasNext()) {
View Full Code Here

        }

        // remove attributeFormDefault and elementFormDefault
        Iterable<XmlElement> schemas = wsdl.getTypes().elements(null, "schema");
        for (XmlElement schema : schemas) {
            XmlAttribute attributeFormDefault = schema.attribute("attributeFormDefault");
            schema.removeAttribute(attributeFormDefault);

            XmlAttribute elementFormDefault = schema.attribute("elementFormDefault");
            schema.removeAttribute(elementFormDefault);
        }
    }
View Full Code Here

TOP

Related Classes of org.xmlpull.infoset.XmlAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.