Package org.kxml2.kdom

Examples of org.kxml2.kdom.Node


  public static BundleMetaTypeResource loadBMTIfromUrl(BundleContext bc, Bundle b, URL url) throws IOException {
    InputStream in = null;

    if(xml_parser == null){
      xml_parser = new KXmlParser();

      confAdminTracker = new ServiceTracker(bc, ConfigurationAdmin.class.getName(), null);
      confAdminTracker.open();
    }
View Full Code Here


        }
    };
    private KXmlParser xmlParser;

    XmlReader() {
        this.xmlParser = new KXmlParser();
        try {
            // Make namespace-aware
            this.xmlParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        } catch (XmlPullParserException e) {
            throw new RuntimeException(e);
View Full Code Here

        try
        {
            InputStream is = new FileInputStream( new File( m_obrXml ) );
            try
            {
                KXmlParser kxp = new KXmlParser();
                kxp.setInput( is, null );
                kxp.nextTag(); // skip top level element
                kxp.nextTag(); // go to first child element
                parseObrXml( kxp );
            }
            finally
            {
                is.close();
View Full Code Here

    {
    }

    public RepositoryImpl parseRepository(InputStream is) throws Exception
    {
        XmlPullParser reader = new KXmlParser();

        // The spec-based Repository XML uses namespaces, so switch this on...
        reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

        reader.setInput(is, null);
        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");
        }

        if ("http://www.osgi.org/xmlns/repository/v1.0.0".equals(reader.getNamespace()))
            // TODO there are a bunch of other methods here that create a parser, should they be updated too?
            // at the very least they should be made namespace-aware too, so that parsing is the same no matter
            // how its initiated.
            return SpecXMLPullParser.parse(reader);
        else
View Full Code Here

            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}
     */
    @Override
    protected XmlPullParser createParser() {
        return new KXmlParser();
    }
View Full Code Here

TOP

Related Classes of org.kxml2.kdom.Node

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.