Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60460 Details for
Bug 176416
XML Generation not picking up all available namespaces
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Reformatted patch, and cleaned up code.
XSDImpl15xPatchCorrected.txt (text/plain), 3.02 KB, created by
David Carver
on 2007-03-08 21:57:05 EST
(
hide
)
Description:
Reformatted patch, and cleaned up code.
Filename:
MIME Type:
Creator:
David Carver
Created:
2007-03-08 21:57:05 EST
Size:
3.02 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xsd.core >Index: src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/xsd/plugins/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java,v >retrieving revision 1.8.2.1 >diff -u -r1.8.2.1 XSDImpl.java >--- src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java 24 Jan 2007 21:27:39 -0000 1.8.2.1 >+++ src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDImpl.java 9 Mar 2007 02:47:23 -0000 >@@ -82,6 +82,9 @@ > import org.w3c.dom.Node; > import org.w3c.dom.NodeList; > import org.w3c.dom.Text; >+import org.w3c.dom.Document; >+import org.w3c.dom.Attr; >+import org.w3c.dom.NamedNodeMap; > > /** > * Utility class to build cmnodes from XML Schema nodes. The XML Schema model is >@@ -881,6 +884,7 @@ > info.isPrefixRequired = isPrefixRequired(xsdSchema); > list.add(info); > getImportedNamespaceInfo(xsdSchema, list); >+ getAllNamespacesInfo(xsdSchema, list); > result = list; > } > else if (propertyName.equals(PROPERTY_ELEMENT_FORM_DEFAULT)) >@@ -946,6 +950,57 @@ > } > } > >+ /** >+ * Retrieve a list of all the namespaces that have been defined with the use of xmlns >+ * in the schema. This may or may not be more accurate than searching on the XSDImports >+ * Note schemaLocation is not populated by this method, so a user has to fill it in manually >+ * >+ * @param theXSDSchema >+ * the current Schema >+ * @param list >+ * a list of namespaces >+ */ >+ public void getAllNamespacesInfo(XSDSchema theXSDSchema, List list) { >+ Document document = theXSDSchema.getDocument(); >+ Node rootNode = document.getFirstChild(); >+ >+ NamedNodeMap attributeList = rootNode.getAttributes(); >+ >+ for (int index = 0; index < attributeList.getLength(); index++) { >+ Attr attribute = (Attr) attributeList.item(index); >+ if (attribute.getNamespaceURI() != null) { >+ if (checkNamespace(list, attribute.getNodeValue()) == false) { >+ NamespaceInfo info = new NamespaceInfo(); >+ info.uri = attribute.getNodeValue(); >+ info.prefix = attribute.getLocalName(); >+ info.isPrefixRequired = true; >+ list.add(info); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Checks to see if a namespace has already been added to the list. >+ * @param list >+ * A list of namespaces >+ * @param namespace >+ * Namespace to check >+ * @return >+ * true or false. >+ */ >+ private boolean checkNamespace(List list, String namespace) { >+ boolean returnSW = false; >+ for (Iterator iterator = list.iterator(); iterator.hasNext();) { >+ NamespaceInfo info = (NamespaceInfo) iterator.next(); >+ if (info.uri.contentEquals(new StringBuffer(namespace))) { >+ returnSW = true; >+ } >+ } >+ >+ return returnSW; >+ } >+ > /** > * Returns set of named (top-level) element declarations for this schema > * node.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 176416
:
60283
|
60443
|
60445
|
60446
| 60460