Welcome!

Artificial Intelligence Authors: Zakia Bouachraoui, Elizabeth White, Liz McMillan, Pat Romanski, Carmen Gonzalez

RSS Feed Item

RE: validation against xml schema (xsd)

George,

Thanks very much for this information and for your thoughts.  They will
be useful!

Matt

> -----Original Message-----
> From: George Cristian Bina [mailto:[email protected]]
> Sent: Thursday, March 05, 2009 4:00 PM
> To: Johnson, Matthew C. (LNG-HBE)
> Cc: [email protected]
> Subject: Re:  validation against xml schema (xsd)
> 
> Hi Matt,
> 
> You can do a first parse and stop once you reach the root element, for
> instance by throwing an exception on the first startElement callback.
> That will give you enough information about the document to determine
> the schema to use. While you do this parse you can buffer what the
> parser reads and then start the validation feeding the parser with the
> buffered content and then the remaining content of your document. You
> can find an example of this in Jing, see the AutoSchemaReader and the
> RewindableReader and RewindableInputStream classes:
> 
> http://code.google.com/p/jing-
>
trang/source/browse/trunk/mod/validate/src/main/com/thaiopensource/valid
at
> e/auto/AutoSchemaReader.java
> http://code.google.com/p/jing-
>
trang/source/browse/trunk/mod/validate/src/main/com/thaiopensource/valid
at
> e/auto/RewindableReader.java
> http://code.google.com/p/jing-
>
trang/source/browse/trunk/mod/validate/src/main/com/thaiopensource/valid
at
> e/auto/RewindableInputStream.java
> 
> Best Regards,
> George
> --
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
> 
> 
> Johnson, Matthew C. (LNG-HBE) wrote:
> > Hello,
> >
> >
> >
> > I am wrestling with a choice and would like to ask for opinions.  In
> > validating XML instance documents against a W3C XML Schema instance,
I
> > can either rely use @xsi:schemaLocation and rely on it as a hint or
I
> > can infer which schema to apply using some other piece of
information
> > from the document.  I believe one of the arguments against using
> > @xsi:schemaLocation is that the consuming application should
arguably be
> > in a better position to determine which schema to apply than the
> > producer.  This is especially true in situations where a document
could
> > be valid against multiple schemas.  My scenario is that a document
is
> > either valid or not but I do not want to discount this argument.
> > Another argument against is that it is defined as only a hint and
that
> > not all tools support it, although in my case, the tools do support
it.
> >
> >
> >
> > My question is, if I did not use/provide @xsi:schemaLocation, what
are
> > some suggested options and means to determine the schema?  I will
almost
> > certainly be using a catalog (OASIS) so I believe this will play a
role
> > in the decision.  One option I have considered is using the
namespace
> > URI of the root element as a sort of public identifier that could be
> > used by the catalog resolver but this has limited support in
> > "off-the-shelf" parsing solutions.  For example, Xerces (Java)
supports
> > this through their (XNI) XMLCatalogResolver class but standard SAX
> > EntityResolver(2) does not expose/report namespaces.
> >
> >
> >
> > The piece that is bugging me a little is that, regardless of the
means
> > of determining the schema, it feels like an extra
> > step/pass/look-into-the-document is required before the actual parse
of
> > the document.  Relying on @xsi:schemaLocation feels much more like
> > relying on a DOCTYPE for a DTD in that it is recognized during the
main
> > parsing step represented by a standard API call (e.g.
> > xmlreader.parse(...)) (even if that call does a few passes itself).
> >
> >
> >
> > I could even remove the notion of XSD here and ask the same question
if
> > I were validating against one of multiple RelaxNG schemas.  Since
RNG
> > does not have the standardized equivalent of @xsi:schemaLocation
that
> > allows the instance document to say "validate me to this schema", it
> > feels like a pre-pass would be needed here too.  The Oxygen editor
uses
> > a processing instruction to indicate which RNG file it should use
for
> > validation but I am unsure whether the implementation first does a
pass
> > to get the PI and then another to validate or whether it is able to
> > validate in a single pass.
> >
> >
> >
> > Am I missing anything here?  I appreciate any comments,
alternatives,
> > etc.  Thanks, I appreciate it!
> >
> >
> >
> > Matt
> >
> >
> >
> > PS:  My scenario involves collections of heterogeneous content types
so
> > each document could be of one of several schema types (but only
valid to
> > one).  The effect is that I could not rely on doing a pre-parse (or
> > regex) on the first of a collection and assume that all docs in that
> > collection are the same.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >

Read the original blog entry...

IoT & Smart Cities Stories
Moroccanoil®, the global leader in oil-infused beauty, is thrilled to announce the NEW Moroccanoil Color Depositing Masks, a collection of dual-benefit hair masks that deposit pure pigments while providing the treatment benefits of a deep conditioning mask. The collection consists of seven curated shades for commitment-free, beautifully-colored hair that looks and feels healthy.
The textured-hair category is inarguably the hottest in the haircare space today. This has been driven by the proliferation of founder brands started by curly and coily consumers and savvy consumers who increasingly want products specifically for their texture type. This trend is underscored by the latest insights from NaturallyCurly's 2018 TextureTrends report, released today. According to the 2018 TextureTrends Report, more than 80 percent of women with curly and coily hair say they purcha...
The textured-hair category is inarguably the hottest in the haircare space today. This has been driven by the proliferation of founder brands started by curly and coily consumers and savvy consumers who increasingly want products specifically for their texture type. This trend is underscored by the latest insights from NaturallyCurly's 2018 TextureTrends report, released today. According to the 2018 TextureTrends Report, more than 80 percent of women with curly and coily hair say they purcha...
We all love the many benefits of natural plant oils, used as a deap treatment before shampooing, at home or at the beach, but is there an all-in-one solution for everyday intensive nutrition and modern styling?I am passionate about the benefits of natural extracts with tried-and-tested results, which I have used to develop my own brand (lemon for its acid ph, wheat germ for its fortifying action…). I wanted a product which combined caring and styling effects, and which could be used after shampo...
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected pat...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.