[x3d-public] JSON to DOM inquiry (for XML schema)
John Carlson
yottzumm at gmail.com
Wed Dec 13 23:44:28 PST 2023
Could it be I am validating with the wrong XML schema version?
On Thu, Dec 14, 2023 at 1:40 AM John Carlson <yottzumm at gmail.com> wrote:
>
>
> On Wed, Dec 13, 2023 at 9:11 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> If someone could point me at a way to validate DOM documents in Java
>> with XML Schema, it would probably take me 1-4 days to start validating X3D
>> JSON with XML schema.
>>
>
> If someone could send me an X3D XML file that they know passes XML Schema
> and X3D validator, that would be appreciated. I am working on an X3D XML
> validator (with schema), and stumbling a bit. Working Java source code
> would be helpful too!
>
> Here's an example error passed to MyDefaultHandler. I'm using a
> DOMSource, like:
>
> DOMSource source = new
> DOMSource(document.getElementsByTagName("X3D").item(0));
> validator.validate(source);
>
> Passing just the document variable produces similar results.
>
> [apply] Processing C:\Users\john\x3dschema\examples\x3domflowers.x3d
> [apply] org.xml.sax.SAXParseException; cvc-elt.1.a: Cannot find the
> declaration of element 'X3D'.
> [apply] at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
> [apply] at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
> Source)
> [apply] at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> [apply] at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> [apply] at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> [apply] at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)
> [apply] at
> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
> [apply] at
> org.apache.xerces.jaxp.validation.DOMValidatorHelper.beginNode(Unknown
> Source)
> [apply] at
> org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown
> Source)
> [apply] at
> org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown
> Source)
> [apply] at
> org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
> [apply] at
> java.xml/javax.xml.validation.Validator.validate(Validator.java:124)
> [apply] at Validate.main(Unknown Source)
>
> Code is at link below. Basically, I don't see a file that doesn't throw
> this error, JSON or XML. Could it be how I'm constructing DOMSource?
>
> Feel free to comment out any JSON stuff.
>
> https://github.com/coderextreme/x3dschema/blob/main/Validate.java
>
> I just noticed that X3DJSAIL is using Xerces. I guess that's preferred.
>
> I'm taking a break for my hands. I'll probably continue trying stuff
> tomorrow.
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231214/29de2b06/attachment.html>
More information about the x3d-public
mailing list