Author: scabanovich
Date: 2010-02-02 09:17:44 -0500 (Tue, 02 Feb 2010)
New Revision: 20076
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5781
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java 2010-02-02
14:17:05 UTC (rev 20075)
+++
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java 2010-02-02
14:17:44 UTC (rev 20076)
@@ -13,6 +13,8 @@
import java.io.IOException;
import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.EntityRecognizerContext;
+import org.jboss.tools.common.model.loaders.XMLRecognizerContext;
import org.jboss.tools.common.xml.XMLEntityResolver;
import org.jboss.tools.seam.xml.SeamXMLPlugin;
@@ -29,11 +31,15 @@
public SeamComponentsEntityRecognizer() {}
- public String getEntityName(String ext, String body) {
+ public String getEntityName(EntityRecognizerContext context) {
+ String body = context.getBody();
if(body == null) return null;
- if(body.indexOf(PUBLIC_ID_11) >= 0) {
- return ENT_SEAM_COMPONENTS_11;
- }
+ XMLRecognizerContext xml = context.getXMLContext();
+ if(xml.isDTD()) {
+ String publicId = xml.getPublicId();
+ if(PUBLIC_ID_11.equals(publicId)) return ENT_SEAM_COMPONENTS_11;
+ return null;
+ }
if(!isComponentsSchema(body)) {
return null;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java 2010-02-02
14:17:05 UTC (rev 20075)
+++
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/ds/model/DSEntityRecognizer.java 2010-02-02
14:17:44 UTC (rev 20076)
@@ -3,6 +3,8 @@
import java.io.IOException;
import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.EntityRecognizerContext;
+import org.jboss.tools.common.model.loaders.XMLRecognizerContext;
import org.jboss.tools.common.xml.XMLEntityResolver;
import org.jboss.tools.seam.xml.SeamXMLPlugin;
@@ -19,23 +21,23 @@
public DSEntityRecognizer() {}
- public String getEntityName(String ext, String body) {
+ public String getEntityName(EntityRecognizerContext context) {
+ String body = context.getBody();
if(body == null) return null;
- if(body.indexOf(PUBLIC_ID_1_5) >= 0) {
- if (body.indexOf("DOCTYPE datasources") >= 0) {
- return ENT_DATASOURCES_FILE;
+ XMLRecognizerContext xml = context.getXMLContext();
+ if(xml.isDTD()) {
+ String publicId = xml.getPublicId();
+ String root = xml.getRootName();
+ if(PUBLIC_ID_1_5.equals(publicId)) {
+ if("datasources".equals(root)) return ENT_DATASOURCES_FILE;
+ if("connection-factories".equals(root)) return
ENT_CONNECTION_FACTORIES_FILE;
}
- if (body.indexOf("DOCTYPE connection-factories") >= 0) {
- return ENT_CONNECTION_FACTORIES_FILE;
+ if(PUBLIC_ID_5_0.equals(publicId)) {
+ if("datasources".equals(root)) return ENT_DATASOURCES_FILE_50_DTD;
+ if("connection-factories".equals(root)) return
ENT_CONNECTION_FACTORIES_FILE_50_DTD;
}
- } else if(body.indexOf(PUBLIC_ID_5_0) >= 0) {
- if (body.indexOf("DOCTYPE datasources") >= 0) {
- return ENT_DATASOURCES_FILE_50_DTD;
- }
- if (body.indexOf("DOCTYPE connection-factories") >= 0) {
- return ENT_CONNECTION_FACTORIES_FILE_50_DTD;
- }
- }
+ }
+
return null;
}