Author: jochen
Date: Wed Aug 30 05:18:37 2006
New Revision: 438473
URL: http://svn.apache.org/viewvc?rev=438473&view=rev
Log:
An xs:include or xs:import will now honour the parents location when searching
for the child, even if a schema transformer is being used.
Modified:
webservices/jaxme/branches/MAVEN/projects/xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
webservices/jaxme/branches/b0_5/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
Modified:
webservices/jaxme/branches/MAVEN/projects/xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
URL:
http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/projects/xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java?rev=438473&r1=438472&r2=438473&view=diff
==============================================================================
---
webservices/jaxme/branches/MAVEN/projects/xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
(original)
+++
webservices/jaxme/branches/MAVEN/projects/xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
Wed Aug 30 05:18:37 2006
@@ -313,6 +313,10 @@
lch.comment(msg.toCharArray(), 0, msg.length());
}
pReader.setContentHandler(pHandler);
+ LocatorImpl loc = new LocatorImpl();
+ loc.setSystemId(pSource.getSystemId());
+ loc.setPublicId(pSource.getPublicId());
+ pHandler.setDocumentLocator(loc);
pReader.parse(pSource);
if (fos != null) {
fos.close();
@@ -436,15 +440,15 @@
/** <p>Handles xs:include.</p>
*/
protected void includeSchema(XsESchema pIncludingSchema,
- XsEInclude pInclude)
+ XsEInclude pInclude, Locator pLocator,
+ String pSchemaLocation)
throws SAXException, IOException, ParserConfigurationException {
final XsAnyURI schemaLocation = pInclude.getSchemaLocation();
if (schemaLocation == null) {
throw new LocSAXException("Invalid include: Missing
'schemaLocation' attribute.",
pInclude.getLocator());
}
- Locator locator = pInclude.getLocator();
- XsESchema includedSchema = parseSyntax(locator,
schemaLocation.toString());
+ XsESchema includedSchema = parseSyntax(pLocator,
schemaLocation.toString());
XsAnyURI incNamespace = includedSchema.getTargetNamespace();
if (incNamespace == null) {
if (pIncludingSchema.getTargetNamespace() != null) {
@@ -459,7 +463,7 @@
pInclude.getLocator());
}
}
- parse(includedSchema, schemaLocation.toString());
+ parse(includedSchema, pSchemaLocation);
}
private void checkValidImportSchema(XsESchema pImportingSchema, String
pNamespace,
@@ -562,11 +566,15 @@
addSyntaxSchema(pSyntaxSchema);
try {
Object[] childs = pSyntaxSchema.getChilds();
-
+
for (int i = 0; i < childs.length; i++) {
Object o = childs[i];
if (o instanceof XsEInclude) {
- includeSchema(pSyntaxSchema,
(XsEInclude) o);
+ XsEInclude xsEInclude = (XsEInclude) o;
+ XsAnyURI schemaLocation =
xsEInclude.getSchemaLocation();
+ includeSchema(pSyntaxSchema, xsEInclude,
+
getImportLocator(xsEInclude, pSchemaLocation),
+ schemaLocation == null
? null : schemaLocation.toString());
} else if (o instanceof XsERedefine) {
redefineSchema(pSyntaxSchema,
(XsERedefine) o);
} else if (o instanceof XsEImport) {
Modified:
webservices/jaxme/branches/b0_5/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
URL:
http://svn.apache.org/viewvc/webservices/jaxme/branches/b0_5/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java?rev=438473&r1=438472&r2=438473&view=diff
==============================================================================
---
webservices/jaxme/branches/b0_5/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
(original)
+++
webservices/jaxme/branches/b0_5/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
Wed Aug 30 05:18:37 2006
@@ -313,6 +313,10 @@
lch.comment(msg.toCharArray(), 0, msg.length());
}
pReader.setContentHandler(pHandler);
+ LocatorImpl loc = new LocatorImpl();
+ loc.setSystemId(pSource.getSystemId());
+ loc.setPublicId(pSource.getPublicId());
+ pHandler.setDocumentLocator(loc);
pReader.parse(pSource);
if (fos != null) {
fos.close();
@@ -436,15 +440,15 @@
/** <p>Handles xs:include.</p>
*/
protected void includeSchema(XsESchema pIncludingSchema,
- XsEInclude pInclude)
+ XsEInclude pInclude, Locator pLocator,
+ String pSchemaLocation)
throws SAXException, IOException, ParserConfigurationException {
final XsAnyURI schemaLocation = pInclude.getSchemaLocation();
if (schemaLocation == null) {
throw new LocSAXException("Invalid include: Missing
'schemaLocation' attribute.",
pInclude.getLocator());
}
- Locator locator = pInclude.getLocator();
- XsESchema includedSchema = parseSyntax(locator,
schemaLocation.toString());
+ XsESchema includedSchema = parseSyntax(pLocator,
schemaLocation.toString());
XsAnyURI incNamespace = includedSchema.getTargetNamespace();
if (incNamespace == null) {
if (pIncludingSchema.getTargetNamespace() != null) {
@@ -459,7 +463,7 @@
pInclude.getLocator());
}
}
- parse(includedSchema, schemaLocation.toString());
+ parse(includedSchema, pSchemaLocation);
}
private void checkValidImportSchema(XsESchema pImportingSchema, String
pNamespace,
@@ -562,11 +566,15 @@
addSyntaxSchema(pSyntaxSchema);
try {
Object[] childs = pSyntaxSchema.getChilds();
-
+
for (int i = 0; i < childs.length; i++) {
Object o = childs[i];
if (o instanceof XsEInclude) {
- includeSchema(pSyntaxSchema,
(XsEInclude) o);
+ XsEInclude xsEInclude = (XsEInclude) o;
+ XsAnyURI schemaLocation =
xsEInclude.getSchemaLocation();
+ includeSchema(pSyntaxSchema, xsEInclude,
+
getImportLocator(xsEInclude, pSchemaLocation),
+ schemaLocation == null
? null : schemaLocation.toString());
} else if (o instanceof XsERedefine) {
redefineSchema(pSyntaxSchema,
(XsERedefine) o);
} else if (o instanceof XsEImport) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]