[287706] React to upcoming changes in the SSE DOM
diff --git a/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java b/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java
index d608402..9abdc21 100644
--- a/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java
+++ b/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1920,7 +1920,9 @@
Element element = xsdElementDeclaration.getElement();
if(element != null)
{
- return element.getAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE);
+ if (element.hasAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE))
+ return element.getAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE);
+ else return null;
}
}
return "";
@@ -2591,8 +2593,12 @@
public String getNamespaceURI()
{
- String uri = xsdWildcard.getElement().getAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
- return (uri != null && uri.length() > 0) ? uri : "##any";
+ if (xsdWildcard.getElement().hasAttribute(XSDConstants.NAMESPACE_ATTRIBUTE))
+ {
+ return xsdWildcard.getElement().getAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
+ }
+ else
+ return "##any";
}
/**
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java
index 2e6616b..8ee0c52 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,8 +45,8 @@
namespacePrefix = handleNamespacePrefices();
attributeQName = namespacePrefix + ":" + attribute.getName(); //$NON-NLS-1$
- String value = component.getElement().getAttribute(attributeQName);
- if (value == null)
+
+ if (!(component.getElement().hasAttribute(attributeQName)))
{
appInfoAttributeAdded = true;
component.getElement().setAttribute(attributeQName, ""); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java
index 561a218..2446901 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -139,7 +139,7 @@
String xmlnsColon = "xmlns:"; //$NON-NLS-1$
String attributeName = xmlnsColon + prefix;
int count = 0;
- while (schemaElement.getAttribute(attributeName) != null)
+ while (schemaElement.hasAttribute(attributeName))
{
count++;
prefix = basePrefix + count;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java
index 9e37158..6ce4c73 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -159,7 +159,7 @@
String xmlnsColon = "xmlns:"; //$NON-NLS-1$
String attributeName = xmlnsColon + prefix;
int count = 0;
- while (schemaElement.getAttribute(attributeName) != null)
+ while (schemaElement.hasAttribute(attributeName))
{
count++;
prefix = basePrefix + count;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java
index c49051f..d159eb1 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,8 +35,7 @@
{
Element element = particle.getElement();
beginRecording(element);
- String currentMax = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- removeMaxOccursAttribute = (currentMax == null)? true: false;
+ removeMaxOccursAttribute = (!(element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE)))? true: false;
oldMaxOccurs = particle.getMaxOccurs();
particle.setMaxOccurs(newMaxOccurs);
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java
index 364523f..5e31766 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,8 +38,7 @@
try
{
beginRecording(element);
- String currentMin = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- removeMinOccursAttribute = (currentMin == null) ? true : false;
+ removeMinOccursAttribute = (!(element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE))) ? true : false;
if (component instanceof XSDParticle)
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java
index f0791b6..35efdd6 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -101,7 +101,7 @@
updateAllNodes(element, xsdForXSDPrefix);
// remove the old xmlns attribute for the schema for schema
- if (element.getAttribute("xmlns") != null && //$NON-NLS-1$
+ if (element.hasAttribute("xmlns") && //$NON-NLS-1$
element.getAttribute("xmlns").equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) //$NON-NLS-1$
{
element.removeAttribute("xmlns"); //$NON-NLS-1$
@@ -123,7 +123,7 @@
else
// if no prefix
{
- if (element.getAttribute("xmlns") != null) //$NON-NLS-1$
+ if (element.hasAttribute("xmlns")) //$NON-NLS-1$
{
if (!element.getAttribute("xmlns").equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) //$NON-NLS-1$
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java
index 94593d4..556acfa 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -178,14 +178,14 @@
Element element = particle.getElement();
if (element != null)
{
- String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- if (min != null && refreshMinText)
+ if (element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE) && refreshMinText)
{
+ String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
minCombo.setText(min);
}
- if (max != null && refreshMaxText)
+ if (element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE) && refreshMaxText)
{
+ String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
maxCombo.setText(max);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
index c17a72f..0c2f82b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -198,9 +198,9 @@
enabled = false;
}
- String blockAttValue = complexType.getElement().getAttribute(XSDConstants.BLOCK_ATTRIBUTE);
- if (blockAttValue != null)
+ if (complexType.getElement().hasAttribute(XSDConstants.BLOCK_ATTRIBUTE))
{
+ String blockAttValue = complexType.getElement().getAttribute(XSDConstants.BLOCK_ATTRIBUTE);
blockCombo.setText(blockAttValue);
}
else
@@ -209,10 +209,10 @@
}
blockCombo.setEnabled(enabled);
- String finalAttValue = complexType.getElement().getAttribute(XSDConstants.FINAL_ATTRIBUTE);
- if (finalAttValue != null)
+ if (complexType.getElement().hasAttribute(XSDConstants.FINAL_ATTRIBUTE))
{
- finalCombo.setText(finalAttValue);
+ String finalAttValue = complexType.getElement().getAttribute(XSDConstants.FINAL_ATTRIBUTE);
+ finalCombo.setText(finalAttValue);
}
else
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
index ff9bbc7..d4a6436 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -337,9 +337,10 @@
}
Element element = eleDec.getElement();
- String blockAttValue = element.getAttribute(XSDConstants.BLOCK_ATTRIBUTE);
- if (blockAttValue != null)
+
+ if (element.hasAttribute(XSDConstants.BLOCK_ATTRIBUTE))
{
+ String blockAttValue = element.getAttribute(XSDConstants.BLOCK_ATTRIBUTE);
blockCombo.setText(blockAttValue);
}
else
@@ -358,12 +359,11 @@
{
nillableCombo.setText(EMPTY);
}
-
-
- String finalAttValue = element.getAttribute(XSDConstants.FINAL_ATTRIBUTE);
- if (finalAttValue != null)
+
+ if (element.hasAttribute(XSDConstants.FINAL_ATTRIBUTE))
{
- finalCombo.setText(finalAttValue);
+ String finalAttValue = element.getAttribute(XSDConstants.FINAL_ATTRIBUTE);
+ finalCombo.setText(finalAttValue);
}
else
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
index 8ef030c..dab2646 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -157,9 +157,10 @@
}
// Handle TargetNamespaceText
- String tns = element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
- if (tns != null && tns.length() > 0)
+
+ if (element.hasAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE))
{
+ String tns = element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
String processedString = TextProcessor.process(tns);
targetNamespaceText.setText(processedString);
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java
index 2f0e4a3..06db194 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -93,9 +93,10 @@
{
XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input;
- String finalAttValue = simpleType.getElement().getAttribute(XSDConstants.FINAL_ATTRIBUTE);
- if (finalAttValue != null)
+
+ if (simpleType.getElement().hasAttribute(XSDConstants.FINAL_ATTRIBUTE))
{
+ String finalAttValue = simpleType.getElement().getAttribute(XSDConstants.FINAL_ATTRIBUTE);
finalCombo.setText(finalAttValue);
}
else
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
index 091729e..c7c764f 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
@@ -396,16 +396,18 @@
Element listNode = getFirstChildNodeIfExists(parent, XSDConstants.LIST_ELEMENT_TAG, false);
if (listNode != null)
{
- reuseType = listNode.getAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE);
+ if (listNode.hasAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE))
+ reuseType = listNode.getAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE);
XSDDOMHelper.removeNodeAndWhitespace(listNode);
}
Element unionNode = getFirstChildNodeIfExists(parent, XSDConstants.UNION_ELEMENT_TAG, false);
if (unionNode != null)
{
- String memberAttr = unionNode.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
- if (memberAttr != null)
+
+ if (unionNode.hasAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE))
{
+ String memberAttr = unionNode.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
StringTokenizer stringTokenizer = new StringTokenizer(memberAttr);
reuseType = stringTokenizer.nextToken();
}