[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

dom4j set properties

  • To: xml-dev <xml-dev@l...>
  • Subject: dom4j set properties
  • From: Laura Hatcher <lhatcher@a...>
  • Date: Fri, 25 Jan 2002 17:19:12 -0500

dom4j xsd
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.