hi,
>> (2) Problems with Xerces (?)
>>
>> When using Xerces as a validating or non-validating parser I'm
getting
>> an error message saying
>>
>> "Unexpected end of element {}:VAR"
>
> Do you have the stack trace of the error?
yes -
com.arm.dragonfly.ui.UserVisibleException: XML Parsing Exception
File: Tr(C\N\V\R\product.xml, P(Y:\i2work\test\collect\sourceTwo,
product.xml))
Line: 8
Message: Unexpected end of element {}:VAR
at com.arm.dragonfly.ui.Main.main(Main.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.arm.dragonfly.ui.Launcher.main(Launcher.java:56)
Caused by: com.arm.dragonfly.wh.XMLParsingException: Unexpected end of
element {}:VAR
at
com.arm.dragonfly.wh.jaxb.WXMLUtil$EThrowingHandler.handleEvent(WXMLUtil
.java:41)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.SAXUnmarshallerHandlerImpl.h
andleEvent(SAXUnmarshallerHandlerImpl.java:561)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.AbstractUnmarshallingEventHa
ndlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:140)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.AbstractUnmarshallingEventHa
ndlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:137)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.AbstractUnmarshallingEventHa
ndlerImpl.unexpectedLeaveElement(AbstractUnmarshallingEventHandlerImpl.j
ava:154)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.AbstractUnmarshallingEventHa
ndlerImpl.leaveElement(AbstractUnmarshallingEventHandlerImpl.java:64)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.VARIETYTypeImpl$Unmarshaller.leaveEl
ement(VARIETYTypeImpl.java:440)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.SAXUnmarshallerHandlerImpl.e
ndElement(SAXUnmarshallerHandlerImpl.java:140)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(
AbstractSAXParser.java:585)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emp
tyElement(AbstractXMLDocumentParser.java:221)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement
(XMLDTDValidator.java:820)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
canStartElement(XMLDocumentFragmentScannerImpl.java:839)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$F
ragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:15
63)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
canDocument(XMLDocumentFragmentScannerImpl.java:341)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML1
1Configuration.java:828)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML1
1Configuration.java:758)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.jav
a:148)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abstr
actSAXParser.java:1178)
at
com.arm.dragonfly.wh.jaxb.wxml.impl.runtime.UnmarshallerImpl.unmarshal(U
nmarshallerImpl.java:140)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:114)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:97)
at
com.arm.dragonfly.wh.jaxb.JAXBRootCache.fetch(JAXBRootCache.java:135)
at
com.arm.dragonfly.wh.jaxb.JAXBOperations.getComponents(JAXBOperations.ja
va:55)
at
com.arm.dragonfly.wh.DefaultOperations.getComponentsMatching(DefaultOper
ations.java:86)
at com.arm.dragonfly.wh.tool.Collect.execute(Collect.java:110)
at
com.arm.dragonfly.ui.WarehouseTools.handleCommandLine(WarehouseTools.jav
a:153)
at com.arm.dragonfly.ui.Main.mainImpl(Main.java:153)
at com.arm.dragonfly.ui.Main.main(Main.java:58)
... 5 more
>> (1) Entity resolution in JAXB via SAX EntityResolver
>>
>> I guess its as simple as adding an EntityResolver to an XmlReader and
>> then having jaxb unmarshalling happen via a SaxSource?
>
> Yes. Or you can set UnmarshallerHandler as a ContentHandler to your
parser.
This isn't strictly JAXB anymore, but I've not been able to find out the
answer to this via any other channel so hope you don't mind if I post
this here just in case.. :)
I'm having problems actually receiving notification of the
general-external-entities presence from the SAX EntityResolver API
I think I can't use a SAX DeclHandler, or LexicalHandler because these
will notify me of the presence of the Entity declarations but not allow
me to return an InputSource for them to be resolved to?
I've tried posting the problem to the java community forums, and the
Xerces user mailing list but have not yet got a response. I'm not sure
if it doesn't work because
1) my xml instance document is wrong
2) my use of the EntityResolver API is wrong (not much scope here)
3) my configuration of the XML parser is wrong (have been playing with
both Crimson and Xerces)
i have an xml instance document which starts
========
<?xml version='1.0'?>
<!DOCTYPE PARTLIST SYSTEM
'
http://www.arm.com/warehouse/warehouse-04.dtd' [
<!ENTITY sqltest_external SYSTEM 'SQL EXPRESSION'> <!-- am not
getting notified about this via EntityResolver
<!ENTITY sqltest_internal 'SQL EXPRESSION'>
]>
<PARTLIST>
========
where I was hoping to use EntityResolver to pick up both the dtd
reference, and the "sqltest_external" entity
Currently, using the xerces distribution inside jre5.0 only the dtd
reference is reported - but /not/ the external entity
"sqltest_external". I've found other listener/handler API for finding
out that these entities are in the document and are parsed, but would
like to use EntityResolver to process the "SQL EXPRESSION" so that the
result is substituted for &sql_external;
this is something that doesn't seem possible with DeclHandler, or
LexicalHandler
the sax javadoc for EntityResolver says: "The XML reader will then allow
the application to intercept any external entities (including the
external DTD subset and external parameter entities, if any) before
including them."
so my thinking is that either
a) the sqltest_external entity is not really external - but i don't
see why not from the annotated xml spec.
b) the implementation is not honouring its javadoc contract?
thanks,
Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net