A very good source for general XML related questions can be found at the XML FAQs website.
XML Frequently Asked Questions
General FAQs
What are Namespaces and how are they used?
Common answers for Namespaces and their use can be found at the XML Namespaces FAQ.
Where can Frequently Asked Questions for XML Schema be found?
Common answers for general schema problems can be found at the XML Schema FAQ.
How do I make sure the character encoding I set in the XML Declaration is being honored by the receiver or processing application?
You can't ever guarantee that it will be honored, but you can provide a strong hint on what the receiver or processing application will do with your file. According to RFC3023 Section 3 the way the content-type is set will affect how the XML may be handled by the receiver or processor:
Content-type: text/xml; charset="utf-8"
Result: utf-8
Content-type: text/xml
Result: us-ascii
Content-type: application/xml; charset="utf-16"
Result: utf-16
Content-type: application/xml
Result: encoding-known-by-your-parser
Content-type: text/xml; charset="utf-8"
Result: utf-8
Content-type: text/xml
Result: us-ascii
Content-type: application/xml; charset="utf-16"
Result: utf-16
Content-type: application/xml
Result: encoding-known-by-your-parser
What are the recommended encodings to use for STAR BODs?
STAR recommends using either UTF-8 or UTF-16 for the encoding. All XML parsers are required to support these encodings according to the XML Specifications. These are the only ones that they are required to support, others may be supported but aren't guaranteed to be supported.
Enumerated Lists
Some of the STAR code lists that I would like to use do not match my legacy system's code lists. For example, my Part Order Types are identified with signal digit codes (1 = Stock, 2 = Rush, etc) and the STAR codes use three character Part Order Types (STK = Stock, RUS = Rush, etc.). How can I implement the standard if the code list doesn't match my system?
It is the goal of STAR to develop standard enumerated lists where possible to increase interoperability. In many cases, systems have code lists that have been in place for years and there are no plans to change them. In those cases, the implementer will be responsible for translating the STAR code list that comes to their legacy code list and vice verse when the code list is being sent out by the implementer.
OAGI
I have found a BOD in the OAGIS repository that meet my organization's needs. How can we incorporate that BOD into the STAR standards?
It is the goal of STAR to leverage OAGIS standards as much as possible where it is applicable. If there is an OAGIS BOD that meets a STAR member's needs, the member should submit the following:
1. A modification request indicating the OAGIS BOD to be included. NOTE: STAR does not support the OAGIS User Area, so if there are additional field requirements need for the BOD those should also be included on the modification request.
2. A use case form indicating the use case that the OAGIS BOD will satisfy
3. A sequence diagram indicating how the member will use the Noun/Verb combinations to support the use case.
1. A modification request indicating the OAGIS BOD to be included. NOTE: STAR does not support the OAGIS User Area, so if there are additional field requirements need for the BOD those should also be included on the modification request.
2. A use case form indicating the use case that the OAGIS BOD will satisfy
3. A sequence diagram indicating how the member will use the Noun/Verb combinations to support the use case.
Data Binding
What tools have been tested and known to work with STAR Schemas?
STAR has tested their Schemas with the following tools:
*JAXB 2.0 - STAR does not recommend versions of JAXB prior to version 2.0.
*XMLBeans 1.4 or greater.
*XSDObjectGen for .NET (STAR 4 Schemas)
*LiquidXML for C#, JAVA, VB.NET, C++
*XML SPY Enterprise - C#, JAVA, C++
Other tools may work, but these are the ones STAR data architects have tested. If you know of another framework that works, please let us know.
*JAXB 2.0 - STAR does not recommend versions of JAXB prior to version 2.0.
*XMLBeans 1.4 or greater.
*XSDObjectGen for .NET (STAR 4 Schemas)
*LiquidXML for C#, JAVA, VB.NET, C++
*XML SPY Enterprise - C#, JAVA, C++
Other tools may work, but these are the ones STAR data architects have tested. If you know of another framework that works, please let us know.
Where can I find out more about data binding for XML Schemas?
The XML Data Binding Resources article by Ronald Bourret is a good source on data binding and XML.
Performance
Do you have any tips for improving performance?
There are various ways to improve performance when using XML:
Only send what you need. Each STAR BOD has a limited number of required fields and a several optional fields. It is not necessary to send empty tags for fields that are not required and that you do not need.
Cache the Schema or pre-compile. Then reuse the pre-compiled schema for validation. This will offer significant performance enhancements. Otherwise the parser has to load the schema each time, parse them, build the infoset, and then validate against the instance. caching, keeps the infoset version in memory and then it just needs to do the validation instead of all of the other steps.
If doing Data Binding, then depending on platform here are some recommendations:
* .NET
Use XSDObjectGen instead of XSD.EXE, as it has better XML Schema support.
*JAVA
*If using JAXB then use JAXB 2.0 if possible. It has much improved XML Schema Support
* JAXME 2 is an Apache implementation of the JAXB specification and runs with a Java 1.4 SDK or greater.
*XMLBeans from Apache is another good alternative and has very good XML Schema support.
Regardless of which Data Binding tool chosen, it is recommended that validation against the XML Schema be undertaken. Data Binding tools still may produce invalid XML Instances, even though the classes were generated from the schemas.
Only send what you need. Each STAR BOD has a limited number of required fields and a several optional fields. It is not necessary to send empty tags for fields that are not required and that you do not need.
Cache the Schema or pre-compile. Then reuse the pre-compiled schema for validation. This will offer significant performance enhancements. Otherwise the parser has to load the schema each time, parse them, build the infoset, and then validate against the instance. caching, keeps the infoset version in memory and then it just needs to do the validation instead of all of the other steps.
If doing Data Binding, then depending on platform here are some recommendations:
* .NET
Use XSDObjectGen instead of XSD.EXE, as it has better XML Schema support.
*JAVA
*If using JAXB then use JAXB 2.0 if possible. It has much improved XML Schema Support
* JAXME 2 is an Apache implementation of the JAXB specification and runs with a Java 1.4 SDK or greater.
*XMLBeans from Apache is another good alternative and has very good XML Schema support.
Regardless of which Data Binding tool chosen, it is recommended that validation against the XML Schema be undertaken. Data Binding tools still may produce invalid XML Instances, even though the classes were generated from the schemas.
How do I precompile or cache a schema using Xerces?
You need to be using a version of Xerces 2 that supports grammar pools. This feature was introduced with Xerces 2.6. It is recommended to always use the most current version of Xerces, many installations ship with older versions that do not have the schema caching ability. Information about XML Grammar Pools can be found on the Apache.org website.
STAR also has some sample code that shows how to handle this for STAR BODs. Note this is only a sample and will need to be modified for your particular environment.
STAR also has some sample code that shows how to handle this for STAR BODs. Note this is only a sample and will need to be modified for your particular environment.
How do I precompile or cache a schema using Microsoft .NET framework?
MSDN contains an article on XML Performance Improvements which specifies an number of best practices for working with XML and the .NET framework. Included in there is the recommendation to cache the schemas and reuse them when performing validation.
How do I precompile or cache a schema using SAXON for JAVA?
The Controlling Schema Validation in Java page contains information that explains how to preload schemas and reuse them during validation.
How do I precompile or cache a schema using SAXON for .NET?
SAXON supports an API for loading and validating schema when using .NET. This is documented in the Dot Net API and is implemented through the SchemaManager API.
How do I precompile or cache a schema using JAXP 1.3?
The article, "jaxp: Fast and Easy XML Processing" contains information on how to precompile and reuse the compiled schema with any parser.
Sample XML
How can I obtain a copy of a valid sample XML file?
STAR offers a collection of sample XML files in the STAR schema repository. You may also generate your own sample XML from the STAR schema using a tool such as XML Spy. If you are using XML Spy, open the STAR schema and following these steps:
Go to the DTD/Schema menu
Select Generate Sample XML File...
Select mandatory vs non-mandatory attribute and element generation and whether or not to fill with data
Select OK
Go to the DTD/Schema menu
Select Generate Sample XML File...
Select mandatory vs non-mandatory attribute and element generation and whether or not to fill with data
Select OK
Validation
What parsers do you recommend for validating STAR BODs?
STAR recommends the following:
Xerces 2.7 or greater
XML Spy 2006 sp2
Microsoft MSXML and .NET XML 1.1 or greater
Saxon-SA
Xerces 2.7 or greater
XML Spy 2006 sp2
Microsoft MSXML and .NET XML 1.1 or greater
Saxon-SA
I can't validate the XML against the schemas in PHP 5. How do I do this?
If you are using PHP 5, then make sure that your system has the most recent version of PHP 5 installed. Along with this the most current version of libxml2 must be installed as well. PHP 5 uses the libxml2 library available at XMLSoft.org. There are known XSD implementation issues with libxml2. Periodic updates to this library correct known issues with libxml2's XSD implementation and validation with schemas.
Are there any Alternatives to using libxml2?
If you are running on a windows system and have the .NET framework installed, you can try interfacing the .NET framework library through PHP and use it's validation framework. You might also want to implement a web service that your application could call to validate using another platforms XSD validator.
XML Spy Messages
I am attempting to open a STAR 5 BOD using XML Spy 2006 sp2 and I'm receiving a message asking if I want XML Spy to create prefixes for several OAGIS namespaces. If I select "No" the files open without issues. Is this an error? Should I be creating prefixes?
No, this is not an error and no, there is no need to create prefixes for the OAGIS namespaces. This is an option that is offered specifically by the XML Spy tool and is not necessary for opening and validating STAR BODs.
Schema Formats
When developing, which format of the STAR schema should I use: Developer or Standalone?
No, this is not an error and no, there is no need to create prefixes for the OAGIS namespaces. This is an option that is offered specifically by the XML Spy tool and is not necessary for opening and validating STAR BODs.
If I'm using a noun-specific WSDL, which format of the STAR schema should I use: Developer or Standalone?
If a noun-specific WSDL is being implemented the Developer BODs must be used. Otherwise, namespace conflicts for schema definitions will occur in the STAR namespace.
Note: Due to the structure change and increased namespaces of STAR 5, Standalones are no longer true Standalones. They will still have to import the OAGI namespaces and any other additional required namespaces.
Note: Due to the structure change and increased namespaces of STAR 5, Standalones are no longer true Standalones. They will still have to import the OAGI namespaces and any other additional required namespaces.
STAR 4 to STAR 5
In STAR 4.0 I was able to capture the version of the BOD with a bodVersion attribute. How will I do that in STAR 5.0?
In STAR 5.0 this requirement is captured in the "versionID" attribute. This is an attribute of the root element of the BOD. The version of the schema repository as a whole is captured in the "releaseID" attribute that is also an attribute of the root element of the BOD.
I noticed some attributes are missing that were previously on Verbs in STAR 4. Where do these appear in STAR 5?
The OAGIS 9 verbs have been redesigned from STAR 4, and are not backwards compatible in many cases. As an example, the show attribute on the GET verb has been removed. A GET should always send back a SHOW response. To indicate how to handle error conditions, for ConfirmBOD, use the ConfirmationCode in the Application/Sender component.
Where is ReturnCriteria in STAR 4?
Answer:OAGIS 9 catagorizes the Verbs into the following catagories:
* Action
* Response
* Request
For the verbs that fall into these categories the equivalent to ReturnCriteria is:
* ActionExpression
* ResponseExpression
* RequestExpression
* Action
* Response
* Request
For the verbs that fall into these categories the equivalent to ReturnCriteria is:
* ActionExpression
* ResponseExpression
* RequestExpression
Are there sequence diagrams for the BODs and Verbs?
Yes. The diagrams can be found for each Noun on the XML Sequence Diagrams page.
I use the XML Schemas to create database table and column names, but my database can only support 30 characters for the names. STAR 5 has many names longer than 30 characters.
OAGIS 9 Naming and Design Rules removed the 30 character naming restriction as many core component names are longer than 30 characters. If you are using Oracle 9 or later, then you might need to upgrade to Oracle 10. If that is not an option, then an interface layer may need to be created to map the Schema names to the appropriate database table or column name.