diff options
author | Raphael <raphael@google.com> | 2009-11-20 12:46:08 -0800 |
---|---|---|
committer | Raphael <raphael@google.com> | 2009-11-20 12:46:08 -0800 |
commit | 109964b3c9b274d5c69f10114dff6917b597365b (patch) | |
tree | ef5e494bbe30f7c94aa216a04d6fa8ccf9be572e /eclipse | |
parent | 4b38ad894bdc56b21c0d7c2a169df49a8c4898b6 (diff) | |
download | sdk-109964b3c9b274d5c69f10114dff6917b597365b.zip sdk-109964b3c9b274d5c69f10114dff6917b597365b.tar.gz sdk-109964b3c9b274d5c69f10114dff6917b597365b.tar.bz2 |
ADT fix: layout device config files can be empty (no devices)
SDK BUG 2275276
Change-Id: I139f3b16a258a8e1b223b62d9c93e9870b6fb27c
Diffstat (limited to 'eclipse')
2 files changed, 44 insertions, 45 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd index 8a58560..0551afd 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd @@ -22,12 +22,16 @@ attributeFormDefault="unqualified" version="1"> - <xsd:element name="layout-devices"> + <!-- The root element layout-devices defines a sequence of 0..n device elements. --> + + <xsd:element name="layout-devices" type="c:layoutDevicesType" /> + + <xsd:complexType name="layoutDevicesType"> <xsd:annotation> <xsd:documentation xml:lang="en"> The "layout-devices" element is the root element of this schema. - It must contain one or more "device" elements that each define the configurations + It must contain zero or more "device" elements that each define the configurations available for a given device. These definitions are used in the Graphical Layout Editor in the @@ -35,43 +39,41 @@ </xsd:documentation> </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <!-- layout-devices defines a sequence of 1..n device elements. --> - <xsd:element name="device" minOccurs="1" maxOccurs="unbounded"> - - <xsd:annotation> - <xsd:documentation xml:lang="en"> - A device element must contain at most one "default" element - followed by one or more "config" elements. - - The "default" element defines all the default parameters - inherited by the following "config" elements. - Each "config" element can override the default values, if any. - - A "device" element also has a required "name" attribute that - represents the user-interface name of this device. - </xsd:documentation> - </xsd:annotation> - - <xsd:complexType> - <!-- device defines a choice of 0..1 default element - and 1..n config elements. --> - - <xsd:sequence> - <xsd:element name="default" type="c:parametersType" - minOccurs="0" maxOccurs="1" /> - <xsd:element name="config" type="c:configType" - minOccurs="1" maxOccurs="unbounded" /> - </xsd:sequence> - - <xsd:attribute name="name" type="xsd:normalizedString" use="required" /> - </xsd:complexType> - - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> + <xsd:sequence> + <!-- layout-devices defines a sequence of 0..n device elements. --> + <xsd:element name="device" minOccurs="0" maxOccurs="unbounded"> + + <xsd:annotation> + <xsd:documentation xml:lang="en"> + A device element must contain at most one "default" element + followed by one or more "config" elements. + + The "default" element defines all the default parameters + inherited by the following "config" elements. + Each "config" element can override the default values, if any. + + A "device" element also has a required "name" attribute that + represents the user-interface name of this device. + </xsd:documentation> + </xsd:annotation> + + <xsd:complexType> + <!-- device defines a choice of 0..1 default element + and 1..n config elements. --> + + <xsd:sequence> + <xsd:element name="default" type="c:parametersType" + minOccurs="0" maxOccurs="1" /> + <xsd:element name="config" type="c:configType" + minOccurs="1" maxOccurs="unbounded" /> + </xsd:sequence> + + <xsd:attribute name="name" type="xsd:normalizedString" use="required" /> + </xsd:complexType> + + </xsd:element> + </xsd:sequence> + </xsd:complexType> <!-- The type of a device>default element. This is overridden by configType below for the device>config element. diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java index 8aa8ee0..9c3bf93 100755 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java @@ -189,15 +189,12 @@ public class TestLayoutDevicesXsd extends TestCase { "cvc-complex-type.4: Attribute 'name' must appear on element 'd:device'.");
}
- /** A document with a root element containing no device element is not valid. */
+ /** A document with a root element containing no device element is valid. */
public void testEmptyRootXml() throws Exception {
- checkFailure(
+ checkSuccess(
// document
"<?xml version=\"1.0\"?>" +
- "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" />",
-
- // expected failure
- "cvc-complex-type.2.4.b: The content of element 'd:layout-devices' is not complete.*");
+ "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" />");
}
/** A document with an empty device element is not valid. */
|