Package org.apache.woden

Examples of org.apache.woden.XMLElement


    private void addDocumentation(AxisDescription axisDescription, DocumentableElement element) {
        DocumentationElement[] documentationElements = element.getDocumentationElements();
        String documentation = "";
        for (int i = 0; i < documentationElements.length; i++) {
            DocumentationElement documentationElement = documentationElements[i];
            XMLElement contentElement = documentationElement.getContent();
            Element content = (Element)contentElement.getSource();
            if (content != null) {
                documentation = documentation + DOM2Writer.nodeToString(content.getFirstChild());
            }
        }
        if (!"".equals(documentation)) {
View Full Code Here


     *
     */
    public XMLElement evaluate() {
        if(xpointer.hasPointerParts()) { //Scheme based pointer.
            //Take each pointer part at a time and evaluate it against the root element. The first result found will be returned.
            XMLElement result = null;
            for(Iterator it = Arrays.asList(xpointer.getPointerParts()).iterator(); it.hasNext(); ) {
                PointerPart pointerPart = (PointerPart)it.next();
                //TODO Add extra pointer parts here once we support them.
                if (pointerPart instanceof ElementPointerPart) {
                    result = evaluateElementPointerPart((ElementPointerPart)pointerPart);
View Full Code Here

     * @return an XMLElement pointed to by this Element pointer part, or null if none exists.
     */
    private XMLElement evaluateElementPointerPart(ElementPointerPart elementPointerPart) {
        if (elementPointerPart.hasChildSequence() && elementPointerPart.hasNCName()) { //Both NCName and childSequence.
            //Find NCName.
            XMLElement element = evaluateShorthandPointer(elementPointerPart.getNCName());
            if (element == null) return null;
            //Walk through children.
            return evaluateChildSequence(element, elementPointerPart.getChildSequence());
        } else if(elementPointerPart.hasNCName()) { //Only NCName
            return evaluateShorthandPointer(elementPointerPart.getNCName());
View Full Code Here

     */
    private XMLElement evaluateShorthandPointer(NCName ncname) {
        //Iterator for XMLElement from root in document order. See http://www.w3.org/TR/xpath#dt-document-order
        String shorthand = ncname.toString();
        for(Iterator it = new DocumentOrderIterator(root); it.hasNext(); ){
            XMLElement element = (XMLElement)it.next();
            if (testElementShorthand(element, shorthand)) return element;
        }
        return null;
    }
View Full Code Here

     * @return an XMLElement[] of the remaining nodes.
     */
    private static XMLElement[] filterNoneElementNodes(XMLElement[] nodes) {
        List nodeList = Arrays.asList(nodes);
        for(Iterator it = nodeList.iterator(); it.hasNext(); ) {           
            XMLElement node = (XMLElement)it.next();
            if(node.getLocalName().indexOf('#') > -1) {
                it.remove();
            }
        }
        XMLElement[] nNodes = new XMLElement[nodeList.size()];
        nodeList.toArray(nNodes);
View Full Code Here

            return !stack.isEmpty();
        }
       
        public Object next() {
            //Get next element.
            XMLElement element;
            try {
                element = (XMLElement)stack.pop();
            } catch (EmptyStackException e) {
                throw new NoSuchElementException();
            }
            //Add children to top of stack in reverse order.
            List children = Arrays.asList(element.getChildElements());
            Collections.reverse(children);
            stack.addAll(children);
           
            return element;
        }
View Full Code Here

     * Evaluates the XPointer on the root Element and returns the resulting Element or null.
     *
     * @return an Element from the resultant evaluation of the root Element or null if evaluation fails.
     */
    public Element evaluateElement(){
        XMLElement element = evaluate();
        if (element != null) return (Element)element.getSource();
        return null;
    }
View Full Code Here

     *
     * @return an Element from the resultant evaluation of the root Element or
     *         null if evaluation fails.
     */
    public OMElement evaluateElement() {
        XMLElement element = evaluate();
        if (element != null) return (OMElement) element.getSource();
        return null;
    }
View Full Code Here

        //Now parse any extensibility attributes or elements

        parseExtensionAttributes(docEl, DocumentationElement.class, documentation, desc);

        XMLElement[] children = docEl.getChildElements();
        XMLElement tempEl = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            documentation.addExtensionElement(
View Full Code Here

        types.setTypeSystem(Constants.TYPE_XSD_2001);

        parseExtensionAttributes(typesEl, TypesElement.class, types, desc);

        XMLElement[] children = typesEl.getChildElements();
        XMLElement tempEl = null;
        QName tempElQN = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            tempElQN = tempEl.getQName();

            //TODO validate element order? <documentation> must be first.

            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
            {
View Full Code Here

TOP

Related Classes of org.apache.woden.XMLElement

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.