B Tommie Usdin | 2 Jul 2009 00:46
Favicon

[ANN] Complete Balisage 2009 Program posted

The complete Balisage: The Markup Conference 2009 program, including 
late-breaking news, has just been posted.

   * Detailed program: http://www.balisage.net/2009/Program.html
   * Schedule at a Glance:  http://www.balisage.net/2009/At-A-Glance.html

Balisage 2009 is the place to come to think about XML, and about 
markup. The Balisage program varies from the practical to the 
theoretical, with a little heresy mixed in:

   * Practical
      - pipelines
      - creating XML schemas from UML
      - editing tools
      - version control for XML documents
      - checking and validating XML documents

   * Real-world Uses of XML
      - healthcare
      - large humanities datasets
      - archives

   * Overlap and complex documents
      - TEI feature structures
      - encoding non-hierarchical structures in RDF
      - tagging and manipulating structures that are not well managed
         as trees

   * Proposed changes
      - to XML Namespaces
(Continue reading)

B Tommie Usdin | 2 Jul 2009 00:50
Favicon

[ANN] Complete Balisage 2009 Program posted

The complete Balisage: The Markup Conference 2009 program, including 
late-breaking news, has just been posted.

   * Detailed program: http://www.balisage.net/2009/Program.html
   * Schedule at a Glance:  http://www.balisage.net/2009/At-A-Glance.html

Balisage 2009 is the place to come to think about XML, and about 
markup. The Balisage program varies from the practical to the 
theoretical, with a little heresy mixed in:

   * Practical
      - pipelines
      - creating XML schemas from UML
      - editing tools
      - version control for XML documents
      - checking and validating XML documents

   * Real-world Uses of XML
      - healthcare
      - large humanities datasets
      - archives

   * Overlap and complex documents
      - TEI feature structures
      - encoding non-hierarchical structures in RDF
      - tagging and manipulating structures that are not well managed
         as trees

   * Proposed changes
      - to XML Namespaces
(Continue reading)

Grubaugh, Eric-p65363 | 1 Jul 2009 23:24

Composite schema issue

I have been made aware of a bug in Xerces 2.6.2 on JRE 1.5.0_18:

According to source code comments there is a bug in xerces that prevents it from parsing schemas with imports and includes correctly:

Xerces (used by JAXP in Java 1.5 and later) does not correctly parse composite schema,
(i.e. schema containing <import> and <include> elements) unless the schema are first written
to disk files.  Writing schema to disk files, forces us to re-write each <import> and <include>
element's schemalocation attribute to reference disk files instead.

I have been searching the Bugzilla reports to determine whether this has been fixed or even ever reported, but I cannot find anything that seems directly related. I just wanted to know if this has been fixed between 2.6.2 and the current version, as an upgrade would obviously be the simplest fix, or if it needs to be reported.

Thank you.

Jeff Greif | 2 Jul 2009 08:21
Picon
Favicon

Re: Composite schema issue

You can put any URI you want into the location attribute on import or
include, and resolve it from schemas held in strings or relational
databases or resources in a jar file or anything else, if you provide
an EntityResolver to the parser.  See
DocumentBuilder.setEntityResolver().

You can also use set a property on the parser to specify a set of
schema locations.  The property is
http://apache.org/xml/properties/schema/external-schemaLocation and
its value is a string containing an alternating series of namespace
followed by location-URI.  This can be combined with the use of an
EntityResolver.

If you use the non-JAXP parsers provided by Xerces, you can specify an
XMLEntityResolver.  This is passed an XmlResourceIdentifier, which,
for a needed XML schema, will include the target namespace of the
schema.  You can build an XmlEntityResolver which uses some arbitrary
technique to resolve schema namespaces to the source text.

Jeff

On Wed, Jul 1, 2009 at 2:24 PM, Grubaugh,
Eric-p65363<Eric.Grubaugh <at> gdc4s.com> wrote:
> I have been made aware of a bug in Xerces 2.6.2 on JRE 1.5.0_18:
>
> According to source code comments there is a bug in xerces that prevents it
> from parsing schemas with imports and includes correctly:
>
> Xerces (used by JAXP in Java 1.5 and later) does not correctly parse
> composite schema,
> (i.e. schema containing <import> and <include> elements) unless the schema
> are first written
> to disk files.  Writing schema to disk files, forces us to re-write each
> <import> and <include>
> element's schemalocation attribute to reference disk files instead.
>
> I have been searching the Bugzilla reports to determine whether this has
> been fixed or even ever reported, but I cannot find anything that seems
> directly related. I just wanted to know if this has been fixed between 2.6.2
> and the current version, as an upgrade would obviously be the simplest fix,
> or if it needs to be reported.
>
> Thank you.
govelogo | 3 Jul 2009 06:39
Picon

