Connecting Tech Pros Worldwide Forums | Help | Site Map

Parsing XML Schema's

Pushya
Guest
 
Posts: n/a
#1: Jul 20 '05
Hello -

I am trying to parse a .XSD file to obtain information about element
name and type in the file. I have been trying to find some kind of
documentation for Schema Parsing. All I come across is documentation
for validating XML files against XSD files. Is ther any way to parse
the XSD file itself? Any help will be appreciated.

Thanks for your time.

Regards,
-Pushya

Martin Honnen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Parsing XML Schema's




Pushya wrote:
[color=blue]
> I am trying to parse a .XSD file to obtain information about element
> name and type in the file. I have been trying to find some kind of
> documentation for Schema Parsing. All I come across is documentation
> for validating XML files against XSD files. Is ther any way to parse
> the XSD file itself? Any help will be appreciated.[/color]

MSXML and MS .NET implement a schema object model I think, check
http://msdn.microsoft.com/library/de...rview_73g7.asp
http://msdn.microsoft.com/library/de...rence_3ig5.asp

I think Xerces from xml.apache.org also implements some grammar (schema)
object model.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Ray
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Parsing XML Schema's


Hi Martin,

do you mean the xmlbeans by apache.org or any other (java) xml binding
frameworks? I'm looking for the same facility
in order to manipulate a dom tree, e.g. adding child nodes to a node
with the rigth types, so that the xml or dom stays valid.

It would be the best if there exists methods that there are methods
handling this by themselves. For example: If a valid xml looks like:

<book>
<title>XML in a Nutshell</title>
<author>Author's Name</title>
<publisher></publisher>
<price>39.99</price>
</book>

and assuming the publisher title does not exist yet. Now I would
like to add the publisher tag including content to the dom tree or
xml.
This should be done by the add method, knowing that it has to add the
tag between author and price. Ok, in this
example the order is not relevant, but in other cases it is and the
right order and should be preserved according
to the schema.

Are they any tools or frameworks (preferable to use with java), that
can handle this. I think it would be possible with
java xml binding frameworks like castor or jaxb but at the moment i
would prefer to access directly the dom.

Thanks!

Regards
Ray


Martin Honnen <mahotrash@yahoo.de> wrote in message news:<40a251eb$1@olaf.komtel.net>...[color=blue]
> Pushya wrote:
>[color=green]
> > I am trying to parse a .XSD file to obtain information about element
> > name and type in the file. I have been trying to find some kind of
> > documentation for Schema Parsing. All I come across is documentation
> > for validating XML files against XSD files. Is ther any way to parse
> > the XSD file itself? Any help will be appreciated.[/color]
>
> MSXML and MS .NET implement a schema object model I think, check
> http://msdn.microsoft.com/library/de...rview_73g7.asp
> http://msdn.microsoft.com/library/de...rence_3ig5.asp
>
> I think Xerces from xml.apache.org also implements some grammar (schema)
> object model.[/color]
Martin Honnen
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Parsing XML Schema's




Ray wrote:

[color=blue]
> do you mean the xmlbeans by apache.org or any other (java) xml binding
> frameworks? I'm looking for the same facility
> in order to manipulate a dom tree, e.g. adding child nodes to a node
> with the rigth types, so that the xml or dom stays valid.
>
> It would be the best if there exists methods that there are methods
> handling this by themselves. For example: If a valid xml looks like:
>
> <book>
> <title>XML in a Nutshell</title>
> <author>Author's Name</title>
> <publisher></publisher>
> <price>39.99</price>
> </book>
>
> and assuming the publisher title does not exist yet. Now I would
> like to add the publisher tag including content to the dom tree or
> xml.
> This should be done by the add method, knowing that it has to add the
> tag between author and price. Ok, in this
> example the order is not relevant, but in other cases it is and the
> right order and should be preserved according
> to the schema.
>
> Are they any tools or frameworks (preferable to use with java), that
> can handle this. I think it would be possible with
> java xml binding frameworks like castor or jaxb but at the moment i
> would prefer to access directly the dom.[/color]

DOM Level 3 validation has methods to help you edit a document compliant
to a schema. I am not sure when/whether Xerces intends to support that.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Henry S. Thompson
Guest
 
Posts: n/a
#5: Jul 20 '05

re: Parsing XML Schema's


fishypushy@hotmail.com (Pushya) writes:
[color=blue]
> I am trying to parse a .XSD file to obtain information about element
> name and type in the file. I have been trying to find some kind of
> documentation for Schema Parsing. All I come across is documentation
> for validating XML files against XSD files. Is ther any way to parse
> the XSD file itself? Any help will be appreciated.[/color]

If you're a Python user, XSV [1] exposes its schema data model.

ht

[1] http://www.ltg.ed.ac.uk/~ht/xsv-status.html
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Closed Thread


Similar .NET Framework bytes