Rectangle 27 98

I'm going to add a separate answer just because I don't see it here. It's not 100% what Pentium10 asked for, but I ended up here by searching for Error parsing XML: unbound prefix

Turns out I was using custom parameters for AdMob ads like ads:adSize, but I hadn't added

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

frequent issues arising in android view, Error parsing XML: unbound pr...

xml android eclipse android-linearlayout
Rectangle 27 1

The reason the code is not working is because of the namespace. If the namespace is always the same, you can code it as a prefix to the tag you're trying to find:

import xml.etree.ElementTree as ET

xml = """
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/14.1D0/junos">
    <route-information xmlns="http://xml.juniper.net/junos/14.1D0/junos-routing">
        <!-- keepalive -->
        <route-table>
            <table-name>inet.0</table-name>
            <destination-count>52</destination-count>
            <total-route-count>52</total-route-count>
            <active-route-count>52</active-route-count>
            <holddown-route-count>0</holddown-route-count>
            <hidden-route-count>0</hidden-route-count>
            <rt junos:style="brief">
                <rt-destination>5.5.5.5/32</rt-destination>
                <rt-entry>
                    <active-tag>*</active-tag>
                    <current-active/>
                    <last-active/>
                    <protocol-name>Direct</protocol-name>
                    <preference>0</preference>
                    <age junos:seconds="428929">4d 23:08:49</age>
                    <nh>
                        <selected-next-hop/>
                        <via>lo0.0</via>
                    </nh>
                </rt-entry>
            </rt>
        </route-table>
    </route-information>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>
"""

XML_NAMESPACE = '{http://xml.juniper.net/junos/14.1D0/junos-routing}'
root = ET.fromstring(xml)
rt_nodes = root.iter(tag='{}rt-destination'.format(XML_NAMESPACE))
print rt_nodes.next().text  # 5.5.5.5/32

If you need something more flexible, you can check out the answers here.

python - ElementTree: Parsing XML great-grandchildren - Stack Overflow

python xml automation elementtree
Rectangle 27 1

I think the namespace in the XML is causing a problem for parsing. Try to specify the namespace in package-info.java and mention the prefix as "a" in there. You can check more information here.

You could check a similar question here

The response XML returned from my web service call had some issue which caused the exception when unmarshaling it. When I removed some unused sections from the XSD file, this worked.

Great ! Still, you could mark the sections which are optional in the XSD as optional using minOccurs attribute (that is, if these sections can appear again, in some other responses its better to mark them as optional rather than removing(I know, that's not what you asked for)).

Since I auto generate the XSD, optional fields are automatically marked thus they are annotated in the generated java files as well. Having the unused fields annotated as that didn't make any difference in resolving the issue. I use eclipselink within my project. I doubt it can be one reason for this.

java - javax.xml.bind.UnmarshalException iccurs when unmarshalling an ...

java xml jaxb
Rectangle 27 3

I'll throw in a little more for the newbies and for folks, like myself, that don't understand XML.

The answers above a pretty good, but the general answer is that you need a namespace for any namespace used in the config.xml file.

Translation: Any XML tag name that has is a tag with a namespace where blah is the namespace and fubar is the XML tag. The namespace lets you use many different tools to interpret the XML with their own tag names. For example, Intel XDK uses the namespace intelxdk and android uses android. Thus you need the following namespaces or the build throws up blood (i.e. Error parsing XML: unbound prefix) which is translated to: You used a namespace, but did not define it.

xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:intelxdk="http://xdk.intel.com/ns/v1"

frequent issues arising in android view, Error parsing XML: unbound pr...

xml android eclipse android-linearlayout