Re: Name-value pairs in xml root tag

Hi Michael,


I thought this would solve my problem. But I run into an order issue. 

What I want is to be able to match from a uri to its prefix while parsing through an xml. It seems startPrefixMapping() is paired with startElement(). So if there is a xsi:type attribute of the element pointing to a new type yet been parsed, I won't be able to find the prefix in the uri -> prefix hashtable I have been keep tracking.

It seems to me that a SAX parser may not work for what I want. Is there a sample using a DOM parser to traverse a DOM tree and still be able to use JAXP to get TypeInfo and ElementPSVI?

thanks a lot,
David


On Mon, Jun 29, 2009 at 10:40 PM, Michael Glavassevich <mrglavas <at> ca.ibm.com> wrote:

Namespace declarations are normally reported in SAX through the startPrefixMapping() [1] and endPrefixMapping() [2] callbacks.

[1] http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String,%20java.lang.String)
[2] http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas <at> ca.ibm.com
E-mail: mrglavas <at> apache.org

govelogo <govelogo <at> gmail.com> wrote on 06/29/2009 01:39:29 PM:



> I used the sample handler in jaxp.TypeInfoWriter. Looks like it
> should be straight forward; I must have overlooked sth ... Can you
> just quickly point out which object I should use? 

>
> thanks a lot,
> David

> On Mon, Jun 29, 2009 at 2:07 PM, <keshlam <at> us.ibm.com> wrote:
> Those are all namespace declarations. If you register the right SAX
> handler, you should have no trouble seeing them.
>
> ______________________________________
> "... Three things see no end: A loop with exit code done wrong,
> A semaphore untested, And the change that comes along. ..."
>  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
> http://www.ovff.org/pegasus/songs/threes-rev-11.html)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe <at> xerces.apache.org
> For additional commands, e-mail: j-users-help <at> xerces.apache.org


govelogo | 3 Jul 2009 16:44
Picon

Why this type name shows like a garbage string?

Hi there,


I am running the jaxp.TypeInfoWriter to parse a xml. For one element, I got this result,

      startElement(name="{http://crm.testschema.ca/xml/as/ServiceAndOfferMapping/v1-0}associatedWithServices",type="{http://crm.testschema.ca/xml/as/ServiceAndOfferMapping/v1-0}#AnonType_associatedWithServicesInstalledProductOfferingValueType",qname="saom:associatedWithServices",attributes={})

inside the ServiceAndOfferMapping (saom) .xsd, "associatedWithServices" is defined here as below, (the schema for cbeservice-v1-5 is "http://ossj.org/xml/Common-CBEService/v1-5")


<xs:complexType name="InstalledProductOfferingValueType">
<xs:complexContent>
<xs:extension base="cbeproductoffering-v1-5:ProductOfferingValue">
<xs:sequence>
<xs:element name="associatedWithServices" minOccurs="0">
<xs:complexType>
<xs:complexContent>
<xs:extension base="cbeservice-v1-5:ArrayOfServiceKey"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="serviceAndOfferMapping" type="saom:ServiceAndOfferMappingType"/>

My question is why the type name is not shown as the base type (cbeservice-v1-5:ArrayOfServiceKey), but rather like a garbage string (in red color)?

many thanks,
David
Michael Glavassevich | 3 Jul 2009 17:45
Picon

Re: Why this type name shows like a garbage string?

govelogo <govelogo <at> gmail.com> wrote on 07/03/2009 10:44:17 AM:

