[jdom-interest] How do I parse XML tags like: <FreeFormText xml:lang="Text">Text< /FreeFormText>

Pandia, Rajesh rajesh.pandia at matrixone.com
Thu May 9 10:11:11 PDT 2002


I get this error when this XML file is loaded... How do I parse XML tags
like:
<FreeFormText xml:lang="Text">Text</FreeFormText>

Please help

Exception in thread "main" org.jdom.JDOMException: Error on line 7 of
document f
ile:///D:/Work/WebMethodsB2B/XMLGen/project/0A1.xml: The xml:lang attribute
valu
e "Text" is an invalid language identifier.
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:296)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:682)
        at PIP0A1.main(PIP0A1.java:53)
Root cause: org.xml.sax.SAXParseException: The xml:lang attribute value
"Text" i
s an invalid language identifier.
        at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1008
)
        at
org.apache.xerces.framework.XMLDocumentScanner.checkXMLLangAttributeV
alue(XMLDocumentScanner.java, Compiled Code)
        at
org.apache.xerces.validators.common.XMLValidator.validateElementAndAt
tributes(XMLValidator.java, Compiled Code)
        at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XML
Validator.java, Compiled Code)
        at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumen
tScanner.java, Compiled Code)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.disp
atch(XMLDocumentScanner.java, Compiled Code)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
canner.java, Compiled Code)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:287)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:682)
        at PIP0A1.main(PIP0A1.java:53)
press any key to exit...

Here is the snippet of the source:
=======================
            java.io.File lfile = new java.io.File(fileName);
            System.out.println("XML File Exists: "+lfile.exists()+", Loading
file: "+fileName);
               
            if(lfile.exists()) 
            {
                org.jdom.input.SAXBuilder builder = new
SAXBuilder(DEFAULT_SAX_DRIVER_CLASS);
                Document doc = builder.build(fileName);
                //System.out.println(doc+": Doc");
                Element root = doc.getRootElement();
                //System.out.println("Root Found");

            }

Here is the XML file:
===============
<?xml version="1.0" encoding="UTF-8"?>
<Pip0A1FailureNotification>
	<ActionControl>
		<ActionIdentity>
	
<GlobalBusinessActionCode>Text</GlobalBusinessActionCode>
			<messageStandard>
				<FreeFormText
xml:lang="Text">Text</FreeFormText>
			</messageStandard>
			<standardVersion>
				<VersionIdentifier>Text</VersionIdentifier>
			</standardVersion>
		</ActionIdentity>
		<messageTrackingID>
			<InstanceIdentifier>Text</InstanceIdentifier>
		</messageTrackingID>
	</ActionControl>
	<failedInitiatingDocumentDateTime>
		<DateTimeStamp>Text</DateTimeStamp>
	</failedInitiatingDocumentDateTime>
	<failedInitiatingDocumentIdentifier>
	
<ProprietaryDocumentIdentifier>Text</ProprietaryDocumentIdentifier>
	</failedInitiatingDocumentIdentifier>
	<fromRole>
		<PartnerRoleDescription>
			<ContactInformation>
				<contactName>
					<FreeFormText
xml:lang="Text">Text</FreeFormText>
				</contactName>
				<EmailAddress>Text</EmailAddress>
				<facsimileNumber>
	
<CommunicationsNumber>Text</CommunicationsNumber>
				</facsimileNumber>
				<telephoneNumber>
	
<CommunicationsNumber>Text</CommunicationsNumber>
				</telephoneNumber>
			</ContactInformation>
	
<GlobalPartnerRoleClassificationCode>Text</GlobalPartnerRoleClassificationCo
de>
			<PartnerDescription>
				<BusinessDescription>
	
<GlobalBusinessIdentifier>Text</GlobalBusinessIdentifier>
	
<GlobalSupplyChainCode>Text</GlobalSupplyChainCode>
				</BusinessDescription>
	
<GlobalPartnerClassificationCode>Text</GlobalPartnerClassificationCode>
			</PartnerDescription>
		</PartnerRoleDescription>
	</fromRole>
	<GlobalDocumentFunctionCode>Text</GlobalDocumentFunctionCode>
	<ProcessIdentity>
	
<GlobalProcessIndicatorCode>Text</GlobalProcessIndicatorCode>
		<InstanceIdentifier>Text</InstanceIdentifier>
		<VersionIdentifier>Text</VersionIdentifier>
	</ProcessIdentity>
	<reason>
		<FreeFormText xml:lang="Text">Text</FreeFormText>
	</reason>
	<thisDocumentGenerationDateTime>
		<DateTimeStamp>Text</DateTimeStamp>
	</thisDocumentGenerationDateTime>
	<thisDocumentIdentifier>
	
<ProprietaryDocumentIdentifier>Text</ProprietaryDocumentIdentifier>
	</thisDocumentIdentifier>
	<toRole>
		<PartnerRoleDescription>
			<ContactInformation>
				<contactName>
					<FreeFormText
xml:lang="Text">Text</FreeFormText>
				</contactName>
				<EmailAddress>Text</EmailAddress>
				<facsimileNumber>
	
<CommunicationsNumber>Text</CommunicationsNumber>
				</facsimileNumber>
				<telephoneNumber>
	
<CommunicationsNumber>Text</CommunicationsNumber>
				</telephoneNumber>
			</ContactInformation>
	
<GlobalPartnerRoleClassificationCode>Text</GlobalPartnerRoleClassificationCo
de>
			<PartnerDescription>
				<BusinessDescription>
	
<GlobalBusinessIdentifier>Text</GlobalBusinessIdentifier>
	
<GlobalSupplyChainCode>Text</GlobalSupplyChainCode>
				</BusinessDescription>
	
<GlobalPartnerClassificationCode>Text</GlobalPartnerClassificationCode>
			</PartnerDescription>
		</PartnerRoleDescription>
	</toRole>
</Pip0A1FailureNotification>




More information about the jdom-interest mailing list