This question might alternately be phrased as 'What determines the set
of schemas available for a validation episode?'
Suppose a parser is instantiated with a grammar pool and used to
preparse the grammar for namespace C, which imports B, which imports A.
There is an abstract element a in A wh
Xerces will validate your schema if you cause it to be parsed with the
appropriate parser features set. The necessary features are discussed
on the Features page of the documentation and the XML Schema FAQ. You
can force the schema to be read
1. by parsing an instance document whose root ele
UTF-8 (note hyphen) not UTF8
Jeff
vivek agarwal wrote:
Hi,
In the XML declaration prolog, are Java encodings allowed as well? I
tried to parse an XML doc using JDK 1.5 with the following decl:
and it gave no errors, but Xerces clearly says, it is an invalid encoding?
Thanks,
Vivek.
--
see http://xml.apache.org/xerces2-j/faq-general.html#faq-5
- Original Message -
From: "Gaurav Gupta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 23, 2005 10:37 PM
Subject: Re: How to get an xml subtree using DOM?
> I think this can be done by first reaching to
ed?
> Multiple namespaces may be involved. It is not certain from this
> information there is any schema interdependency at all.
>
> Bob
>
> Jeff Greif wrote:
> > You would find out, for example, that
> >
> > Before parsing A.xsd, the grammar pool held X,Y,Z
>
t; <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 06, 2004 1:38 PM
Subject: Re: Problem with grammar pool
> Jeff Greif wrote:
> > Another not-very-appealing possibility is to iterate over the grammar
pool
> > before and after parsing the document
Another not-very-appealing possibility is to iterate over the grammar pool
before and after parsing the document or root schema and look at the change.
This assumes the grammar pool is not used by multiple threads.
Jeff
- Original Message -
From: "Bob Foster" <[EMAIL PROTECTED]>
To: <[EMA
- Original Message -
From: "Bob Foster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 2004 11:10 AM
Subject: Problem with grammar pool
> My XMLGrammarPool implementation keeps a cache of grammars, invalidating
> the cache when a grammar is modified. This works
I think there's a left square bracket missing in the CDATA. It should be
Jeff
- Original Message -
From: Michael Glavassevich
To: [EMAIL PROTECTED]
Sent: Monday, November 22, 2004 9:07 AM
Subject: Re: SAX Parse error while parsing CDATA element
The sequence "]]>" [1] cannot appear in
This could be a xerces bug (2.6.2) or an XML Schema
misunderstanding on my part.
I have a schema fragment (in a schema with
targetNamespace present and elementFormDefault="qualified") inside a
complexType:
The externalSchemaLocation property must contain a string of the form
"namespace1 location-url-1 namespace2 location-url-2 ..."
In that string you must put the namespace/location pairs of all the schemas
referred to in the document, with whitespace separating the tokens.
Jeff
- Original Mess
create new simple types by using methods provided by
> SchemaDVFactory.
>
> Hope this helps,
> Sandy Gao
> Software Developer, IBM Canada
> (1-905) 413-3255
> [EMAIL PROTECTED]
>
>
>
>
> "Jeff Greif"
>
I'm looking for a little Java utility based on Xerces (in lieu of writing it
myself) to validate against its corresponding XSSimpleTypeDefinition a
string that is supposed to conform to a simple type.
An ugly but obvious approach is to create an document whose root element is
designated to have th
A valid XML file has one element at top level; all others must be nested
inside it, so the example is not valid. Probably that's only marginally
relevant to the question you're asking, though. Xerces can validate a file
(and fill in default values, etc) according to a DTD or schema, but does not
This is a speculation only, not an authoritative reply.
I would guess that
means "a single arbitrary element, repeated an arbitrary number of times"
rather than "an arbitrary sequence of possibly disparate elements".
Then
would be a specialized form of
but a sequence of two disparate
I think this problem is related to this recent message:
http://marc.theaimsgroup.com/?l=xerces-j-dev&m=108283663510778&w=2
on which no one commented.
Jeff
- Original Message -
From: "Michail Papadopoulos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 04, 2004 2:22 PM
S
At least two choices:
1. You could take all the in-memory schemas and pre-parse them into a
grammar pool. See the Grammars FAQ.
2. You could put some URIs into the SCHEMA_LOCATION list but provide an
EntityResolver subclass which knew how to find the in-memory strings or
input streams correspond
I think prohibited substitutions refers to substitution groups. An element
E1 can be declared to be the "head" of a substitution group. If another
element E2 is of a type derived from E1's type, it may declare that it is a
member of E1's substitution group, allowing E2 to be used wherever E1 coul
Your file: URLs are not correct. They should look like:
file:///C:/server_repository/xsd
Jeff
- Original Message -
From: "Franz-Josef Herpers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 26, 2004 8:22 AM
Subject: Re: include and redefine with XML Schema API
> I'v
Title: Message
A quick glance suggests that if you
have
...
the hexValue element could either be branch #2
(hexValue) or branch #3 (any) of the choice. This indeterminacy is
illegal.
Jeff
- Original Message -
From:
Benson Cheng
To: [EMAIL PROTECTED]
There are some circumstances under which it would
be possible to preprocess the document, stripping out xsi:type="HondaCar", or
modify it to say xsi:type="Car". I haven't followed the previous
messages in sufficient detail to know whether it will work in this
case.
As Sandy says in anoth
A completely portable, low-tech, arms-length solution would be to construct
the document, then traverse it to construct one or both of the Maps,
Node->Id and Id->Node, assigning the Id as you go.
Each modification of the document thereafter could traverse the affected
subtree and add to the maps,
The externalSchemaLocation property requires a whitespace-separated string
of names in pairs, the first of each pair a URI for the namespace and the
second a URI for the corresponding schema, e.g.
http://foo.com/fooNS http://foo.com/foo.xsd
http://foo.com/barNS file:///c:/projects/schemas/bar.x
The XML Schema specification specifies how the schemaLocation attribute can
(Bbe used, and how import can be used. Note that the only attribute required
(Bfor the import element is the namespace, the location attribute is only a
(Bhint to the processor. The location of the schema need not be sp
Title: XML Schema Validation Error
Probably attributes are unqualified in the soap
envelope schema. If so you should omit the namespace prefix (those
attributes are *not* in the soap envelope schema -- they are in no
namespace and hence meet the namespace matching criterion "##other" on the
I don't think the namespace prefix is a part of the PSVI (or the XML infoset
either). The only aspects of namespace prefixes that would be in the
infosets would be the xmlns:foo="fooNamespaceUri" attributes.
In general, the mapping namespace <-> prefix is many to many. The same
prefix can be use
ace="http://foo.com/namespace4"
(B> xmlns="http://foo.com/namespace4"
(B> elementFormDefault="qualified">
(B>
(B>
(B>
(B>
(B>
(B> Since this file is validated correctly, I had assumed Xerces-J 2.5.0
(B&g
Probably xerces proceeds like this:
(B
(BXerces must be able to directly locate the schema for the namespace of the
(Broot element. It does not read schema#1 (for a seemingly irrelevant
(Bnamespace) in the hopes of finding the location of schema#2. If schema #1
(Bis in the schemaLocation at
A DeferredTextImpl is a text node, not any kind of Element. This could
happen if
-- the document structure had changed and the code hadn't kept up
-- more likely, the treatment of white space is different, so a text node
is now appearing (and didn't on the other machines) between elements, e.g
When Xerces (using PSVI DOM) validates an element
foo whose type is from schema A and that element has some content element bar
(in A's target namespace) whose type is from
schema B imported by schema A, everything works as expected: If bar's content
conforms to its type, it will be reported
The namespace prefix is not a part of the PSVI
(post schema validation infoset) which is represented by the XSModel. I
think you'd probably have to do a separate parse of the schema file and rummage
in the SAX events or the DOM to find the prefix.
Jeff
- Original Message -
Fr
The rules are:
1. Constructs in included
schemas are defined in the target namespace of the including schema. The
included schema's namespace must match the targetNamespace of the includer, or
it must have no namespace.
2. Import must be for
schemas with namespaces different from the
Lots of Web Services using SOAP contain XML
Schema type definitions like this:
(The base type is given below).
When a SOAP/WSDL processor reads this type, it
can determine via special knowledge (out of band as far as WX
The xerces XsModel and related interfaces support accessing these
attributes.
Jeff
- Original Message -
From: "Bob Schloss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 17, 2003 6:55 PM
Subject: Re: get occurence constraint in elementation declaration
>
>
>
>
> FYI:
When a type is derived, do the various methods on
XSSimpleTypeDefinition return results reflecting the entire chain of derivation,
or just the lexical definition of the current type? For instance, if a
facet is defined on one of the base types in the derivation, will its value be
returned b
Just a guess, but I think the working model the spec-writers had in mind was
that if s1 imported s2 and s2 imported s3, that s1 would specify the
location of s2 (in the import element) and s2 would specify the location of
s3 (similarly). In this case, the relative directory choices that actually
w
- Original Message -
From: "Karr, David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 20, 2003 2:39 PM
Subject: RE: Best way to make XMLSerializer not encode single quotes
> I don't know what version is included here. I sure wish I could tell
> from the manifest file
Title: Validate against XML Schema without URI
I think you would:
1. Add an externalSchemaLocation
property to the parser which specifies a URI of your choice for the schema for
the given namespace.
2. Provide an
org.xml.sax.EntityResolver specialization for the parser whose resolveEn
- Original Message -
From: "Joseph Kesselman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 5:52 AM
Subject: Re: registering schema locations
...
> What's wrong with having the document explicitly declare which schemas it
> needs? It has to declare the namespac
See http://xml.apache.org/xerces2-j/faq-grammars.html#faq-5 for traversing
XML Schema grammars, and the docs for the XSModel and related classes.
Remember to set the parser configuration to use PSVI DOM implementation.
This stuff should do the right thing for schemas that others.
There is anothe
Last time I looked, there was no class implementing XSAnnotation. I think
there was a message on this mailing list earlier in the week about someone
beginning the implementation imminently. Checking the archives would
probably confirm this.
Jeff
- Original Message -
From: "Karl Mueller"
If you apply the given XPath, you get a nodeset. For each node in the
nodeset, you can traverse recursively through its parents back to the
document root, thus constructing the path. You have to take into account
the type of node in the nodeset (treatment is slightly different for
element, attrib
see the xerces grammar FAQ.
Jeff
- Original Message -
From: "Hess Yvan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 27, 2003 6:00 AM
Subject: XML schema validation performance (precompilation?)
> Hi,
>
> I have to validate many XML documents against a XML schema that
Creating a document from a subtree and parsing it will not work if the root
element of the subtree is not a legal root element of the document (doesn't
have a doctype associated with it, or is not a global element in an XML
Schema or something equivalent for other schema languages). If the root of
If you're using namespaces anywhere in your document, you should use
setAttributeNS instead of setAttribute. Mixing namespace-aware and
namespace-unaware DOM interfaces often makes a mess.
Jeff
-
To unsubscribe, e-mail: [EMAIL
can only be used for schema components in the same targetNamespace
as the including schema. As Sandy pointed out, while the including schema
is being parsed, the grammar for the included stuff cannot already exist
because a grammar contains all the constructs of a given namespace.
must be used f
DOMParser also uses EntityResolver.
Jeff
- Original Message -
From: "Christian Nelson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 17, 2003 6:31 PM
Subject: Re: Schema Related Questions
>
> Thanks for the response!
>
> The second solution (EntityResolver) is only val
No. The xsi:schemaLocation attribute is
just a hint to the parser about where to find the schema. If you attach an
EntityResolver to the parser (in its constructor, or by some method like
setEntityResolver) you have complete control of how any URIs are looked
up. You can resolve particula
Title: Message
Alternatively, you can provide an EntityResolver
that will resolve the SystemId (the URI) of the DTD to a copy on the local
filesystem of the parsing application.
In general, even a non-validating XML parser is
supposed to read the DTD to supply default values for attribute
See http://www.w3.org/TR/2003/WD-DOM-Level-3-Val-20030205/validation.html
and http://xml.apache.org/xerces2-j/faq-dom.html#faq-7
Jeff
- Original Message -
From: "Frank Jakop" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 10, 2003 4:39 AM
Subject: revalidation of elemen
MessageThe noNamespaceSchemaLocation property takes just one string, the URI
of the schema. The schemaLocation property takes space-separated URIs in
pairs, each pair containing the namespace URI and the schema URI. So, just
remove http://mytestdomain.com/testurl
from the noNamespaceSchemaLocatio
In the schema for the element jx:Bean
(http://www.jxbeans.org/schema/JXBeans-1_0.xsd) there is a content model
(Class, EventListener*, Property*)
which does not allow any other elements. You would need to change the
schema to permit whatever additional elements you want before the Class
element, r
Actually, if you look at the CachingParserPool source code (at least in
2.2.1), you find that it's not parsers that are reused, but the symbol table
and grammar pool, I think. But parsers suppposedly can be reused and I'm
trying to find out if it's worth the trouble.
Jeff
- Original Message -
In using a org.apache.xerces.parsers.DOMParser,
if you have a fixed configuration and feature/property settings, is anything
much gained by skipping repeated calls to the constructor, and instead reusing a
parser and resetting the state between parses, as opposed to creating a new
parser wit
The external-schemaLocation property must be a string containing
"ns1 xsd1 ns2 xsd2 ... "
that is, pairs of (namespaceURI, XsdURI) with each URI whitespace-delimited.
I think that earlier versions of Xerces were more liberal about what they
accepted for xsdURI.
Jeff
- Original Message -
Fr
the schema does not mention the attribute elementFormDefault, so the
elements are unqualified. This means that the global elements (elements
whose declarations are children of the schema element) are in the target
namespace, while local elements (defined within complex types) are in no
namespace.
In xerces-j 2.3.0, the various psvi interfaces
are marked as deprecated. Is there going to be something to replace
them? I have code making significant use of them, written when these APIs
were touted rather than deprecated (e.g. in xerces 2.1.0).
Jeff
hive/23_series/23.140/schema/REL-5-M
M7-1-2">
> 5.3.0
>
>
> ... using my custom PrefixResolver that you mentioned in the xalan
> mailing list.
>
>
> Jesus M. Salvo Jr. wrote:
>
> >
> > Thanks for that Jeff. Good you are on this list too ;) You
The XPath spec says you can't use XPath on this. Some versions of xalan
will let you do /:Response/:Status, but the authors claim it's a bug if it
works.
Jeff
- Original Message -
From: "Jesus M. Salvo Jr." <[EMAIL PROTECTED]>
To: "Xerces mailing list" <[EMAIL PROTECTED]>
Sent: Monday, Feb
The schema spec says that the value of xsi:type *must* be the same as or
derived from the declared type of the element. In your second request, the
xsi:type is the base type of the declared type of the element which is thus
illegal. I don't know a way to ignore this error while validating otherwis
} catch (org.xml.sax.SAXException ex){
System.out.println("SAXException Exception");
throw new SAXException("Error Validating the content XML.");
} catch (java.io.IOException ex){
System.out.println("IOException Exception");
throw new SAXException(&quo
> Could you please write a sample code or modify my code below so that I can
> understand what you are syaing.
>
> Thanks
> Praveen
> - Original Message -
> From: "Jeff Greif" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, Ja
I'm not able to give information correct in detail, but here is an outline
of what must happen:
The entity resolver is called with a namespace URI or a schema location as
an argument, I think. In the course of parsing your instance document (.xml
file), it will be called to process your schema's
It depends. If you want the wsdl to be handled by a wsdl
processor, you have to abide by the spec. If you are using the file for
some other purpose, you can validate it against any schema you
like.
- Original Message -
From:
Kiran
Bhumana
To: [EMAIL PROTECTED]
Since you are validating the document
against the wsdl schema, it must conform to the WSDL schema. The root
element, must have element content of
?,*
? ,*,*,*,
* (and, in WSDL 1.2, *). No other
element content is permitted. At least one content element other than
documentation must be
You can always do this;
new DocumentBuilder()
.parse(new InputSource(new FileReader(filename)));
which lets the java.io stuff handle the processing of the filename with
spaces.
Jeff
- Original Message -
From: "Neeraj Bajaj" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL
Oops -- my mistake. Forgot
"elementFormDefault='qualified'" in the schema!
Jeff
- Original Message -----
From:
Jeff Greif
To: [EMAIL PROTECTED]
Sent: Saturday, December 14, 2002 9:58
AM
Subject: namespace in
XSElementDeclaration for local
In Xerces 2.1.0 and 2.2.1, it appears that if I
produce a schema model using
XMLSchemaLoader loader = new
XMLSchemaLoader();
SchemaGrammar grammar =
loader.loadGrammar(...);
XSModel model =
grammar.toXSModel();
and then look at a global type definition, there
is a non-null names
Here's a java snippet for Xerces DomParser:
if (noNsXsdFilePath != null) {
propId = "http://apache.org/xml/properties";
+ "/schema/external-noNamespaceSchemaLocation";
parser.setProperty(propId, noNsXsdFilePath);
}
Try making the schema location in
a full URI of either file: or http: type. Perhaps the relative directory
path isn't working the same way in Xerces 2 as in Xerces 1.
Jeff
- Original Message -
From: "Thébault, Médérick" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December
Is there a utility in Xerces that, given a dom,
will construct an XPath (string or some other representation) from the root to
the given node? I know how to do this if there isn't such a utility, but
am trying to save myself a little work.
Jeff
1. I'm using the org.apache.xerces.impl.xs.psvi interfaces (XSModel and
descendants). It seems that the XSParticle object can have a term which is
either an element, a wildcard element, or a model group, and an XSModelGroup
can in turn represent a sequence, choice or all particle. Does the absen
If you don't get a more straightforward suggestion from someone more
familiar with Xerces than I, you could try equipping your parser with a
preparsed schema grammar in a grammar pool (indexed by namespace uri). This
can be made to supersede the schemaLocation attribute of the instance
document, o
There can be a huge number of valid possible reorderings for some content
models. See message on this subject earlier today.
Jeff
- Original Message -
From: "Royi Ronen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 07, 2002 7:23 AM
Subject: xml - dtd compatibility
With the tools I've used, the best you can do is to try to validate your
DOM, and fix it up yourself if validation fails. Validating the DOM can
either be done using the Xerces 2 DOM Level 3 Validation stuff, or by
serializing the DOM and reparsing. If you use the DOM Level 3 validation
interface
Thanks, Neil.
I'm dealing with a particular case of embedded schemas, and have some
guidance from a) the WSDL spec, incomplete as it is, and b) the application
usage.
When I'm dealing with a piece of WSDL that specifies that the some operation
of the web services returns a thing of type T in name
approaches?
Jeff Greif
Webalo, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
77 matches
Mail list logo