> Hi there,
>
> I am running the jaxp.TypeInfoWriter to parse a xml. For one
> element, I got this result,
>
>       startElement(name="{http://crm.testschema.
> ca/xml/as/ServiceAndOfferMapping/v1-0}associatedWithServices",type="{
> http://crm.testschema.ca/xml/as/ServiceAndOfferMapping/v1-0}
> #AnonType_associatedWithServicesInstalledProductOfferingValueType",qname="
> saom:associatedWithServices",attributes={})
>
> inside the ServiceAndOfferMapping (saom) .xsd,
> "associatedWithServices" is defined here as below, (the schema for
> cbeservice-v1-5 is "http://ossj.org/xml/Common-CBEService/v1-5")
>
> <xs:complexType name="InstalledProductOfferingValueType">
> <xs:complexContent>
> <xs:extension base="cbeproductoffering-v1-5:ProductOfferingValue">
> <xs:sequence>
> <xs:element name="associatedWithServices" minOccurs="0">
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="cbeservice-v1-5:ArrayOfServiceKey"/>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> <xs:element name="serviceAndOfferMapping" type="saom:
> ServiceAndOfferMappingType"/>
>
> My question is why the type name is not shown as the base type (
> cbeservice-v1-5:ArrayOfServiceKey), but rather like a garbage string
> (in red color)?

Because the base type is not its type. The type of "associatedWithServices" actually has no name. It's anonymous, however the API [1] you're using requires that implementations produce an "anonymous type name" [2] to uniquely identify the anonymous type and that is what you're getting.

> many thanks,
> David

[1] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo
[2] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/glossary.html#dt-anonymous

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas <at> ca.ibm.com
E-mail: mrglavas <at> apache.org

Michael Glavassevich | 3 Jul 2009 17:54
Picon

Re: Name-value pairs in xml root tag

govelogo <govelogo <at> gmail.com> wrote on 07/03/2009 12:39:55 AM:

> Hi Michael,
>
> I thought this would solve my problem. But I run into an order issue. 
>
> What I want is to be able to match from a uri to its prefix while
> parsing through an xml. It seems startPrefixMapping() is paired
> with startElement(). So if there is a xsi:type attribute of the
> element pointing to a new type yet been parsed, I won't be able to
> find the prefix in the uri -> prefix hashtable I have been keep tracking.

Um... why not? The startPrefixMapping() calls come first. You should always have all the information you need to do prefix -> uri mapping on any startElement().

> It seems to me that a SAX parser may not work for what I want. Is
> there a sample using a DOM parser to traverse a DOM tree and still
> be able to use JAXP to get TypeInfo and ElementPSVI?

There are plenty of samples, FAQs and articles which show how to use or talk about how to use these things in isolation, but you'd probably have to connect the dots yourself.

> thanks a lot,
> David

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas <at> ca.ibm.com
E-mail: mrglavas <at> apache.org

Michael Glavassevich | 3 Jul 2009 18:06
Picon

Re: Composite schema issue

... and the usual disclaimer. What ships in Java 5 is Sun's fork of the Xerces codebase. It is not Xerces 2.6.2 or any other Apache version for that matter. All sorts of changes and additions were made to it since it branched from the Apache code that we are not aware of and have no influence over. It is known to have issues which are unique to it and others which have long been fixed in Xerces. If you need assistance with this codebase the Sun forums are a more appropriate place for discussion.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas <at> ca.ibm.com
E-mail: mrglavas <at> apache.org

jeff.greif <at> gmail.com wrote on 07/02/2009 02:21:20 AM:

> You can put any URI you want into the location attribute on import or
> include, and resolve it from schemas held in strings or relational
> databases or resources in a jar file or anything else, if you provide
> an EntityResolver to the parser.  See
> DocumentBuilder.setEntityResolver().
>
> You can also use set a property on the parser to specify a set of
> schema locations.  The property is
> http://apache.org/xml/properties/schema/external-schemaLocation and
> its value is a string containing an alternating series of namespace
> followed by location-URI.  This can be combined with the use of an
> EntityResolver.
>
> If you use the non-JAXP parsers provided by Xerces, you can specify an
> XMLEntityResolver.  This is passed an XmlResourceIdentifier, which,
> for a needed XML schema, will include the target namespace of the
> schema.  You can build an XmlEntityResolver which uses some arbitrary
> technique to resolve schema namespaces to the source text.
>
> Jeff
>
> On Wed, Jul 1, 2009 at 2:24 PM, Grubaugh,
> Eric-p65363<Eric.Grubaugh <at> gdc4s.com> wrote:
> > I have been made aware of a bug in Xerces 2.6.2 on JRE 1.5.0_18:
> >
> > According to source code comments there is a bug in xerces that prevents it
> > from parsing schemas with imports and includes correctly:
> >
> > Xerces (used by JAXP in Java 1.5 and later) does not correctly parse
> > composite schema,
> > (i.e. schema containing <import> and <include> elements) unless the schema
> > are first written
> > to disk files.  Writing schema to disk files, forces us to re-write each
> > <import> and <include>
> > element's schemalocation attribute to reference disk files instead.
> >
> > I have been searching the Bugzilla reports to determine whether this has
> > been fixed or even ever reported, but I cannot find anything that seems
> > directly related. I just wanted to know if this has been fixed between 2.6.2
> > and the current version, as an upgrade would obviously be the simplest fix,
> > or if it needs to be reported.
> >
> > Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe <at> xerces.apache.org
> For additional commands, e-mail: j-users-help <at> xerces.apache.org

govelogo | 3 Jul 2009 18:47
Picon

Re: Why this type name shows like a garbage string?

Hi Michael,


Thanks a lot! ... few more questions,

1. Where is the [validity] property set? is it part of schema or configuration in the api?

2. it seems that the anonymous type needs to be set throught api, right? how to do that?

3. I came across such a chunk of xml,

                  <ns35:item
                     xmlns:ns35="http://ossj.org/xml/Common-CBEService/v1-5" xsi:type="ns35:ServiceSpecificationKey">
                     <ns37:applicationDN
                        xmlns:ns36="http://ossj.org/xml/Common/v1-5" xmlns:ns37="http://ossj.org/xml/Common/v1-5">om.catalogue</ns37:applicationDN>
                     <ns38:type
                        xmlns:ns36="http://ossj.org/xml/Common/v1-5"
                        xmlns:ns37="http://ossj.org/xml/Common/v1-5" xmlns:ns38="http://ossj.org/xml/Common/v1-5">service.spec.name</ns38:type>
                     <ns39:primaryKey
                        xmlns:ns36="http://ossj.org/xml/Common/v1-5"
                        xmlns:ns37="http://ossj.org/xml/Common/v1-5"
                        xmlns:ns38="http://ossj.org/xml/Common/v1-5" xmlns:ns39="http://ossj.org/xml/Common/v1-5">securitySuiteService</ns39:primaryKey>
                  </ns35:item>

I can not understand why it needs to assign multiple namespace prefix to the same schema. But even so, can I see these ns/schema pairs through TypeInfo and ElementPSVI objects?

4. I also came across this error, can you explain a little bit of what "abstract" means here? 

[Error] Input.xml:372:112: cvc-elt.2: The value of {abstract} in the element declaration for 'ns14:baseState_ProductOffering' must be false.

its schema definition is as this,

<element name="baseState_ProductOffering" type="string" abstract="true"/>

thanks a lot,
David



On Fri, Jul 3, 2009 at 12:45 PM, Michael Glavassevich <mrglavas <at> ca.ibm.com> wrote:

govelogo <govelogo <at> gmail.com> wrote on 07/03/2009 10:44:17 AM:

> Hi there,


>
> I am running the jaxp.TypeInfoWriter to parse a xml. For one
> element, I got this result,
>
>       startElement(name="{http://crm.testschema.
> ca/xml/as/ServiceAndOfferMapping/v1-0}associatedWithServices",type="{
> http://crm.testschema.ca/xml/as/ServiceAndOfferMapping/v1-0}
> #AnonType_associatedWithServicesInstalledProductOfferingValueType",qname="
> saom:associatedWithServices",attributes={})
>
> inside the ServiceAndOfferMapping (saom) .xsd,
> "associatedWithServices" is defined here as below, (the schema for
> cbeservice-v1-5 is "http://ossj.org/xml/Common-CBEService/v1-5")
>
> <xs:complexType name="InstalledProductOfferingValueType">
> <xs:complexContent>
> <xs:extension base="cbeproductoffering-v1-5:ProductOfferingValue">
> <xs:sequence>
> <xs:element name="associatedWithServices" minOccurs="0">
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="cbeservice-v1-5:ArrayOfServiceKey"/>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> <xs:element name="serviceAndOfferMapping" type="saom:
> ServiceAndOfferMappingType"/>
>
> My question is why the type name is not shown as the base type (
> cbeservice-v1-5:ArrayOfServiceKey), but rather like a garbage string
> (in red color)?

Because the base type is not its type. The type of "associatedWithServices" actually has no name. It's anonymous, however the API [1] you're using requires that implementations produce an "anonymous type name" [2] to uniquely identify the anonymous type and that is what you're getting.

> many thanks,
> David

[1] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo
[2] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/glossary.html#dt-anonymous

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas <at> ca.ibm.com
E-mail: mrglavas <at> apache.org



Gmane