ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
[xml-dev] dom4j set properties
by Laura Hatcher other posts by this author
Jan 25 2002 10:19PM messages near this date
Re: RE: [xml-dev] Generality of HTTP -- OT | RE: [xml-dev] Entity resolution vs. URI resolution
I am attempt to use the Xerces 1.4.3 external schema location property
by setting it using the dom4j method setProperty.  My code compiles, but
when I run my code validation isn't working correctly.  The error that I
get is not that it can not locate the schema that it is suppose to
validate against, but that the root element will not validate
correctly.  I know that the instances that I am using validate correctly
against the schemas, but not when using the setProperty method.  My
parse method looks like this:

   public boolean parse()
   {

        //probably won't need this check for null input since there is
        //currently no default constructor
        if (_input == null) {
            StringBuffer msg = new StringBuffer()
                .append("No input was detected for validation.");
            return false;
        }

        try
        {
            // building the Document object of JDOM
            SAXReader xmlReader = new SAXReader(_validation);

xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);

            if (this._validation == true) {

xmlReader.setFeature("http://xml.org/sax/features/validation", true);

xmlReader.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
true);
                xmlReader.setProperty(

"http://apache.org/xml/properties/schema/external-schemaLocation",
                        "http://www.argoneng.com/lh
/products/baseline/tasking_unclass/interfaces/taskingObjects.xsd");
                xmlReader.setProperty(

"http://apache.org/xml/properties/schema/external-schemaLocation",
                        "http://www.argoneng.com/lh
/products/baseline/tasking_unclass/interfaces/taskingDefs.xsd");
                xmlReader.setProperty(

"http://apache.org/xml/properties/schema/external-schemaLocation",
                        "http://www.argoneng.com/lh
/products/baseline/tasking_unclass/interfaces/detTasking.xsd");
                xmlReader.setProperty(

"http://apache.org/xml/properties/schema/external-schemaLocation",
                        "http://www.argoneng.com/lh
/products/baseline/tasking_unclass/interfaces/ratTasking.xsd");

            }

            _doc = xmlReader.read(_input);
            return true;

        }
        catch (DocumentException e)
        {
            StringBuffer msg2 = new StringBuffer()
                .append("The Document that is needed for validation is
incorrect");
            e.printStackTrace(DebugPrint.getPrintStream(9,
SRT_PRODUCT));
            return false;
        }
        catch (SAXException sax)
        {
            StringBuffer msg3 = new StringBuffer()
                .append("The Document was not validated correctly");
            sax.printStackTrace(DebugPrint.getPrintStream(9,
SRT_PRODUCT));
            return false;
        }
    }

Has anyone had experience with this?

Thanks in advance,
Laura Hatcher


-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org> 

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl> 

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved