Package org.xmlpull.v1.builder

Examples of org.xmlpull.v1.builder.Iterable


            return parse(reader);
    }

    public RepositoryImpl parseRepository(Reader r) throws Exception
    {
        XmlPullParser reader = new KXmlParser();
        reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

        reader.setInput(r);
        int event = reader.nextTag();
        if (event != XmlPullParser.START_TAG || !REPOSITORY.equals(reader.getName()))
        {
            throw new Exception("Expected element 'repository' at the root of the document");
        }
        return parse(reader);
    }
View Full Code Here


        return parse(reader);
    }

    public ResourceImpl parseResource(Reader r) throws Exception
    {
        XmlPullParser reader = new KXmlParser();
        reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

        reader.setInput(r);
        int event = reader.nextTag();
        if (event != XmlPullParser.START_TAG || !RESOURCE.equals(reader.getName()))
        {
            throw new Exception("Expected element 'resource'");
        }
        return parseResource(reader);
    }
View Full Code Here

        return parseResource(reader);
    }

    public CapabilityImpl parseCapability(Reader r) throws Exception
    {
        XmlPullParser reader = new KXmlParser();
        reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

        reader.setInput(r);
        int event = reader.nextTag();
        if (event != XmlPullParser.START_TAG || !CAPABILITY.equals(reader.getName()))
        {
            throw new Exception("Expected element 'capability'");
        }
        return parseCapability(reader);
    }
View Full Code Here

        return parseCapability(reader);
    }

    public PropertyImpl parseProperty(Reader r) throws Exception
    {
        XmlPullParser reader = new KXmlParser();
        reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

        reader.setInput(r);
        int event = reader.nextTag();
        if (event != XmlPullParser.START_TAG || !P.equals(reader.getName()))
        {
            throw new Exception("Expected element 'p'");
        }
        return parseProperty(reader);
    }
View Full Code Here

        return parseProperty(reader);
    }

    public RequirementImpl parseRequirement(Reader r) throws Exception
    {
        XmlPullParser reader = new KXmlParser();
        reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

        reader.setInput(r);
        int event = reader.nextTag();
        if (event != XmlPullParser.START_TAG || !REQUIRE.equals(reader.getName()))
        {
            throw new Exception("Expected element 'require'");
        }
        return parseRequire(reader);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void executeAction( Dsmlv2Container container ) throws XmlPullParserException, IOException
    {
        XmlPullParser xpp = container.getParser();

        int eventType = xpp.getEventType();

        do
        {
            if ( eventType == XmlPullParser.START_DOCUMENT )
            {
                container.setState( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE );
            }
            else if ( eventType == XmlPullParser.END_DOCUMENT )
            {
                container.setState( Dsmlv2StatesEnum.GRAMMAR_END );
            }
            else if ( eventType == XmlPullParser.START_TAG )
            {
                processTag( container, Tag.START );
            }
            else if ( eventType == XmlPullParser.END_TAG )
            {
                processTag( container, Tag.END );
            }

            eventType = xpp.next();
        }
        while ( eventType != XmlPullParser.END_DOCUMENT );
    }
View Full Code Here

     * @throws XmlPullParserException
     *      when an error occurs during the parsing
     */
    private void processTag( Dsmlv2Container container, int tagType ) throws XmlPullParserException
    {
        XmlPullParser xpp = container.getParser();

        String tagName = Strings.toLowerCase( xpp.getName() );

        GrammarTransition transition = getTransition( container.getState(), new Tag( tagName, tagType ) );

        if ( transition != null )
        {
View Full Code Here

    private void createAndAddControl( Dsmlv2Container container,
        AbstractDsmlMessageDecorator<? extends Message> parent ) throws XmlPullParserException
    {
        CodecControl<? extends Control> control = null;

        XmlPullParser xpp = container.getParser();

        // Checking and adding the Control's attributes
        String attributeValue;
        // TYPE
        attributeValue = xpp.getAttributeValue( "", "type" );

        if ( attributeValue != null )
        {
            if ( !Oid.isOid( attributeValue ) )
            {
                throw new XmlPullParserException( I18n.err( I18n.ERR_03006 ), xpp, null );
            }

            control = container.getLdapCodecService().newControl( new OpaqueControl( attributeValue ) );
            parent.addControl( control );
        }
        else
        {
            throw new XmlPullParserException( I18n.err( I18n.ERR_03005 ), xpp, null );
        }
        // CRITICALITY
        attributeValue = xpp.getAttributeValue( "", "criticality" );

        if ( attributeValue != null )
        {
            if ( attributeValue.equals( "true" ) )
            {
View Full Code Here

        throws XmlPullParserException
    {
        DsmlControl<? extends Control> control =
            ( ( AbstractDsmlMessageDecorator<?> ) parent ).getCurrentControl();

        XmlPullParser xpp = container.getParser();
        try
        {
            // We have to catch the type Attribute Value before going to the next Text node
            String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );

            // Getting the value
            String nextText = xpp.nextText();

            if ( !nextText.equals( "" ) )
            {
                if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
                {
View Full Code Here

        this.container.setGrammar( Dsmlv2ResponseGrammar.getInstance() );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here

TOP

Related Classes of org.xmlpull.v1.builder.Iterable

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.