[jdom-interest] The element type "a" must be terminated by the matching end-tag "</a>".

Helen.Watchorn at transwareplc.com Helen.Watchorn at transwareplc.com
Fri Apr 12 09:41:15 PDT 2002


Hi - I've searched the web seeing if I could find a solution to this
JDOMException error that I get when I validate an XML doc, but no joy.

I hoping someone can help me here.

In essence I cannot see where Xerces is finding the opening 'a' element in
my XML doc/schema because to my mind there is no such element in these docs
in the first place. I cannot change the XML or schema files so I kinda
frustrated to say the least.

This is the error I get:

Error on line 2: The element type "a" must be terminated by the matching
end-tag "</a>".
org.jdom.JDOMException: Error on line 2: The element type "a" must be
terminated by the matching end-tag "</a>".
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:367)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:740)
        at
com.transwareplc.erudigm.util.JDOMHelper.toJDom(JDOMHelper.java:69)
        at
src.com.transwareplc.erudigm.business.scorm.scormutil.RecursiveFilecount.main(RecursiveFilecount.java:76)
Caused by: org.xml.sax.SAXParseException: The element type "a" must be
terminated by the matching end-tag "</a>".
        at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1171)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:740)
        at
com.transwareplc.erudigm.util.JDOMHelper.toJDom(JDOMHelper.java:69)
        at
src.com.transwareplc.erudigm.business.scorm.scormutil.RecursiveFilecount.main(RecursiveFilecount.java:76)
Erudigm Exception: org.jdom.JDOMException: Error on line 2: The element
type "a" must be terminated by the matching end-tag "</a>".
        at
com.transwareplc.erudigm.util.JDOMHelper.toJDom(JDOMHelper.java:73)
        at
src.com.transwareplc.erudigm.business.scorm.scormutil.RecursiveFilecount.main(RecursiveFilecount.java:76)

The first 4 lines of the XML file are:
<?xml version="1.0"?>
<lom xmlns="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1
imsmd_rootv1p2p1.xsd">
  <general>
  ...

This is my Java code to validate the XML file:

SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser",
true);
builder.setFeature("http://apache.org/xml/features/validation/schema",
true);
builder.setProperty
("http://apache.org/xml/properties/schema/external-schemaLocation",
"imsmd_rootv1p2p1.xsd"
                + " " + "http://www.w3.org/XML/1998/namespace
ims_xml.xsd");

doc = builder.build(new StringReader(content)); //where 'content' == string
representation of the XML file

Thanks,
Helen










More information about the jdom-interest mailing list